Go to the documentation of this file.
14 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
15 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
26 #include "llvm/ADT/Any.h"
27 #include "llvm/ADT/Optional.h"
28 #include "llvm/Support/Error.h"
49 bool ApplyBuiltinTransfer;
54 : ApplyBuiltinTransfer(ApplyBuiltinTransfer) {}
109 const ControlFlowContext &CFCtx,
111 const CFGBlock &Block,
const Environment &InitEnv,
112 TypeErasedDataflowAnalysis &Analysis,
113 std::function<
void(
const CFGStmt &,
114 const TypeErasedDataflowAnalysisState &)>
115 HandleTransferredStmt =
nullptr);
123 TypeErasedDataflowAnalysis &Analysis,
124 const Environment &InitEnv);
129 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
Type-erased lattice element container.
TypeErasedLattice Lattice
Type-erased model of a program property.
virtual ~TypeErasedDataflowAnalysis()
LatticeJoinEffect
Effect indicating whether a lattice join operation resulted in a new value.
Represents a single basic block in a source-level CFG.
virtual void transferTypeErased(const Stmt *, TypeErasedLattice &, Environment &)=0
Applies the analysis transfer function for a given statement and type-erased lattice element.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TypeErasedDataflowAnalysis(bool ApplyBuiltinTransfer)
TypeErasedDataflowAnalysisState transferBlock(const ControlFlowContext &CFCtx, std::vector< llvm::Optional< TypeErasedDataflowAnalysisState >> &BlockStates, const CFGBlock &Block, const Environment &InitEnv, TypeErasedDataflowAnalysis &Analysis, std::function< void(const CFGStmt &, const TypeErasedDataflowAnalysisState &)> HandleTransferredStmt=nullptr)
Transfers the state of a basic block by evaluating each of its statements in the context of Analysis ...
Supplements Environment with non-standard comparison and join operations.
virtual TypeErasedLattice typeErasedInitialElement()=0
Returns a type-erased lattice element that models the initial state of a basic block.
TypeErasedDataflowAnalysisState(TypeErasedLattice Lattice, Environment Env)
Type-erased base class for dataflow analyses built on a single lattice type.
Stmt - This represents one statement.
virtual bool isEqualTypeErased(const TypeErasedLattice &, const TypeErasedLattice &)=0
Returns true if and only if the two given type-erased lattice elements are equal.
TypeErasedDataflowAnalysis()
virtual ASTContext & getASTContext()=0
Returns the ASTContext that is used by the analysis.
llvm::Expected< std::vector< llvm::Optional< TypeErasedDataflowAnalysisState > > > runTypeErasedDataflowAnalysis(const ControlFlowContext &CFCtx, TypeErasedDataflowAnalysis &Analysis, const Environment &InitEnv)
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states tha...
virtual LatticeJoinEffect joinTypeErased(TypeErasedLattice &, const TypeErasedLattice &)=0
Joins two type-erased lattice elements by computing their least upper bound.
Holds the state of the program (store and heap) at a given program point.
bool applyBuiltinTransfer() const
Determines whether to apply the built-in transfer functions, which model the heap and stack in the En...
Type-erased model of the program at a given program point.
Environment Env
Model of the state of the program (store and heap).