[Mlir-commits] [mlir] c0db2b7 - [mlir][tblgen] Reverting fatality of assemblyFormat with skipDefaultBuilders=1

wren romano llvmlistbot at llvm.org
Wed Jul 6 18:07:47 PDT 2022


Author: wren romano
Date: 2022-07-06T18:07:39-07:00
New Revision: c0db2b75ac1c0ff4299adcf2c6781a1775a28bfb

URL: https://github.com/llvm/llvm-project/commit/c0db2b75ac1c0ff4299adcf2c6781a1775a28bfb
DIFF: https://github.com/llvm/llvm-project/commit/c0db2b75ac1c0ff4299adcf2c6781a1775a28bfb.diff

LOG: [mlir][tblgen] Reverting fatality of assemblyFormat with skipDefaultBuilders=1

Per @rriddle, we do not want to require `skipDefaultBuilders=0` per se; that is, even though the `assemblyFormat`-generated parser requires a builder with the same prototype as the default-builder, that prototype could instead be implemented via custom `builders`.  This differential reduces the FatalError introduced in D128555 to a non-fatal Warning instead, so that users can still be informed of the error condition (rather than waiting for the C++ compiler to fail).

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D129234

Added: 
    

Modified: 
    mlir/lib/TableGen/AttrOrTypeDef.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/TableGen/AttrOrTypeDef.cpp b/mlir/lib/TableGen/AttrOrTypeDef.cpp
index 67dc24b2335cd..477e624ba2a51 100644
--- a/mlir/lib/TableGen/AttrOrTypeDef.cpp
+++ b/mlir/lib/TableGen/AttrOrTypeDef.cpp
@@ -81,11 +81,13 @@ AttrOrTypeDef::AttrOrTypeDef(const llvm::Record *def) : def(def) {
                     "'assemblyFormat' or 'hasCustomAssemblyFormat' can only be "
                     "used when 'mnemonic' is set");
   }
-  // Assembly format parser requires default builders to be generated.
+  // Assembly format parser requires builders with the same prototype
+  // as the default-builders.
+  // TODO: attempt to detect when a custom builder matches the prototype.
   if (hasDeclarativeFormat && skipDefaultBuilders()) {
-    PrintFatalError(
-        getLoc(),
-        "'assemblyFormat' requires 'skipDefaultBuilders' to be false");
+    PrintWarning(getLoc(),
+                 "using 'assemblyFormat' with 'skipDefaultBuilders=1' may "
+                 "result in C++ compilation errors");
   }
   // Assembly format printer requires accessors to be generated.
   if (hasDeclarativeFormat && !genAccessors()) {


        


More information about the Mlir-commits mailing list