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

None

>From 92066054a6a14f2e16b7f2256bf730762ab5d5d6 Mon Sep 17 00:00:00 2001
From: Morris Hafner <mhaf...@nvidia.com>
Date: Wed, 12 Mar 2025 07:28:09 -0700
Subject: [PATCH] [CIR] Don't generate ClangIR after an unrecoverable error
 occured

---
 clang/lib/CIR/CodeGen/CIRGenerator.cpp | 2 ++
 1 file changed, 2 insertions(+)

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