From 353c38e23108856daa2c5d0e86443ac5136dcaa7 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 15:02:29 +0000 Subject: fix(codegen): skip IR verification after reported errors Verify the module only when no error was reported, and let defineRecord skip bad fields and still set the record body, marking it Invalid so later missing-field lookups stay silent. Co-Authored-By: Claude Sonnet 5.5 --- lib/CodeGen/CodeGen.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGen.cc') diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc index d81c4ff..e45a3db 100644 --- a/lib/CodeGen/CodeGen.cc +++ b/lib/CodeGen/CodeGen.cc @@ -364,7 +364,9 @@ void CodeGen::compile(const std::vector &Sources) { RuntimeChecker->emitStderr(Msg); Builder->CreateRet(ConstantInt::get(Type::getInt32Ty(*TheContext), 1)); - if (verifyModule(*TheModule, &errs())) { + // After a reported error the IR may be incomplete; verifying it would only + // dump noise behind the real diagnostic. + if (!HadError && verifyModule(*TheModule, &errs())) { errs() << cps::diagnosticPrefix(cps::Severity::Fatal, "") << "LLVM module verification failed\n"; HadError = true; } -- cgit v1.3.1-4-g156e