[clang] [clang][CodeGen] Detect backward jumps for C lifetime markers (PR #238919)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 25 16:50:40 PST 2026
================
@@ -19188,13 +19188,20 @@ void Sema::PopExpressionEvaluationContext() {
// temporaries that we may have created as part of the evaluation of
// the expression in that context: they aren't relevant because they
// will never be constructed.
- if (Rec.isUnevaluated() || Rec.isConstantEvaluated()) {
+ if (Rec.isUnevaluated() || (Rec.isConstantEvaluated() &&
+ !Rec.InConditionallyConstantEvaluateContext)) {
ExprCleanupObjects.erase(ExprCleanupObjects.begin() + Rec.NumCleanupObjects,
ExprCleanupObjects.end());
Cleanup = Rec.ParentCleanup;
CleanupVarDeclMarking();
std::swap(MaybeODRUseExprs, Rec.SavedMaybeODRUseExprs);
- // Otherwise, merge the contexts together.
+ } else if (Rec.isConstantEvaluated()) {
+ // Array bounds may turn out to be VLAs evaluated at runtime; preserve
+ // cleanups so enclosing expressions are wrapped in ExprWithCleanups.
----------------
efriedma-quic wrote:
Does this interact at all with https://github.com/llvm/llvm-project/pull/244274 ?
https://github.com/llvm/llvm-project/pull/238919
More information about the cfe-commits
mailing list