================
@@ -175,9 +179,66 @@ class LifetimeChecker {
FinalWarningsMap[ExpiredLoan] = {/*ExpiryLoc=*/EF->getExpiryLoc(),
/*BestCausingFact=*/BestCausingFact,
/*MovedExpr=*/MovedExpr,
+ /*InvalidatedByExpr=*/nullptr,
/*ConfidenceLevel=*/CurConfidence};
}
+ // TODO: Doc.
+ void checkInvalidation(const InvalidateOriginFact *IOF) {
+ OriginID InvalidatedOrigin = IOF->getInvalidatedOrigin();
+ /// Get loans directly pointing to the invalidated container
+ LoanSet DirectlyInvalidatedLoans =
+ LoanPropagation.getLoans(InvalidatedOrigin, IOF);
+ llvm::DenseSet<LoanID> AllInvalidatedLoans;
+
+ auto GetAccessPath = [](const Loan *L) -> AccessPath {
+ if (auto *PL = dyn_cast<PathLoan>(L))
+ return PL->getAccessPath();
+ // TODO: Handle place holder loans.
+ // if (auto *PL = dyn_cast<PlaceholderLoan>(L))
+ // return PL->getParmVarDecl();
+ return {};
+ };
+
+ // Build set of all loans that reference the invalidated container.
+ // We match loans by AccessPath because multiple IssueFacts may create
+ // loans to the same container.
+ FactMgr.forAllPredecessors(IOF, [&](const Fact *PF) {
----------------
Xazax-hun wrote:
I have the same question as I had for the other PR. I'd expect loan propagation
to take care of this and I am not sure why we need to this.
https://github.com/llvm/llvm-project/pull/179093
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits