[clang] [LifetimeSafety] Warn on meaningless [[clang::lifetimebound]] parameters (PR #201101)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 2 05:26:16 PDT 2026
================
@@ -631,6 +631,13 @@ This warning may produce false-positives diagnostics when it cannot fully model
}];
}
+def LifetimeSafetyMeaninglessLifetimebound
+ : DiagGroup<"lifetime-safety-meaningless-lifetimebound"> {
+ code Documentation = [{
+Detects uses of [[clang::lifetimebound]] that have no effect because the annotated type cannot carry a lifetime.
----------------
Xazax-hun wrote:
Nit: strictly speaking, the `lifetimebound` annotation is not a type annotation, so referring to the "annotated type" is not correct.
I think we could use terminology like "the type of the annotated parameter" or "the type of the annotated implicit object parameter" depending on the kind of annotation instead.
https://github.com/llvm/llvm-project/pull/201101
More information about the cfe-commits
mailing list