Skip to content

Commit 933ecf5

Browse files
authored
[mlir] adds [[maybe_unused]] to variables that might not be used (llvm#131184)
This should suppress an unused variable warning that was seemingly pervasive.
1 parent a16c225 commit 933ecf5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mlir/tools/mlir-tblgen/RewriterGen.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,13 @@ void PatternEmitter::emitAttributeMatch(DagNode tree, StringRef castedName,
872872

873873
os << "{\n";
874874
if (op.getDialect().usePropertiesForAttributes()) {
875-
os.indent() << formatv("auto tblgen_attr = {0}.getProperties().{1}();\n",
876-
castedName, op.getGetterName(namedAttr->name));
877-
} else {
878875
os.indent() << formatv(
879-
"auto tblgen_attr = {0}->getAttrOfType<{1}>(\"{2}\");"
880-
"(void)tblgen_attr;\n",
881-
castedName, attr.getStorageType(), namedAttr->name);
876+
"[[maybe_unused]] auto tblgen_attr = {0}.getProperties().{1}();\n",
877+
castedName, op.getGetterName(namedAttr->name));
878+
} else {
879+
os.indent() << formatv("[[maybe_unused]] auto tblgen_attr = "
880+
"{0}->getAttrOfType<{1}>(\"{2}\");\n",
881+
castedName, attr.getStorageType(), namedAttr->name);
882882
}
883883

884884
// TODO: This should use getter method to avoid duplication.

0 commit comments

Comments
 (0)