[clang] [clang] In Sema use new parentEvaluationContext function (PR #93338)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Sat May 25 01:44:04 PDT 2024
================
@@ -17693,12 +17691,13 @@ void Sema::PopExpressionEvaluationContext() {
// Append the collected materialized temporaries into previous context before
// exit if the previous also is a lifetime extending context.
- auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2];
+ auto &PrevRecord = parentEvaluationContext();
if (getLangOpts().CPlusPlus23 && Rec.InLifetimeExtendingContext &&
PrevRecord.InLifetimeExtendingContext &&
!Rec.ForRangeLifetimeExtendTemps.empty()) {
- PrevRecord.ForRangeLifetimeExtendTemps.append(
- Rec.ForRangeLifetimeExtendTemps);
+ const_cast<SmallVector<MaterializeTemporaryExpr *, 8> &>(
----------------
Endilll wrote:
For the context, our overall const-correctness situation in Sema is less than ideal, to put it mildly. In this particular case I think we need to add a non-const overload for `parentEvaluationContext()` with the following prototype: `ExpressionEvaluationContextRecord &parentEvaluationContext()`.
https://github.com/llvm/llvm-project/pull/93338
More information about the cfe-commits
mailing list