Skip to content

Commit

Permalink
[mlir:ODS] Disambiguate getContext call for the rare case of the op h…
Browse files Browse the repository at this point in the history
…aving an input called context
  • Loading branch information
d0k committed Oct 15, 2022
1 parent 0278c9c commit 4418f0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions mlir/test/mlir-tblgen/op-attribute.td
Original file line number Diff line number Diff line change
Expand Up @@ -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<some-return-type> 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
Expand Down
2 changes: 1 addition & 1 deletion mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 4418f0d

Please sign in to comment.