mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-09 05:02:19 +00: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:
parent
4b540fa8a1
commit
c32c8fd143
@ -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()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user