[clang] [LifetimeSafety] Warn on incorrectly placed `[[clang::lifetimebound]]` attributes (PR #196144)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Fri May 8 09:16:03 PDT 2026


================
@@ -624,6 +624,13 @@ Warning to detect invalidation of references.
   }];
 }
 
+def LifetimeSafetyLifetimeboundViolation : DiagGroup<"lifetime-safety-lifetimebound-violation"> {
+  code Documentation = [{
+Detects parameters marked as [[clang::lifetimebound]] for which we could not verify that the return value can be lifetime bound to them.
+This may contain false-positives, e.g. when we fail to track origin propagation for the return value.
----------------
Xazax-hun wrote:

```suggestion
This warning may produce false-positives diagnostics when it cannot fully model the code.
```

I think the terms like `origin propagation` are for us. When we target our users let's try to keep things a bit more high level. 

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


More information about the cfe-commits mailing list