[clang] [LifetimeSafety] Warn when lifetimebound attribute is present on the definition but not on declaration (PR #197753)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 15 05:19:55 PDT 2026
================
@@ -415,6 +416,28 @@ class LifetimeChecker {
}
}
+ void reportMisplacedLifetimebound() {
+ const FunctionDecl *FDef = dyn_cast<FunctionDecl>(FD);
+ if (!FDef)
+ return;
+
+ const FunctionDecl *FDecl = FDef->getPreviousDecl();
----------------
NeKon69 wrote:
Would you prefer a warning on all not annotated cases or only on one? Because I have a feeling that warning on *all* cases might be too harsh, I could just add a note saying something like "another declaration here"
https://github.com/llvm/llvm-project/pull/197753
More information about the cfe-commits
mailing list