[clang] [LifetimeSafety] Add per-program-point lattice tracking (PR #149199)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 17 03:19:44 PDT 2025
================
@@ -524,14 +531,20 @@ template <typename Derived, typename LatticeType, Direction Dir>
class DataflowAnalysis {
public:
using Lattice = LatticeType;
- using Base = DataflowAnalysis<Derived, LatticeType, Dir>;
+ using Base = DataflowAnalysis<Derived, Lattice, Dir>;
private:
const CFG &Cfg;
AnalysisDeclContext &AC;
+ /// The dataflow state before a basic block is processed.
llvm::DenseMap<const CFGBlock *, Lattice> InStates;
+ /// The dataflow state after a basic block is processed.
llvm::DenseMap<const CFGBlock *, Lattice> OutStates;
+ /// The dataflow state at a Program Point.
+ /// In a forward analysis, this is the state after the Fact at that point has
+ /// been applied, while in a backward analysis, it is the state before.
+ llvm::DenseMap<ProgramPoint, Lattice> PerPointStates;
----------------
Xazax-hun wrote:
Do you think all of the analyses need `PerPointStates`? E.g., what about the `ExpiredLoansAnalysis`? I wonder if we should have a boolean policy here.
https://github.com/llvm/llvm-project/pull/149199
More information about the cfe-commits
mailing list