Author: Morris Hafner
Date: 2025-03-14T07:20:42-07:00
New Revision: 0f98d1b9fa56c19dcbf1b002608e51047ac56d60

URL: 
https://github.com/llvm/llvm-project/commit/0f98d1b9fa56c19dcbf1b002608e51047ac56d60
DIFF: 
https://github.com/llvm/llvm-project/commit/0f98d1b9fa56c19dcbf1b002608e51047ac56d60.diff

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

Co-authored-by: Morris Hafner <mhaf...@nvidia.com>

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenerator.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenerator.cpp 
b/clang/lib/CIR/CodeGen/CIRGenerator.cpp
index 91070eda7d45a..6fa31ab707139 100644
--- a/clang/lib/CIR/CodeGen/CIRGenerator.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenerator.cpp
@@ -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;
 
   for (Decl *decl : group)
     cgm->emitTopLevelDecl(decl);


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to