[clang] [LifetimeSafety] Warn on incorrectly placed `[[clang::lifetimebound]]` attributes (PR #196144)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Fri May 8 08:33:50 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() &&
----------------
usx95 wrote:
Maybe not do this for STL but still do for other implicit annotation.
That said, implicit annotation violation is not actionable by the user so I am fine not having for these at all as currently. If we want to detect this, assert fail is better suited here ?
https://github.com/llvm/llvm-project/pull/196144
More information about the cfe-commits
mailing list