================
@@ -1096,29 +1096,37 @@ void FactsGenerator::handleFunctionCall(const Expr
*Call,
flow(CallList, getOriginsList(*Args[0]), /*Kill=*/true);
return;
}
- auto IsArgLifetimeBound = [FD, &Args](unsigned I) -> bool {
+ auto IsArgLifetimeBound = [FD](unsigned I) -> bool {
const ParmVarDecl *PVD = nullptr;
if (const auto *Method = dyn_cast<CXXMethodDecl>(FD);
Method && Method->isInstance() && !isa<CXXConstructorDecl>(FD)) {
if (I == 0)
// For the 'this' argument, the attribute is on the method itself.
- return implicitObjectParamIsLifetimeBound(Method) ||
- shouldTrackImplicitObjectArg(
- *Args[0], Method, /*RunningUnderLifetimeSafety=*/true);
+ return implicitObjectParamIsLifetimeBound(Method);
if ((I - 1) < Method->getNumParams())
// For explicit arguments, find the corresponding parameter
// declaration.
PVD = Method->getParamDecl(I - 1);
- } else if (I == 0 && shouldTrackFirstArgument(FD)) {
- return true;
- } else if (I == 1 && shouldTrackSecondArgument(FD)) {
- return true;
} else if (I < FD->getNumParams()) {
// For free functions or static methods.
PVD = FD->getParamDecl(I);
}
return PVD ? PVD->hasAttr<clang::LifetimeBoundAttr>() : false;
};
+ auto ShouldTrackArg = [FD, &Args, IsArgLifetimeBound](unsigned I) -> bool {
+ if (IsArgLifetimeBound(I))
+ return true;
+ if (const auto *Method = dyn_cast<CXXMethodDecl>(FD);
+ Method && Method->isInstance() && !isa<CXXConstructorDecl>(FD))
+ if (I == 0)
+ return shouldTrackImplicitObjectArg(
+ *Args[0], Method, /*RunningUnderLifetimeSafety=*/true);
+ if (I == 0 && shouldTrackFirstArgument(FD))
+ return true;
+ if (I == 1 && shouldTrackSecondArgument(FD))
+ return true;
+ return false;
+ };
----------------
iitianpushkar wrote:
ok!
https://github.com/llvm/llvm-project/pull/206337
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits