14#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
15#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_TYPEERASEDDATAFLOWANALYSIS_H
28#include "llvm/ADT/Any.h"
29#include "llvm/Support/Error.h"
113 const std::optional<DataflowAnalysisContext::Options> &
115 return Options.BuiltinOpts;
142 const ControlFlowContext &CFCtx,
143 llvm::ArrayRef<std::optional<TypeErasedDataflowAnalysisState>> BlockStates,
145 TypeErasedDataflowAnalysis &Analysis,
147 const TypeErasedDataflowAnalysisState &)>
148 PostVisitCFG =
nullptr);
158 const ControlFlowContext &CFCtx, TypeErasedDataflowAnalysis &Analysis,
159 const Environment &InitEnv,
161 const TypeErasedDataflowAnalysisState &)>
162 PostVisitCFG =
nullptr);
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a single basic block in a source-level CFG.
Represents a top-level expression in a basic block.
Stmt - This represents one statement.
Supplements Environment with non-standard comparison and join operations.
Holds the state of the program (store and heap) at a given program point.
Type-erased base class for dataflow analyses built on a single lattice type.
const std::optional< DataflowAnalysisContext::Options > & builtinOptions() const
If the built-in model is enabled, returns the options to be passed to them.
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.
virtual LatticeJoinEffect widenTypeErased(TypeErasedLattice &Current, const TypeErasedLattice &Previous)=0
Chooses a lattice element that approximates the current element at a program point,...
virtual TypeErasedLattice typeErasedInitialElement()=0
Returns a type-erased lattice element that models the initial state of a basic block.
virtual void transferTypeErased(const CFGElement &, TypeErasedLattice &, Environment &)=0
Applies the analysis transfer function for a given control flow graph element and type-erased lattice...
virtual ASTContext & getASTContext()=0
Returns the ASTContext that is used by the analysis.
virtual LatticeJoinEffect joinTypeErased(TypeErasedLattice &, const TypeErasedLattice &)=0
Joins two type-erased lattice elements by computing their least upper bound.
virtual ~TypeErasedDataflowAnalysis()
TypeErasedDataflowAnalysis()
virtual bool isEqualTypeErased(const TypeErasedLattice &, const TypeErasedLattice &)=0
Returns true if and only if the two given type-erased lattice elements are equal.
TypeErasedDataflowAnalysis(DataflowAnalysisOptions Options)
llvm::Expected< std::vector< std::optional< TypeErasedDataflowAnalysisState > > > runTypeErasedDataflowAnalysis(const ControlFlowContext &CFCtx, TypeErasedDataflowAnalysis &Analysis, const Environment &InitEnv, std::function< void(const CFGElement &, const TypeErasedDataflowAnalysisState &)> PostVisitCFG=nullptr)
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states tha...
TypeErasedDataflowAnalysisState transferBlock(const ControlFlowContext &CFCtx, llvm::ArrayRef< std::optional< TypeErasedDataflowAnalysisState > > BlockStates, const CFGBlock &Block, const Environment &InitEnv, TypeErasedDataflowAnalysis &Analysis, std::function< void(const CFGElement &, const TypeErasedDataflowAnalysisState &)> PostVisitCFG=nullptr)
Transfers the state of a basic block by evaluating each of its elements in the context of Analysis an...
LatticeJoinEffect
Effect indicating whether a lattice join operation resulted in a new value.
std::optional< DataflowAnalysisContext::Options > BuiltinOpts
Options for the built-in model, or empty to not apply them.
Type-erased model of the program at a given program point.
TypeErasedDataflowAnalysisState(TypeErasedLattice Lattice, Environment Env)
TypeErasedLattice Lattice
Type-erased model of a program property.
Environment Env
Model of the state of the program (store and heap).
Type-erased lattice element container.