clang 19.0.0git
Public Member Functions | List of all members
clang::dataflow::TypeErasedDataflowAnalysis Class Referenceabstract

Type-erased base class for dataflow analyses built on a single lattice type. More...

#include "clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h"

Inheritance diagram for clang::dataflow::TypeErasedDataflowAnalysis:
Inheritance graph
[legend]

Public Member Functions

 TypeErasedDataflowAnalysis ()
 
 TypeErasedDataflowAnalysis (DataflowAnalysisOptions Options)
 
virtual ~TypeErasedDataflowAnalysis ()
 
virtual ASTContextgetASTContext ()=0
 Returns the ASTContext that is used by the analysis.
 
virtual TypeErasedLattice typeErasedInitialElement ()=0
 Returns a type-erased lattice element that models the initial state of a basic block.
 
virtual TypeErasedLattice joinTypeErased (const TypeErasedLattice &, const TypeErasedLattice &)=0
 Joins two type-erased lattice elements by computing their least upper bound.
 
virtual LatticeJoinEffect widenTypeErased (TypeErasedLattice &Current, const TypeErasedLattice &Previous)=0
 Chooses a lattice element that approximates the current element at a program point, given the previous element at that point.
 
virtual bool isEqualTypeErased (const TypeErasedLattice &, const TypeErasedLattice &)=0
 Returns true if and only if the two given type-erased lattice elements are equal.
 
virtual void transferTypeErased (const CFGElement &, TypeErasedLattice &, Environment &)=0
 Applies the analysis transfer function for a given control flow graph element and type-erased lattice element.
 
virtual void transferBranchTypeErased (bool Branch, const Stmt *, TypeErasedLattice &, Environment &)=0
 Applies the analysis transfer function for a given edge from a CFG block of a conditional statement.
 
const std::optional< DataflowAnalysisContext::Options > & builtinOptions () const
 If the built-in model is enabled, returns the options to be passed to them.
 
- Public Member Functions inherited from clang::dataflow::Environment::ValueModel
virtual ~ValueModel ()=default
 
virtual ComparisonResult compare (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2)
 Returns: Same: Val1 is equivalent to Val2, according to the model.
 
virtual bool merge (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2, Value &MergedVal, Environment &MergedEnv)
 DEPRECATED.
 
virtual void join (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2, Value &JoinedVal, Environment &JoinedEnv)
 Modifies JoinedVal to approximate both Val1 and Val2.
 
virtual Valuewiden (QualType Type, Value &Prev, const Environment &PrevEnv, Value &Current, Environment &CurrentEnv)
 This function may widen the current value – replace it with an approximation that can reach a fixed point more quickly than iterated application of the transfer function alone.
 

Detailed Description

Type-erased base class for dataflow analyses built on a single lattice type.

Definition at line 54 of file TypeErasedDataflowAnalysis.h.

Constructor & Destructor Documentation

◆ TypeErasedDataflowAnalysis() [1/2]

clang::dataflow::TypeErasedDataflowAnalysis::TypeErasedDataflowAnalysis ( )
inline

Definition at line 58 of file TypeErasedDataflowAnalysis.h.

◆ TypeErasedDataflowAnalysis() [2/2]

clang::dataflow::TypeErasedDataflowAnalysis::TypeErasedDataflowAnalysis ( DataflowAnalysisOptions  Options)
inline

Definition at line 60 of file TypeErasedDataflowAnalysis.h.

◆ ~TypeErasedDataflowAnalysis()

virtual clang::dataflow::TypeErasedDataflowAnalysis::~TypeErasedDataflowAnalysis ( )
inlinevirtual

Definition at line 63 of file TypeErasedDataflowAnalysis.h.

Member Function Documentation

◆ builtinOptions()

const std::optional< DataflowAnalysisContext::Options > & clang::dataflow::TypeErasedDataflowAnalysis::builtinOptions ( ) const
inline

If the built-in model is enabled, returns the options to be passed to them.

Otherwise returns empty.

Definition at line 114 of file TypeErasedDataflowAnalysis.h.

◆ getASTContext()

virtual ASTContext & clang::dataflow::TypeErasedDataflowAnalysis::getASTContext ( )
pure virtual

◆ isEqualTypeErased()

virtual bool clang::dataflow::TypeErasedDataflowAnalysis::isEqualTypeErased ( const TypeErasedLattice ,
const TypeErasedLattice  
)
pure virtual

◆ joinTypeErased()

virtual TypeErasedLattice clang::dataflow::TypeErasedDataflowAnalysis::joinTypeErased ( const TypeErasedLattice ,
const TypeErasedLattice  
)
pure virtual

Joins two type-erased lattice elements by computing their least upper bound.

Places the join result in the left element and returns an effect indicating whether any changes were made to it.

Implemented in clang::dataflow::DataflowAnalysis< Derived, LatticeT >, clang::dataflow::DataflowAnalysis< NoopAnalysis, NoopLattice >, and clang::dataflow::DataflowAnalysis< UncheckedOptionalAccessModel, NoopLattice >.

◆ transferBranchTypeErased()

virtual void clang::dataflow::TypeErasedDataflowAnalysis::transferBranchTypeErased ( bool  Branch,
const Stmt ,
TypeErasedLattice ,
Environment  
)
pure virtual

Applies the analysis transfer function for a given edge from a CFG block of a conditional statement.

Parameters
StmtThe condition which is responsible for the split in the CFG.
BranchTrue if the edge goes to the basic block where the condition is true.

Implemented in clang::dataflow::DataflowAnalysis< Derived, LatticeT >, clang::dataflow::DataflowAnalysis< NoopAnalysis, NoopLattice >, and clang::dataflow::DataflowAnalysis< UncheckedOptionalAccessModel, NoopLattice >.

◆ transferTypeErased()

virtual void clang::dataflow::TypeErasedDataflowAnalysis::transferTypeErased ( const CFGElement ,
TypeErasedLattice ,
Environment  
)
pure virtual

Applies the analysis transfer function for a given control flow graph element and type-erased lattice element.

Implemented in clang::dataflow::DataflowAnalysis< Derived, LatticeT >, clang::dataflow::DataflowAnalysis< NoopAnalysis, NoopLattice >, and clang::dataflow::DataflowAnalysis< UncheckedOptionalAccessModel, NoopLattice >.

◆ typeErasedInitialElement()

virtual TypeErasedLattice clang::dataflow::TypeErasedDataflowAnalysis::typeErasedInitialElement ( )
pure virtual

◆ widenTypeErased()

virtual LatticeJoinEffect clang::dataflow::TypeErasedDataflowAnalysis::widenTypeErased ( TypeErasedLattice Current,
const TypeErasedLattice Previous 
)
pure virtual

Chooses a lattice element that approximates the current element at a program point, given the previous element at that point.

Places the widened result in the current element (Current). Widening is optional – it is only needed to either accelerate convergence (for lattices with non-trivial height) or guarantee convergence (for lattices with infinite height).

Returns an indication of whether any changes were made to Current in order to widen. This saves a separate call to isEqualTypeErased after the widening.

Implemented in clang::dataflow::DataflowAnalysis< Derived, LatticeT >, clang::dataflow::DataflowAnalysis< NoopAnalysis, NoopLattice >, and clang::dataflow::DataflowAnalysis< UncheckedOptionalAccessModel, NoopLattice >.

Referenced by clang::dataflow::runTypeErasedDataflowAnalysis().


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