[clang] [CIR] Run the CIR lowering pipeline without a live ASTContext and accept serialized .cir as cc1 input (PR #219048)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 1 18:56:35 PDT 2026
================
@@ -293,10 +290,19 @@ struct LoweringPreparePass
}
///
- /// AST related
- /// -----------
+ /// Target / language fact source
+ /// -----------------------------
- clang::ASTContext *astCtx;
+ /// Target/LangOpts/CXXABI bundle the pass reads instead of going to a live
+ /// ASTContext. Set from the surrounding cc1 invocation by
+ /// runCIRToCIRPasses (or by the .cir input path in CIRGenAction). Always
+ /// non-null while the pass runs.
+ cir::LowerModule *lowerModule = nullptr;
----------------
bcardosolopes wrote:
"Always non-null while the pass runs" isn't enforced anywhere, and `createLoweringPreparePass()` with no arguments is still declared, which hands you exactly this null. Every use below is an unguarded deref, so that's a segfault rather than a diagnostic.
You already did the right thing a few hundred lines down, swapping the `assert` on a missing `static_local_info` for an `emitError` and a bail. Same treatment here.
https://github.com/llvm/llvm-project/pull/219048
More information about the cfe-commits
mailing list