File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,8 @@ class AbstractAttribute {
150
150
// / The unique identifier of the derived Attribute class.
151
151
const TypeID typeID;
152
152
153
- // / The unique name of this type.
153
+ // / The unique name of this attribute. The string is not owned by the context,
154
+ // / so the lifetime of this string should outlive the MLIR context.
154
155
const StringRef name;
155
156
};
156
157
Original file line number Diff line number Diff line change @@ -149,7 +149,8 @@ class AbstractType {
149
149
// / The unique identifier of the derived Type class.
150
150
const TypeID typeID;
151
151
152
- // / The unique name of this type.
152
+ // / The unique name of this type. The string is not owned by the context, so
153
+ // / The lifetime of this string should outlive the MLIR context.
153
154
const StringRef name;
154
155
};
155
156
Original file line number Diff line number Diff line change @@ -215,7 +215,8 @@ class MLIRContextImpl {
215
215
// / This is a mapping from type name to the abstract type describing it.
216
216
// / It is used by `AbstractType::lookup` to get an `AbstractType` from a name.
217
217
// / As this map needs to be populated before `StringAttr` is loaded, we
218
- // / cannot use `StringAttr` as the key.
218
+ // / cannot use `StringAttr` as the key. The context does not take ownership
219
+ // / of the key, so the `StringRef` must outlive the context.
219
220
llvm::DenseMap<StringRef, AbstractType *> nameToType;
220
221
221
222
// / Cached Type Instances.
@@ -246,7 +247,8 @@ class MLIRContextImpl {
246
247
// / it. It is used by `AbstractType::lookup` to get an `AbstractType` from a
247
248
// / name.
248
249
// / As this map needs to be populated before `StringAttr` is loaded, we
249
- // / cannot use `StringAttr` as the key.
250
+ // / cannot use `StringAttr` as the key. The context does not take ownership
251
+ // / of the key, so the `StringRef` must outlive the context.
250
252
llvm::DenseMap<StringRef, AbstractAttribute *> nameToAttribute;
251
253
252
254
// / Cached Attribute Instances.
You can’t perform that action at this time.
0 commit comments