[clang] [Lifetime Safety] Distinguish attributed/inferred lifetimebound diagnostics (PR #220248)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 09:12:48 PDT 2026


================
@@ -603,7 +603,7 @@ void uaf_via_inferred_lifetimebound() {
   {
     int local;
     f = return_lambda_capturing_param(local); // expected-warning {{local variable 'local' does not live long enough}} \
-                                              // expected-note {{result of call to 'return_lambda_capturing_param' aliases the storage of local variable 'local' because parameter 'x' is lifetimebound}}
+                                              // expected-note {{result of call to 'return_lambda_capturing_param' aliases the storage of local variable 'local' because parameter 'x' is marked as lifetimebound}}
----------------
usx95 wrote:

`return_lambda_capturing_param`, on the contrary, is not marked lifetimebound. It has an inferred annotation present. We should check for implicit annotation attr to retrieve this information.

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


More information about the cfe-commits mailing list