================
@@ -686,9 +693,10 @@ Detects misuse of [[clang::noescape]] annotation where the
parameter escapes (fo
}
def LifetimeSafetyValidations : DiagGroup<"lifetime-safety-validations",
- [LifetimeSafetyNoescape,
-
LifetimeSafetyLifetimeboundViolation,
-
LifetimeSafetyMisplacedLifetimebound]> {
+ [LifetimeSafetyNoescape,
+ LifetimeSafetyLifetimeboundViolation,
+
LifetimeSafetyInapplicableLifetimebound,
+
LifetimeSafetyMisplacedLifetimebound]> {
----------------
usx95 wrote:
I think these should be broken into two separate categories.
`LifetimeSafetyMisplacedLifetimebound` and
`LifetimeSafetyInapplicableLifetimebound` do not require CFG-based analysis.
High-level suggestion (AI)
```cpp
def LifetimeSafetyAnnotationPlacement
: DiagGroup<"lifetime-safety-annotation-placement",
[LifetimeSafetyInapplicableLifetimebound,
LifetimeSafetyMisplacedLifetimebound]> {
code Documentation = [{
Validates that lifetime annotations are placed on appropriate types and in
appropriate locations.
}];
}
def LifetimeSafetyAnnotationVerification
: DiagGroup<"lifetime-safety-annotation-verification",
[LifetimeSafetyNoescape,
LifetimeSafetyLifetimeboundViolation]> {
code Documentation = [{
Verifies that function implementations adhere to their lifetime annotation
contracts through dataflow analysis.
}];
}
def LifetimeSafetyValidations : DiagGroup<"lifetime-safety-validations",
[LifetimeSafetyAnnotationPlacement,
LifetimeSafetyAnnotationVerification]> {
code Documentation = [{
Validates correct usage and adherence to lifetime safety annotations like
[[clang::noescape]] and [[clang::lifetimebound]].
}];
}
```
You can use `-Wlifetime-safety-annotation-placement` in the tests. One
invocation should be fine as it does not depend on the CFG.
https://github.com/llvm/llvm-project/pull/201101
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits