Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::ArgValVar Class Reference

Class representing a function argument variable in the SVFIR. More...

#include <SVFVariables.h>

Inheritance diagram for SVF::ArgValVar:
SVF::ValVar SVF::SVFVar SVF::GenericNode< SVFVar, SVFStmt > SVF::SVFValue

Public Member Functions

 ArgValVar (NodeID i, u32_t argNo, const ICFGNode *icn, const FunObjVar *callGraphNode, const SVFType *svfType)
 Constructor.
const std::string getValueName () const
 Return name of a LLVM value.
void addCGNodeFromDB (const FunObjVar *cgNode)
virtual const FunObjVar * getFunction () const
 Get containing function, or null for globals/constants.
const FunObjVar * getParent () const
u32_t getArgNo () const
bool isArgOfUncalledFunction () const
virtual bool isPointer () const
 Check if this variable represents a pointer.
virtual const std::string toString () const
 Get string representation.
Public Member Functions inherited from SVF::ValVar
 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 ICFGNode * getICFGNode () const
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 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::SVFStmtSetTy & getIncomingEdges (SVFStmt::PEDGEK kind)
 Edge accessors and checkers.
SVFStmt::SVFStmtSetTy & getOutgoingEdges (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< SVFVar, SVFStmt >
 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)
EdgeType * hasIncomingEdge (EdgeType *edge) const
 Find incoming and outgoing edges.
EdgeType * hasOutgoingEdge (EdgeType *edge) const
const GEdgeSetTy & getOutEdges () const
const GEdgeSetTy & getInEdges () 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 SVFType * getType () 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 ArgValVar *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof (const ValVar *node)
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::ValVar
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< SVFVar, SVFStmt >
static bool classof (const GenericNode< SVFVar, SVFStmt > *)
static bool classof (const SVFValue *)

Private Attributes

const FunObjVar * cgNode
u32_t argNo

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< SVFVar, SVFStmt >
typedef SVFVar NodeType
typedef SVFStmt 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::KindToSVFStmtMapTy & getInEdgeKindToSetMap () const
const SVFStmt::KindToSVFStmtMapTy & getOutEdgeKindToSetMap () 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 SVFType * type
 SVF type.
std::string name
std::string sourceLoc
 Source code information of this value.

Detailed Description

Class representing a function argument variable in the SVFIR.

This class models function argument in the program analysis. It extends ValVar to specifically handle function argument.

Definition at line 365 of file SVFVariables.h.

Constructor & Destructor Documentation

◆ ArgValVar()

ArgValVar::ArgValVar ( NodeID i,
u32_t argNo,
const ICFGNode * icn,
const FunObjVar * callGraphNode,
const SVFType * svfType )

Constructor.

Definition at line 154 of file SVFVariables.cpp.

156 : ValVar(i, svfType, icn, ArgValNode),
157 cgNode(callGraphNode), argNo(argNo)
158{
159 assert((callGraphNode->isDeclaration() || icn) &&
160 "ArgValVar of a defined function must have a valid ICFGNode");
161}
const FunObjVar * cgNode
bool isDeclaration() const
ValVar(NodeID i, const SVFType *svfType, const ICFGNode *node, PNODEK ty=ValNode)
Constructor.

Member Function Documentation

◆ addCGNodeFromDB()

void SVF::ArgValVar::addCGNodeFromDB ( const FunObjVar * cgNode)
inline

Definition at line 408 of file SVFVariables.h.

409 {
410 this->cgNode = cgNode;
411 }

◆ classof() [1/5]

bool SVF::ArgValVar::classof ( const ArgValVar * )
inlinestatic

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

Definition at line 376 of file SVFVariables.h.

377 {
378 return true;
379 }

◆ classof() [2/5]

bool SVF::ArgValVar::classof ( const GenericPAGNodeTy * node)
inlinestatic

Definition at line 388 of file SVFVariables.h.

389 {
390 return node->getNodeKind() == ArgValNode;
391 }

◆ classof() [3/5]

bool SVF::ArgValVar::classof ( const SVFValue * node)
inlinestatic

Definition at line 392 of file SVFVariables.h.

393 {
394 return node->getNodeKind() == ArgValNode;
395 }

◆ classof() [4/5]

bool SVF::ArgValVar::classof ( const SVFVar * node)
inlinestatic

Definition at line 384 of file SVFVariables.h.

385 {
386 return node->getNodeKind() == ArgValNode;
387 }

◆ classof() [5/5]

bool SVF::ArgValVar::classof ( const ValVar * node)
inlinestatic

Definition at line 380 of file SVFVariables.h.

381 {
382 return node->getNodeKind() == ArgValNode;
383 }

◆ getArgNo()

u32_t SVF::ArgValVar::getArgNo ( ) const
inline

Return the index of this formal argument in its containing function. For example in "void foo(int a, float b)" a is 0 and b is 1.

Definition at line 419 of file SVFVariables.h.

420 {
421 return argNo;
422 }

◆ getFunction()

const FunObjVar * ArgValVar::getFunction ( ) const
virtual

Get containing function, or null for globals/constants.

Reimplemented from SVF::ValVar.

Definition at line 163 of file SVFVariables.cpp.

164{
165 return getParent();
166}
const FunObjVar * getParent() const

◆ getParent()

const FunObjVar * ArgValVar::getParent ( ) const

Definition at line 168 of file SVFVariables.cpp.

169{
170 return cgNode;
171}

◆ getValueName()

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

Return name of a LLVM value.

Implements SVF::SVFVar.

Definition at line 403 of file SVFVariables.h.

404 {
405 return getName() + " (argument valvar)";
406 }
virtual const std::string & getName() const
Definition SVFValue.h:184

◆ isArgOfUncalledFunction()

bool ArgValVar::isArgOfUncalledFunction ( ) const

Definition at line 173 of file SVFVariables.cpp.

174{
176}
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
bool isUncalledFunction() const

◆ isPointer()

bool ArgValVar::isPointer ( ) const
virtual

Check if this variable represents a pointer.

Reimplemented from SVF::SVFVar.

Definition at line 178 of file SVFVariables.cpp.

179{
180 return cgNode->getArg(argNo)->getType()->isPointerTy();
181}

◆ toString()

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

Get string representation.

Reimplemented from SVF::ValVar.

Definition at line 183 of file SVFVariables.cpp.

184{
185 std::string str;
186 std::stringstream rawstr(str);
187 rawstr << "ArgValVar ID: " << getId();
189 {
190 rawstr << "\n";
191 rawstr << valueOnlyToString();
192 }
193 return rawstr.str();
194}
static const Option< bool > ShowSVFIRValue
Definition Options.h:120
NodeID getId() const
Get ID.
Definition SVFValue.h:158
const std::string valueOnlyToString() const
Definition LLVMUtil.cpp:747

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 367 of file SVFVariables.h.

Member Data Documentation

◆ argNo

u32_t SVF::ArgValVar::argNo
private

Definition at line 371 of file SVFVariables.h.

◆ cgNode

const FunObjVar* SVF::ArgValVar::cgNode
private

Definition at line 370 of file SVFVariables.h.


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