================
@@ -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) {
----------------
usx95 wrote:

Now we iterate over live loans. Thanks for the suggestion.

https://github.com/llvm/llvm-project/pull/179093
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to