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

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

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/Analysis/LifetimeSafety/Dataflow.h"

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 OriginFlowFact &)
Lattice transfer (Lattice In, const ReturnOfOriginFact &)
Lattice transfer (Lattice In, const UseFact &)
Lattice transfer (Lattice In, const TestPointFact &)

Protected Member Functions

 DataflowAnalysis (const CFG &Cfg, AnalysisDeclContext &AC, FactManager &FactMgr)
Lattice getState (ProgramPoint P) const
std::optional< LatticegetInState (const CFGBlock *B) const
Lattice getOutState (const CFGBlock *B) const
void dump () const

Protected Attributes

FactManagerFactMgr

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 57 of file Dataflow.h.

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 60 of file Dataflow.h.

◆ Lattice

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

Definition at line 59 of file Dataflow.h.

Constructor & Destructor Documentation

◆ DataflowAnalysis()

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

Definition at line 80 of file Dataflow.h.

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 130 of file Dataflow.h.

◆ getInState()

template<typename Derived, typename LatticeType, Direction Dir>
std::optional< 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 119 of file Dataflow.h.

◆ run()

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

Definition at line 85 of file Dataflow.h.

◆ transfer() [1/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 181 of file Dataflow.h.

◆ transfer() [2/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 180 of file Dataflow.h.

◆ transfer() [3/6]

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

Definition at line 182 of file Dataflow.h.

◆ 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 183 of file Dataflow.h.

◆ 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 185 of file Dataflow.h.

◆ 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 184 of file Dataflow.h.

Member Data Documentation

◆ FactMgr

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

Definition at line 78 of file Dataflow.h.


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