Static Value-Flow Analysis
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
SVF::GenericNode< NodeTy, EdgeTy > Class Template Reference

#include <GenericGraph.h>

Inheritance diagram for SVF::GenericNode< NodeTy, EdgeTy >:
SVF::SVFBaseNode SVF::CDGNode SVF::CHNode SVF::ICFGNode SVF::PTACallGraphNode SVF::SVFVar SVF::TCTNode SVF::VFGNode SVF::GlobalICFGNode SVF::InterICFGNode SVF::IntraICFGNode SVF::ObjVar SVF::ValVar SVF::ArgumentVFGNode SVF::BinaryOPVFGNode SVF::BranchVFGNode SVF::CmpVFGNode SVF::DummyVersionPropSVFGNode SVF::MRSVFGNode SVF::NullPtrVFGNode SVF::PHIVFGNode SVF::StmtVFGNode SVF::UnaryOPVFGNode

Public Types

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

 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 GenericNode< NodeTy, EdgeTy > *)
 
static bool classof (const SVFBaseNode *)
 

Private Attributes

GEdgeSetTy InEdges
 all incoming edge of this node More...
 
GEdgeSetTy OutEdges
 all outgoing edge of this node More...
 

Friends

class SVFIRWriter
 
class SVFIRReader
 

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

template<class NodeTy, class EdgeTy>
class SVF::GenericNode< NodeTy, EdgeTy >

Generic node on the graph as base class

Definition at line 393 of file GenericGraph.h.

Member Typedef Documentation

◆ const_iterator

template<class NodeTy , class EdgeTy >
typedef GEdgeSetTy::const_iterator SVF::GenericNode< NodeTy, EdgeTy >::const_iterator

Definition at line 406 of file GenericGraph.h.

◆ EdgeType

template<class NodeTy , class EdgeTy >
typedef EdgeTy SVF::GenericNode< NodeTy, EdgeTy >::EdgeType

Definition at line 400 of file GenericGraph.h.

◆ GEdgeSetTy

template<class NodeTy , class EdgeTy >
typedef OrderedSet<EdgeType*, typename EdgeType::equalGEdge> SVF::GenericNode< NodeTy, EdgeTy >::GEdgeSetTy

Edge kind.

Definition at line 402 of file GenericGraph.h.

◆ iterator

template<class NodeTy , class EdgeTy >
typedef GEdgeSetTy::iterator SVF::GenericNode< NodeTy, EdgeTy >::iterator

Edge iterator

Definition at line 405 of file GenericGraph.h.

◆ NodeType

template<class NodeTy , class EdgeTy >
typedef NodeTy SVF::GenericNode< NodeTy, EdgeTy >::NodeType

Definition at line 399 of file GenericGraph.h.

Constructor & Destructor Documentation

◆ GenericNode()

template<class NodeTy , class EdgeTy >
SVF::GenericNode< NodeTy, EdgeTy >::GenericNode ( NodeID  i,
GNodeK  k 
)
inline

Constructor.

Definition at line 416 of file GenericGraph.h.

416  : SVFBaseNode(i, k)
417  {
418 
419  }
SVFBaseNode(NodeID i, GNodeK k, SVFType *ty=nullptr)
Definition: GenericGraph.h:254

◆ ~GenericNode()

template<class NodeTy , class EdgeTy >
virtual SVF::GenericNode< NodeTy, EdgeTy >::~GenericNode ( )
inlinevirtual

Destructor.

Definition at line 422 of file GenericGraph.h.

423  {
424  for (auto * edge : OutEdges)
425  delete edge;
426  }
GEdgeSetTy OutEdges
all outgoing edge of this node
Definition: GenericGraph.h:412

Member Function Documentation

◆ addIncomingEdge()

template<class NodeTy , class EdgeTy >
bool SVF::GenericNode< NodeTy, EdgeTy >::addIncomingEdge ( EdgeType inEdge)
inline

Add incoming and outgoing edges.

Definition at line 527 of file GenericGraph.h.

528  {
529  return InEdges.insert(inEdge).second;
530  }
GEdgeSetTy InEdges
all incoming edge of this node
Definition: GenericGraph.h:411

◆ addOutgoingEdge()

template<class NodeTy , class EdgeTy >
bool SVF::GenericNode< NodeTy, EdgeTy >::addOutgoingEdge ( EdgeType outEdge)
inline

Definition at line 531 of file GenericGraph.h.

532  {
533  return OutEdges.insert(outEdge).second;
534  }

◆ classof() [1/2]

template<class NodeTy , class EdgeTy >
static bool SVF::GenericNode< NodeTy, EdgeTy >::classof ( const GenericNode< NodeTy, EdgeTy > *  )
inlinestatic

Definition at line 575 of file GenericGraph.h.

576  {
577  return true;
578  }

◆ classof() [2/2]

template<class NodeTy , class EdgeTy >
static bool SVF::GenericNode< NodeTy, EdgeTy >::classof ( const SVFBaseNode )
inlinestatic

Definition at line 580 of file GenericGraph.h.

581  {
582  return true;
583  }

◆ directInEdgeBegin() [1/2]

template<class NodeTy , class EdgeTy >
virtual iterator SVF::GenericNode< NodeTy, EdgeTy >::directInEdgeBegin ( )
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 498 of file GenericGraph.h.

499  {
500  return InEdges.begin();
501  }

◆ directInEdgeBegin() [2/2]

template<class NodeTy , class EdgeTy >
virtual const_iterator SVF::GenericNode< NodeTy, EdgeTy >::directInEdgeBegin ( ) const
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 515 of file GenericGraph.h.

516  {
517  return InEdges.begin();
518  }

◆ directInEdgeEnd() [1/2]

template<class NodeTy , class EdgeTy >
virtual iterator SVF::GenericNode< NodeTy, EdgeTy >::directInEdgeEnd ( )
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 502 of file GenericGraph.h.

503  {
504  return InEdges.end();
505  }

◆ directInEdgeEnd() [2/2]

template<class NodeTy , class EdgeTy >
virtual const_iterator SVF::GenericNode< NodeTy, EdgeTy >::directInEdgeEnd ( ) const
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 519 of file GenericGraph.h.

520  {
521  return InEdges.end();
522  }

◆ directOutEdgeBegin() [1/2]

template<class NodeTy , class EdgeTy >
virtual iterator SVF::GenericNode< NodeTy, EdgeTy >::directOutEdgeBegin ( )
inlinevirtual

Iterators used for SCC detection, overwrite it in child class if necessary.

Reimplemented in SVF::ConstraintNode.

Definition at line 490 of file GenericGraph.h.

491  {
492  return OutEdges.begin();
493  }

◆ directOutEdgeBegin() [2/2]

template<class NodeTy , class EdgeTy >
virtual const_iterator SVF::GenericNode< NodeTy, EdgeTy >::directOutEdgeBegin ( ) const
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 507 of file GenericGraph.h.

508  {
509  return OutEdges.begin();
510  }

◆ directOutEdgeEnd() [1/2]

template<class NodeTy , class EdgeTy >
virtual iterator SVF::GenericNode< NodeTy, EdgeTy >::directOutEdgeEnd ( )
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 494 of file GenericGraph.h.

495  {
496  return OutEdges.end();
497  }

◆ directOutEdgeEnd() [2/2]

template<class NodeTy , class EdgeTy >
virtual const_iterator SVF::GenericNode< NodeTy, EdgeTy >::directOutEdgeEnd ( ) const
inlinevirtual

Reimplemented in SVF::ConstraintNode.

Definition at line 511 of file GenericGraph.h.

512  {
513  return OutEdges.end();
514  }

◆ getInEdges()

template<class NodeTy , class EdgeTy >
const GEdgeSetTy& SVF::GenericNode< NodeTy, EdgeTy >::getInEdges ( ) const
inline

Definition at line 434 of file GenericGraph.h.

435  {
436  return InEdges;
437  }

◆ getOutEdges()

template<class NodeTy , class EdgeTy >
const GEdgeSetTy& SVF::GenericNode< NodeTy, EdgeTy >::getOutEdges ( ) const
inline

Get incoming/outgoing edge set

Definition at line 430 of file GenericGraph.h.

431  {
432  return OutEdges;
433  }

◆ hasIncomingEdge() [1/2]

template<class NodeTy , class EdgeTy >
bool SVF::GenericNode< NodeTy, EdgeTy >::hasIncomingEdge ( ) const
inline

Has incoming/outgoing edge set.

Definition at line 442 of file GenericGraph.h.

443  {
444  return (InEdges.empty() == false);
445  }

◆ hasIncomingEdge() [2/2]

template<class NodeTy , class EdgeTy >
EdgeType* SVF::GenericNode< NodeTy, EdgeTy >::hasIncomingEdge ( EdgeType edge) const
inline

Find incoming and outgoing edges.

Definition at line 557 of file GenericGraph.h.

558  {
559  const_iterator it = InEdges.find(edge);
560  if (it != InEdges.end())
561  return *it;
562  else
563  return nullptr;
564  }
GEdgeSetTy::const_iterator const_iterator
Definition: GenericGraph.h:406

◆ hasOutgoingEdge() [1/2]

template<class NodeTy , class EdgeTy >
bool SVF::GenericNode< NodeTy, EdgeTy >::hasOutgoingEdge ( ) const
inline

Definition at line 446 of file GenericGraph.h.

447  {
448  return (OutEdges.empty() == false);
449  }

◆ hasOutgoingEdge() [2/2]

template<class NodeTy , class EdgeTy >
EdgeType* SVF::GenericNode< NodeTy, EdgeTy >::hasOutgoingEdge ( EdgeType edge) const
inline

Definition at line 565 of file GenericGraph.h.

566  {
567  const_iterator it = OutEdges.find(edge);
568  if (it != OutEdges.end())
569  return *it;
570  else
571  return nullptr;
572  }

◆ InEdgeBegin() [1/2]

template<class NodeTy , class EdgeTy >
iterator SVF::GenericNode< NodeTy, EdgeTy >::InEdgeBegin ( )
inline

Definition at line 462 of file GenericGraph.h.

463  {
464  return InEdges.begin();
465  }

◆ InEdgeBegin() [2/2]

template<class NodeTy , class EdgeTy >
const_iterator SVF::GenericNode< NodeTy, EdgeTy >::InEdgeBegin ( ) const
inline

Definition at line 478 of file GenericGraph.h.

479  {
480  return InEdges.begin();
481  }

◆ InEdgeEnd() [1/2]

template<class NodeTy , class EdgeTy >
iterator SVF::GenericNode< NodeTy, EdgeTy >::InEdgeEnd ( )
inline

Definition at line 466 of file GenericGraph.h.

467  {
468  return InEdges.end();
469  }

◆ InEdgeEnd() [2/2]

template<class NodeTy , class EdgeTy >
const_iterator SVF::GenericNode< NodeTy, EdgeTy >::InEdgeEnd ( ) const
inline

Definition at line 482 of file GenericGraph.h.

483  {
484  return InEdges.end();
485  }

◆ OutEdgeBegin() [1/2]

template<class NodeTy , class EdgeTy >
iterator SVF::GenericNode< NodeTy, EdgeTy >::OutEdgeBegin ( )
inline

iterators

Definition at line 454 of file GenericGraph.h.

455  {
456  return OutEdges.begin();
457  }

◆ OutEdgeBegin() [2/2]

template<class NodeTy , class EdgeTy >
const_iterator SVF::GenericNode< NodeTy, EdgeTy >::OutEdgeBegin ( ) const
inline

Definition at line 470 of file GenericGraph.h.

471  {
472  return OutEdges.begin();
473  }

◆ OutEdgeEnd() [1/2]

template<class NodeTy , class EdgeTy >
iterator SVF::GenericNode< NodeTy, EdgeTy >::OutEdgeEnd ( )
inline

Definition at line 458 of file GenericGraph.h.

459  {
460  return OutEdges.end();
461  }

◆ OutEdgeEnd() [2/2]

template<class NodeTy , class EdgeTy >
const_iterator SVF::GenericNode< NodeTy, EdgeTy >::OutEdgeEnd ( ) const
inline

Definition at line 474 of file GenericGraph.h.

475  {
476  return OutEdges.end();
477  }

◆ removeIncomingEdge()

template<class NodeTy , class EdgeTy >
u32_t SVF::GenericNode< NodeTy, EdgeTy >::removeIncomingEdge ( EdgeType edge)
inline

Remove incoming and outgoing edges

Definition at line 539 of file GenericGraph.h.

540  {
541  iterator it = InEdges.find(edge);
542  assert(it != InEdges.end() && "can not find in edge in SVFG node");
543  InEdges.erase(it);
544  return 1;
545  }
GEdgeSetTy::iterator iterator
Definition: GenericGraph.h:405

◆ removeOutgoingEdge()

template<class NodeTy , class EdgeTy >
u32_t SVF::GenericNode< NodeTy, EdgeTy >::removeOutgoingEdge ( EdgeType edge)
inline

Definition at line 546 of file GenericGraph.h.

547  {
548  iterator it = OutEdges.find(edge);
549  assert(it != OutEdges.end() && "can not find out edge in SVFG node");
550  OutEdges.erase(it);
551  return 1;
552  }

Friends And Related Function Documentation

◆ SVFIRReader

template<class NodeTy , class EdgeTy >
friend class SVFIRReader
friend

Definition at line 396 of file GenericGraph.h.

◆ SVFIRWriter

template<class NodeTy , class EdgeTy >
friend class SVFIRWriter
friend

Definition at line 395 of file GenericGraph.h.

Member Data Documentation

◆ InEdges

template<class NodeTy , class EdgeTy >
GEdgeSetTy SVF::GenericNode< NodeTy, EdgeTy >::InEdges
private

all incoming edge of this node

Definition at line 411 of file GenericGraph.h.

◆ OutEdges

template<class NodeTy , class EdgeTy >
GEdgeSetTy SVF::GenericNode< NodeTy, EdgeTy >::OutEdges
private

all outgoing edge of this node

Definition at line 412 of file GenericGraph.h.


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