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

#include <DCHG.h>

Inheritance diagram for SVF::DCHNode:
SVF::GenericNode< DCHNode, DCHEdge > SVF::SVFBaseNode

Public Types

enum  CLASSATTR { PURE_ABSTRACT = 0x1 , MULTI_INHERITANCE = 0x2 , TEMPLATE = 0x04 , SCALAR = 0x08 }
 
typedef std::vector< const Function * > FuncVector
 
- Public Types inherited from SVF::GenericNode< DCHNode, DCHEdge >
typedef DCHNode NodeType
 
typedef DCHEdge EdgeType
 
typedef OrderedSet< EdgeType *, typename EdgeType::equalGEdgeGEdgeSetTy
 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

 DCHNode (const DIType *diType, NodeID i=0, GNodeK k=GNodeK::DCHNodeKd)
 
 ~DCHNode ()
 
const DITypegetDIType (void) const
 
std::string getName () const
 
void setFlag (CLASSATTR mask)
 Flags. More...
 
bool hasFlag (CLASSATTR mask) const
 
void setPureAbstract ()
 Attribute. More...
 
void setMultiInheritance ()
 
void setTemplate ()
 
void setScalar ()
 
bool isPureAbstract () const
 
bool isMultiInheritance () const
 
bool isTemplate () const
 
bool isScalar () const
 
void addTypedef (const DIDerivedType *diTypedef)
 
const Set< const DIDerivedType * > & getTypedefs (void) const
 
void setVTable (const SVFGlobalValue *vtbl)
 
const SVFGlobalValuegetVTable () const
 
const std::vector< std::vector< const Function * > > & getVfnVectors (void) const
 Returns the vector of virtual function vectors. More...
 
std::vector< const Function * > & getVfnVector (unsigned n)
 Return the nth virtual function vector in the vtable. More...
 
- Public Member Functions inherited from SVF::GenericNode< DCHNode, DCHEdge >
 GenericNode (NodeID i, GNodeK k)
 Constructor. More...
 
virtual ~GenericNode ()
 Destructor. More...
 
bool hasIncomingEdge () const
 Has incoming/outgoing edge set. More...
 
EdgeTypehasIncomingEdge (EdgeType *edge) const
 Find incoming and outgoing edges. More...
 
bool hasOutgoingEdge () const
 
EdgeTypehasOutgoingEdge (EdgeType *edge) const
 
iterator OutEdgeBegin ()
 iterators More...
 
const_iterator OutEdgeBegin () const
 
iterator OutEdgeEnd ()
 
const_iterator OutEdgeEnd () const
 
iterator InEdgeBegin ()
 
const_iterator InEdgeBegin () const
 
iterator InEdgeEnd ()
 
const_iterator InEdgeEnd () const
 
virtual iterator directOutEdgeBegin ()
 Iterators used for SCC detection, overwrite it in child class if necessary. More...
 
virtual const_iterator directOutEdgeBegin () const
 
virtual iterator directOutEdgeEnd ()
 
virtual const_iterator directOutEdgeEnd () const
 
virtual iterator directInEdgeBegin ()
 
virtual const_iterator directInEdgeBegin () const
 
virtual iterator directInEdgeEnd ()
 
virtual const_iterator directInEdgeEnd () const
 
bool addIncomingEdge (EdgeType *inEdge)
 Add incoming and outgoing edges. More...
 
bool addOutgoingEdge (EdgeType *outEdge)
 
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
 

Private Attributes

const DITypediType
 Type of this node. More...
 
Set< const DIDerivedType * > typedefs
 Typedefs which map to this type. More...
 
const SVFGlobalValuevtable
 
std::string typeName
 
size_t flags
 
std::vector< const Function * > primaryVTable
 The virtual functions which this class actually defines/overrides. More...
 
std::vector< std::vector< const Function * > > vfnVectors
 

Additional Inherited Members

- Static Public Member Functions inherited from SVF::GenericNode< DCHNode, DCHEdge >
static bool classof (const GenericNode< DCHNode, DCHEdge > *)
 
static bool classof (const SVFBaseNode *)
 
- 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 63 of file DCHG.h.

Member Typedef Documentation

◆ FuncVector

typedef std::vector<const Function*> SVF::DCHNode::FuncVector

Definition at line 74 of file DCHG.h.

Member Enumeration Documentation

◆ CLASSATTR

Enumerator
PURE_ABSTRACT 
MULTI_INHERITANCE 
TEMPLATE 
SCALAR 

Definition at line 66 of file DCHG.h.

67  {
68  PURE_ABSTRACT = 0x1, // pure virtual abstract class
69  MULTI_INHERITANCE = 0x2, // multi inheritance class
70  TEMPLATE = 0x04, // template class
71  SCALAR = 0x08 // non-class scalar type
72  } CLASSATTR;
@ PURE_ABSTRACT
Definition: DCHG.h:68
@ MULTI_INHERITANCE
Definition: DCHG.h:69
@ TEMPLATE
Definition: DCHG.h:70
@ SCALAR
Definition: DCHG.h:71

Constructor & Destructor Documentation

◆ DCHNode()

SVF::DCHNode::DCHNode ( const DIType diType,
NodeID  i = 0,
GNodeK  k = GNodeK::DCHNodeKd 
)
inline

Definition at line 76 of file DCHG.h.

77  : GenericNode<DCHNode, DCHEdge>(i, k), vtable(nullptr), flags(0)
78  {
79  this->diType = diType;
80  if (diType == nullptr)
81  {
82  typeName = "null-void";
83  }
84  else if (diType->getRawName() != nullptr)
85  {
86  typeName = diType->getName().str();
87  }
88  else
89  {
90  typeName = "unnamed!";
91  }
92  }
const DIType * diType
Type of this node.
Definition: DCHG.h:193
size_t flags
Definition: DCHG.h:198
std::string typeName
Definition: DCHG.h:197
const SVFGlobalValue * vtable
Definition: DCHG.h:196

◆ ~DCHNode()

SVF::DCHNode::~DCHNode ( )
inline

Definition at line 94 of file DCHG.h.

94 { }

Member Function Documentation

◆ addTypedef()

void SVF::DCHNode::addTypedef ( const DIDerivedType diTypedef)
inline

Definition at line 154 of file DCHG.h.

155  {
156  typedefs.insert(diTypedef);
157  }
Set< const DIDerivedType * > typedefs
Typedefs which map to this type.
Definition: DCHG.h:195

◆ getDIType()

const DIType* SVF::DCHNode::getDIType ( void  ) const
inline

Definition at line 96 of file DCHG.h.

97  {
98  return diType;
99  }

◆ getName()

std::string SVF::DCHNode::getName ( ) const
inline

Definition at line 101 of file DCHG.h.

102  {
103  return typeName;
104  }

◆ getTypedefs()

const Set<const DIDerivedType *>& SVF::DCHNode::getTypedefs ( void  ) const
inline

Definition at line 159 of file DCHG.h.

160  {
161  return typedefs;
162  }

◆ getVfnVector()

std::vector<const Function* >& SVF::DCHNode::getVfnVector ( unsigned  n)
inline

Return the nth virtual function vector in the vtable.

Definition at line 181 of file DCHG.h.

182  {
183  if (vfnVectors.size() < n + 1)
184  {
185  vfnVectors.resize(n + 1);
186  }
187 
188  return vfnVectors[n];
189  }
cJSON * n
Definition: cJSON.cpp:2558
std::vector< std::vector< const Function * > > vfnVectors
Definition: DCHG.h:204

◆ getVfnVectors()

const std::vector<std::vector<const Function* > >& SVF::DCHNode::getVfnVectors ( void  ) const
inline

Returns the vector of virtual function vectors.

Definition at line 175 of file DCHG.h.

176  {
177  return vfnVectors;
178  }

◆ getVTable()

const SVFGlobalValue* SVF::DCHNode::getVTable ( ) const
inline

Definition at line 169 of file DCHG.h.

170  {
171  return vtable;
172  }

◆ hasFlag()

bool SVF::DCHNode::hasFlag ( CLASSATTR  mask) const
inline

Definition at line 112 of file DCHG.h.

113  {
114  return (flags & mask) == mask;
115  }

◆ isMultiInheritance()

bool SVF::DCHNode::isMultiInheritance ( ) const
inline

Definition at line 140 of file DCHG.h.

141  {
142  return hasFlag(MULTI_INHERITANCE);
143  }
bool hasFlag(CLASSATTR mask) const
Definition: DCHG.h:112

◆ isPureAbstract()

bool SVF::DCHNode::isPureAbstract ( ) const
inline

Definition at line 136 of file DCHG.h.

137  {
138  return hasFlag(PURE_ABSTRACT);
139  }

◆ isScalar()

bool SVF::DCHNode::isScalar ( ) const
inline

Definition at line 148 of file DCHG.h.

149  {
150  return hasFlag(SCALAR);
151  }

◆ isTemplate()

bool SVF::DCHNode::isTemplate ( ) const
inline

Definition at line 144 of file DCHG.h.

145  {
146  return hasFlag(TEMPLATE);
147  }

◆ setFlag()

void SVF::DCHNode::setFlag ( CLASSATTR  mask)
inline

Flags.

Definition at line 108 of file DCHG.h.

109  {
110  flags |= mask;
111  }

◆ setMultiInheritance()

void SVF::DCHNode::setMultiInheritance ( )
inline

Definition at line 124 of file DCHG.h.

125  {
127  }
void setFlag(CLASSATTR mask)
Flags.
Definition: DCHG.h:108

◆ setPureAbstract()

void SVF::DCHNode::setPureAbstract ( )
inline

Attribute.

Definition at line 120 of file DCHG.h.

121  {
123  }

◆ setScalar()

void SVF::DCHNode::setScalar ( )
inline

Definition at line 132 of file DCHG.h.

133  {
134  setFlag(SCALAR);
135  }

◆ setTemplate()

void SVF::DCHNode::setTemplate ( )
inline

Definition at line 128 of file DCHG.h.

129  {
130  setFlag(TEMPLATE);
131  }

◆ setVTable()

void SVF::DCHNode::setVTable ( const SVFGlobalValue vtbl)
inline

Definition at line 164 of file DCHG.h.

165  {
166  vtable = vtbl;
167  }

Member Data Documentation

◆ diType

const DIType* SVF::DCHNode::diType
private

Type of this node.

Definition at line 193 of file DCHG.h.

◆ flags

size_t SVF::DCHNode::flags
private

Definition at line 198 of file DCHG.h.

◆ primaryVTable

std::vector<const Function* > SVF::DCHNode::primaryVTable
private

The virtual functions which this class actually defines/overrides.

Definition at line 200 of file DCHG.h.

◆ typedefs

Set<const DIDerivedType *> SVF::DCHNode::typedefs
private

Typedefs which map to this type.

Definition at line 195 of file DCHG.h.

◆ typeName

std::string SVF::DCHNode::typeName
private

Definition at line 197 of file DCHG.h.

◆ vfnVectors

std::vector<std::vector<const Function*> > SVF::DCHNode::vfnVectors
private

If a vtable is split into more than one vfn vector for multiple inheritance, 0 would be the primary base + this classes virtual functions, 1 would be the second parent, 2 would be third parent, etc.

Definition at line 204 of file DCHG.h.

◆ vtable

const SVFGlobalValue* SVF::DCHNode::vtable
private

Definition at line 196 of file DCHG.h.


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