[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 03:39:38 PDT 2024


================
@@ -1073,14 +1078,16 @@ static void checkExprLifetimeImpl(Sema &SemaRef,
     }
 
     case LK_Assignment: {
-      if (!MTE)
+      if (!MTE || pathContainsInit(Path))
         return false;
       assert(shouldLifetimeExtendThroughPath(Path) ==
                  PathLifetimeKind::NoExtend &&
              "No lifetime extension for assignments");
-      if (!pathContainsInit(Path))
-        SemaRef.Diag(DiagLoc, diag::warn_dangling_pointer_assignment)
-            << AEntity->LHS << DiagRange;
+      SemaRef.Diag(DiagLoc,
+                   IsGslPtrInitWithGslTempOwner
----------------
hokein wrote:

Done, renamed to `IsGslPtrValueFromGslTempOwner`.

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


More information about the cfe-commits mailing list