[clang] [LifetimeSafety][NFC] Use one allocator per analyzed function (PR #246490)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 12:55:44 PST 2026


Xazax-hun wrote:

It is true that we do not necessarily allocate 7 every time. But there were the allocators:

1. OriginLoanMap::Factory: origin → loan-set map nodes, for loan propagation.
2. LoanSet::Factory: loan-set nodes.
3. MovedLoansMap::Factory: moved-loan map nodes.
4. LivenessMap::Factory: origin → liveness map nodes.
5. FactManager::FactAllocator: every fact.
6. OriginManager::ListAllocator: origin-list nodes.
7. LoanManager::LoanAllocator: loans and placeholder bases.

So if we allocated at least one origin, at least one fact for a function, we would end up with hitting most of these. True that there are some functions where we might not generate any facts at all. But a single fact already triggers like 6 of these. And since we represent lvalues as loans to the underlying storage, it is not too hard to hit functions that generate at least one fact. 

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


More information about the cfe-commits mailing list