================
@@ -10967,16 +10967,27 @@ def warn_lifetime_safety_use_after_free : Warning<
     "%select{allocated object|parameter}0 does not live long enough">,
     InGroup<LifetimeSafetyUseAfterFree>, DefaultIgnore;
 
-def warn_lifetime_safety_return_stack_addr
-    : Warning<"address of stack memory is returned later">,
-      InGroup<LifetimeSafetyReturnStackAddr>,
-      DefaultIgnore;
-def warn_lifetime_safety_return_stack_addr_moved
-    : Warning<"address of stack memory may be returned later. "
-      "This could be false positive as the storage may have been moved. "
-      "Consider moving first and then aliasing later to resolve the issue">,
-      InGroup<LifetimeSafetyReturnStackAddrMoved>,
-      DefaultIgnore;
+def warn_lifetime_safety_return_stack_addr : Warning<
+  "%select{address of|reference to}0 stack memory associated with "
+  "%select{local variable|parameter}2 %1 returned">,
+  InGroup<LifetimeSafetyReturnStackAddr>, DefaultIgnore;
----------------
usx95 wrote:

I agree we used to do this in `-Wdangling` analysis but in retrospect this is 
very hard to understand and maintain specially at the callsite.

A suggestion would be to create the formatted strings in the analysis and not 
use this. So here we could have raw string placeholders and analysis can have a 
central printing policy.


```
def warn_lifetime_safety_return_stack_addr : Warning<
  "%0 stack memory associated with %1 %2 returned">,
  InGroup<LifetimeSafetyReturnStackAddr>, DefaultIgnore;
```

https://github.com/llvm/llvm-project/pull/199432
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to