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

#include <SymbolTableInfo.h>

Public Member Functions

 MemObj (SymID id, ObjTypeInfo *ti, const SVFValue *val=nullptr, const SVFBaseNode *node=nullptr)
 Constructor. More...
 
virtual ~MemObj ()
 Destructor. More...
 
virtual const std::string toString () const
 
const SVFValuegetValue () const
 Get the reference value to this object. More...
 
const SVFBaseNodegetGNode () const
 Get the reference value to this object. More...
 
SymID getId () const
 Get the memory object id. More...
 
const SVFTypegetType () const
 Get obj type. More...
 
u32_t getNumOfElements () const
 Get the number of elements of this object. More...
 
void setNumOfElements (u32_t num)
 Set the number of elements of this object. More...
 
u32_t getMaxFieldOffsetLimit () const
 Get max field offset limit. More...
 
bool isFieldInsensitive () const
 Return true if its field limit is 0. More...
 
void setFieldInsensitive ()
 Set the memory object to be field insensitive. More...
 
void setFieldSensitive ()
 Set the memory object to be field sensitive (up to max field limit) More...
 
bool isBlackHoleObj () const
 Whether it is a black hole object. More...
 
u32_t getByteSizeOfObj () const
 Get the byte size of this object. More...
 
bool isConstantByteSize () const
 Check if byte size is a const value. More...
 
bool isFunction () const
 object attributes methods More...
 
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
 
bool isConstDataOrAggData () const
 
bool operator== (const MemObj &mem) const
 Operator overloading. More...
 
void destroy ()
 Clean up memory. More...
 

Private Attributes

ObjTypeInfotypeInfo
 Type information of this object. More...
 
const SVFValuerefVal
 The unique value of this symbol/variable. More...
 
SymID symId
 The unique id to represent this symbol. More...
 
const SVFBaseNodegNode
 

Friends

class SVFIRWriter
 
class SVFIRReader
 
class SVFIRBuilder
 

Detailed Description

Memory object symbols or MemObj (address-taken variables in LLVM-based languages)

Definition at line 381 of file SymbolTableInfo.h.

Constructor & Destructor Documentation

◆ MemObj()

MemObj::MemObj ( SymID  id,
ObjTypeInfo ti,
const SVFValue val = nullptr,
const SVFBaseNode node = nullptr 
)

Constructor.

Constructor of a memory object

Definition at line 377 of file SymbolTableInfo.cpp.

377  :
378  typeInfo(ti), refVal(val), symId(id), gNode(node)
379 {
380 }
const SVFValue * refVal
The unique value of this symbol/variable.
SymID symId
The unique id to represent this symbol.
const SVFBaseNode * gNode
ObjTypeInfo * typeInfo
Type information of this object.

◆ ~MemObj()

virtual SVF::MemObj::~MemObj ( )
inlinevirtual

Destructor.

Definition at line 402 of file SymbolTableInfo.h.

403  {
404  destroy();
405  }
void destroy()
Clean up memory.

Member Function Documentation

◆ destroy()

void MemObj::destroy ( )

Clean up memory.

Definition at line 423 of file SymbolTableInfo.cpp.

424 {
425  delete typeInfo;
426  typeInfo = nullptr;
427 }

◆ getByteSizeOfObj()

u32_t MemObj::getByteSizeOfObj ( ) const

Get the byte size of this object.

Definition at line 397 of file SymbolTableInfo.cpp.

398 {
399  return typeInfo->getByteSizeOfObj();
400 }
u32_t getByteSizeOfObj() const
Get the byte size of this object.

◆ getGNode()

const SVFBaseNode* SVF::MemObj::getGNode ( ) const
inline

Get the reference value to this object.

Definition at line 416 of file SymbolTableInfo.h.

417  {
418  return gNode;
419  }

◆ getId()

SymID SVF::MemObj::getId ( ) const
inline

Get the memory object id.

Definition at line 422 of file SymbolTableInfo.h.

423  {
424  return symId;
425  }

◆ getMaxFieldOffsetLimit()

u32_t MemObj::getMaxFieldOffsetLimit ( ) const

Get max field offset limit.

Definition at line 430 of file SymbolTableInfo.cpp.

431 {
433 }
u32_t getMaxFieldOffsetLimit()
Get max field offset limit.

◆ getNumOfElements()

u32_t MemObj::getNumOfElements ( ) const

Get the number of elements of this object.

Definition at line 391 of file SymbolTableInfo.cpp.

392 {
393  return typeInfo->getNumOfElements();
394 }
u32_t getNumOfElements() const
Get the number of elements of this object.

◆ getType()

const SVFType * MemObj::getType ( ) const

Get obj type.

Get obj type info.

Definition at line 416 of file SymbolTableInfo.cpp.

417 {
418  return typeInfo->getType();
419 }
const SVFType * getType() const
Get LLVM type.

◆ getValue()

const SVFValue* SVF::MemObj::getValue ( ) const
inline

Get the reference value to this object.

Definition at line 410 of file SymbolTableInfo.h.

411  {
412  return refVal;
413  }

◆ isArray()

bool MemObj::isArray ( ) const

Definition at line 477 of file SymbolTableInfo.cpp.

478 {
479  return typeInfo->isArray();
480 }

◆ isBlackHoleObj()

bool MemObj::isBlackHoleObj ( ) const

Whether it is a black hole object.

Whether it is a black hole object

Definition at line 385 of file SymbolTableInfo.cpp.

386 {
388 }
SymID getId() const
Get the memory object id.
static bool isBlkObj(NodeID id)

◆ isConstantArray()

bool MemObj::isConstantArray ( ) const

Definition at line 497 of file SymbolTableInfo.cpp.

498 {
499  return typeInfo->isConstantArray();
500 }

◆ isConstantByteSize()

bool MemObj::isConstantByteSize ( ) const

Check if byte size is a const value.

Check if byte size is static determined.

Definition at line 403 of file SymbolTableInfo.cpp.

404 {
405  return typeInfo->isConstantByteSize();
406 }
bool isConstantByteSize() const
Check if byte size is a const value.

◆ isConstantStruct()

bool MemObj::isConstantStruct ( ) const

Definition at line 492 of file SymbolTableInfo.cpp.

493 {
494  return typeInfo->isConstantStruct();
495 }

◆ isConstDataOrAggData()

bool MemObj::isConstDataOrAggData ( ) const

Definition at line 507 of file SymbolTableInfo.cpp.

508 {
509  return typeInfo->isConstDataOrAggData();
510 }

◆ isConstDataOrConstGlobal()

bool MemObj::isConstDataOrConstGlobal ( ) const

Definition at line 502 of file SymbolTableInfo.cpp.

503 {
505 }
bool isConstDataOrConstGlobal()

◆ isFieldInsensitive()

bool MemObj::isFieldInsensitive ( ) const

Return true if its field limit is 0.

Definition at line 436 of file SymbolTableInfo.cpp.

437 {
438  return getMaxFieldOffsetLimit() == 0;
439 }
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.

◆ isFunction()

bool MemObj::isFunction ( ) const

object attributes methods

Definition at line 447 of file SymbolTableInfo.cpp.

448 {
449  return typeInfo->isFunction();
450 }
bool isFunction()
Object attributes.

◆ isGlobalObj()

bool MemObj::isGlobalObj ( ) const

Definition at line 452 of file SymbolTableInfo.cpp.

453 {
454  return typeInfo->isGlobalObj();
455 }

◆ isHeap()

bool MemObj::isHeap ( ) const

Definition at line 467 of file SymbolTableInfo.cpp.

468 {
469  return typeInfo->isHeap();
470 }

◆ isStack()

bool MemObj::isStack ( ) const

Definition at line 462 of file SymbolTableInfo.cpp.

463 {
464  return typeInfo->isStack();
465 }

◆ isStaticObj()

bool MemObj::isStaticObj ( ) const

Definition at line 457 of file SymbolTableInfo.cpp.

458 {
459  return typeInfo->isStaticObj();
460 }

◆ isStruct()

bool MemObj::isStruct ( ) const

Definition at line 472 of file SymbolTableInfo.cpp.

473 {
474  return typeInfo->isStruct();
475 }

◆ isVarArray()

bool MemObj::isVarArray ( ) const

Definition at line 487 of file SymbolTableInfo.cpp.

488 {
489  return typeInfo->isVarArray();
490 }

◆ isVarStruct()

bool MemObj::isVarStruct ( ) const

Definition at line 482 of file SymbolTableInfo.cpp.

483 {
484  return typeInfo->isVarStruct();
485 }

◆ operator==()

bool SVF::MemObj::operator== ( const MemObj mem) const
inline

Operator overloading.

Definition at line 476 of file SymbolTableInfo.h.

477  {
478  return getValue() == mem.getValue();
479  }
const SVFValue * getValue() const
Get the reference value to this object.

◆ setFieldInsensitive()

void MemObj::setFieldInsensitive ( )

Set the memory object to be field insensitive.

Definition at line 442 of file SymbolTableInfo.cpp.

443 {
445 }
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.

◆ setFieldSensitive()

void MemObj::setFieldSensitive ( )

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

Set mem object to be field sensitive (up to maximum field limit)

Definition at line 368 of file SymbolTableInfo.cpp.

◆ setNumOfElements()

void MemObj::setNumOfElements ( u32_t  num)

Set the number of elements of this object.

Definition at line 410 of file SymbolTableInfo.cpp.

411 {
412  return typeInfo->setNumOfElements(num);
413 }
void setNumOfElements(u32_t num)
Set the number of elements of this object.

◆ toString()

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

Definition at line 513 of file SymbolTableInfo.cpp.

514 {
515  std::string str;
516  std::stringstream rawstr(str);
517  rawstr << "MemObj : " << getId() << getValue()->toString() << "\n";
518  return rawstr.str();
519 }
const char *const string
Definition: cJSON.h:172
std::string toString() const
Needs to be implemented by a SVF front end.
Definition: LLVMUtil.cpp:663

Friends And Related Function Documentation

◆ SVFIRBuilder

friend class SVFIRBuilder
friend

Definition at line 385 of file SymbolTableInfo.h.

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 384 of file SymbolTableInfo.h.

◆ SVFIRWriter

friend class SVFIRWriter
friend

Definition at line 383 of file SymbolTableInfo.h.

Member Data Documentation

◆ gNode

const SVFBaseNode* SVF::MemObj::gNode
private

Definition at line 395 of file SymbolTableInfo.h.

◆ refVal

const SVFValue* SVF::MemObj::refVal
private

The unique value of this symbol/variable.

Definition at line 391 of file SymbolTableInfo.h.

◆ symId

SymID SVF::MemObj::symId
private

The unique id to represent this symbol.

Definition at line 393 of file SymbolTableInfo.h.

◆ typeInfo

ObjTypeInfo* SVF::MemObj::typeInfo
private

Type information of this object.

Definition at line 389 of file SymbolTableInfo.h.


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