[PATCH] D86904: [mlir] Support for defining Types in tblgen

John Demme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 18:10:07 PDT 2020


jdd updated this revision to Diff 294848.
jdd added a comment.

Fixing whitespace and clang-tidy issues


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86904/new/

https://reviews.llvm.org/D86904

Files:
  mlir/lib/TableGen/TypeDef.cpp
  mlir/tools/mlir-tblgen/OpDocGen.cpp
  mlir/tools/mlir-tblgen/TypeDefGen.cpp


Index: mlir/tools/mlir-tblgen/TypeDefGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/TypeDefGen.cpp
+++ mlir/tools/mlir-tblgen/TypeDefGen.cpp
@@ -184,8 +184,6 @@
   os << llvm::formatv("  static {0} get(::mlir::MLIRContext* ctxt{1});\n",
                       typeDef.getCppClassName(), parameterParameters);
 
-
-
   // verify invariants
   if (typeDef.genVerifyInvariantsDecl())
     os << llvm::formatv(typeDefDeclVerifyStr, parameterParameters,
@@ -445,7 +443,7 @@
       // Both the mnenomic and printerCode must be defined (for parity with
       // parserCode)
       os << "void " << typeDef.getCppClassName()
-        << "::print(mlir::DialectAsmPrinter& printer) const {\n";
+         << "::print(mlir::DialectAsmPrinter& printer) const {\n";
       if (*printerCode == "") {
         // if no code specified, emit error
         llvm::PrintError(
@@ -467,7 +465,7 @@
     if (parserCode) {
       // The mnenomic must be defined so the dispatcher knows how to dispatch
       os << "::mlir::Type " << typeDef.getCppClassName()
-        << "::parse(::mlir::MLIRContext* ctxt, ::mlir::DialectAsmParser& "
+         << "::parse(::mlir::MLIRContext* ctxt, ::mlir::DialectAsmParser& "
             "parser) "
             "{\n";
       if (*parserCode == "") {
@@ -478,7 +476,9 @@
                 ": parser (if specified) must have non-empty code");
         return mlir::failure();
       } else {
-        auto fmtCtxt = FmtContext().addSubst("_parser", "parser").addSubst("_ctxt", "ctxt");
+        auto fmtCtxt = FmtContext()
+                           .addSubst("_parser", "parser")
+                           .addSubst("_ctxt", "ctxt");
         auto fmtObj = tgfmt(*parserCode, &fmtCtxt);
         fmtObj.format(os);
         os << "\n";
Index: mlir/tools/mlir-tblgen/OpDocGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/OpDocGen.cpp
+++ mlir/tools/mlir-tblgen/OpDocGen.cpp
@@ -202,7 +202,7 @@
   } else {
     os << "\nSyntax:\n\n```\n!" << td.getDialect().getName() << "."
        << td.getMnemonic() << "<\n";
-    for (auto it = parameters.begin(); it < parameters.end(); it++) {
+    for (auto *it = parameters.begin(); it < parameters.end(); it++) {
       os << "  " << it->getSyntax();
       if (it < parameters.end() - 1)
         os << ",";
Index: mlir/lib/TableGen/TypeDef.cpp
===================================================================
--- mlir/lib/TableGen/TypeDef.cpp
+++ mlir/lib/TableGen/TypeDef.cpp
@@ -19,7 +19,7 @@
 using namespace mlir::tblgen;
 
 Dialect TypeDef::getDialect() const {
-  auto dialectDef =
+  auto *dialectDef =
       dyn_cast<llvm::DefInit>(def->getValue("dialect")->getValue());
   if (dialectDef == nullptr)
     return Dialect(nullptr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86904.294848.patch
Type: text/x-patch
Size: 2815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200929/8fda7de3/attachment-0001.bin>


More information about the llvm-commits mailing list