diff --git a/mlir/lib/TableGen/AttrOrTypeDef.cpp b/mlir/lib/TableGen/AttrOrTypeDef.cpp --- a/mlir/lib/TableGen/AttrOrTypeDef.cpp +++ b/mlir/lib/TableGen/AttrOrTypeDef.cpp @@ -81,7 +81,13 @@ "'assemblyFormat' or 'hasCustomAssemblyFormat' can only be " "used when 'mnemonic' is set"); } - // Assembly format requires accessors to be generated. + // Assembly format parser requires default builders to be generated. + if (hasDeclarativeFormat && skipDefaultBuilders()) { + PrintFatalError( + getLoc(), + "'assemblyFormat' requires 'skipDefaultBuilders' to be false"); + } + // Assembly format printer requires accessors to be generated. if (hasDeclarativeFormat && !genAccessors()) { PrintFatalError(getLoc(), "'assemblyFormat' requires 'genAccessors' to be true"); diff --git a/mlir/lib/TableGen/Builder.cpp b/mlir/lib/TableGen/Builder.cpp --- a/mlir/lib/TableGen/Builder.cpp +++ b/mlir/lib/TableGen/Builder.cpp @@ -21,8 +21,10 @@ StringRef Builder::Parameter::getCppType() const { if (const auto *stringInit = dyn_cast(def)) return stringInit->getValue(); - const llvm::Record *record = cast(def)->getDef(); - return record->getValueAsString("type"); + if (const llvm::Record *record = cast(def)->getDef()) + return record->getValueAsString("type"); + llvm::PrintFatalError("Builder DAG arguments must be either strings or defs " + "which inherit from CArg\n"); } /// Return an optional string containing the default value to use for this