[clang] [LifetimeSafety] Add ExpireOriginFact to fix false positives for pointers in loops (PR #182368)
Alex Wang via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 20 10:22:48 PST 2026
aeft wrote:
> Do we need a new fact? Couldn't we make this work by handling `ExpireFact` in liveness analysis?
Good question! I think it's better to have a new fact. The key distinction is that `ExpireFact` and `ExpireOriginFact` operate on different entities:
- `ExpireFact` targets a Loan (pointee storage is destroyed).
- `ExpireOriginFact` targets an Origin (pointer variable's lifetime ends).
This mirrors the existing pattern: `InvalidateOriginFact` also targets an Origin rather than a Loan. Both `InvalidateOriginFact` and `ExpireOriginFact` act on what a pointer holds, not on what it points to.
https://github.com/llvm/llvm-project/pull/182368
More information about the cfe-commits
mailing list