Fix ODS Attribute/Type declarative assembly generator after API change for Attribute...
authorMehdi Amini <joker.eph@gmail.com>
Wed, 10 Nov 2021 01:05:34 +0000 (01:05 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Wed, 10 Nov 2021 01:08:35 +0000 (01:08 +0000)
The change in f30a8a6f674 conflicted with the recently landed feature on
ODS assembly format for Attribute/Type.

mlir/test/mlir-tblgen/attr-or-type-format.td
mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp

index 2d42693..b521790 100644 (file)
@@ -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 << ' ' << ":";
index 24dba68..2dbc371 100644 (file)
@@ -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;