Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected 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 *)
 Methods for support type inquiry through isa, cast, and dyn_cast:
 
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 *)
 

Protected Member Functions

 BaseObjVar (NodeID i, const ICFGNode *node, PNODEK ty=BaseObjNode)
 ICFGNode related to the creation of this object.
 
- Protected Member Functions inherited from SVF::ObjVar
 ObjVar (NodeID i, PNODEK ty=ObjNode)
 Constructor to create an empty ObjVar (for SVFIRReader/deserialization)
 
 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.
 

Private Attributes

ObjTypeInfotypeInfo
 
const ICFGNodeicfgNode
 

Friends

class SVFIRWriter
 
class SVFIRReader
 
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
}
 
- 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 523 of file SVFVariables.h.

Constructor & Destructor Documentation

◆ BaseObjVar() [1/2]

SVF::BaseObjVar::BaseObjVar ( NodeID  i,
const ICFGNode node,
PNODEK  ty = BaseObjNode 
)
inlineprotected

ICFGNode related to the creation of this object.

Constructor to create empty ObjVar (for SVFIRReader/deserialization)

Definition at line 535 of file SVFVariables.h.

535: ObjVar(i, ty), icfgNode(node) {}
const ICFGNode * icfgNode
ObjVar(NodeID i, PNODEK ty=ObjNode)
Constructor to create an empty ObjVar (for SVFIRReader/deserialization)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ BaseObjVar() [2/2]

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

Constructor.

Definition at line 563 of file SVFVariables.h.

565 : ObjVar(i, svfType, ty), typeInfo(ti), icfgNode(node)
566 {
567 }
ObjTypeInfo * typeInfo

Member Function Documentation

◆ classof() [1/5]

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

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

Definition at line 540 of file SVFVariables.h.

541 {
542 return true;
543 }

◆ classof() [2/5]

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

Definition at line 552 of file SVFVariables.h.

553 {
554 return isBaseObjVarKinds(node->getNodeKind());
555 }
static bool isBaseObjVarKinds(GNodeK n)
Definition SVFValue.h:264

◆ classof() [3/5]

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

Definition at line 544 of file SVFVariables.h.

545 {
546 return isBaseObjVarKinds(node->getNodeKind());
547 }

◆ classof() [4/5]

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

Definition at line 556 of file SVFVariables.h.

557 {
558 return isBaseObjVarKinds(node->getNodeKind());
559 }

◆ classof() [5/5]

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

Definition at line 548 of file SVFVariables.h.

549 {
550 return isBaseObjVarKinds(node->getNodeKind());
551 }

◆ destroy()

void SVF::BaseObjVar::destroy ( )
inline

Clean up memory.

Definition at line 711 of file SVFVariables.h.

712 {
713 delete typeInfo;
714 typeInfo = nullptr;
715 }

◆ getBaseMemObj()

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

Definition at line 569 of file SVFVariables.h.

570 {
571 return this;
572 }

◆ getByteSizeOfObj()

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

Get the byte size of this object.

Definition at line 642 of file SVFVariables.h.

643 {
644 return typeInfo->getByteSizeOfObj();
645 }
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:76

◆ getICFGNode()

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

Get the ICFGNode related to the creation of this object.

Definition at line 575 of file SVFVariables.h.

576 {
577 return icfgNode;
578 }

◆ getId()

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

Get the memory object id.

Definition at line 589 of file SVFVariables.h.

590 {
591 return id;
592 }
NodeID id
Node ID.
Definition SVFValue.h:205

◆ getMaxFieldOffsetLimit()

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

Get max field offset limit.

Definition at line 613 of file SVFVariables.h.

614 {
616 }
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 601 of file SVFVariables.h.

602 {
603 return typeInfo->getNumOfElements();
604 }
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 595 of file SVFVariables.h.

596 {
597 return typeInfo->getType();
598 }
const SVFType * getType() const
Get LLVM type.
Definition ObjTypeInfo.h:98

◆ 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 581 of file SVFVariables.h.

582 {
583 return getName() + " (base object)";
584 }
virtual const std::string & getName() const
Definition SVFValue.h:186

◆ isArray()

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

Definition at line 680 of file SVFVariables.h.

681 {
682 return typeInfo->isArray();
683 }

◆ 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:165

◆ isConstantArray()

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

Definition at line 696 of file SVFVariables.h.

697 {
698 return typeInfo->isConstantArray();
699 }

◆ isConstantByteSize()

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

Check if byte size is a const value.

Definition at line 648 of file SVFVariables.h.

649 {
651 }
bool isConstantByteSize() const
Check if byte size is a const value.

◆ isConstantStruct()

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

Definition at line 692 of file SVFVariables.h.

693 {
694 return typeInfo->isConstantStruct();
695 }
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 704 of file SVFVariables.h.

705 {
707 }
bool isConstDataOrAggData()

◆ isConstDataOrConstGlobal()

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

Definition at line 700 of file SVFVariables.h.

701 {
703 }
bool isConstDataOrConstGlobal()

◆ isFieldInsensitive()

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

Return true if its field limit is 0.

Definition at line 620 of file SVFVariables.h.

621 {
622 return getMaxFieldOffsetLimit() == 0;
623 }
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.

◆ isFunction()

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

object attributes methods

Definition at line 656 of file SVFVariables.h.

657 {
658 return typeInfo->isFunction();
659 }
bool isFunction()
Object attributes.

◆ isGlobalObj()

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

Definition at line 660 of file SVFVariables.h.

661 {
662 return typeInfo->isGlobalObj();
663 }

◆ isHeap()

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

Definition at line 672 of file SVFVariables.h.

673 {
674 return typeInfo->isHeap();
675 }

◆ isStack()

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

Definition at line 668 of file SVFVariables.h.

669 {
670 return typeInfo->isStack();
671 }

◆ isStaticObj()

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

Definition at line 664 of file SVFVariables.h.

665 {
666 return typeInfo->isStaticObj();
667 }

◆ isStruct()

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

Definition at line 676 of file SVFVariables.h.

677 {
678 return typeInfo->isStruct();
679 }

◆ isVarArray()

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

Definition at line 688 of file SVFVariables.h.

689 {
690 return typeInfo->isVarArray();
691 }

◆ isVarStruct()

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

Definition at line 684 of file SVFVariables.h.

685 {
686 return typeInfo->isVarStruct();
687 }

◆ setFieldInsensitive()

void SVF::BaseObjVar::setFieldInsensitive ( )
inline

Set the memory object to be field insensitive.

Definition at line 626 of file SVFVariables.h.

627 {
629 }
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 633 of file SVFVariables.h.

◆ setNumOfElements()

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

Set the number of elements of this object.

Definition at line 607 of file SVFVariables.h.

608 {
610 }
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 527 of file SVFVariables.h.

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 526 of file SVFVariables.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 525 of file SVFVariables.h.

Member Data Documentation

◆ icfgNode

const ICFGNode* SVF::BaseObjVar::icfgNode
private

Definition at line 531 of file SVFVariables.h.

◆ typeInfo

ObjTypeInfo* SVF::BaseObjVar::typeInfo
private

Definition at line 529 of file SVFVariables.h.


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