[clang] [LifetimeSafety] Add ExpireOriginFact to fix false positives for pointers in loops (PR #182368)
Zhijie Wang via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 11:08:58 PST 2026
aeft wrote:
> If we reuse `ExpireFact`, it would need to carry both an optional `LoanID` and an optional `OriginID`, and the transfer functions would need to branch on which one is present. That feels a bit awkward with the current CRTP dispatch where each fact kind maps to one transfer function.
@usx95 @Xazax-hun Thanks for the feedback! I updated to only expire the outermost origin and accept the multi-level pointer case as a known limitation (with a FIXME noting it needs flow-sensitive origin aliasing).
Regarding reusing `ExpireFact`, they target fundamentally different entities (Loan vs Origin) with different transfer semantics (`ExpireFact` is no-op in dataflow). To reuse it, `ExpireFact` would need to hold either a `LoanID` or an `OriginID`, and transfer functions would branch on which is present. I think separate fact kinds are cleaner here, but happy to go with reuse if you prefer.
https://github.com/llvm/llvm-project/pull/182368
More information about the cfe-commits
mailing list