clang
9.0.0svn
|
#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
Public Types | |
using | NodeTy = ExplodedNode |
using | AllNodesTy = llvm::FoldingSet< ExplodedNode > |
using | roots_iterator = NodeVector::iterator |
using | const_roots_iterator = NodeVector::const_iterator |
using | eop_iterator = NodeVector::iterator |
using | const_eop_iterator = NodeVector::const_iterator |
using | node_iterator = AllNodesTy::iterator |
using | const_node_iterator = AllNodesTy::const_iterator |
using | NodeMap = llvm::DenseMap< const ExplodedNode *, ExplodedNode * > |
Public Member Functions | |
ExplodedGraph () | |
~ExplodedGraph () | |
ExplodedNode * | getNode (const ProgramPoint &L, ProgramStateRef State, bool IsSink=false, bool *IsNew=nullptr) |
Retrieve the node associated with a (Location,State) pair, where the 'Location' is a ProgramPoint in the CFG. More... | |
ExplodedNode * | createUncachedNode (const ProgramPoint &L, ProgramStateRef State, bool IsSink=false) |
Create a node for a (Location, State) pair, but don't store it for deduplication later. More... | |
std::unique_ptr< ExplodedGraph > | MakeEmptyGraph () const |
ExplodedNode * | addRoot (ExplodedNode *V) |
addRoot - Add an untyped node to the set of roots. More... | |
ExplodedNode * | addEndOfPath (ExplodedNode *V) |
addEndOfPath - Add an untyped node to the set of EOP nodes. More... | |
unsigned | num_roots () const |
unsigned | num_eops () const |
bool | empty () const |
unsigned | size () const |
void | reserve (unsigned NodeCount) |
node_iterator | nodes_begin () |
node_iterator | nodes_end () |
const_node_iterator | nodes_begin () const |
const_node_iterator | nodes_end () const |
roots_iterator | roots_begin () |
roots_iterator | roots_end () |
const_roots_iterator | roots_begin () const |
const_roots_iterator | roots_end () const |
eop_iterator | eop_begin () |
eop_iterator | eop_end () |
const_eop_iterator | eop_begin () const |
const_eop_iterator | eop_end () const |
llvm::BumpPtrAllocator & | getAllocator () |
BumpVectorContext & | getNodeAllocator () |
std::unique_ptr< ExplodedGraph > | trim (ArrayRef< const NodeTy *> Nodes, InterExplodedGraphMap *ForwardMap=nullptr, InterExplodedGraphMap *InverseMap=nullptr) const |
Creates a trimmed version of the graph that only contains paths leading to the given nodes. More... | |
void | enableNodeReclamation (unsigned Interval) |
Enable tracking of recently allocated nodes for potential reclamation when calling reclaimRecentlyAllocatedNodes(). More... | |
void | reclaimRecentlyAllocatedNodes () |
Reclaim "uninteresting" nodes created since the last time this method was called. More... | |
Static Public Member Functions | |
static bool | isInterestingLValueExpr (const Expr *Ex) |
Returns true if nodes for the given expression kind are always kept around. More... | |
Protected Types | |
using | NodeVector = std::vector< ExplodedNode * > |
Protected Attributes | |
NodeVector | Roots |
The roots of the simulation graph. More... | |
NodeVector | EndNodes |
The nodes in the simulation graph which have been specially marked as the endpoint of an abstract simulation path. More... | |
llvm::FoldingSet< ExplodedNode > | Nodes |
Nodes - The nodes in the graph. More... | |
BumpVectorContext | BVC |
BVC - Allocator and context for allocating nodes and their predecessor and successor groups. More... | |
unsigned | NumNodes = 0 |
NumNodes - The number of nodes in the graph. More... | |
NodeVector | ChangedNodes |
A list of recently allocated nodes that can potentially be recycled. More... | |
NodeVector | FreeNodes |
A list of nodes that can be reused. More... | |
unsigned | ReclaimNodeInterval = 0 |
Determines how often nodes are reclaimed. More... | |
unsigned | ReclaimCounter |
Counter to determine when to reclaim nodes. More... | |
Friends | |
class | CoreEngine |
Definition at line 263 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::AllNodesTy = llvm::FoldingSet<ExplodedNode> |
Definition at line 350 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::const_eop_iterator = NodeVector::const_iterator |
Definition at line 354 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::const_node_iterator = AllNodesTy::const_iterator |
Definition at line 356 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::const_roots_iterator = NodeVector::const_iterator |
Definition at line 352 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::eop_iterator = NodeVector::iterator |
Definition at line 353 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::node_iterator = AllNodesTy::iterator |
Definition at line 355 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::NodeMap = llvm::DenseMap<const ExplodedNode *, ExplodedNode *> |
Definition at line 385 of file ExplodedGraph.h.
Definition at line 349 of file ExplodedGraph.h.
|
protected |
Definition at line 268 of file ExplodedGraph.h.
using clang::ento::ExplodedGraph::roots_iterator = NodeVector::iterator |
Definition at line 351 of file ExplodedGraph.h.
|
default |
|
default |
|
inline |
addEndOfPath - Add an untyped node to the set of EOP nodes.
Definition at line 335 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::enqueueEndOfFunction().
|
inline |
addRoot - Add an untyped node to the set of roots.
Definition at line 329 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::ExecuteWorkList(), and clang::ento::CoreEngine::ExecuteWorkListWithInitialState().
ExplodedNode * ExplodedGraph::createUncachedNode | ( | const ProgramPoint & | L, |
ProgramStateRef | State, | ||
bool | IsSink = false |
||
) |
Create a node for a (Location, State) pair, but don't store it for deduplication later.
This is useful when copying an already completed ExplodedGraph for further processing.
Definition at line 333 of file ExplodedGraph.cpp.
References getAllocator().
|
inline |
Definition at line 343 of file ExplodedGraph.h.
|
inline |
Enable tracking of recently allocated nodes for potential reclamation when calling reclaimRecentlyAllocatedNodes().
Definition at line 404 of file ExplodedGraph.h.
Referenced by clang::ento::ExprEngine::ExprEngine().
|
inline |
Definition at line 374 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::ExecuteWorkListWithInitialState().
|
inline |
Definition at line 378 of file ExplodedGraph.h.
|
inline |
Definition at line 376 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::ExecuteWorkListWithInitialState().
|
inline |
Definition at line 380 of file ExplodedGraph.h.
|
inline |
Definition at line 382 of file ExplodedGraph.h.
References clang::BumpVectorContext::getAllocator().
Referenced by clang::ento::ExplodedNode::addPredecessor(), createUncachedNode(), clang::ento::ExplodedNode::getID(), and getNode().
ExplodedNode * ExplodedGraph::getNode | ( | const ProgramPoint & | L, |
ProgramStateRef | State, | ||
bool | IsSink = false , |
||
bool * | IsNew = nullptr |
||
) |
Retrieve the node associated with a (Location,State) pair, where the 'Location' is a ProgramPoint in the CFG.
If no node for this pair exists, it is created. IsNew is set to true if the node was freshly created.
Definition at line 295 of file ExplodedGraph.cpp.
References ChangedNodes, FreeNodes, getAllocator(), Nodes, NumNodes, clang::ento::ExplodedNode::Profile(), and ReclaimNodeInterval.
Referenced by clang::ento::CoreEngine::enqueueStmtNode(), clang::ento::CoreEngine::ExecuteWorkList(), clang::ento::CoreEngine::ExecuteWorkListWithInitialState(), clang::ento::ExprEngine::processCallEnter(), and clang::ento::ExprEngine::processCallExit().
|
inline |
Definition at line 383 of file ExplodedGraph.h.
Referenced by clang::ento::ExplodedNode::addPredecessor().
Returns true if nodes for the given expression kind are always kept around.
Definition at line 49 of file ExplodedGraph.cpp.
References clang::ProgramPoint::castAs(), FreeNodes, clang::ProgramPoint::getAs(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::getLocationContext(), clang::ProgramPoint::getLocationContext(), clang::LocationContext::getParentMap(), clang::ento::ExplodedNode::getState(), clang::ProgramPoint::getTag(), clang::ento::CallEvent::isCallStmt(), clang::ParentMap::isConsumedExpr(), clang::Expr::isLValue(), Nodes, NumNodes, clang::ento::ExplodedNode::pred_begin(), clang::ento::ExplodedNode::pred_size(), clang::CodeGen::state, clang::ento::ExplodedNode::succ_begin(), and clang::ento::ExplodedNode::succ_size().
|
inline |
Definition at line 324 of file ExplodedGraph.h.
Referenced by trim().
|
inline |
Definition at line 358 of file ExplodedGraph.h.
|
inline |
Definition at line 362 of file ExplodedGraph.h.
|
inline |
Definition at line 360 of file ExplodedGraph.h.
|
inline |
Definition at line 364 of file ExplodedGraph.h.
|
inline |
Definition at line 341 of file ExplodedGraph.h.
|
inline |
Definition at line 340 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::ExecuteWorkList().
void ExplodedGraph::reclaimRecentlyAllocatedNodes | ( | ) |
Reclaim "uninteresting" nodes created since the last time this method was called.
Definition at line 170 of file ExplodedGraph.cpp.
References ChangedNodes, ReclaimCounter, and ReclaimNodeInterval.
Referenced by clang::ento::ExprEngine::ProcessStmt().
|
inline |
Definition at line 346 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::ExecuteWorkList().
|
inline |
Definition at line 366 of file ExplodedGraph.h.
Referenced by llvm::GraphTraits< clang::ento::ExplodedGraph * >::getEntryNode().
|
inline |
Definition at line 370 of file ExplodedGraph.h.
|
inline |
Definition at line 368 of file ExplodedGraph.h.
|
inline |
Definition at line 372 of file ExplodedGraph.h.
|
inline |
Definition at line 344 of file ExplodedGraph.h.
std::unique_ptr< ExplodedGraph > ExplodedGraph::trim | ( | ArrayRef< const NodeTy *> | Nodes, |
InterExplodedGraphMap * | ForwardMap = nullptr , |
||
InterExplodedGraphMap * | InverseMap = nullptr |
||
) | const |
Creates a trimmed version of the graph that only contains paths leading to the given nodes.
Nodes | The nodes which must appear in the final graph. Presumably these are end-of-path nodes (i.e. they have no successors). | |
[out] | ForwardMap | A optional map from nodes in this graph to nodes in the returned graph. |
[out] | InverseMap | An optional map from nodes in the returned graph to nodes in this graph. |
Definition at line 342 of file ExplodedGraph.cpp.
References clang::ento::ExplodedNode::addPredecessor(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::isSink(), MakeEmptyGraph(), and Nodes.
|
friend |
Definition at line 265 of file ExplodedGraph.h.
|
protected |
BVC - Allocator and context for allocating nodes and their predecessor and successor groups.
Definition at line 285 of file ExplodedGraph.h.
|
protected |
A list of recently allocated nodes that can potentially be recycled.
Definition at line 291 of file ExplodedGraph.h.
Referenced by getNode(), and reclaimRecentlyAllocatedNodes().
|
protected |
The nodes in the simulation graph which have been specially marked as the endpoint of an abstract simulation path.
Definition at line 278 of file ExplodedGraph.h.
|
protected |
A list of nodes that can be reused.
Definition at line 294 of file ExplodedGraph.h.
Referenced by getNode(), and isInterestingLValueExpr().
|
protected |
Nodes - The nodes in the graph.
Definition at line 281 of file ExplodedGraph.h.
Referenced by getNode(), isInterestingLValueExpr(), and trim().
|
protected |
NumNodes - The number of nodes in the graph.
Definition at line 288 of file ExplodedGraph.h.
Referenced by getNode(), and isInterestingLValueExpr().
|
protected |
Counter to determine when to reclaim nodes.
Definition at line 302 of file ExplodedGraph.h.
Referenced by reclaimRecentlyAllocatedNodes().
|
protected |
Determines how often nodes are reclaimed.
If this is 0, nodes will never be reclaimed.
Definition at line 299 of file ExplodedGraph.h.
Referenced by getNode(), and reclaimRecentlyAllocatedNodes().
|
protected |
The roots of the simulation graph.
Usually there will be only one, but clients are free to establish multiple subgraphs within a single SimulGraph. Moreover, these subgraphs can often merge when paths from different roots reach the same state at the same program location.
Definition at line 274 of file ExplodedGraph.h.