[Mlir-commits] [mlir] edfc4bb - [mlir][ods] Remove warning in `AttrOrTypeDef`

Jeff Niu llvmlistbot at llvm.org
Fri Jul 22 08:29:29 PDT 2022


Author: Jeff Niu
Date: 2022-07-22T08:29:23-07:00
New Revision: edfc4bb9b9f40604c4a6bfd9e96c21b43bece77c

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

LOG: [mlir][ods] Remove warning in `AttrOrTypeDef`

This warning was added because using attribute or type assembly formats
with `skipDefaultBuilders` set could cause compilation errors, since the
required builder prototype may not necessarily be generated and would
need to be checked by hand. This patch removes the warning because a
warning that the generated C++ "might" not compile is not particularly
useful. Attempting to address the TODO (i.e. detect whether a builder of
the correct prototype is provided) would be fragile since it would not
be possible to account for implicit conversions, etc.

In general, ODS should not be emitting warnings in cases like these.

Reviewed By: rriddle, wrengr

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

Added: 
    

Modified: 
    mlir/lib/TableGen/AttrOrTypeDef.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/TableGen/AttrOrTypeDef.cpp b/mlir/lib/TableGen/AttrOrTypeDef.cpp
index acd0e5529fdd7..37760d4b5d9ac 100644
--- a/mlir/lib/TableGen/AttrOrTypeDef.cpp
+++ b/mlir/lib/TableGen/AttrOrTypeDef.cpp
@@ -85,19 +85,13 @@ AttrOrTypeDef::AttrOrTypeDef(const llvm::Record *def) : def(def) {
                     "'assemblyFormat' or 'hasCustomAssemblyFormat' can only be "
                     "used when 'mnemonic' is set");
   }
-  // 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()) {
-    PrintWarning(getLoc(),
-                 "using 'assemblyFormat' with 'skipDefaultBuilders=1' may "
-                 "result in C++ compilation errors");
-  }
   // Assembly format printer requires accessors to be generated.
   if (hasDeclarativeFormat && !genAccessors()) {
     PrintFatalError(getLoc(),
                     "'assemblyFormat' requires 'genAccessors' to be true");
   }
+  // TODO: Ensure that a suitable builder prototype can be generated:
+  // https://llvm.org/PR56415
 }
 
 Dialect AttrOrTypeDef::getDialect() const {


        


More information about the Mlir-commits mailing list