clang  3.9.0svn
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
clang::ento::ExplodedGraph Class Reference

#include <ExplodedGraph.h>

Collaboration diagram for clang::ento::ExplodedGraph:
Collaboration graph
[legend]

Public Types

typedef ExplodedNode NodeTy
 
typedef llvm::FoldingSet< ExplodedNodeAllNodesTy
 
typedef NodeVector::iterator roots_iterator
 
typedef NodeVector::const_iterator const_roots_iterator
 
typedef NodeVector::iterator eop_iterator
 
typedef NodeVector::const_iterator const_eop_iterator
 
typedef AllNodesTy::iterator node_iterator
 
typedef AllNodesTy::const_iterator const_node_iterator
 
typedef llvm::DenseMap< const ExplodedNode *, ExplodedNode * > NodeMap
 

Public Member Functions

ExplodedNodegetNode (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...
 
ExplodedNodecreateUncachedNode (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< ExplodedGraphMakeEmptyGraph () const
 
ExplodedNodeaddRoot (ExplodedNode *V)
 addRoot - Add an untyped node to the set of roots. More...
 
ExplodedNodeaddEndOfPath (ExplodedNode *V)
 addEndOfPath - Add an untyped node to the set of EOP nodes. More...
 
 ExplodedGraph ()
 
 ~ExplodedGraph ()
 
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 ()
 
BumpVectorContextgetNodeAllocator ()
 
std::unique_ptr< ExplodedGraphtrim (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

typedef std::vector< ExplodedNode * > NodeVector
 

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< ExplodedNodeNodes
 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
 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
 Determines how often nodes are reclaimed. More...
 
unsigned ReclaimCounter
 Counter to determine when to reclaim nodes. More...
 

Friends

class CoreEngine
 

Detailed Description

Definition at line 247 of file ExplodedGraph.h.

Member Typedef Documentation

Definition at line 336 of file ExplodedGraph.h.

typedef NodeVector::const_iterator clang::ento::ExplodedGraph::const_eop_iterator

Definition at line 340 of file ExplodedGraph.h.

typedef AllNodesTy::const_iterator clang::ento::ExplodedGraph::const_node_iterator

Definition at line 342 of file ExplodedGraph.h.

typedef NodeVector::const_iterator clang::ento::ExplodedGraph::const_roots_iterator

Definition at line 338 of file ExplodedGraph.h.

typedef NodeVector::iterator clang::ento::ExplodedGraph::eop_iterator

Definition at line 339 of file ExplodedGraph.h.

typedef AllNodesTy::iterator clang::ento::ExplodedGraph::node_iterator

Definition at line 341 of file ExplodedGraph.h.

Definition at line 371 of file ExplodedGraph.h.

Definition at line 335 of file ExplodedGraph.h.

typedef std::vector<ExplodedNode *> clang::ento::ExplodedGraph::NodeVector
protected

Definition at line 252 of file ExplodedGraph.h.

typedef NodeVector::iterator clang::ento::ExplodedGraph::roots_iterator

Definition at line 337 of file ExplodedGraph.h.

Constructor & Destructor Documentation

ExplodedGraph::ExplodedGraph ( )

Definition at line 50 of file ExplodedGraph.cpp.

ExplodedGraph::~ExplodedGraph ( )

Definition at line 53 of file ExplodedGraph.cpp.

Member Function Documentation

ExplodedNode* clang::ento::ExplodedGraph::addEndOfPath ( ExplodedNode V)
inline

addEndOfPath - Add an untyped node to the set of EOP nodes.

Definition at line 317 of file ExplodedGraph.h.

References clang::ento::ExplodedNode::ExplodedGraph.

ExplodedNode* clang::ento::ExplodedGraph::addRoot ( ExplodedNode V)
inline

addRoot - Add an untyped node to the set of roots.

Definition at line 311 of file ExplodedGraph.h.

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 339 of file ExplodedGraph.cpp.

References getAllocator().

bool clang::ento::ExplodedGraph::empty ( ) const
inline

Definition at line 329 of file ExplodedGraph.h.

void clang::ento::ExplodedGraph::enableNodeReclamation ( unsigned  Interval)
inline

Enable tracking of recently allocated nodes for potential reclamation when calling reclaimRecentlyAllocatedNodes().

Definition at line 390 of file ExplodedGraph.h.

eop_iterator clang::ento::ExplodedGraph::eop_begin ( )
inline

Definition at line 360 of file ExplodedGraph.h.

const_eop_iterator clang::ento::ExplodedGraph::eop_begin ( ) const
inline

Definition at line 364 of file ExplodedGraph.h.

eop_iterator clang::ento::ExplodedGraph::eop_end ( )
inline

Definition at line 362 of file ExplodedGraph.h.

const_eop_iterator clang::ento::ExplodedGraph::eop_end ( ) const
inline

Definition at line 366 of file ExplodedGraph.h.

llvm::BumpPtrAllocator& clang::ento::ExplodedGraph::getAllocator ( )
inline
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 301 of file ExplodedGraph.cpp.

References ChangedNodes, FreeNodes, getAllocator(), Nodes, NumNodes, clang::ento::ExplodedNode::Profile(), and ReclaimNodeInterval.

Referenced by clang::ento::ExprEngine::processCallEnter(), clang::ento::ExprEngine::processCallExit(), REGISTER_TRAIT_WITH_PROGRAMSTATE(), and clang::ento::ExprEngine::Visit().

BumpVectorContext& clang::ento::ExplodedGraph::getNodeAllocator ( )
inline

Definition at line 369 of file ExplodedGraph.h.

Referenced by clang::ento::ExplodedNode::addPredecessor().

bool ExplodedGraph::isInterestingLValueExpr ( const Expr Ex)
static
std::unique_ptr<ExplodedGraph> clang::ento::ExplodedGraph::MakeEmptyGraph ( ) const
inline

Definition at line 306 of file ExplodedGraph.h.

Referenced by trim().

node_iterator clang::ento::ExplodedGraph::nodes_begin ( )
inline

Definition at line 344 of file ExplodedGraph.h.

const_node_iterator clang::ento::ExplodedGraph::nodes_begin ( ) const
inline

Definition at line 348 of file ExplodedGraph.h.

node_iterator clang::ento::ExplodedGraph::nodes_end ( )
inline

Definition at line 346 of file ExplodedGraph.h.

const_node_iterator clang::ento::ExplodedGraph::nodes_end ( ) const
inline

Definition at line 350 of file ExplodedGraph.h.

unsigned clang::ento::ExplodedGraph::num_eops ( ) const
inline

Definition at line 327 of file ExplodedGraph.h.

unsigned clang::ento::ExplodedGraph::num_roots ( ) const
inline

Definition at line 326 of file ExplodedGraph.h.

void ExplodedGraph::reclaimRecentlyAllocatedNodes ( )

Reclaim "uninteresting" nodes created since the last time this method was called.

Definition at line 180 of file ExplodedGraph.cpp.

References ChangedNodes, ReclaimCounter, and ReclaimNodeInterval.

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

void clang::ento::ExplodedGraph::reserve ( unsigned  NodeCount)
inline

Definition at line 332 of file ExplodedGraph.h.

roots_iterator clang::ento::ExplodedGraph::roots_begin ( )
inline

Definition at line 352 of file ExplodedGraph.h.

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

const_roots_iterator clang::ento::ExplodedGraph::roots_begin ( ) const
inline

Definition at line 356 of file ExplodedGraph.h.

roots_iterator clang::ento::ExplodedGraph::roots_end ( )
inline

Definition at line 354 of file ExplodedGraph.h.

const_roots_iterator clang::ento::ExplodedGraph::roots_end ( ) const
inline

Definition at line 358 of file ExplodedGraph.h.

unsigned clang::ento::ExplodedGraph::size ( ) const
inline

Definition at line 330 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.

Parameters
NodesThe nodes which must appear in the final graph. Presumably these are end-of-path nodes (i.e. they have no successors).
[out]ForwardMapA optional map from nodes in this graph to nodes in the returned graph.
[out]InverseMapAn optional map from nodes in the returned graph to nodes in this graph.
Returns
The trimmed graph

Definition at line 348 of file ExplodedGraph.cpp.

References clang::ento::ExplodedNode::addPredecessor(), clang::ento::ExplodedNode::getLocation(), clang::ento::ExplodedNode::isSink(), MakeEmptyGraph(), and Nodes.

Referenced by clang::ento::BugReporter::FlushReports().

Friends And Related Function Documentation

friend class CoreEngine
friend

Definition at line 249 of file ExplodedGraph.h.

Member Data Documentation

BumpVectorContext clang::ento::ExplodedGraph::BVC
protected

BVC - Allocator and context for allocating nodes and their predecessor and successor groups.

Definition at line 269 of file ExplodedGraph.h.

NodeVector clang::ento::ExplodedGraph::ChangedNodes
protected

A list of recently allocated nodes that can potentially be recycled.

Definition at line 275 of file ExplodedGraph.h.

Referenced by getNode(), and reclaimRecentlyAllocatedNodes().

NodeVector clang::ento::ExplodedGraph::EndNodes
protected

The nodes in the simulation graph which have been specially marked as the endpoint of an abstract simulation path.

Definition at line 262 of file ExplodedGraph.h.

NodeVector clang::ento::ExplodedGraph::FreeNodes
protected

A list of nodes that can be reused.

Definition at line 278 of file ExplodedGraph.h.

Referenced by getNode(), and isInterestingLValueExpr().

llvm::FoldingSet<ExplodedNode> clang::ento::ExplodedGraph::Nodes
protected

Nodes - The nodes in the graph.

Definition at line 265 of file ExplodedGraph.h.

Referenced by getNode(), isInterestingLValueExpr(), and trim().

unsigned clang::ento::ExplodedGraph::NumNodes
protected

NumNodes - The number of nodes in the graph.

Definition at line 272 of file ExplodedGraph.h.

Referenced by getNode(), and isInterestingLValueExpr().

unsigned clang::ento::ExplodedGraph::ReclaimCounter
protected

Counter to determine when to reclaim nodes.

Definition at line 286 of file ExplodedGraph.h.

Referenced by reclaimRecentlyAllocatedNodes().

unsigned clang::ento::ExplodedGraph::ReclaimNodeInterval
protected

Determines how often nodes are reclaimed.

If this is 0, nodes will never be reclaimed.

Definition at line 283 of file ExplodedGraph.h.

Referenced by getNode(), and reclaimRecentlyAllocatedNodes().

NodeVector clang::ento::ExplodedGraph::Roots
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 258 of file ExplodedGraph.h.


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