[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 07:12:32 PDT 2026


================
@@ -11007,6 +11003,11 @@ def warn_lifetime_safety_dangling_global_moved
       InGroup<LifetimeSafetyDanglingGlobalMoved>,
       DefaultIgnore;
 
+def warn_lifetime_safety_param_lifetimebound_violation
+    : Warning<"parameter is marked as [[clang::lifetimebound]] but isn't returned">,
----------------
Xazax-hun wrote:

Similar concerns here:
* The issue might be missing annotations
* We do not actually need to literally return the parameter. We just need to return something that is lifetimebound to the parameter.

I wonder if the warning should be something like "could not verify that the return value can be lifetime bound to this parameter" 

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


More information about the cfe-commits mailing list