[Mlir-commits] [mlir] [mlir][mlir-tblgen] Emit correct error message if method is pruned (PR #160334)

Justin Kim llvmlistbot at llvm.org
Wed Sep 24 09:04:12 PDT 2025


================
@@ -552,6 +567,10 @@ void DefGen::emitCheckedCustomBuilder(const AttrOrTypeBuilder &builder) {
       getCustomBuilderParams(
           {{"::llvm::function_ref<::mlir::InFlightDiagnostic()>", "emitError"}},
           builder));
+
+  // If method is pruned, report error and terminate.
+  ERROR_IF_PRUNED(m, "getChecked", def);
+
----------------
JustinKim98 wrote:

What would be the correct way to test if mlir-tablegen fails with expected error message when invalid input is given?
Current mlirgen unites seems to be only testing validity of generated files..

Moreover, I am considering to add some tests for generated attributes from TestDialect, since there seems to be no proper unit test testing whether attributes are correctly generated.


https://github.com/llvm/llvm-project/pull/160334


More information about the Mlir-commits mailing list