forked from OSchip/llvm-project
[mlir][ods] Fix incorrectly generated attribute name.
In prefixed accessor on OpAdaptor.
This commit is contained in:
parent
8659b241ae
commit
2fa76d4769
|
@ -2455,9 +2455,9 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter(const Operator &op)
|
||||||
FmtContext fctx;
|
FmtContext fctx;
|
||||||
fctx.withBuilder("::mlir::Builder(odsAttrs.getContext())");
|
fctx.withBuilder("::mlir::Builder(odsAttrs.getContext())");
|
||||||
|
|
||||||
auto emitAttr = [&](StringRef name, Attribute attr) {
|
auto emitAttr = [&](StringRef name, StringRef emitName, Attribute attr) {
|
||||||
auto *method = adaptor.addMethodAndPrune(attr.getStorageType(), name);
|
auto *method = adaptor.addMethodAndPrune(attr.getStorageType(), emitName);
|
||||||
ERROR_IF_PRUNED(method, "Adaptor::" + name, op);
|
ERROR_IF_PRUNED(method, "Adaptor::" + emitName, op);
|
||||||
auto &body = method->body();
|
auto &body = method->body();
|
||||||
body << " assert(odsAttrs && \"no attributes when constructing adapter\");"
|
body << " assert(odsAttrs && \"no attributes when constructing adapter\");"
|
||||||
<< "\n " << attr.getStorageType() << " attr = "
|
<< "\n " << attr.getStorageType() << " attr = "
|
||||||
|
@ -2489,8 +2489,8 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter(const Operator &op)
|
||||||
const auto &name = namedAttr.name;
|
const auto &name = namedAttr.name;
|
||||||
const auto &attr = namedAttr.attr;
|
const auto &attr = namedAttr.attr;
|
||||||
if (!attr.isDerivedAttr()) {
|
if (!attr.isDerivedAttr()) {
|
||||||
for (auto emitName : op.getGetterNames(name))
|
for (const auto &emitName : op.getGetterNames(name))
|
||||||
emitAttr(emitName, attr);
|
emitAttr(name, emitName, attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue