[Mlir-commits] [mlir] [MLIR] Make Ops AttrName getters const (PR #96291)
Thomas Preud'homme
llvmlistbot at llvm.org
Fri Jun 21 03:03:06 PDT 2024
https://github.com/RoboTux created https://github.com/llvm/llvm-project/pull/96291
None
>From a474881a752413734147cda4aef9fde2e17712de Mon Sep 17 00:00:00 2001
From: Thomas Preud'homme <thomas.preudhomme at arm.com>
Date: Fri, 21 Jun 2024 10:57:08 +0100
Subject: [PATCH] [MLIR] Make Ops AttrName getters const
---
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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);
}
More information about the Mlir-commits
mailing list