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

#include <SVFVariables.h>

Inheritance diagram for SVF::BaseObjVar:
SVF::ObjVar SVF::SVFVar SVF::GenericNode< NodeTy, EdgeTy > SVF::SVFValue SVF::ConstAggObjVar SVF::ConstDataObjVar SVF::DummyObjVar SVF::FunObjVar SVF::GlobalObjVar SVF::HeapObjVar SVF::StackObjVar SVF::ConstFPObjVar SVF::ConstIntObjVar SVF::ConstNullPtrObjVar

Public Member Functions

 BaseObjVar (NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node, PNODEK ty=BaseObjNode)
 Constructor.
 
virtual const BaseObjVargetBaseMemObj () const
 
const ICFGNodegetICFGNode () const
 Get the ICFGNode related to the creation of this object.
 
const std::string getValueName () const
 Return name of a LLVM value.
 
virtual const std::string toString () const
 Get string representation.
 
NodeID getId () const
 Get the memory object id.
 
const SVFTypegetType () const
 Get obj type.
 
u32_t getNumOfElements () const
 Get the number of elements of this object.
 
void setNumOfElements (u32_t num)
 Set the number of elements of this object.
 
u32_t getMaxFieldOffsetLimit () const
 Get max field offset limit.
 
bool isFieldInsensitive () const
 Return true if its field limit is 0.
 
void setFieldInsensitive ()
 Set the memory object to be field insensitive.
 
void setFieldSensitive ()
 Set the memory object to be field sensitive (up to max field limit)
 
bool isBlackHoleObj () const
 Whether it is a black hole object.
 
u32_t getByteSizeOfObj () const
 Get the byte size of this object.
 
bool isConstantByteSize () const
 Check if byte size is a const value.
 
bool isFunction () const
 object attributes methods
 
bool isGlobalObj () const
 
bool isStaticObj () const
 
bool isStack () const
 
bool isHeap () const
 
bool isStruct () const
 
bool isArray () const
 
bool isVarStruct () const
 
bool isVarArray () const
 
bool isConstantStruct () const
 
bool isConstantArray () const
 
bool isConstDataOrConstGlobal () const
 
virtual bool isConstDataOrAggData () const
 Check if this variable represents constant/aggregate data.
 
void destroy ()
 Clean up memory.
 
virtual const FunObjVargetFunction () const
 Get containing function, or null for globals/constants.
 
- 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.
 
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 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
 

Static Public Member Functions

static bool classof (const BaseObjVar *)
 ICFGNode related to the creation of this object.
 
static bool classof (const ObjVar *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::ObjVar
static bool classof (const ObjVar *)
 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

ObjTypeInfotypeInfo
 
const ICFGNodeicfgNode
 

Friends

class SVFIRBuilder
 

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 , ConstAggValNode , ConstDataValNode , BlackHoleValNode ,
  ConstFPValNode , ConstIntValNode , ConstNullptrValNode , DummyValNode ,
  ObjNode , GepObjNode , BaseObjNode , FunObjNode ,
  HeapObjNode , StackObjNode , GlobalObjNode , ConstAggObjNode ,
  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 ,
  DCHNodeKd , BasicBlockKd , OtherKd
}
 
- Protected Member Functions inherited from SVF::ObjVar
 ObjVar (NodeID i, const SVFType *svfType, PNODEK ty=ObjNode)
 Constructor.
 
- Protected Member Functions inherited from SVF::SVFVar
 SVFVar (NodeID i, PNODEK k)
 Empty constructor for deserialization.
 
- 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 502 of file SVFVariables.h.

Constructor & Destructor Documentation

◆ BaseObjVar()

SVF::BaseObjVar::BaseObjVar ( NodeID  i,
ObjTypeInfo ti,
const SVFType svfType,
const ICFGNode node,
PNODEK  ty = BaseObjNode 
)
inline

Constructor.

Definition at line 536 of file SVFVariables.h.

538 : ObjVar(i, svfType, ty), typeInfo(ti), icfgNode(node)
539 {
540 }
const ICFGNode * icfgNode
ObjTypeInfo * typeInfo
ObjVar(NodeID i, const SVFType *svfType, PNODEK ty=ObjNode)
Constructor.
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Member Function Documentation

◆ classof() [1/5]

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

ICFGNode related to the creation of this object.

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

Definition at line 513 of file SVFVariables.h.

514 {
515 return true;
516 }

◆ classof() [2/5]

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

Definition at line 525 of file SVFVariables.h.

526 {
527 return isBaseObjVarKinds(node->getNodeKind());
528 }
static bool isBaseObjVarKinds(GNodeK n)
Definition SVFValue.h:264

◆ classof() [3/5]

static bool SVF::BaseObjVar::classof ( const ObjVar node)
inlinestatic

Definition at line 517 of file SVFVariables.h.

518 {
519 return isBaseObjVarKinds(node->getNodeKind());
520 }

◆ classof() [4/5]

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

Definition at line 529 of file SVFVariables.h.

530 {
531 return isBaseObjVarKinds(node->getNodeKind());
532 }

◆ classof() [5/5]

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

Definition at line 521 of file SVFVariables.h.

522 {
523 return isBaseObjVarKinds(node->getNodeKind());
524 }

◆ destroy()

void SVF::BaseObjVar::destroy ( )
inline

Clean up memory.

Definition at line 684 of file SVFVariables.h.

685 {
686 delete typeInfo;
687 typeInfo = nullptr;
688 }

◆ getBaseMemObj()

virtual const BaseObjVar * SVF::BaseObjVar::getBaseMemObj ( ) const
inlinevirtual

Definition at line 542 of file SVFVariables.h.

543 {
544 return this;
545 }

◆ getByteSizeOfObj()

u32_t SVF::BaseObjVar::getByteSizeOfObj ( ) const
inline

Get the byte size of this object.

Definition at line 615 of file SVFVariables.h.

616 {
617 return typeInfo->getByteSizeOfObj();
618 }
u32_t getByteSizeOfObj() const
Get the byte size of this object.

◆ getFunction()

const FunObjVar * BaseObjVar::getFunction ( ) const
virtual

Get containing function, or null for globals/constants.

Reimplemented from SVF::SVFVar.

Reimplemented in SVF::FunObjVar.

Definition at line 224 of file SVFVariables.cpp.

225{
226 if(icfgNode)
227 return icfgNode->getFun();
228 return nullptr;
229}
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
Definition ICFGNode.h:74

◆ getICFGNode()

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

Get the ICFGNode related to the creation of this object.

Definition at line 548 of file SVFVariables.h.

549 {
550 return icfgNode;
551 }

◆ getId()

NodeID SVF::BaseObjVar::getId ( ) const
inline

Get the memory object id.

Definition at line 562 of file SVFVariables.h.

563 {
564 return id;
565 }
NodeID id
Node ID.
Definition SVFValue.h:205

◆ getMaxFieldOffsetLimit()

u32_t SVF::BaseObjVar::getMaxFieldOffsetLimit ( ) const
inline

Get max field offset limit.

Definition at line 586 of file SVFVariables.h.

587 {
589 }
u32_t getMaxFieldOffsetLimit()
Get max field offset limit.

◆ getNumOfElements()

u32_t SVF::BaseObjVar::getNumOfElements ( ) const
inline

Get the number of elements of this object.

Definition at line 574 of file SVFVariables.h.

575 {
576 return typeInfo->getNumOfElements();
577 }
u32_t getNumOfElements() const
Get the number of elements of this object.

◆ getType()

const SVFType * SVF::BaseObjVar::getType ( ) const
inlinevirtual

Get obj type.

Reimplemented from SVF::SVFValue.

Definition at line 568 of file SVFVariables.h.

569 {
570 return typeInfo->getType();
571 }
const SVFType * getType() const
Get LLVM type.
Definition ObjTypeInfo.h:96

◆ getValueName()

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

Return name of a LLVM value.

Reimplemented from SVF::ObjVar.

Reimplemented in SVF::HeapObjVar, SVF::StackObjVar, and SVF::DummyObjVar.

Definition at line 554 of file SVFVariables.h.

555 {
556 return getName() + " (base object)";
557 }
virtual const std::string & getName() const
Definition SVFValue.h:186

◆ isArray()

bool SVF::BaseObjVar::isArray ( ) const
inline

Definition at line 653 of file SVFVariables.h.

654 {
655 return typeInfo->isArray();
656 }

◆ isBlackHoleObj()

bool BaseObjVar::isBlackHoleObj ( ) const

Whether it is a black hole object.

Definition at line 218 of file SVFVariables.cpp.

219{
220 return IRGraph::isBlkObj(getId());
221}
NodeID getId() const
Get the memory object id.
static bool isBlkObj(NodeID id)
Definition IRGraph.h:163

◆ isConstantArray()

bool SVF::BaseObjVar::isConstantArray ( ) const
inline

Definition at line 669 of file SVFVariables.h.

670 {
671 return typeInfo->isConstantArray();
672 }

◆ isConstantByteSize()

bool SVF::BaseObjVar::isConstantByteSize ( ) const
inline

Check if byte size is a const value.

Definition at line 621 of file SVFVariables.h.

622 {
624 }
bool isConstantByteSize() const
Check if byte size is a const value.

◆ isConstantStruct()

bool SVF::BaseObjVar::isConstantStruct ( ) const
inline

Definition at line 665 of file SVFVariables.h.

666 {
667 return typeInfo->isConstantStruct();
668 }
bool isConstantStruct()

◆ isConstDataOrAggData()

virtual bool SVF::BaseObjVar::isConstDataOrAggData ( ) const
inlinevirtual

Check if this variable represents constant/aggregate data.

Reimplemented from SVF::SVFVar.

Reimplemented in SVF::ConstAggObjVar, and SVF::ConstDataObjVar.

Definition at line 677 of file SVFVariables.h.

678 {
680 }
bool isConstDataOrAggData()

◆ isConstDataOrConstGlobal()

bool SVF::BaseObjVar::isConstDataOrConstGlobal ( ) const
inline

Definition at line 673 of file SVFVariables.h.

674 {
676 }
bool isConstDataOrConstGlobal()

◆ isFieldInsensitive()

bool SVF::BaseObjVar::isFieldInsensitive ( ) const
inline

Return true if its field limit is 0.

Definition at line 593 of file SVFVariables.h.

594 {
595 return getMaxFieldOffsetLimit() == 0;
596 }
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.

◆ isFunction()

bool SVF::BaseObjVar::isFunction ( ) const
inline

object attributes methods

Definition at line 629 of file SVFVariables.h.

630 {
631 return typeInfo->isFunction();
632 }
bool isFunction()
Object attributes.

◆ isGlobalObj()

bool SVF::BaseObjVar::isGlobalObj ( ) const
inline

Definition at line 633 of file SVFVariables.h.

634 {
635 return typeInfo->isGlobalObj();
636 }

◆ isHeap()

bool SVF::BaseObjVar::isHeap ( ) const
inline

Definition at line 645 of file SVFVariables.h.

646 {
647 return typeInfo->isHeap();
648 }

◆ isStack()

bool SVF::BaseObjVar::isStack ( ) const
inline

Definition at line 641 of file SVFVariables.h.

642 {
643 return typeInfo->isStack();
644 }

◆ isStaticObj()

bool SVF::BaseObjVar::isStaticObj ( ) const
inline

Definition at line 637 of file SVFVariables.h.

638 {
639 return typeInfo->isStaticObj();
640 }

◆ isStruct()

bool SVF::BaseObjVar::isStruct ( ) const
inline

Definition at line 649 of file SVFVariables.h.

650 {
651 return typeInfo->isStruct();
652 }

◆ isVarArray()

bool SVF::BaseObjVar::isVarArray ( ) const
inline

Definition at line 661 of file SVFVariables.h.

662 {
663 return typeInfo->isVarArray();
664 }

◆ isVarStruct()

bool SVF::BaseObjVar::isVarStruct ( ) const
inline

Definition at line 657 of file SVFVariables.h.

658 {
659 return typeInfo->isVarStruct();
660 }

◆ setFieldInsensitive()

void SVF::BaseObjVar::setFieldInsensitive ( )
inline

Set the memory object to be field insensitive.

Definition at line 599 of file SVFVariables.h.

600 {
602 }
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.

◆ setFieldSensitive()

void SVF::BaseObjVar::setFieldSensitive ( )
inline

Set the memory object to be field sensitive (up to max field limit)

Definition at line 606 of file SVFVariables.h.

◆ setNumOfElements()

void SVF::BaseObjVar::setNumOfElements ( u32_t  num)
inline

Set the number of elements of this object.

Definition at line 580 of file SVFVariables.h.

581 {
583 }
void setNumOfElements(u32_t num)
Set the number of elements of this object.

◆ toString()

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

Get string representation.

Reimplemented from SVF::ObjVar.

Reimplemented in SVF::HeapObjVar, SVF::StackObjVar, SVF::FunObjVar, SVF::GlobalObjVar, SVF::ConstAggObjVar, SVF::ConstDataObjVar, SVF::ConstFPObjVar, SVF::ConstIntObjVar, SVF::ConstNullPtrObjVar, and SVF::DummyObjVar.

Definition at line 230 of file SVFVariables.cpp.

231{
232 std::string str;
233 std::stringstream rawstr(str);
234 rawstr << "BaseObjVar ID: " << getId() << " (base object)";
236 {
237 rawstr << "\n";
239 }
240 return rawstr.str();
241}
static const Option< bool > ShowSVFIRValue
Definition Options.h:119
const std::string valueOnlyToString() const
Definition LLVMUtil.cpp:735

Friends And Related Symbol Documentation

◆ SVFIRBuilder

Definition at line 504 of file SVFVariables.h.

Member Data Documentation

◆ icfgNode

const ICFGNode* SVF::BaseObjVar::icfgNode
private

Definition at line 508 of file SVFVariables.h.

◆ typeInfo

ObjTypeInfo* SVF::BaseObjVar::typeInfo
private

Definition at line 506 of file SVFVariables.h.


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