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

via cfe-commits cfe-commits at lists.llvm.org
Fri May 8 08:05:24 PDT 2026


================
@@ -358,6 +362,18 @@ class LifetimeChecker {
     }
   }
 
+  void reportLifetimeboundViolations() {
+    if (!isa<FunctionDecl>(FD))
+      return;
+    for (const ParmVarDecl *PVD : cast<FunctionDecl>(FD)->parameters()) {
+      if (!PVD->hasAttr<LifetimeBoundAttr>())
+        continue;
+      if (!PVD->getAttr<LifetimeBoundAttr>()->isImplicit() &&
----------------
NeKon69 wrote:

This did happen earlier when I did some testing for `make_unique`. It's really hard to track what have gone wrong though...

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


More information about the cfe-commits mailing list