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

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu May 7 22:59:33 PDT 2026


================
@@ -624,12 +624,19 @@ Warning to detect invalidation of references.
   }];
 }
 
+def LifetimeSafetyLifetimeboundViolation : DiagGroup<"lifetime-safety-lifetimebound-violation"> {
+  code Documentation = [{
+Warning to detect lifetimebound violations introduced by marking parameter as lifetimebound but not returning it in any way.
----------------
usx95 wrote:

suggestion: `Detects parameters marked as [[clang::lifetimebound]] that do not escape through the return value.`

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


More information about the cfe-commits mailing list