Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
SVF::ValVar Class Reference

#include <SVFVariables.h>

Inheritance diagram for SVF::ValVar:
SVF::SVFVar SVF::GenericNode< NodeTy, EdgeTy > SVF::SVFValue SVF::ArgValVar SVF::AsmPCValVar SVF::ConstDataValVar SVF::DummyValVar SVF::FunValVar SVF::GepValVar SVF::GlobalValVar SVF::IntrinsicValVar SVF::RetValPN SVF::VarArgValPN

Public Member Functions

 ValVar (NodeID i, const SVFType *svfType, const ICFGNode *node, PNODEK ty=ValNode)
 Constructor.
 
const std::string getValueName () const
 Return name of a LLVM value.
 
const ICFGNodegetICFGNode () const
 
virtual const FunObjVargetFunction () const
 Get containing function, or null for globals/constants.
 
virtual const std::string toString () const
 Get string representation.
 
std::string getValVarNodeFieldsStmt () const
 
- Public Member Functions inherited from SVF::SVFVar
 SVFVar (NodeID i, const SVFType *svfType, PNODEK k)
 Standard constructor with ID, type and kind.
 
virtual ~SVFVar ()
 Virtual destructor.
 
virtual bool isPointer () const
 Check if this variable represents a pointer.
 
virtual bool isConstDataOrAggDataButNotNullPtr () const
 Check if this variable represents constant data/metadata but not null pointer.
 
virtual bool isIsolatedNode () const
 Check if this node is isolated (no edges) in the SVFIR graph.
 
SVFStmt::SVFStmtSetTygetIncomingEdges (SVFStmt::PEDGEK kind)
 Edge accessors and checkers.
 
SVFStmt::SVFStmtSetTygetOutgoingEdges (SVFStmt::PEDGEK kind)
 
bool hasIncomingEdges (SVFStmt::PEDGEK kind) const
 
bool hasOutgoingEdges (SVFStmt::PEDGEK kind) const
 
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin (SVFStmt::PEDGEK kind) const
 Edge iterators.
 
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd (SVFStmt::PEDGEK kind) const
 
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin (SVFStmt::PEDGEK kind) const
 
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd (SVFStmt::PEDGEK kind) const
 
virtual bool ptrInUncalledFunction () const
 Check if this pointer is in an uncalled function.
 
virtual bool isConstDataOrAggData () const
 Check if this variable represents constant/aggregate data.
 
void dump () const
 Debug dump to console.
 
- Public Member Functions inherited from SVF::GenericNode< NodeTy, EdgeTy >
 GenericNode (NodeID i, GNodeK k, const SVFType *svfType=nullptr)
 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::SVFValue
 SVFValue (NodeID i, GNodeK k, const SVFType *ty=nullptr)
 
NodeID getId () const
 Get ID.
 
GNodeK getNodeKind () const
 Get node kind.
 
virtual const SVFTypegetType () const
 
virtual void setName (const std::string &nameInfo)
 
virtual void setName (std::string &&nameInfo)
 
virtual const std::string & getName () const
 
virtual void setSourceLoc (const std::string &sourceCodeInfo)
 
virtual const std::string getSourceLoc () const
 
const std::string valueOnlyToString () const
 
const bool hasLLVMValue () const
 

Static Public Member Functions

static bool classof (const ValVar *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
static bool classof (const SVFVar *node)
 
static bool classof (const GenericPAGNodeTy *node)
 
static bool classof (const SVFValue *node)
 
- Static Public Member Functions inherited from SVF::SVFVar
static bool classof (const SVFVar *)
 Type checking support for LLVM-style RTTI.
 
static bool classof (const GenericPAGNodeTy *node)
 
static bool classof (const SVFValue *node)
 
- Static Public Member Functions inherited from SVF::GenericNode< NodeTy, EdgeTy >
static bool classof (const GenericNode< NodeTy, EdgeTy > *)
 
static bool classof (const SVFValue *)
 

Private Attributes

const ICFGNodeicfgNode
 

Friends

class GraphDBClient
 

Additional Inherited Members

- Public Types inherited from SVF::SVFVar
typedef GNodeK PNODEK
 
typedef s64_t GEdgeKind
 
- Public Types inherited from SVF::GenericNode< NodeTy, EdgeTy >
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::SVFValue
enum  GNodeK {
  IntraBlock , GlobalBlock , FunEntryBlock , FunExitBlock ,
  FunCallBlock , FunRetBlock , ValNode , ArgValNode ,
  FunValNode , GepValNode , RetValNode , VarargValNode ,
  GlobalValNode , ConstDataValNode , BlackHoleValNode , ConstFPValNode ,
  ConstIntValNode , ConstNullptrValNode , DummyValNode , IntrinsicValNode ,
  AsmPCValNode , ObjNode , GepObjNode , BaseObjNode ,
  FunObjNode , HeapObjNode , StackObjNode , GlobalObjNode ,
  ConstDataObjNode , ConstFPObjNode , ConstIntObjNode , ConstNullptrObjNode ,
  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 ,
  BasicBlockKd , OtherKd
}
 
- Protected Member Functions inherited from SVF::SVFVar
const SVFStmt::KindToSVFStmtMapTygetInEdgeKindToSetMap () const
 
const SVFStmt::KindToSVFStmtMapTygetOutEdgeKindToSetMap () const
 
- Static Protected Member Functions inherited from SVF::SVFValue
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 isConstantDataValVar (GNodeK n)
 
static bool isObjVarKinds (GNodeK n)
 
static bool isBaseObjVarKinds (GNodeK n)
 
static bool isConstantDataObjVarKinds (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::SVFVar
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap
 Maps tracking incoming and outgoing edges by kind.
 
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap
 
- Protected Attributes inherited from SVF::SVFValue
NodeID id
 Node ID.
 
GNodeK nodeKind
 Node kind.
 
const SVFTypetype
 SVF type.
 
std::string name
 
std::string sourceLoc
 Source code information of this value.
 

Detailed Description

Definition at line 263 of file SVFVariables.h.

Constructor & Destructor Documentation

◆ ValVar()

ValVar::ValVar ( NodeID  i,
const SVFType svfType,
const ICFGNode node,
PNODEK  ty = ValNode 
)

Constructor.

Definition at line 86 of file SVFVariables.cpp.

87 : SVFVar(i, svfType, ty), icfgNode(node)
88{
89 if (SVFUtil::isa<GlobalValVar>(this))
90 {
91 assert(node && "GlobalValVar must have a valid ICFGNode");
92 }
93 else if (SVFUtil::isa<GepValVar>(this))
94 {
95 assert(node && "GepValVar must have a valid ICFGNode");
96 }
97 else if (SVFUtil::isa<ArgValVar>(this) ||
98 SVFUtil::isa<RetValPN>(this) ||
99 SVFUtil::isa<VarArgValPN>(this))
100 {
101 // Conditional assert (isDeclaration || icn) is in each subclass constructor.
102 }
103 else if (SVFUtil::isa<ConstDataValVar>(this) ||
104 SVFUtil::isa<FunValVar>(this) ||
105 SVFUtil::isa<DummyValVar>(this) ||
106 SVFUtil::isa<IntrinsicValVar>(this) ||
107 SVFUtil::isa<AsmPCValVar>(this))
108 {
109 // These ValVar subclasses don't require an ICFGNode.
110 }
111 else if (ty == ValNode)
112 {
113 assert(node && "Base ValVar must have a valid ICFGNode");
114 }
115 else
116 {
117 assert(false && "Unknown ValVar subclass -- update this check");
118 }
119}
const ICFGNode * icfgNode
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

Member Function Documentation

◆ classof() [1/4]

static bool SVF::ValVar::classof ( const GenericPAGNodeTy node)
inlinestatic

Definition at line 281 of file SVFVariables.h.

282 {
283 return isValVarKinds(node->getNodeKind());
284 }
static bool isValVarKinds(GNodeK n)
Definition SVFValue.h:238

◆ classof() [2/4]

static bool SVF::ValVar::classof ( const SVFValue node)
inlinestatic

Definition at line 285 of file SVFVariables.h.

286 {
287 return isValVarKinds(node->getNodeKind());
288 }

◆ classof() [3/4]

static bool SVF::ValVar::classof ( const SVFVar node)
inlinestatic

Definition at line 277 of file SVFVariables.h.

278 {
279 return isValVarKinds(node->getNodeKind());
280 }

◆ classof() [4/4]

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

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

Definition at line 273 of file SVFVariables.h.

274 {
275 return true;
276 }

◆ getFunction()

const FunObjVar * ValVar::getFunction ( ) const
virtual

Get containing function, or null for globals/constants.

Reimplemented from SVF::SVFVar.

Reimplemented in SVF::ArgValVar, SVF::GepValVar, SVF::FunValVar, SVF::RetValPN, and SVF::VarArgValPN.

Definition at line 121 of file SVFVariables.cpp.

122{
123 if(icfgNode)
124 return icfgNode->getFun();
125 return nullptr;
126}
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
Definition ICFGNode.h:75

◆ getICFGNode()

const ICFGNode * SVF::ValVar::getICFGNode ( ) const
inline

Definition at line 299 of file SVFVariables.h.

300 {
301 return icfgNode;
302 }

◆ getValueName()

const std::string SVF::ValVar::getValueName ( ) const
inlinevirtual

Return name of a LLVM value.

Implements SVF::SVFVar.

Reimplemented in SVF::VarArgValPN.

Definition at line 294 of file SVFVariables.h.

295 {
296 return getName();
297 }
virtual const std::string & getName() const
Definition SVFValue.h:184

◆ getValVarNodeFieldsStmt()

std::string SVF::ValVar::getValVarNodeFieldsStmt ( ) const

◆ toString()

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

Get string representation.

Reimplemented from SVF::SVFVar.

Reimplemented in SVF::ArgValVar, SVF::GepValVar, SVF::FunValVar, SVF::GlobalValVar, SVF::ConstDataValVar, SVF::BlackHoleValVar, SVF::ConstFPValVar, SVF::ConstIntValVar, SVF::ConstNullPtrValVar, SVF::RetValPN, SVF::VarArgValPN, SVF::DummyValVar, SVF::IntrinsicValVar, and SVF::AsmPCValVar.

Definition at line 128 of file SVFVariables.cpp.

129{
130 std::string str;
131 std::stringstream rawstr(str);
132 rawstr << "ValVar ID: " << getId();
134 {
135 rawstr << "\n";
137 }
138 return rawstr.str();
139}
static const Option< bool > ShowSVFIRValue
Definition Options.h:118
NodeID getId() const
Get ID.
Definition SVFValue.h:158
const std::string valueOnlyToString() const
Definition LLVMUtil.cpp:741

Friends And Related Symbol Documentation

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 265 of file SVFVariables.h.

Member Data Documentation

◆ icfgNode

const ICFGNode* SVF::ValVar::icfgNode
private

Definition at line 268 of file SVFVariables.h.


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