14#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_COREENGINE_H
15#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_COREENGINE_H
27#include "llvm/ADT/SmallVector.h"
28#include "llvm/ADT/iterator_range.h"
29#include "llvm/Support/Casting.h"
56 std::vector<std::pair<BlockEntrance, const ExplodedNode *>>;
59 std::vector<std::pair<const CFGBlock *, const ExplodedNode *>>;
70 std::unique_ptr<WorkList> WList;
71 std::unique_ptr<WorkList> CTUWList;
122 std::optional<unsigned> getCompletedIterationCount(
const CFGBlock *B,
157 blocksAborted.push_back(std::make_pair(block, node));
164 return llvm::iterator_range(blocksExhausted);
174 bool MarkAsSink =
false)
const {
184 State = State->BindExpr(E, SF,
V);
221 : Eng(E), Block(B), SF(S) {
240 return Eng.WList->getBlockCounter().getNumVisited(SF, Block->getBlockID());
This file defines AnalysisDeclContext, a class that manages the analysis context data for context sen...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Stores options for the analyzer from the command line.
Represents a single basic block in a source-level CFG.
Represents binding an expression to a temporary.
Represents a point when we begin processing an inlined call.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
This represents one expression.
Represents the declaration of a label.
static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K, const StackFrame *SF, const ProgramPointTag *tag)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
It represents a stack frame of the call stack.
Stmt - This represents one statement.
An abstract data type used to count the number of times a given block has been visited along a path a...
CoreEngine - Implements the core logic of the graph-reachability analysis.
void addAbortedBlock(const ExplodedNode *node, const CFGBlock *block)
Inform the CoreEngine that a basic block was aborted because it could not be completely analyzed.
CoreEngine(ExprEngine &exprengine, FunctionSummariesTy *FS, AnalyzerOptions &Opts)
Construct a CoreEngine object to analyze the provided CFG.
DataTag::Factory & getDataTags()
void enqueueStmtNode(ExplodedNode *N, const CFGBlock *Block, unsigned Idx)
Enqueue a single node created as a result of statement processing.
bool wasBlockAborted() const
CoreEngine & operator=(const CoreEngine &)=delete
void dispatchWorkItem(ExplodedNode *Pred, ProgramPoint Loc, const WorkListUnit &WU)
Dispatch the work list item based on the given location information.
std::vector< std::pair< const CFGBlock *, const ExplodedNode * > > BlocksAborted
WorkList * getCTUWorkList() const
bool wasBlocksExhausted() const
WorkList * getWorkList() const
std::vector< std::pair< BlockEntrance, const ExplodedNode * > > BlocksExhausted
void enqueueStmtNodes(ExplodedNodeSet &Set, const CFGBlock *Block, unsigned Idx)
Enqueue nodes that were created as a result of processing a statement onto the work list.
CoreEngine(const CoreEngine &)=delete
friend class NodeBuilderContext
bool ExecuteWorkList(const StackFrame *SF, unsigned Steps, ProgramStateRef InitState)
ExecuteWorkList - Run the worklist algorithm for a maximum number of steps.
ExplodedNode * makePostStmtNode(const Stmt *S, ProgramStateRef State, ExplodedNode *Pred, bool MarkAsSink=false) const
auto exhausted_blocks() const
bool hasWorkRemaining() const
ExplodedGraph & getGraph()
getGraph - Returns the exploded graph.
ExplodedNode * makeNodeWithBinding(ExplodedNode *Pred, const Expr *E, SVal V, ProgramPoint::Kind K=ProgramPoint::PostStmtKind) const
ExplodedNode * makeNodeWithBinding(ExplodedNode *Pred, const Expr *E, SVal V, ProgramStateRef State, ProgramPoint::Kind K=ProgramPoint::PostStmtKind) const
void enqueueEndOfFunction(ExplodedNodeSet &Set, const ReturnStmt *RS)
enqueue the nodes corresponding to the end of function onto the end of path / work list.
auto aborted_blocks() const
ExplodedNode * makeNode(const ProgramPoint &Loc, ProgramStateRef State, ExplodedNode *Pred, bool MarkAsSink=false) const
void enqueue(ExplodedNodeSet &Set)
Enqueue the given set of nodes onto the work list.
ExplodedNodeSet is a set of ExplodedNode * elements with the invariant that its elements cannot be nu...
const ProgramStateRef & getState() const
const StackFrame * getStackFrame() const
const CoreEngine & getEngine() const
Return the CoreEngine associated with this builder.
const CFGBlock * getBlock() const
Return the CFGBlock associated with this builder.
NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N)
NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, const StackFrame *S)
unsigned blockCount() const
Returns the number of times the current basic block has been visited on the exploded graph path.
const StackFrame * getStackFrame() const
Return the stack frame associated with this builder.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
Top level wrappers for InstallAPI frontend operations.