This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Model StringRef in C API
ClosedPublic

Authored by ftynse on Sep 15 2020, 3:05 AM.

Details

Summary

Numerous MLIR functions return instances of StringRef to refer to a
non-owning fragment of a string (usually owned by the context). This is a
relatively simple class that is defined in LLVM. Provide a simple wrapper in
the MLIR C API that contains the pointer and length of the string fragment and
use it for Standard attribute functions that return StringRef instead of the
previous, callback-based mechanism.

Diff Detail

Event Timeline

ftynse created this revision.Sep 15 2020, 3:05 AM
Herald added a project: Restricted Project. · View Herald Transcript
ftynse requested review of this revision.Sep 15 2020, 3:05 AM
stellaraccident accepted this revision.Sep 15 2020, 2:54 PM

Matches what was discussed on discourse. This will break the python bindings. Do you want to update those in this patch or have me do them in a follow-up? As a non-default feature still under development, either is in bounds; however, the changes should be small/mechanical and if you can include them, it will help.

This revision is now accepted and ready to land.Sep 15 2020, 2:54 PM
ftynse updated this revision to Diff 292171.Sep 16 2020, 3:45 AM

Also update Python bindings

Do you want to update those in this patch or have me do them in a follow-up?

Sure, for some reason my existing build did not pick up the (optional) bindings so I didn't see the failure. Fixed now.

stellaraccident accepted this revision.Sep 16 2020, 6:12 AM

Thanks for the option updates. We should talk soon about enabling these by default.

This revision was landed with ongoing or failed builds.Sep 16 2020, 7:04 AM
This revision was automatically updated to reflect the committed changes.