[clang] [analyzer] Implement BugReporterVisitor for UseAfterLifetimeEnd to trace lifetime source binding (PR #207052)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 27 01:45:46 PDT 2026


================
@@ -142,13 +158,18 @@ int *direct_return() {
   int i = 5;
   return test_func(&i);
   // expected-warning at -1 {{Returning value bound to 'i' that will go out of scope}}
-  // expected-warning at -2 {{address of stack memory associated with local variable 'i' returned}}
+  // expected-note at -2    {{Value's lifetime bound to the lifetime of 'i' here}}
+  // expected-note at -3    {{Lifetime of 'i' ended here}}
+  // expected-warning at -4 {{address of stack memory associated with local variable 'i' returned}}
----------------
isuckatcs wrote:

Nit: some of these messages starts with a capital letter, but others start with lowecase. Is this something to worry about?

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


More information about the cfe-commits mailing list