[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 04:54:14 PDT 2026
================
@@ -130,6 +130,16 @@ class LifetimeSafetySemaHelper {
virtual void
reportLifetimeboundViolation(const CXXMethodDecl *MDWithLifetimebound) {}
+ // Reports a member function definition that has [[clang::lifetimebound]] on
+ // the implicit this parameter when the previous declaration does not.
+ virtual void reportMisplacedLifetimebound(const FunctionDecl *FDef,
----------------
NeKon69 wrote:
I mean, yeah, probably, but the reason I made this function accept `FunctionDecl` is that `getImplicitObjectParamLifetimeBoundAttr` later accepts a `FunctionDecl`, and we don't really use any `CXXMethodDecl` specific methods. So adding an explicit cast felt unnecessary to me. Do you think I should change that?
https://github.com/llvm/llvm-project/pull/197753
More information about the cfe-commits
mailing list