Static Value-Flow Analysis
Loading...
Searching...
No Matches
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::CallGraphNode SVF::ICFGNode SVF::PTACallGraphNode SVF::SVFVar SVF::TCTNode SVF::VFGNode

Public Types

typedef NodeTy NodeType
 
typedef EdgeTy EdgeType
 
typedef OrderedSet< EdgeType *, typename EdgeType::equalGEdge > GEdgeSetTy
 Edge kind.
 
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 , FunValNode ,
  GepValNode , RetNode , VarargNode , DummyValNode ,
  ObjNode , GepObjNode , BaseObjNode , FunObjNode ,
  HeapObjNode , StackObjNode , 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.
 
virtual ~GenericNode ()
 Destructor.
 
bool hasIncomingEdge () const
 Has incoming/outgoing edge set.
 
bool hasOutgoingEdge () const
 
iterator OutEdgeBegin ()
 iterators
 
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.
 
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.
 
bool addOutgoingEdge (EdgeType *outEdge)
 
EdgeTypehasIncomingEdge (EdgeType *edge) const
 Find incoming and outgoing edges.
 
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.
 
GNodeK getNodeKind () const
 Get node kind.
 
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
 
GEdgeSetTy OutEdges
 all outgoing edge of this node
 

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.
 
static bool isInterICFGNodeKind (GNodeK n)
 
static bool isSVFVarKind (GNodeK n)
 
static bool isValVarKinds (GNodeK n)
 
static bool isObjVarKinds (GNodeK n)
 
static bool isBaseObjVarKinds (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.
 
GNodeK nodeKind
 Node kind.
 
const SVFTypetype
 SVF type.
 
std::string sourceLoc
 Source code information of this value.
 

Detailed Description

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

Generic node on the graph as base class

Definition at line 366 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 379 of file GenericGraph.h.

◆ EdgeType

Definition at line 373 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 375 of file GenericGraph.h.

◆ iterator

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

Edge iterator

Definition at line 378 of file GenericGraph.h.

◆ NodeType

Definition at line 372 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 389 of file GenericGraph.h.

389 : SVFBaseNode(i, k)
390 {
391
392 }
SVFBaseNode(NodeID i, GNodeK k, SVFType *ty=nullptr)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~GenericNode()

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

Destructor.

Definition at line 395 of file GenericGraph.h.

396 {
397 for (auto * edge : OutEdges)
398 delete edge;
399 }
GEdgeSetTy OutEdges
all outgoing edge of this node

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 500 of file GenericGraph.h.

501 {
502 return InEdges.insert(inEdge).second;
503 }
GEdgeSetTy InEdges
all incoming edge of this node

◆ addOutgoingEdge()

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

Definition at line 504 of file GenericGraph.h.

505 {
506 return OutEdges.insert(outEdge).second;
507 }

◆ classof() [1/2]

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

Definition at line 548 of file GenericGraph.h.

549 {
550 return true;
551 }

◆ classof() [2/2]

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

Definition at line 553 of file GenericGraph.h.

554 {
555 return true;
556 }

◆ directInEdgeBegin() [1/2]

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

Reimplemented in SVF::ConstraintNode.

Definition at line 471 of file GenericGraph.h.

472 {
473 return InEdges.begin();
474 }

◆ 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 488 of file GenericGraph.h.

489 {
490 return InEdges.begin();
491 }

◆ directInEdgeEnd() [1/2]

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

Reimplemented in SVF::ConstraintNode.

Definition at line 475 of file GenericGraph.h.

476 {
477 return InEdges.end();
478 }

◆ 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 492 of file GenericGraph.h.

493 {
494 return InEdges.end();
495 }

◆ 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 463 of file GenericGraph.h.

464 {
465 return OutEdges.begin();
466 }

◆ 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 480 of file GenericGraph.h.

481 {
482 return OutEdges.begin();
483 }

◆ directOutEdgeEnd() [1/2]

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

Reimplemented in SVF::ConstraintNode.

Definition at line 467 of file GenericGraph.h.

468 {
469 return OutEdges.end();
470 }

◆ 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 484 of file GenericGraph.h.

485 {
486 return OutEdges.end();
487 }

◆ getInEdges()

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

Definition at line 407 of file GenericGraph.h.

408 {
409 return InEdges;
410 }

◆ getOutEdges()

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

Get incoming/outgoing edge set

Definition at line 403 of file GenericGraph.h.

404 {
405 return OutEdges;
406 }

◆ hasIncomingEdge() [1/2]

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

Has incoming/outgoing edge set.

Definition at line 415 of file GenericGraph.h.

416 {
417 return (InEdges.empty() == false);
418 }

◆ 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 530 of file GenericGraph.h.

531 {
533 if (it != InEdges.end())
534 return *it;
535 else
536 return nullptr;
537 }
GEdgeSetTy::const_iterator const_iterator

◆ hasOutgoingEdge() [1/2]

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

Definition at line 419 of file GenericGraph.h.

420 {
421 return (OutEdges.empty() == false);
422 }

◆ hasOutgoingEdge() [2/2]

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

Definition at line 538 of file GenericGraph.h.

539 {
541 if (it != OutEdges.end())
542 return *it;
543 else
544 return nullptr;
545 }

◆ InEdgeBegin() [1/2]

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

Definition at line 435 of file GenericGraph.h.

436 {
437 return InEdges.begin();
438 }

◆ InEdgeBegin() [2/2]

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

Definition at line 451 of file GenericGraph.h.

452 {
453 return InEdges.begin();
454 }

◆ InEdgeEnd() [1/2]

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

Definition at line 439 of file GenericGraph.h.

440 {
441 return InEdges.end();
442 }

◆ InEdgeEnd() [2/2]

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

Definition at line 455 of file GenericGraph.h.

456 {
457 return InEdges.end();
458 }

◆ OutEdgeBegin() [1/2]

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

iterators

Definition at line 427 of file GenericGraph.h.

428 {
429 return OutEdges.begin();
430 }

◆ OutEdgeBegin() [2/2]

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

Definition at line 443 of file GenericGraph.h.

444 {
445 return OutEdges.begin();
446 }

◆ OutEdgeEnd() [1/2]

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

Definition at line 431 of file GenericGraph.h.

432 {
433 return OutEdges.end();
434 }

◆ OutEdgeEnd() [2/2]

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

Definition at line 447 of file GenericGraph.h.

448 {
449 return OutEdges.end();
450 }

◆ removeIncomingEdge()

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

Remove incoming and outgoing edges

Definition at line 512 of file GenericGraph.h.

513 {
514 iterator it = InEdges.find(edge);
515 assert(it != InEdges.end() && "can not find in edge in SVFG node");
516 InEdges.erase(it);
517 return 1;
518 }
GEdgeSetTy::iterator iterator

◆ removeOutgoingEdge()

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

Definition at line 519 of file GenericGraph.h.

520 {
521 iterator it = OutEdges.find(edge);
522 assert(it != OutEdges.end() && "can not find out edge in SVFG node");
523 OutEdges.erase(it);
524 return 1;
525 }

Friends And Related Symbol Documentation

◆ SVFIRReader

Definition at line 369 of file GenericGraph.h.

◆ SVFIRWriter

Definition at line 368 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 384 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 385 of file GenericGraph.h.


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