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

#include <ICFGNode.h>

Inheritance diagram for SVF::FunExitICFGNode:
SVF::InterICFGNode SVF::ICFGNode SVF::GenericNode< NodeTy, EdgeTy > SVF::SVFBaseNode

Public Member Functions

 FunExitICFGNode (NodeID id, const SVFFunction *f)
 
const SVFFunctiongetFun () const override
 Return function. More...
 
const SVFVargetFormalRet () const
 Return formal return parameter. More...
 
void addFormalRet (const SVFVar *fr)
 Add formal return parameter. More...
 
const std::string toString () const override
 
const std::string getSourceLoc () const override
 
- Public Member Functions inherited from SVF::InterICFGNode
 InterICFGNode (NodeID id, ICFGNodeK k)
 Constructor. More...
 
- Public Member Functions inherited from SVF::ICFGNode
 ICFGNode (NodeID i, GNodeK k)
 Constructor. More...
 
virtual const SVFBasicBlockgetBB () const
 Return the basic block of this ICFGNode. More...
 
void dump () const
 
void addVFGNode (const VFGNode *vfgNode)
 
const VFGNodeListgetVFGNodes () const
 
void addSVFStmt (const SVFStmt *edge)
 
const SVFStmtListgetSVFStmts () 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)
 
const std::string valueOnlyToString () const
 

Static Public Member Functions

static bool classof (const FunEntryICFGNode *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static bool classof (const ICFGNode *node)
 
static bool classof (const InterICFGNode *node)
 
static bool classof (const GenericICFGNodeTy *node)
 
static bool classof (const SVFBaseNode *node)
 
- Static Public Member Functions inherited from SVF::InterICFGNode
static bool classof (const InterICFGNode *)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static bool classof (const ICFGNode *node)
 
static bool classof (const GenericICFGNodeTy *node)
 
static bool classof (const SVFBaseNode *node)
 
- Static Public Member Functions inherited from SVF::ICFGNode
static bool classof (const ICFGNode *)
 
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 Member Functions

 FunExitICFGNode (NodeID id)
 Constructor to create empty FunExitICFGNode (for SVFIRReader/deserialization) More...
 

Private Attributes

const SVFVarformalRet
 

Friends

class SVFIRWriter
 
class SVFIRReader
 

Additional Inherited Members

- Public Types inherited from SVF::ICFGNode
typedef ICFGEdge::ICFGEdgeSetTy::iterator iterator
 
typedef ICFGEdge::ICFGEdgeSetTy::const_iterator const_iterator
 
typedef Set< const CallPE * > CallPESet
 
typedef Set< const RetPE * > RetPESet
 
typedef std::list< const VFGNode * > VFGNodeList
 
typedef std::list< const SVFStmt * > SVFStmtList
 
typedef GNodeK ICFGNodeK
 
- 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
}
 
- 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::ICFGNode
const SVFFunctionfun
 
const SVFBasicBlockbb
 
VFGNodeList VFGNodes
 
SVFStmtList pagEdges
 
- 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

Function exit ICFGNode containing (at most one) FormalRetVFGNodes of a function

Definition at line 351 of file ICFGNode.h.

Constructor & Destructor Documentation

◆ FunExitICFGNode() [1/2]

SVF::FunExitICFGNode::FunExitICFGNode ( NodeID  id)
inlineprivate

Constructor to create empty FunExitICFGNode (for SVFIRReader/deserialization)

Definition at line 360 of file ICFGNode.h.

const SVFVar * formalRet
Definition: ICFGNode.h:357
InterICFGNode(NodeID id, ICFGNodeK k)
Constructor.
Definition: ICFGNode.h:243

◆ FunExitICFGNode() [2/2]

FunExitICFGNode::FunExitICFGNode ( NodeID  id,
const SVFFunction f 
)

Definition at line 50 of file ICFG.cpp.

51  : InterICFGNode(id, FunExitBlock), formalRet(nullptr)
52 {
53  fun = f;
54  // if function is implemented
55  if (f->begin() != f->end())
56  {
57  bb = f->getExitBB();
58  }
59 }
const SVFFunction * fun
Definition: ICFGNode.h:148
const SVFBasicBlock * bb
Definition: ICFGNode.h:149
const_iterator end() const
Definition: SVFValue.h:440
const_iterator begin() const
Definition: SVFValue.h:435
const SVFBasicBlock * getExitBB() const
Definition: SVFValue.cpp:186

Member Function Documentation

◆ addFormalRet()

void SVF::FunExitICFGNode::addFormalRet ( const SVFVar fr)
inline

Add formal return parameter.

Definition at line 378 of file ICFGNode.h.

379  {
380  formalRet = fr;
381  }

◆ classof() [1/5]

static bool SVF::FunExitICFGNode::classof ( const FunEntryICFGNode )
inlinestatic

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

Definition at line 385 of file ICFGNode.h.

386  {
387  return true;
388  }

◆ classof() [2/5]

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

Definition at line 400 of file ICFGNode.h.

401  {
402  return node->getNodeKind() == FunExitBlock;
403  }

◆ classof() [3/5]

static bool SVF::FunExitICFGNode::classof ( const ICFGNode node)
inlinestatic

Definition at line 390 of file ICFGNode.h.

391  {
392  return node->getNodeKind() == FunExitBlock;
393  }

◆ classof() [4/5]

static bool SVF::FunExitICFGNode::classof ( const InterICFGNode node)
inlinestatic

Definition at line 395 of file ICFGNode.h.

396  {
397  return node->getNodeKind() == FunExitBlock;
398  }

◆ classof() [5/5]

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

Definition at line 405 of file ICFGNode.h.

406  {
407  return node->getNodeKind() == FunExitBlock;
408  }

◆ getFormalRet()

const SVFVar* SVF::FunExitICFGNode::getFormalRet ( ) const
inline

Return formal return parameter.

Definition at line 372 of file ICFGNode.h.

373  {
374  return formalRet;
375  }

◆ getFun()

const SVFFunction* SVF::FunExitICFGNode::getFun ( ) const
inlineoverridevirtual

Return function.

Reimplemented from SVF::ICFGNode.

Definition at line 366 of file ICFGNode.h.

367  {
368  return fun;
369  }

◆ getSourceLoc()

const std::string SVF::FunExitICFGNode::getSourceLoc ( ) const
inlineoverridevirtual

Reimplemented from SVF::SVFBaseNode.

Definition at line 413 of file ICFGNode.h.

414  {
415  return "function ret: " + fun->getSourceLoc();
416  }
virtual const std::string getSourceLoc() const
Definition: SVFValue.h:280

◆ toString()

const std::string FunExitICFGNode::toString ( ) const
overridevirtual

Reimplemented from SVF::ICFGNode.

Definition at line 113 of file ICFG.cpp.

114 {
115  const SVFFunction *fun = getFun();
116  std::string str;
117  std::stringstream rawstr(str);
118  rawstr << "FunExitICFGNode" << getId();
119  rawstr << " {fun: " << fun->getName();
120  // ensure the enclosing function has exit basic block
121  if (!isExtCall(fun) && fun->hasReturn())
122  if(const IntraICFGNode* intraICFGNode = dyn_cast<IntraICFGNode>(fun->getExitBB()->front()))
123  rawstr << intraICFGNode->getSourceLoc();
124  rawstr << "}";
125  for (const SVFStmt *stmt : getSVFStmts())
126  rawstr << "\n" << stmt->toString();
127  return rawstr.str();
128 }
const char *const string
Definition: cJSON.h:172
const SVFFunction * getFun() const override
Return function.
Definition: ICFGNode.h:366
const SVFStmtList & getSVFStmts() const
Definition: ICFGNode.h:117
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
const ICFGNode * front() const
Definition: SVFValue.h:594
bool hasReturn() const
Definition: SVFValue.h:460
const std::string & getName() const
Definition: SVFValue.h:243
bool isExtCall(const SVFFunction *fun)
Definition: SVFUtil.h:278

Friends And Related Function Documentation

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 354 of file ICFGNode.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 353 of file ICFGNode.h.

Member Data Documentation

◆ formalRet

const SVFVar* SVF::FunExitICFGNode::formalRet
private

Definition at line 357 of file ICFGNode.h.


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