[Mlir-commits] [mlir] 2fa76d4 - [mlir][ods] Fix incorrectly generated attribute name.
Jacques Pienaar
llvmlistbot at llvm.org
Fri Oct 29 14:07:36 PDT 2021
Author: Jacques Pienaar
Date: 2021-10-29T14:06:33-07:00
New Revision: 2fa76d4769b5f6ff6a31c9839cd24fd8ccf99cfe
URL: https://github.com/llvm/llvm-project/commit/2fa76d4769b5f6ff6a31c9839cd24fd8ccf99cfe
DIFF: https://github.com/llvm/llvm-project/commit/2fa76d4769b5f6ff6a31c9839cd24fd8ccf99cfe.diff
LOG: [mlir][ods] Fix incorrectly generated attribute name.
In prefixed accessor on OpAdaptor.
Added:
Modified:
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Removed:
################################################################################
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 653b778097247..399bd8898bfa6 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -2455,9 +2455,9 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter(const Operator &op)
FmtContext fctx;
fctx.withBuilder("::mlir::Builder(odsAttrs.getContext())");
- auto emitAttr = [&](StringRef name, Attribute attr) {
- auto *method = adaptor.addMethodAndPrune(attr.getStorageType(), name);
- ERROR_IF_PRUNED(method, "Adaptor::" + name, op);
+ auto emitAttr = [&](StringRef name, StringRef emitName, Attribute attr) {
+ auto *method = adaptor.addMethodAndPrune(attr.getStorageType(), emitName);
+ ERROR_IF_PRUNED(method, "Adaptor::" + emitName, op);
auto &body = method->body();
body << " assert(odsAttrs && \"no attributes when constructing adapter\");"
<< "\n " << attr.getStorageType() << " attr = "
@@ -2489,8 +2489,8 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter(const Operator &op)
const auto &name = namedAttr.name;
const auto &attr = namedAttr.attr;
if (!attr.isDerivedAttr()) {
- for (auto emitName : op.getGetterNames(name))
- emitAttr(emitName, attr);
+ for (const auto &emitName : op.getGetterNames(name))
+ emitAttr(name, emitName, attr);
}
}
More information about the Mlir-commits
mailing list