[clang] [Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (PR #76361)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 06:56:16 PST 2024


================
@@ -9959,6 +9976,18 @@ class Sema final {
     return currentEvaluationContext().isImmediateFunctionContext();
   }
 
+  bool isInLifetimeExtendingContext() const {
+    assert(!ExprEvalContexts.empty() &&
+           "Must be in an expression evaluation context");
+    return ExprEvalContexts.back().IsInLifetimeExtendingContext;
+  }
+
+  bool ShouldMaterializePRValueInDiscardedExpression() const {
----------------
yronglin wrote:

LLVM prefer `shouldMaterializePRValueInDiscardedExpression` https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly , I'll rename it.

https://github.com/llvm/llvm-project/pull/76361


More information about the cfe-commits mailing list