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"
59 std::vector<std::pair<BlockEdge, const ExplodedNode *>>;
62 std::vector<std::pair<const CFGBlock *, const ExplodedNode *>>;
73 std::unique_ptr<WorkList> WList;
74 std::unique_ptr<WorkList> CTUWList;
125 std::optional<unsigned> getCompletedIterationCount(
const CFGBlock *B,
160 blocksAborted.push_back(std::make_pair(block, node));
167 return llvm::iterator_range(blocksExhausted);
201 : Eng(E), Block(B), LC(L) {
220 return Eng.WList->getBlockCounter().getNumVisited(
222 Block->getBlockID());
313 for (
const auto I : S)
344 :
NodeBuilder(DstSet, Ctx), DispatchBlock(*Dispatch), Target(Tgt) {}
359 return C.getLocationContext();
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.
AdjacentBlocks::const_reverse_iterator const_succ_reverse_iterator
AdjacentBlocks::const_iterator const_succ_iterator
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.
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
ProgramPoints can be "tagged" as representing points specific to a given analysis entity.
static ProgramPoint getProgramPoint(const Stmt *S, ProgramPoint::Kind K, const LocationContext *LC, const ProgramPointTag *tag)
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
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...
ExplodedNode * generateNode(ProgramStateRef State, bool branch, ExplodedNode *Pred)
BranchNodeBuilder(ExplodedNodeSet &DstSet, const NodeBuilderContext &C, const CFGBlock *DT, const CFGBlock *DF)
CoreEngine - Implements the core logic of the graph-reachability analysis.
friend class SwitchNodeBuilder
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
friend class IndirectGotoNodeBuilder
WorkList * getWorkList() const
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
std::vector< std::pair< BlockEdge, const ExplodedNode * > > BlocksExhausted
friend class NodeBuilderContext
bool ExecuteWorkList(const LocationContext *L, unsigned Steps, ProgramStateRef InitState)
ExecuteWorkList - Run the worklist algorithm for a maximum number of steps.
auto exhausted_blocks() const
bool hasWorkRemaining() const
ExplodedGraph & getGraph()
getGraph - Returns the exploded graph.
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.
const LocationContext * getLocationContext() const
const Expr * getTarget() const
IndirectGotoNodeBuilder(ExplodedNodeSet &DstSet, NodeBuilderContext &Ctx, const Expr *Tgt, const CFGBlock *Dispatch)
CFGBlock::const_succ_iterator iterator
const LocationContext * getLocationContext() const
ExplodedNode * generateNode(const CFGBlock *Block, ProgramStateRef State, ExplodedNode *Pred)
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, const LocationContext *L)
NodeBuilderContext(const CoreEngine &E, const CFGBlock *B, ExplodedNode *N)
const LocationContext * getLocationContext() const
Return the location context associated with this builder.
unsigned blockCount() const
Returns the number of times the current basic block has been visited on the exploded graph path.
const NodeBuilderContext & C
void takeNodes(ExplodedNode *N)
const NodeBuilderContext & getContext() const
NodeBuilder(ExplodedNode *SrcNode, ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
void takeNodes(const ExplodedNodeSet &S)
ExplodedNode * generateNode(const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred, bool MarkAsSink=false)
Generates a node in the ExplodedGraph.
ExplodedNode * generateSink(const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred)
Generates a sink in the ExplodedGraph.
ExplodedNodeSet & Frontier
The frontier set - a set of nodes which need to be propagated after the builder dies.
void addNodes(ExplodedNode *N)
ExplodedNode * generateSink(const Stmt *S, ExplodedNode *Pred, ProgramStateRef St, const ProgramPointTag *tag=nullptr, ProgramPoint::Kind K=ProgramPoint::PostStmtKind)
ExplodedNode * generateNode(const Stmt *S, ExplodedNode *Pred, ProgramStateRef St, const ProgramPointTag *tag=nullptr, ProgramPoint::Kind K=ProgramPoint::PostStmtKind)
void addNodes(const ExplodedNodeSet &S)
bool hasGeneratedNodes() const
const ExplodedNodeSet & getResults() const
NodeBuilder(ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
NodeBuilder(const ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
SwitchNodeBuilder(ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
CFGBlock::const_succ_reverse_iterator iterator
ExplodedNode * generateCaseStmtNode(const CFGBlock *Block, ProgramStateRef State, ExplodedNode *Pred)
ExplodedNode * generateDefaultCaseNode(ProgramStateRef State, ExplodedNode *Pred)
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
The JSON file list parser is used to communicate input to InstallAPI.