Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
SVF::PTACallGraphNode Class Reference

#include <PTACallGraph.h>

Inheritance diagram for SVF::PTACallGraphNode:
SVF::GenericNode< NodeTy, EdgeTy > SVF::SVFBaseNode

Public Types

typedef PTACallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet
 
typedef PTACallGraphEdge::CallGraphEdgeSet::iterator iterator
 
typedef PTACallGraphEdge::CallGraphEdgeSet::const_iterator const_iterator
 
- Public Types inherited from SVF::GenericNode< NodeTy, EdgeTy >
typedef NodeTy NodeType
 
typedef EdgeTy EdgeType
 
typedef OrderedSet< EdgeType *, typename EdgeType::equalGEdge > GEdgeSetTy
 Edge kind. More...
 
typedef GEdgeSetTy::iterator iterator
 
typedef GEdgeSetTy::const_iterator const_iterator
 
- Public Types inherited from SVF::SVFBaseNode
enum  GNodeK {
  IntraBlock , GlobalBlock , FunEntryBlock , FunExitBlock ,
  FunCallBlock , FunRetBlock , ValNode , GepValNode ,
  RetNode , VarargNode , DummyValNode , ObjNode ,
  GepObjNode , FIObjNode , DummyObjNode , Cmp ,
  BinaryOp , UnaryOp , Branch , DummyVProp ,
  NPtr , FRet , ARet , AParm ,
  FParm , Addr , Copy , Gep ,
  Store , Load , TPhi , TIntraPhi ,
  TInterPhi , FPIN , FPOUT , APIN ,
  APOUT , MPhi , MIntraPhi , MInterPhi ,
  CallNodeKd , CDNodeKd , CFLNodeKd , CHNodeKd ,
  ConstraintNodeKd , TCTNodeKd , DCHNodeKd , OtherKd
}
 

Public Member Functions

 PTACallGraphNode (NodeID i, const SVFFunction *f)
 Constructor. More...
 
const std::stringgetName () const
 
const SVFFunctiongetFunction () const
 Get function of this call node. More...
 
bool isReachableFromProgEntry () const
 Return TRUE if this function can be reached from main. More...
 
virtual const std::string toString () const
 
- Public Member Functions inherited from SVF::GenericNode< NodeTy, EdgeTy >
 GenericNode (NodeID i, GNodeK k)
 Constructor. More...
 
virtual ~GenericNode ()
 Destructor. More...
 
bool hasIncomingEdge () const
 Has incoming/outgoing edge set. More...
 
bool hasOutgoingEdge () const
 
iterator OutEdgeBegin ()
 iterators More...
 
iterator OutEdgeEnd ()
 
iterator InEdgeBegin ()
 
iterator InEdgeEnd ()
 
const_iterator OutEdgeBegin () const
 
const_iterator OutEdgeEnd () const
 
const_iterator InEdgeBegin () const
 
const_iterator InEdgeEnd () const
 
virtual iterator directOutEdgeBegin ()
 Iterators used for SCC detection, overwrite it in child class if necessary. More...
 
virtual iterator directOutEdgeEnd ()
 
virtual iterator directInEdgeBegin ()
 
virtual iterator directInEdgeEnd ()
 
virtual const_iterator directOutEdgeBegin () const
 
virtual const_iterator directOutEdgeEnd () const
 
virtual const_iterator directInEdgeBegin () const
 
virtual const_iterator directInEdgeEnd () const
 
bool addIncomingEdge (EdgeType *inEdge)
 Add incoming and outgoing edges. More...
 
bool addOutgoingEdge (EdgeType *outEdge)
 
EdgeTypehasIncomingEdge (EdgeType *edge) const
 Find incoming and outgoing edges. More...
 
EdgeTypehasOutgoingEdge (EdgeType *edge) const
 
const GEdgeSetTygetOutEdges () const
 
const GEdgeSetTygetInEdges () const
 
u32_t removeIncomingEdge (EdgeType *edge)
 
u32_t removeOutgoingEdge (EdgeType *edge)
 
- Public Member Functions inherited from SVF::SVFBaseNode
 SVFBaseNode (NodeID i, GNodeK k, SVFType *ty=nullptr)
 
NodeID getId () const
 Get ID. More...
 
GNodeK getNodeKind () const
 Get node kind. More...
 
virtual const SVFTypegetType () const
 
virtual void setSourceLoc (const std::string &sourceCodeInfo)
 
virtual const std::string getSourceLoc () const
 
const std::string valueOnlyToString () const
 

Static Public Member Functions

static bool classof (const PTACallGraphNode *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static bool classof (const GenericICFGNodeTy *node)
 
static bool classof (const SVFBaseNode *node)
 
- Static Public Member Functions inherited from SVF::GenericNode< NodeTy, EdgeTy >
static bool classof (const GenericNode< NodeTy, EdgeTy > *)
 
static bool classof (const SVFBaseNode *)
 

Private Attributes

const SVFFunctionfun
 

Friends

OutStreamoperator<< (OutStream &o, const PTACallGraphNode &node)
 Overloading operator << for dumping ICFG node ID. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from SVF::SVFBaseNode
static bool isICFGNodeKinds (GNodeK n)
 Helper functions to check node kinds. More...
 
static bool isInterICFGNodeKind (GNodeK n)
 
static bool isSVFVarKind (GNodeK n)
 
static bool isValVarKinds (GNodeK n)
 
static bool isObjVarKinds (GNodeK n)
 
static bool isVFGNodeKinds (GNodeK n)
 
static bool isArgumentVFGNodeKinds (GNodeK n)
 
static bool isStmtVFGNodeKinds (GNodeK n)
 
static bool isPHIVFGNodeKinds (GNodeK n)
 
static bool isMRSVFGNodeKinds (GNodeK n)
 
static bool isMSSAPHISVFGNodeKinds (GNodeK n)
 
- Protected Attributes inherited from SVF::SVFBaseNode
NodeID id
 Node ID. More...
 
GNodeK nodeKind
 Node kind. More...
 
const SVFTypetype
 SVF type. More...
 
std::string sourceLoc
 Source code information of this value. More...
 

Detailed Description

Definition at line 174 of file PTACallGraph.h.

Member Typedef Documentation

◆ CallGraphEdgeSet

Definition at line 178 of file PTACallGraph.h.

◆ const_iterator

typedef PTACallGraphEdge::CallGraphEdgeSet::const_iterator SVF::PTACallGraphNode::const_iterator

Definition at line 180 of file PTACallGraph.h.

◆ iterator

typedef PTACallGraphEdge::CallGraphEdgeSet::iterator SVF::PTACallGraphNode::iterator

Definition at line 179 of file PTACallGraph.h.

Constructor & Destructor Documentation

◆ PTACallGraphNode()

SVF::PTACallGraphNode::PTACallGraphNode ( NodeID  i,
const SVFFunction f 
)
inline

Constructor.

Definition at line 187 of file PTACallGraph.h.

188  {
189 
190  }
const SVFFunction * fun
Definition: PTACallGraph.h:183
GenericNode< PTACallGraphNode, PTACallGraphEdge > GenericCallGraphNodeTy
Definition: PTACallGraph.h:173

Member Function Documentation

◆ classof() [1/3]

static bool SVF::PTACallGraphNode::classof ( const GenericICFGNodeTy node)
inlinestatic

Definition at line 225 of file PTACallGraph.h.

226  {
227  return node->getNodeKind() == CallNodeKd;
228  }

◆ classof() [2/3]

static bool SVF::PTACallGraphNode::classof ( const PTACallGraphNode )
inlinestatic

Methods for support type inquiry through isa, cast, and dyn_cast:

Definition at line 220 of file PTACallGraph.h.

221  {
222  return true;
223  }

◆ classof() [3/3]

static bool SVF::PTACallGraphNode::classof ( const SVFBaseNode node)
inlinestatic

Definition at line 230 of file PTACallGraph.h.

231  {
232  return node->getNodeKind() == CallNodeKd;
233  }

◆ getFunction()

const SVFFunction* SVF::PTACallGraphNode::getFunction ( ) const
inline

Get function of this call node.

Definition at line 198 of file PTACallGraph.h.

199  {
200  return fun;
201  }

◆ getName()

const std::string& SVF::PTACallGraphNode::getName ( ) const
inline

Definition at line 192 of file PTACallGraph.h.

193  {
194  return fun->getName();
195  }
const std::string & getName() const
Definition: SVFValue.h:243

◆ isReachableFromProgEntry()

bool PTACallGraphNode::isReachableFromProgEntry ( ) const

Return TRUE if this function can be reached from main.

Definition at line 81 of file PTACallGraph.cpp.

82 {
83  std::stack<const PTACallGraphNode*> nodeStack;
84  NodeBS visitedNodes;
85  nodeStack.push(this);
86  visitedNodes.set(getId());
87 
88  while (nodeStack.empty() == false)
89  {
90  PTACallGraphNode* node = const_cast<PTACallGraphNode*>(nodeStack.top());
91  nodeStack.pop();
92 
94  return true;
95 
96  for (const_iterator it = node->InEdgeBegin(), eit = node->InEdgeEnd(); it != eit; ++it)
97  {
98  PTACallGraphEdge* edge = *it;
99  if (visitedNodes.test_and_set(edge->getSrcID()))
100  nodeStack.push(edge->getSrcNode());
101  }
102  }
103 
104  return false;
105 }
NodeType * getSrcNode() const
Definition: GenericGraph.h:97
NodeID getSrcID() const
get methods of the components
Definition: GenericGraph.h:81
iterator InEdgeBegin()
Definition: GenericGraph.h:462
iterator InEdgeEnd()
Definition: GenericGraph.h:466
const SVFFunction * getFunction() const
Get function of this call node.
Definition: PTACallGraph.h:198
PTACallGraphEdge::CallGraphEdgeSet::const_iterator const_iterator
Definition: PTACallGraph.h:180
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
bool test_and_set(unsigned Idx)
void set(unsigned Idx)
bool isProgEntryFunction(const SVFFunction *fun)
Program entry function e.g. main.
Definition: SVFUtil.h:325

◆ toString()

const std::string PTACallGraphNode::toString ( ) const
virtual

Definition at line 73 of file PTACallGraph.cpp.

74 {
75  std::string str;
76  std::stringstream rawstr(str);
77  rawstr << "PTACallGraphNode ID: " << getId() << " {fun: " << fun->getName() << "}";
78  return rawstr.str();
79 }
const char *const string
Definition: cJSON.h:172

Friends And Related Function Documentation

◆ operator<<

OutStream& operator<< ( OutStream o,
const PTACallGraphNode node 
)
friend

Overloading operator << for dumping ICFG node ID.

Definition at line 209 of file PTACallGraph.h.

210  {
211  o << node.toString();
212  return o;
213  }

Member Data Documentation

◆ fun

const SVFFunction* SVF::PTACallGraphNode::fun
private

Definition at line 183 of file PTACallGraph.h.


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