================
@@ -341,6 +359,11 @@ void FactsGenerator::handleLifetimeEnds(const
CFGLifetimeEnds &LifetimeEnds) {
// Iterate through all loans to see if any expire.
for (const auto &Loan : FactMgr.getLoanMgr().getLoans()) {
const AccessPath &LoanPath = Loan.Path;
+ // Skip loans for declarations that have been moved. When a value is moved,
+ // the original owner no longer has ownership and its destruction should
not
+ // cause the loan to expire, preventing false positives.
+ if (MovedDecls.contains(LoanPath.D))
----------------
usx95 wrote:
I am not totally convinced of the upside of such a heuristic. Doing this would
require another dataflow/reachability problem and I don't think that is worth
the complexity.
Note that this only switches the analysis off for only the moved decls but not
for all the rest of the functions. I would prefer having the heuristics simpler
given that this is a major limitation of our lifetime model.
https://github.com/llvm/llvm-project/pull/170007
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits