[llvm-branch-commits] [clang] [LifetimeSafety] Detect use-after-invalidation for STL containers (PR #179093)

Gábor Horváth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Feb 3 02:48:58 PST 2026


================
@@ -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.
----------------
Xazax-hun wrote:

Nit: todo.

https://github.com/llvm/llvm-project/pull/179093


More information about the llvm-branch-commits mailing list