clang  9.0.0svn
Public Types | Public Member Functions | Friends | List of all members
clang::ento::CoreEngine Class Reference

CoreEngine - Implements the core logic of the graph-reachability analysis. More...

#include "clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h"

Public Types

using BlocksExhausted = std::vector< std::pair< BlockEdge, const ExplodedNode * > >
 
using BlocksAborted = std::vector< std::pair< const CFGBlock *, const ExplodedNode * > >
 

Public Member Functions

 CoreEngine (SubEngine &subengine, FunctionSummariesTy *FS, AnalyzerOptions &Opts)
 Construct a CoreEngine object to analyze the provided CFG. More...
 
 CoreEngine (const CoreEngine &)=delete
 
CoreEngineoperator= (const CoreEngine &)=delete
 
ExplodedGraphgetGraph ()
 getGraph - Returns the exploded graph. More...
 
bool ExecuteWorkList (const LocationContext *L, unsigned Steps, ProgramStateRef InitState)
 ExecuteWorkList - Run the worklist algorithm for a maximum number of steps. More...
 
bool ExecuteWorkListWithInitialState (const LocationContext *L, unsigned Steps, ProgramStateRef InitState, ExplodedNodeSet &Dst)
 Returns true if there is still simulation state on the worklist. More...
 
void dispatchWorkItem (ExplodedNode *Pred, ProgramPoint Loc, const WorkListUnit &WU)
 Dispatch the work list item based on the given location information. More...
 
bool wasBlockAborted () const
 
bool wasBlocksExhausted () const
 
bool hasWorkRemaining () const
 
void addAbortedBlock (const ExplodedNode *node, const CFGBlock *block)
 Inform the CoreEngine that a basic block was aborted because it could not be completely analyzed. More...
 
WorkListgetWorkList () const
 
BlocksExhausted::const_iterator blocks_exhausted_begin () const
 
BlocksExhausted::const_iterator blocks_exhausted_end () const
 
BlocksAborted::const_iterator blocks_aborted_begin () const
 
BlocksAborted::const_iterator blocks_aborted_end () const
 
void enqueue (ExplodedNodeSet &Set)
 Enqueue the given set of nodes onto the work list. More...
 
void enqueue (ExplodedNodeSet &Set, const CFGBlock *Block, unsigned Idx)
 Enqueue nodes that were created as a result of processing a statement onto the work list. More...
 
void enqueueEndOfFunction (ExplodedNodeSet &Set, const ReturnStmt *RS)
 enqueue the nodes corresponding to the end of function onto the end of path / work list. More...
 
void enqueueStmtNode (ExplodedNode *N, const CFGBlock *Block, unsigned Idx)
 Enqueue a single node created as a result of statement processing. More...
 

Friends

class CommonNodeBuilder
 
class EndOfFunctionNodeBuilder
 
class ExprEngine
 
class IndirectGotoNodeBuilder
 
class NodeBuilder
 
struct NodeBuilderContext
 
class SwitchNodeBuilder
 

Detailed Description

CoreEngine - Implements the core logic of the graph-reachability analysis.

It traverses the CFG and generates the ExplodedGraph. Program "states" are treated as opaque void pointers. The template class CoreEngine (which subclasses CoreEngine) provides the matching component to the engine that knows the actual types for states. Note that this engine only dispatches to transfer functions at the statement and block-level. The analyses themselves must implement any transfer function logic and the sub-expression level (if any).

Definition at line 54 of file CoreEngine.h.

Member Typedef Documentation

◆ BlocksAborted

using clang::ento::CoreEngine::BlocksAborted = std::vector<std::pair<const CFGBlock *, const ExplodedNode *> >

Definition at line 68 of file CoreEngine.h.

◆ BlocksExhausted

using clang::ento::CoreEngine::BlocksExhausted = std::vector<std::pair<BlockEdge, const ExplodedNode *> >

Definition at line 65 of file CoreEngine.h.

Constructor & Destructor Documentation

◆ CoreEngine() [1/2]

CoreEngine::CoreEngine ( SubEngine subengine,
FunctionSummariesTy FS,
AnalyzerOptions Opts 
)

Construct a CoreEngine object to analyze the provided CFG.

Definition at line 74 of file CoreEngine.cpp.

◆ CoreEngine() [2/2]

clang::ento::CoreEngine::CoreEngine ( const CoreEngine )
delete

Member Function Documentation

◆ addAbortedBlock()

void clang::ento::CoreEngine::addAbortedBlock ( const ExplodedNode node,
const CFGBlock block 
)
inline

Inform the CoreEngine that a basic block was aborted because it could not be completely analyzed.

Definition at line 160 of file CoreEngine.h.

◆ blocks_aborted_begin()

BlocksAborted::const_iterator clang::ento::CoreEngine::blocks_aborted_begin ( ) const
inline

Definition at line 174 of file CoreEngine.h.

◆ blocks_aborted_end()

BlocksAborted::const_iterator clang::ento::CoreEngine::blocks_aborted_end ( ) const
inline

Definition at line 178 of file CoreEngine.h.

References enqueue(), enqueueEndOfFunction(), and enqueueStmtNode().

◆ blocks_exhausted_begin()

BlocksExhausted::const_iterator clang::ento::CoreEngine::blocks_exhausted_begin ( ) const
inline

Definition at line 166 of file CoreEngine.h.

◆ blocks_exhausted_end()

BlocksExhausted::const_iterator clang::ento::CoreEngine::blocks_exhausted_end ( ) const
inline

Definition at line 170 of file CoreEngine.h.

◆ dispatchWorkItem()

void CoreEngine::dispatchWorkItem ( ExplodedNode Pred,
ProgramPoint  Loc,
const WorkListUnit WU 
)

◆ enqueue() [1/2]

void CoreEngine::enqueue ( ExplodedNodeSet Set)

◆ enqueue() [2/2]

void CoreEngine::enqueue ( ExplodedNodeSet Set,
const CFGBlock Block,
unsigned  Idx 
)

Enqueue nodes that were created as a result of processing a statement onto the work list.

Definition at line 530 of file CoreEngine.cpp.

References enqueueStmtNode().

◆ enqueueEndOfFunction()

void CoreEngine::enqueueEndOfFunction ( ExplodedNodeSet Set,
const ReturnStmt RS 
)

enqueue the nodes corresponding to the end of function onto the end of path / work list.

Definition at line 536 of file CoreEngine.cpp.

References clang::ento::ExplodedGraph::addEndOfPath().

Referenced by blocks_aborted_end().

◆ enqueueStmtNode()

void CoreEngine::enqueueStmtNode ( ExplodedNode N,
const CFGBlock Block,
unsigned  Idx 
)

◆ ExecuteWorkList()

bool CoreEngine::ExecuteWorkList ( const LocationContext L,
unsigned  Steps,
ProgramStateRef  InitState 
)

◆ ExecuteWorkListWithInitialState()

bool CoreEngine::ExecuteWorkListWithInitialState ( const LocationContext L,
unsigned  Steps,
ProgramStateRef  InitState,
ExplodedNodeSet Dst 
)

Returns true if there is still simulation state on the worklist.

Definition at line 197 of file CoreEngine.cpp.

References clang::ento::ExplodedNodeSet::Add(), clang::ento::ExplodedNode::addPredecessor(), clang::ento::ExplodedGraph::addRoot(), clang::CFGBlock::back(), clang::CFGBlock::empty(), enqueue(), clang::ento::ExplodedGraph::eop_begin(), clang::ento::ExplodedGraph::eop_end(), ExecuteWorkList(), clang::CFGElement::getAs(), clang::BlockEntrance::getBlock(), clang::CFGBlock::getBlockID(), clang::LocationContext::getCFG(), clang::LocationContext::getDecl(), clang::BlockEdge::getDst(), clang::CallEnter::getEntry(), clang::CFG::getExit(), clang::BlockEntrance::getFirstElement(), clang::ento::ExplodedNode::getLocationContext(), clang::ProgramPoint::getLocationContext(), clang::ento::ExplodedGraph::getNode(), clang::CFG::getNumBlockIDs(), clang::BlockEdge::getSrc(), clang::LocationContext::getStackFrame(), clang::CFGTerminator::getStmt(), clang::CFGBlock::getTerminator(), clang::ento::BlockCounter::Factory::IncrementCount(), clang::ento::FunctionSummariesTy::markVisitedBasicBlock(), Node, clang::ento::SubEngine::processBranch(), clang::ento::SubEngine::processCallEnter(), clang::ento::SubEngine::processCFGBlockEntrance(), clang::ento::SubEngine::processCFGElement(), clang::ento::SubEngine::processCleanupTemporaryBranch(), clang::ento::SubEngine::processEndOfFunction(), clang::ento::SubEngine::processIndirectGoto(), clang::ento::SubEngine::processStaticInitializer(), clang::ento::SubEngine::processSwitch(), clang::CFGBlock::size(), State, clang::CFGBlock::succ_begin(), clang::CFGBlock::succ_end(), and clang::CFGBlock::succ_size().

Referenced by clang::ento::ExprEngine::ExecuteWorkListWithInitialState(), and getGraph().

◆ getGraph()

ExplodedGraph& clang::ento::CoreEngine::getGraph ( )
inline

getGraph - Returns the exploded graph.

Definition at line 133 of file CoreEngine.h.

References dispatchWorkItem(), ExecuteWorkList(), and ExecuteWorkListWithInitialState().

◆ getWorkList()

WorkList* clang::ento::CoreEngine::getWorkList ( ) const
inline

◆ hasWorkRemaining()

bool clang::ento::CoreEngine::hasWorkRemaining ( ) const
inline

Definition at line 154 of file CoreEngine.h.

References wasBlockAborted(), and wasBlocksExhausted().

Referenced by clang::ento::ExprEngine::hasWorkRemaining().

◆ operator=()

CoreEngine& clang::ento::CoreEngine::operator= ( const CoreEngine )
delete

◆ wasBlockAborted()

bool clang::ento::CoreEngine::wasBlockAborted ( ) const
inline

Definition at line 152 of file CoreEngine.h.

Referenced by hasWorkRemaining().

◆ wasBlocksExhausted()

bool clang::ento::CoreEngine::wasBlocksExhausted ( ) const
inline

Definition at line 153 of file CoreEngine.h.

Referenced by hasWorkRemaining(), and clang::ento::ExprEngine::wasBlocksExhausted().

Friends And Related Function Documentation

◆ CommonNodeBuilder

friend class CommonNodeBuilder
friend

Definition at line 55 of file CoreEngine.h.

◆ EndOfFunctionNodeBuilder

friend class EndOfFunctionNodeBuilder
friend

Definition at line 56 of file CoreEngine.h.

◆ ExprEngine

friend class ExprEngine
friend

Definition at line 57 of file CoreEngine.h.

◆ IndirectGotoNodeBuilder

friend class IndirectGotoNodeBuilder
friend

Definition at line 58 of file CoreEngine.h.

◆ NodeBuilder

friend class NodeBuilder
friend

Definition at line 59 of file CoreEngine.h.

◆ NodeBuilderContext

friend struct NodeBuilderContext
friend

Definition at line 60 of file CoreEngine.h.

◆ SwitchNodeBuilder

friend class SwitchNodeBuilder
friend

Definition at line 61 of file CoreEngine.h.


The documentation for this class was generated from the following files: