[llvm-branch-commits] [clang] [LifetimeSafety] Support container interior paths and invalidations (PR #207523)
Gábor Horváth via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 5 04:05:34 PDT 2026
================
@@ -72,6 +72,18 @@ Loan *LoanManager::getOrCreateExtendedLoan(LoanID BaseLoanID,
if (It != ExtensionCache.end())
return It->second;
const auto *BaseLoan = getLoan(BaseLoanID);
+
+ // Stop appending if Element is already in the path to prevent infinite path
+ // accumulation (divergence) on recursive types or casts.
+ //
+ // This sound over-approximation guarantees termination at the cost of
+ // precision. Conflating infinitely deep paths into a single truncated loan
+ // may cause false positives via spurious invalidations, but never causes
+ // false negatives.
+ for (const PathElement &E : BaseLoan->getAccessPath().getElements())
----------------
Xazax-hun wrote:
Do we want to do this with `PathElement::getInterior()` as well? Imagine a vector of vectors like `std::vector<std::vector<int>> v;` and `v[1][1]`. Could we represent that?
https://github.com/llvm/llvm-project/pull/207523
More information about the llvm-branch-commits
mailing list