[llvm-branch-commits] [clang] [Clang] [NFC] Expansion Statements (Part 4: for-range refactor) (PR #169683)
Shafik Yaghmour via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jul 9 23:07:42 PDT 2026
================
@@ -2710,6 +2715,224 @@ static StmtResult RebuildForRangeWithDereference(Sema &SemaRef, Scope *S,
AdjustedRange.get(), RParenLoc, Sema::BFRK_Rebuild);
}
+void Sema::ApplyForRangeOrExpansionStatementLifetimeExtension(
+ VarDecl *RangeVar, ArrayRef<MaterializeTemporaryExpr *> Temporaries) {
+ if (Temporaries.empty())
+ return;
+
+ InitializedEntity Entity = InitializedEntity::InitializeVariable(RangeVar);
+ for (auto *MTE : Temporaries)
+ MTE->setExtendingDecl(RangeVar, Entity.allocateManglingNumber());
+}
+
+Sema::ForRangeBeginEndInfo Sema::BuildCXXForRangeBeginEndVars(
+ Scope *S, VarDecl *RangeVar, SourceLocation ColonLoc,
+ SourceLocation CoawaitLoc,
+ ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps,
+ BuildForRangeKind Kind, bool Constexpr, StmtResult *RebuildResult,
----------------
shafik wrote:
Especially since we use this elsewhere. That is why I asked since we use `IsConstexpr` all over and I was puzzled why we just did not stick w/ that.
https://github.com/llvm/llvm-project/pull/169683
More information about the llvm-branch-commits
mailing list