================
@@ -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.
----------------
Xazax-hun wrote:
Technically, it is not necessarily the parameter that needs to escape.
Consider:
```
int * f(const std::vector<int>& v [[clang::lifetimebound]]) {
return v.data();
}
```
Here, we do not escape the address of vector itself, but we return a pointer to
an inner buffer. So technically, we did not escape the lifetimebound marked
value, but this code is still fine!
https://github.com/llvm/llvm-project/pull/196144
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits