[clang] [CIR] Don't generate ClangIR after an unrecoverable error occured (PR #130971)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 11:14:09 PDT 2025


================
@@ -43,6 +43,8 @@ void CIRGenerator::Initialize(ASTContext &astContext) {
 mlir::ModuleOp CIRGenerator::getModule() const { return cgm->getModule(); }
 
 bool CIRGenerator::HandleTopLevelDecl(DeclGroupRef group) {
+  if (diags.hasUnrecoverableErrorOccurred())
+    return true;
----------------
erichkeane wrote:

It honestly doesn't really matter, we currently delay the codegen in clang until parsing/sema is complete anyway (except for REPL). I'd probably leave it for now, as I wouldn't want this to be a changed behavior.

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


More information about the cfe-commits mailing list