[clang] [LifetimeSafety] Warn on incorrectly placed `[[clang::lifetimebound]]` attributes (PR #196144)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Thu May 7 22:59:33 PDT 2026
================
@@ -624,12 +624,19 @@ Warning to detect invalidation of references.
}];
}
+def LifetimeSafetyLifetimeboundViolation : DiagGroup<"lifetime-safety-lifetimebound-violation"> {
+ code Documentation = [{
+Warning to detect lifetimebound violations introduced by marking parameter as lifetimebound but not returning it in any way.
+ }];
+}
+
def LifetimeSafetyPermissive : DiagGroup<"lifetime-safety-permissive",
[LifetimeSafetyUseAfterScope,
LifetimeSafetyReturnStackAddr,
LifetimeSafetyDanglingField,
LifetimeSafetyDanglingGlobal,
- LifetimeSafetyUseAfterFree]>;
+ LifetimeSafetyUseAfterFree,
+ LifetimeSafetyLifetimeboundViolation]>;
def LifetimeSafetyStrict : DiagGroup<"lifetime-safety-strict",
[LifetimeSafetyPermissive,
----------------
usx95 wrote:
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'><i>[Re: lines +675 to +681]</i></p><!--__GRAPHITE_HTML_TAG_END__-->
Please add the warning to this group.
<!--__GRAPHITE_HTML_TAG_START__--><p class='graphite__hidden'>See this comment inline on <a href="https://app.graphite.com/github/pr/llvm/llvm-project/196144?utm_source=unchanged-line-comment">Graphite</a>.</p><!--__GRAPHITE_HTML_TAG_END__-->
https://github.com/llvm/llvm-project/pull/196144
More information about the cfe-commits
mailing list