18#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_EXPLODEDGRAPH_H 
   19#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_EXPLODEDGRAPH_H 
   28#include "llvm/ADT/ArrayRef.h" 
   29#include "llvm/ADT/DenseMap.h" 
   30#include "llvm/ADT/DepthFirstIterator.h" 
   31#include "llvm/ADT/FoldingSet.h" 
   32#include "llvm/ADT/GraphTraits.h" 
   33#include "llvm/ADT/STLExtras.h" 
   34#include "llvm/ADT/SetVector.h" 
   35#include "llvm/ADT/iterator_range.h" 
   36#include "llvm/Support/Allocator.h" 
   37#include "llvm/Support/Compiler.h" 
   92    NodeGroup(
bool Flag = 
false) : P(Flag) {
 
   93      assert(getFlag() == Flag);
 
  100    unsigned size() 
const;
 
  102    bool empty()
 const { 
return P == 0 || getFlag() != 0; }
 
  117    bool getFlag()
 const {
 
  139                        int64_t Id, 
bool IsSink)
 
  140      : Location(
loc), State(
std::
move(state)), Succs(IsSink), Id(Id) {
 
  141    assert(
isSink() == IsSink);
 
 
  172    return Location.getAs<
T>();
 
 
  180  static void Profile(llvm::FoldingSetNodeID &ID,
 
  185    ID.AddPointer(state.get());
 
  186    ID.AddBoolean(IsSink);
 
 
  189  void Profile(llvm::FoldingSetNodeID& ID)
 const {
 
 
  203  bool isSink()
 const { 
return Succs.getFlag(); }
 
  262  int64_t 
getID()
 const { 
return Id; }
 
  296  void replaceSuccessor(
ExplodedNode *node) { Succs.replaceNode(node); }
 
  297  void replacePredecessor(
ExplodedNode *node) { Preds.replaceNode(node); }
 
 
  301    llvm::DenseMap<const ExplodedNode *, const ExplodedNode *>;
 
  319  llvm::FoldingSet<ExplodedNode> 
Nodes;
 
  355                        bool* IsNew = 
nullptr);
 
  363    bool IsSink = 
false);
 
  368    assert(
V && 
"Cannot designate nullptr as root!");
 
  369    assert(!
Root && 
"The graph already has a root, cannot designate another!");
 
 
  394  llvm::iterator_range<node_iterator> 
nodes() { 
return Nodes; }
 
  396  llvm::iterator_range<const_node_iterator> 
nodes()
 const { 
return Nodes; }
 
  409  using NodeMap = llvm::DenseMap<const ExplodedNode *, ExplodedNode *>;
 
  421  std::unique_ptr<ExplodedGraph>
 
 
  451    assert(N && !N->
isSink());
 
 
  465  unsigned size()
 const { 
return Impl.size();  }
 
  466  bool empty()
    const { 
return Impl.empty(); }
 
  476      Impl.insert_range(S);
 
 
 
  493  template <> 
struct GraphTraits<
clang::ento::ExplodedGraph *> {
 
 
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.
 
Represents a single basic block in a source-level CFG.
 
Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.
 
Decl - This represents one declaration (or definition), e.g.
 
This represents one expression.
 
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
 
const Decl * getDecl() const
 
const ParentMap & getParentMap() const
 
const StackFrameContext * getStackFrame() const
 
const LocationContext * getLocationContext() const
 
It represents a stack frame of the call stack (based on CallEvent).
 
Stmt - This represents one statement.
 
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.
 
unsigned num_eops() const
 
BumpVectorContext & getNodeAllocator()
 
std::vector< ExplodedNode * > NodeVector
 
unsigned ReclaimCounter
Counter to determine when to reclaim nodes.
 
void reserve(unsigned NodeCount)
 
NodeVector ChangedNodes
A list of recently allocated nodes that can potentially be recycled.
 
int64_t NumNodes
NumNodes - The number of nodes in the graph.
 
void enableNodeReclamation(unsigned Interval)
Enable tracking of recently allocated nodes for potential reclamation when calling reclaimRecentlyAll...
 
unsigned ReclaimNodeInterval
Determines how often nodes are reclaimed.
 
NodeVector EndNodes
The nodes in the simulation graph which have been specially marked as the endpoint of an abstract sim...
 
NodeVector::iterator eop_iterator
 
llvm::iterator_range< const_node_iterator > nodes() const
 
void reclaimRecentlyAllocatedNodes()
Reclaim "uninteresting" nodes created since the last time this method was called.
 
static bool isInterestingLValueExpr(const Expr *Ex)
Returns true if nodes for the given expression kind are always kept around.
 
AllNodesTy::const_iterator const_node_iterator
 
llvm::BumpPtrAllocator & getAllocator()
 
AllNodesTy::iterator node_iterator
 
llvm::FoldingSet< ExplodedNode > AllNodesTy
 
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...
 
const_eop_iterator eop_begin() const
 
NodeVector::const_iterator const_eop_iterator
 
BumpVectorContext BVC
BVC - Allocator and context for allocating nodes and their predecessor and successor groups.
 
llvm::iterator_range< node_iterator > nodes()
 
ExplodedNode * getRoot() const
Get the root node of the graph.
 
void designateAsRoot(ExplodedNode *V)
Mark a node as the root of the graph.
 
ExplodedNode * createUncachedNode(const ProgramPoint &L, ProgramStateRef State, int64_t Id, bool IsSink=false)
Create a node for a (Location, State) pair, but don't store it for deduplication later.
 
llvm::FoldingSet< ExplodedNode > Nodes
Nodes - The nodes in the graph.
 
llvm::DenseMap< const ExplodedNode *, ExplodedNode * > NodeMap
 
ExplodedNode * Root
The root of the simulation graph.
 
ExplodedNode * addEndOfPath(ExplodedNode *V)
addEndOfPath - Add an untyped node to the set of EOP nodes.
 
NodeVector FreeNodes
A list of nodes that can be reused.
 
const_eop_iterator eop_end() const
 
bool erase(ExplodedNode *N)
 
ExplodedNodeSet(ExplodedNode *N)
 
ImplTy::iterator iterator
 
ImplTy::const_iterator const_iterator
 
void insert(const ExplodedNodeSet &S)
 
const_iterator end() const
 
void Add(ExplodedNode *N)
 
ExplodedNodeSet()=default
 
const_iterator begin() const
 
const CFGBlock * getCFGBlock() const
 
friend class SwitchNodeBuilder
 
llvm::iterator_range< pred_iterator > pred_range
 
const ProgramStateRef & getState() const
 
friend class ExplodedGraph
 
llvm::iterator_range< const_succ_iterator > const_succ_range
 
pred_iterator pred_begin()
 
const_pred_iterator pred_begin() const
 
const Stmt * getStmtForDiagnostics() const
If the node's program point corresponds to a statement, retrieve that statement.
 
const_succ_iterator succ_begin() const
 
llvm::iterator_range< succ_iterator > succ_range
 
bool isTrivial() const
The node is trivial if it has only one successor, only one predecessor, it's predecessor has only one...
 
const Stmt * getPreviousStmtForDiagnostics() const
Find the statement that was executed immediately before this node.
 
void Profile(llvm::FoldingSetNodeID &ID) const
 
friend class BranchNodeBuilder
 
ProgramPoint getLocation() const
getLocation - Returns the edge associated with the given node.
 
void addPredecessor(ExplodedNode *V, ExplodedGraph &G)
addPredeccessor - Adds a predecessor to the current node, and in tandem add this node as a successor ...
 
llvm::iterator_range< const_pred_iterator > const_pred_range
 
ExplodedNode * getFirstSucc()
 
friend class IndirectGotoNodeBuilder
 
unsigned pred_size() const
 
static void Profile(llvm::FoldingSetNodeID &ID, const ProgramPoint &Loc, const ProgramStateRef &state, bool IsSink)
 
const ExplodedNode * getFirstSucc() const
 
ExplodedNode(const ProgramPoint &loc, ProgramStateRef state, int64_t Id, bool IsSink)
 
bool hasSinglePred() const
 
const_succ_range succs() const
 
succ_iterator succ_begin()
 
const Stmt * getNextStmtForDiagnostics() const
Find the next statement that was executed on this node's execution path.
 
const StackFrameContext * getStackFrame() const
 
ExplodedNode *const * succ_iterator
 
const ExplodedNode * getFirstPred() const
 
const_pred_range preds() const
 
friend class EndOfFunctionNodeBuilder
 
const ParentMap & getParentMap() const
 
SVal getSVal(const Stmt *S) const
Get the value of an arbitrary expression at this node.
 
const LocationContext * getLocationContext() const
 
std::optional< T > getLocationAs() const &
 
const Stmt * getCurrentOrPreviousStmtForDiagnostics() const
Find the statement that was executed at or immediately before this node.
 
const ExplodedNode *const * const_pred_iterator
 
ExplodedNode * getFirstPred()
 
const_succ_iterator succ_end() const
 
unsigned succ_size() const
 
ExplodedNode *const * pred_iterator
 
const ExplodedNode *const * const_succ_iterator
 
const Decl & getCodeDecl() const
 
const_pred_iterator pred_end() const
 
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
 
llvm::DenseMap< const ExplodedNode *, const ExplodedNode * > InterExplodedGraphMap
 
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
 
const Fact * ProgramPoint
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
 
The JSON file list parser is used to communicate input to InstallAPI.
 
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
 
const FunctionProtoType * T
 
Diagnostic wrappers for TextAPI types for error reporting.
 
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
 
static nodes_iterator nodes_end(const GraphTy G)
 
clang::ento::ExplodedGraph * GraphTy
 
clang::ento::ExplodedNode * NodeRef
 
static bool predecessorOfTrivial(NodeRef N)
 
static nodes_iterator nodes_begin(const GraphTy G)
 
static ChildIteratorType child_end(NodeRef N)
 
llvm::df_iterator< GraphTy > nodes_iterator
 
clang::ento::ExplodedNode::succ_iterator ChildIteratorType
 
static NodeRef getEntryNode(const GraphTy G)
 
static ChildIteratorType child_begin(NodeRef N)