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;
165 std::int32_t MaxBlockVisits);
Defines the clang::ASTContext interface.
const Environment & InitEnv
Initial state to start the analysis.
TypeErasedDataflowAnalysis & Analysis
The analysis to be run.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Represents a top-level expression in a basic block.
Stmt - This represents one statement.
Holds CFG with additional information derived from it that is needed to perform dataflow analysis.
Supplements Environment with non-standard comparison and join operations.
Holds the state of the program (store and heap) at a given program point.
Environment fork() const
Returns a new environment that is a copy of this one.
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 ~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.
virtual TypeErasedLattice joinTypeErased(const TypeErasedLattice &, const TypeErasedLattice &)=0
Joins two type-erased lattice elements by computing their least upper bound.
TypeErasedDataflowAnalysis(DataflowAnalysisOptions Options)
std::function< void(const CFGElement &, const TypeErasedDataflowAnalysisState &)> CFGEltCallbackTypeErased
A callback to be called with the state before or after visiting a CFG element.
llvm::Expected< std::vector< std::optional< TypeErasedDataflowAnalysisState > > > runTypeErasedDataflowAnalysis(const AdornedCFG &ACFG, TypeErasedDataflowAnalysis &Analysis, const Environment &InitEnv, const CFGEltCallbacksTypeErased &PostAnalysisCallbacks, std::int32_t MaxBlockVisits)
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states tha...
LatticeEffect
Effect indicating whether a lattice operation resulted in a new value.
The JSON file list parser is used to communicate input to InstallAPI.
A pair of callbacks to be called with the state before and after visiting a CFG element.
CFGEltCallbackTypeErased Before
CFGEltCallbackTypeErased After
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)
TypeErasedDataflowAnalysisState fork() const
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.