================
@@ -526,14 +527,15 @@ class LifetimeChecker {
/// Given a chain of origins that shows how a loan propagates, this function
/// extracts the corresponding expressions for each origin. Origins that
refer
/// to declarations (rather than expressions) are skipped.
- llvm::SmallVector<const Expr *>
- getExprChain(llvm::ArrayRef<OriginID> OriginFlowChain) {
- llvm::SmallVector<const Expr *> rs;
- for (const OriginID CurrOID : OriginFlowChain)
- if (const Expr *CurrExpr =
- FactMgr.getOriginMgr().getOrigin(CurrOID).getExpr())
- rs.push_back(CurrExpr);
- return rs;
+ llvm::SmallVector<AliasChainEntry>
+ getAliasChain(llvm::ArrayRef<const OriginFlowFact *> OriginFlowChain) {
+ llvm::SmallVector<AliasChainEntry> Result;
+ for (const OriginFlowFact *Flow : OriginFlowChain)
+ if (const Expr *CurrExpr = FactMgr.getOriginMgr()
+ .getOrigin(Flow->getSrcOriginID())
+ .getExpr())
+ Result.push_back({CurrExpr, FactMgr.getLifetimeBoundParamInfo(Flow)});
----------------
Xazax-hun wrote:
This function makes me think, do we actually need to store the
`LifetimeBoundInfo`?
I wonder if we can rederive it here from the expression instead. You could
factor `GetLifetimeBoundParamInfo` from the `handleFunctionCall` out and call
it here.
This would save us on memory, and insert/lookup on the hot path (the analysis
itself), and instead we would do work on the cold path (reporting warnings).
https://github.com/llvm/llvm-project/pull/206337
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits