From: wren romano <2998727+wrengr@users.noreply.github.com> Date: Wed, 6 Jul 2022 22:42:53 +0000 (-0700) Subject: [mlir][tblgen] Reverting fatality of assemblyFormat with skipDefaultBuilders=1 X-Git-Tag: upstream/15.0.7~2495 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0db2b75ac1c0ff4299adcf2c6781a1775a28bfb;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/mlir/lib/TableGen/AttrOrTypeDef.cpp b/mlir/lib/TableGen/AttrOrTypeDef.cpp index 67dc24b2335c..477e624ba2a5 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()) {