[Mlir-commits] [mlir] 1370f52 - Fix ODS Attribute/Type declarative assembly generator after API change for Attribute/Type print
Mehdi Amini
llvmlistbot at llvm.org
Tue Nov 9 17:08:43 PST 2021
Author: Mehdi Amini
Date: 2021-11-10T01:08:35Z
New Revision: 1370f52bb7a8fa0d3dbc57f65e14dc3c5fd57005
URL: https://github.com/llvm/llvm-project/commit/1370f52bb7a8fa0d3dbc57f65e14dc3c5fd57005
DIFF: https://github.com/llvm/llvm-project/commit/1370f52bb7a8fa0d3dbc57f65e14dc3c5fd57005.diff
LOG: Fix ODS Attribute/Type declarative assembly generator after API change for Attribute/Type print
The change in f30a8a6f674 conflicted with the recently landed feature on
ODS assembly format for Attribute/Type.
Added:
Modified:
mlir/test/mlir-tblgen/attr-or-type-format.td
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
Removed:
################################################################################
diff --git a/mlir/test/mlir-tblgen/attr-or-type-format.td b/mlir/test/mlir-tblgen/attr-or-type-format.td
index 2d426935fa41..b52179051b4c 100644
--- a/mlir/test/mlir-tblgen/attr-or-type-format.td
+++ b/mlir/test/mlir-tblgen/attr-or-type-format.td
@@ -58,7 +58,6 @@ def TypeParamB : TypeParameter<"TestParamD", "a type param D"> {
// ATTR: }
// ATTR: void TestAAttr::print(::mlir::DialectAsmPrinter &printer) const {
-// ATTR: printer << "attr_a";
// ATTR: printer << ' ' << "hello";
// ATTR: printer << ' ' << "=";
// ATTR: printer << ' ';
@@ -154,7 +153,6 @@ def AttrB : TestAttr<"TestB"> {
// ATTR: }
// ATTR: void TestFAttr::print(::mlir::DialectAsmPrinter &printer) const {
-// ATTR: printer << "attr_c";
// ATTR: printer << ' ';
// ATTR: printer << getV0();
// ATTR: printer << ",";
@@ -209,7 +207,6 @@ def AttrC : TestAttr<"TestF"> {
// TYPE: }
// TYPE: void TestCType::print(::mlir::DialectAsmPrinter &printer) const {
-// TYPE: printer << "type_c";
// TYPE: printer << ' ' << "foo";
// TYPE: printer << ",";
// TYPE: printer << ' ' << ":";
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
index 24dba685af7e..2dbc3712ccbf 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
@@ -189,10 +189,8 @@ static const char *const parseErrorStr =
/// Format for defining an attribute or type printer.
///
/// $0: The attribute or type C++ class name.
-/// $1: The attribute or type mnemonic.
static const char *const attrOrTypePrinterDefn = R"(
void $0::print(::mlir::DialectAsmPrinter &$_printer) const {
- $_printer << "$1";
)";
/// Loop declaration for struct parser.
@@ -464,8 +462,7 @@ void AttrOrTypeFormat::genPrinter(raw_ostream &os) {
ctx.addSubst("_printer", "printer");
/// Generate the definition.
- os << tgfmt(attrOrTypePrinterDefn, &ctx, def.getCppClassName(),
- *def.getMnemonic());
+ os << tgfmt(attrOrTypePrinterDefn, &ctx, def.getCppClassName());
/// Generate printers.
shouldEmitSpace = true;
More information about the Mlir-commits
mailing list