[clang] [CIR] Defer definitions of global variables until they are used. (PR #142496)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 2 15:59:38 PDT 2025
================
@@ -63,6 +63,20 @@ bool CIRGenerator::HandleTopLevelDecl(DeclGroupRef group) {
return true;
}
+void CIRGenerator::HandleTranslationUnit(ASTContext &astContext) {
+ // Release the Builder when there is no error.
+ if (!diags.hasErrorOccurred() && cgm)
+ cgm->release();
+
+ // If there are errors before or when releasing the CGM, reset the module to
+ // stop here before invoking the backend.
+ if (diags.hasErrorOccurred()) {
+ if (cgm)
+ // TODO: cgm->clear();
----------------
andykaylor wrote:
Yeah... I'm not really sure what's needed here. This TODO comment is in the incubator code. I think the idea is that "something" probably needs to happen to clean up after an error, but it isn't clear what that something should be. I should have replaced this with a MissingFeature.
https://github.com/llvm/llvm-project/pull/142496
More information about the cfe-commits
mailing list