[clang] [Clang] Extend lifetime bound analysis to support assignments (PR #96475)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 03:31:30 PDT 2024


================
@@ -1028,6 +1045,7 @@ void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity,
 
       switch (shouldLifetimeExtendThroughPath(Path)) {
       case PathLifetimeKind::Extend:
+        assert(InitEntity && "Expect only on initializing the entity");
----------------
usx95 wrote:

Maybe make it clearer that we do not expect lifetime extension for assignment:
 "Lifetime extension should happen only for initialization and not assigment". Same below.

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


More information about the cfe-commits mailing list