Skip to content

Commit 340d746

Browse files
committed
Turn an assert in mlir-tblgen into a runtime check to be more user friendly (NFC)
Some user hit this condition, where a crash isn't very friendly.
1 parent 7d1bf1c commit 340d746

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mlir/lib/TableGen/Constraint.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ Constraint::Constraint(const llvm::Record *record)
3030
kind = CK_Region;
3131
} else if (def->isSubClassOf("SuccessorConstraint")) {
3232
kind = CK_Successor;
33-
} else {
34-
assert(def->isSubClassOf("Constraint"));
33+
} else if(!def->isSubClassOf("Constraint")) {
34+
llvm::errs() << "Expected a constraint but got: \n";
35+
def->dump();
36+
llvm::report_fatal_error("Abort");
3537
}
3638
}
3739

0 commit comments

Comments
 (0)