[clang] [clang] Implement lifetime analysis for lifetime_capture_by(X) (PR #115921)

Boaz Brickner via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 13 08:36:50 PST 2024


================
@@ -1110,12 +1117,13 @@ static bool shouldRunGSLAssignmentAnalysis(const Sema &SemaRef,
            isAssignmentOperatorLifetimeBound(Entity.AssignmentOperator)));
 }
 
-static void checkExprLifetimeImpl(Sema &SemaRef,
-                                  const InitializedEntity *InitEntity,
-                                  const InitializedEntity *ExtendingEntity,
-                                  LifetimeKind LK,
-                                  const AssignedEntity *AEntity, Expr *Init) {
+static void
+checkExprLifetimeImpl(Sema &SemaRef, const InitializedEntity *InitEntity,
+                      const InitializedEntity *ExtendingEntity, LifetimeKind LK,
+                      const AssignedEntity *AEntity,
+                      const CapturingEntity *CapEntity, Expr *Init) {
   assert((AEntity && LK == LK_Assignment) ||
+         (CapEntity && LK == LK_LifetimeCapture) ||
----------------
bricknerb wrote:

How can line 1130 be true given this assert?
How can we match different LK values in the switch in line 1165?

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


More information about the cfe-commits mailing list