[Mlir-commits] [mlir] [MLIR] Make Ops AttrName getters const (PR #96291)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jun 21 03:03:34 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
Author: Thomas Preud'homme (RoboTux)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/96291.diff
1 Files Affected:
- (modified) mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp (+3-2)
``````````diff
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 3146e65a1d961..1af766561c0da 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1123,7 +1123,7 @@ void OpEmitter::genAttrNameGetters() {
// Emit the getAttributeNameForIndex methods.
{
- auto *method = opClass.addInlineMethod<Method::Private>(
+ auto *method = opClass.addInlineMethod<Method::Private | Method::Const>(
"::mlir::StringAttr", "getAttributeNameForIndex",
MethodParameter("unsigned", "index"));
ERROR_IF_PRUNED(method, "getAttributeNameForIndex", op);
@@ -1161,7 +1161,8 @@ void OpEmitter::genAttrNameGetters() {
// Generate the non-static variant.
{
- auto *method = opClass.addInlineMethod("::mlir::StringAttr", methodName);
+ auto *method = opClass.addInlineMethod<Method::Const>(
+ "::mlir::StringAttr", methodName);
ERROR_IF_PRUNED(method, methodName, op);
method->body() << llvm::formatv(attrNameMethodBody, index);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/96291
More information about the Mlir-commits
mailing list