mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:44:46 +01:00
[mlir] Use getOperation()->setAttr when generating attribute set
methods. This avoids the need to resolve overloads when the current operation also defines a 'setAttr' method.
This commit is contained in:
@@ -57,11 +57,11 @@ def AOp : NS_Op<"a_op", []> {
|
||||
// ---
|
||||
|
||||
// DEF: void AOp::aAttrAttr(some-attr-kind attr) {
|
||||
// DEF-NEXT: this->setAttr("aAttr", attr);
|
||||
// DEF-NEXT: this->getOperation()->setAttr("aAttr", attr);
|
||||
// DEF: void AOp::bAttrAttr(some-attr-kind attr) {
|
||||
// DEF-NEXT: this->setAttr("bAttr", attr);
|
||||
// DEF-NEXT: this->getOperation()->setAttr("bAttr", attr);
|
||||
// DEF: void AOp::cAttrAttr(some-attr-kind attr) {
|
||||
// DEF-NEXT: this->setAttr("cAttr", attr);
|
||||
// DEF-NEXT: this->getOperation()->setAttr("cAttr", attr);
|
||||
|
||||
// Test build methods
|
||||
// ---
|
||||
|
||||
@@ -393,7 +393,7 @@ void OpEmitter::genAttrSetters() {
|
||||
auto &method = opClass.newMethod("void", (name + "Attr").str(),
|
||||
(attr.getStorageType() + " attr").str());
|
||||
auto &body = method.body();
|
||||
body << " this->setAttr(\"" << name << "\", attr);";
|
||||
body << " this->getOperation()->setAttr(\"" << name << "\", attr);";
|
||||
};
|
||||
|
||||
for (auto &namedAttr : op.getAttributes()) {
|
||||
|
||||
Reference in New Issue
Block a user