diff options
| author | River Riddle <riddleriver@gmail.com> | 2021-11-11 01:44:58 +0000 |
|---|---|---|
| committer | River Riddle <riddleriver@gmail.com> | 2021-11-11 02:02:24 +0000 |
| commit | 120591e126f97924f665baacea49080642b1162f (patch) | |
| tree | 81260f796feb79408068e63fad56eeaffa8665d1 /mlir/lib/CAPI/IR/BuiltinAttributes.cpp | |
| parent | 7f153e8ba103bc9489ecdf09b5739ff262e2c54c (diff) | |
[mlir] Replace usages of Identifier with StringAttr
Identifier and StringAttr essentially serve the same purpose, i.e. to hold a string value. Keeping these seemingly identical pieces of functionality separate has caused problems in certain situations:
* Identifier has nice accessors that StringAttr doesn't
* Identifier can't be used as an Attribute, meaning strings are often duplicated between Identifier/StringAttr (e.g. in PDL)
The only thing that Identifier has that StringAttr doesn't is support for caching a dialect that is referenced by the string (e.g. dialect.foo). This functionality is added to StringAttr, as this is useful for StringAttr in generally the same ways it was useful for Identifier.
Differential Revision: https://reviews.llvm.org/D113536
Diffstat (limited to 'mlir/lib/CAPI/IR/BuiltinAttributes.cpp')
| -rw-r--r-- | mlir/lib/CAPI/IR/BuiltinAttributes.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp index 8d6c4ccf6a8b..7ce4283600c8 100644 --- a/mlir/lib/CAPI/IR/BuiltinAttributes.cpp +++ b/mlir/lib/CAPI/IR/BuiltinAttributes.cpp @@ -186,11 +186,11 @@ bool mlirAttributeIsAString(MlirAttribute attr) { } MlirAttribute mlirStringAttrGet(MlirContext ctx, MlirStringRef str) { - return wrap(StringAttr::get(unwrap(ctx), unwrap(str))); + return wrap((Attribute)StringAttr::get(unwrap(ctx), unwrap(str))); } MlirAttribute mlirStringAttrTypedGet(MlirType type, MlirStringRef str) { - return wrap(StringAttr::get(unwrap(str), unwrap(type))); + return wrap((Attribute)StringAttr::get(unwrap(str), unwrap(type))); } MlirStringRef mlirStringAttrGetValue(MlirAttribute attr) { |
