================
@@ -137,6 +139,8 @@ class LifetimeChecker {
else if (auto *FieldEsc = dyn_cast<FieldEscapeFact>(OEF);
FieldEsc && isa<CXXConstructorDecl>(FD))
AnnotationWarningsMap.try_emplace(PVD, FieldEsc->getFieldDecl());
+ } else {
+ VerifiedLiftimeboundEscapes.insert(PVD);
}
----------------
usx95 wrote:
nit: consider inverting the condition to remove the negation:
```cpp
if (PVD->hasAttr<LifetimeBoundAttr>()) {
// Track that this lifetimebound parameter correctly escapes through return.
VerifiedLiftimeboundEscapes.insert(PVD);
} else {
// Otherwise, suggest lifetimebound for parameter escaping through return
// or a field in constructor.
if (auto *ReturnEsc = dyn_cast<ReturnEscapeFact>(OEF))
AnnotationWarningsMap.try_emplace(PVD, ReturnEsc->getReturnExpr());
else if (auto *FieldEsc = dyn_cast<FieldEscapeFact>(OEF);
FieldEsc && isa<CXXConstructorDecl>(FD))
AnnotationWarningsMap.try_emplace(PVD, FieldEsc->getFieldDecl());
}
```
https://github.com/llvm/llvm-project/pull/196144
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits