clang 22.0.0git
clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir > Class Template Reference

A generic, policy-based driver for dataflow analyses. More...

Inheritance diagram for clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >:
[legend]

Public Types

using Lattice = LatticeType
using Base = DataflowAnalysis<Derived, Lattice, Dir>

Public Member Functions

void run ()
Lattice transfer (Lattice In, const IssueFact &)
Lattice transfer (Lattice In, const ExpireFact &)
Lattice transfer (Lattice In, const AssignOriginFact &)
Lattice transfer (Lattice In, const ReturnOfOriginFact &)
Lattice transfer (Lattice In, const UseFact &)
Lattice transfer (Lattice In, const TestPointFact &)

Protected Member Functions

 DataflowAnalysis (const CFG &C, AnalysisDeclContext &AC, FactManager &F)
Lattice getState (ProgramPoint P) const
Lattice getInState (const CFGBlock *B) const
Lattice getOutState (const CFGBlock *B) const
void dump () const

Protected Attributes

FactManagerAllFacts

Detailed Description

template<typename Derived, typename LatticeType, Direction Dir>
class clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >

A generic, policy-based driver for dataflow analyses.

It combines the dataflow runner and the transferer logic into a single class hierarchy.

The derived class is expected to provide:

  • A Lattice type.
  • StringRef getAnalysisName() const
  • Lattice getInitialState(); The initial state of the analysis.
  • Lattice join(Lattice, Lattice); Merges states from multiple CFG paths.
  • Lattice transfer(Lattice, const FactType&); Defines how a single lifetime-relevant Fact transforms the lattice state. Only overloads for facts relevant to the analysis need to be implemented.
Template Parameters
DerivedThe CRTP derived class that implements the specific analysis.
LatticeTypeThe dataflow lattice used by the analysis.
DirThe direction of the analysis (Forward or Backward). TODO: Maybe use the dataflow framework! The framework might need changes to support the current comparison done at block-entry.

Definition at line 777 of file LifetimeSafety.cpp.

Member Typedef Documentation

◆ Base

template<typename Derived, typename LatticeType, Direction Dir>
using clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::Base = DataflowAnalysis<Derived, Lattice, Dir>

Definition at line 780 of file LifetimeSafety.cpp.

◆ Lattice

template<typename Derived, typename LatticeType, Direction Dir>
using clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::Lattice = LatticeType

Definition at line 779 of file LifetimeSafety.cpp.

Constructor & Destructor Documentation

◆ DataflowAnalysis()

template<typename Derived, typename LatticeType, Direction Dir>
clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::DataflowAnalysis ( const CFG & C,
AnalysisDeclContext & AC,
FactManager & F )
inlineexplicitprotected

Definition at line 800 of file LifetimeSafety.cpp.

Member Function Documentation

◆ dump()

template<typename Derived, typename LatticeType, Direction Dir>
void clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::dump ( ) const
inlineprotected

Definition at line 848 of file LifetimeSafety.cpp.

◆ getInState()

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::getInState ( const CFGBlock * B) const
inlineprotected

◆ getOutState()

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::getOutState ( const CFGBlock * B) const
inlineprotected

◆ getState()

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::getState ( ProgramPoint P) const
inlineprotected

Definition at line 842 of file LifetimeSafety.cpp.

◆ run()

template<typename Derived, typename LatticeType, Direction Dir>
void clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::run ( )
inline

Definition at line 805 of file LifetimeSafety.cpp.

◆ transfer() [1/6]

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::transfer ( Lattice In,
const AssignOriginFact &  )
inline

Definition at line 900 of file LifetimeSafety.cpp.

◆ transfer() [2/6]

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::transfer ( Lattice In,
const ExpireFact &  )
inline

Definition at line 899 of file LifetimeSafety.cpp.

◆ transfer() [3/6]

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::transfer ( Lattice In,
const IssueFact &  )
inline

Definition at line 898 of file LifetimeSafety.cpp.

◆ transfer() [4/6]

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::transfer ( Lattice In,
const ReturnOfOriginFact &  )
inline

Definition at line 901 of file LifetimeSafety.cpp.

◆ transfer() [5/6]

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::transfer ( Lattice In,
const TestPointFact &  )
inline

Definition at line 903 of file LifetimeSafety.cpp.

◆ transfer() [6/6]

template<typename Derived, typename LatticeType, Direction Dir>
Lattice clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::transfer ( Lattice In,
const UseFact &  )
inline

Definition at line 902 of file LifetimeSafety.cpp.

Member Data Documentation

◆ AllFacts

template<typename Derived, typename LatticeType, Direction Dir>
FactManager& clang::lifetimes::internal::DataflowAnalysis< Derived, LatticeType, Dir >::AllFacts
protected

Definition at line 798 of file LifetimeSafety.cpp.


The documentation for this class was generated from the following file: