From: Benjamin Kramer Date: Fri, 14 Oct 2022 23:56:01 +0000 (+0200) Subject: [mlir:ODS] Disambiguate getContext call for the rare case of the op having an input... X-Git-Tag: upstream/17.0.6~30452 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4418f0db2dc9dad3fa570b8438e78ff09624bfda;p=platform%2Fupstream%2Fllvm.git [mlir:ODS] Disambiguate getContext call for the rare case of the op having an input called context --- diff --git a/mlir/test/mlir-tblgen/op-attribute.td b/mlir/test/mlir-tblgen/op-attribute.td index 7e7a762..cf76ce0 100644 --- a/mlir/test/mlir-tblgen/op-attribute.td +++ b/mlir/test/mlir-tblgen/op-attribute.td @@ -128,16 +128,16 @@ def AOp : NS_Op<"a_op", []> { // DEF: void AOp::setAAttrAttr(some-attr-kind attr) { // DEF-NEXT: (*this)->setAttr(getAAttrAttrName(), attr); // DEF: void AOp::setAAttr(some-return-type attrValue) { -// DEF-NEXT: (*this)->setAttr(getAAttrAttrName(), some-const-builder-call(::mlir::Builder(getContext()), attrValue)); +// DEF-NEXT: (*this)->setAttr(getAAttrAttrName(), some-const-builder-call(::mlir::Builder((*this)->getContext()), attrValue)); // DEF: void AOp::setBAttrAttr(some-attr-kind attr) { // DEF-NEXT: (*this)->setAttr(getBAttrAttrName(), attr); // DEF: void AOp::setBAttr(some-return-type attrValue) { -// DEF-NEXT: (*this)->setAttr(getBAttrAttrName(), some-const-builder-call(::mlir::Builder(getContext()), attrValue)); +// DEF-NEXT: (*this)->setAttr(getBAttrAttrName(), some-const-builder-call(::mlir::Builder((*this)->getContext()), attrValue)); // DEF: void AOp::setCAttrAttr(some-attr-kind attr) { // DEF-NEXT: (*this)->setAttr(getCAttrAttrName(), attr); // DEF: void AOp::setCAttr(::llvm::Optional attrValue) { // DEF-NEXT: if (attrValue) -// DEF-NEXT: return (*this)->setAttr(getCAttrAttrName(), some-const-builder-call(::mlir::Builder(getContext()), *attrValue)); +// DEF-NEXT: return (*this)->setAttr(getCAttrAttrName(), some-const-builder-call(::mlir::Builder((*this)->getContext()), *attrValue)); // DEF-NEXT: (*this)->removeAttr(getCAttrAttrName()); // Test remove methods diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp index 5b3d0ad..85326ec 100644 --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -1116,7 +1116,7 @@ void OpEmitter::genAttrSetters() { if (!canUseUnwrappedRawValue(baseAttr)) return; FmtContext fctx; - fctx.withBuilder("::mlir::Builder(getContext())"); + fctx.withBuilder("::mlir::Builder((*this)->getContext())"); bool isUnitAttr = attr.getAttrDefName() == "UnitAttr"; bool isOptional = attr.isOptional();