"o", llvm::cl::desc("Output filename"), llvm::cl::value_desc("filename"),
llvm::cl::init("-"));
+ static llvm::cl::opt<bool> allowUnregisteredDialects(
+ "allow-unregistered-dialect",
+ llvm::cl::desc("Allow operation with no registered dialects"),
+ llvm::cl::init(false));
+
static llvm::cl::opt<bool> splitInputFile(
"split-input-file",
llvm::cl::desc("Split the input file into pieces and "
auto processBuffer = [&](std::unique_ptr<llvm::MemoryBuffer> ownedBuffer,
raw_ostream &os) {
MLIRContext context;
+ context.allowUnregisteredDialects(allowUnregisteredDialects);
context.printOpOnDiagnostic(!verifyDiagnostics);
llvm::SourceMgr sourceMgr;
sourceMgr.AddNewSourceBuffer(std::move(ownedBuffer), SMLoc());
--- /dev/null
+// RUN: not mlir-translate %s --allow-unregistered-dialect --mlir-to-llvmir -verify-diagnostics 2>&1 | FileCheck --check-prefix=UNREGOK %s
+// RUN: not mlir-translate %s --mlir-to-llvmir -verify-diagnostics 2>&1 | FileCheck --check-prefix=REGONLY %s
+
+
+// If the parser allows unregistered operations, then the translation fails,
+// otherwise the parse fails.
+
+// UNREGOK: cannot be converted to LLVM IR
+// REGONLY: operation being parsed with an unregistered dialect
+
+func @trivial() {
+ "simple.terminator"() : () -> ()
+}