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

#include <SymbolTableInfo.h>

Public Types

enum  MEMTYPE {
  FUNCTION_OBJ = 0x1 , GLOBVAR_OBJ = 0x2 , STATIC_OBJ = 0x4 , STACK_OBJ = 0x8 ,
  HEAP_OBJ = 0x10 , VAR_STRUCT_OBJ = 0x20 , VAR_ARRAY_OBJ = 0x40 , CONST_STRUCT_OBJ = 0x80 ,
  CONST_ARRAY_OBJ = 0x100 , CONST_GLOBAL_OBJ = 0x200 , CONST_DATA = 0x400
}
 

Public Member Functions

 ObjTypeInfo (const SVFType *t, u32_t max)
 Constructors.
 
virtual ~ObjTypeInfo ()
 Destructor.
 
const SVFTypegetType () const
 Get LLVM type.
 
u32_t getMaxFieldOffsetLimit ()
 Get max field offset limit.
 
void setMaxFieldOffsetLimit (u32_t limit)
 Get max field offset limit.
 
void setNumOfElements (u32_t num)
 Set the number of elements of this object.
 
u32_t getNumOfElements () const
 Get the number of elements of this object.
 
u32_t getByteSizeOfObj () const
 Get the byte size of this object.
 
void setByteSizeOfObj (u32_t size)
 Set the byte size of this object.
 
bool isConstantByteSize () const
 Check if byte size is a const value.
 
void setFlag (MEMTYPE mask)
 Flag for this object type.
 
bool hasFlag (MEMTYPE mask)
 
bool isFunction ()
 Object attributes.
 
bool isGlobalObj ()
 
bool isStaticObj ()
 
bool isStack ()
 
bool isHeap ()
 
bool isVarStruct ()
 
bool isConstantStruct ()
 
bool isStruct ()
 
bool isVarArray ()
 
bool isConstantArray ()
 
bool isArray ()
 
bool isConstDataOrConstGlobal ()
 
bool isConstDataOrAggData ()
 

Private Member Functions

void resetTypeForHeapStaticObj (const SVFType *type)
 

Private Attributes

const SVFTypetype
 SVF type.
 
u32_t flags
 Type flags.
 
u32_t maxOffsetLimit
 
u32_t elemNum
 Size of the object or number of elements.
 
u32_t byteSize
 Byte size of object.
 

Friends

class SVFIRWriter
 
class SVFIRReader
 
class SymbolTableBuilder
 

Detailed Description

Type Info of an abstract memory object

Definition at line 488 of file SymbolTableInfo.h.

Member Enumeration Documentation

◆ MEMTYPE

Enumerator
FUNCTION_OBJ 
GLOBVAR_OBJ 
STATIC_OBJ 
STACK_OBJ 
HEAP_OBJ 
VAR_STRUCT_OBJ 
VAR_ARRAY_OBJ 
CONST_STRUCT_OBJ 
CONST_ARRAY_OBJ 
CONST_GLOBAL_OBJ 
CONST_DATA 

Definition at line 495 of file SymbolTableInfo.h.

496 {
497 FUNCTION_OBJ = 0x1, // object is a function
498 GLOBVAR_OBJ = 0x2, // object is a global variable
499 STATIC_OBJ = 0x4, // object is a static variable allocated before main
500 STACK_OBJ = 0x8, // object is a stack variable
501 HEAP_OBJ = 0x10, // object is a heap variable
502 VAR_STRUCT_OBJ = 0x20, // object contains struct
503 VAR_ARRAY_OBJ = 0x40, // object contains array
504 CONST_STRUCT_OBJ = 0x80, // constant struct
505 CONST_ARRAY_OBJ = 0x100, // constant array
506 CONST_GLOBAL_OBJ = 0x200, // global constant object
507 CONST_DATA = 0x400, // constant object str e.g. 5, 10, 1.0
508 } MEMTYPE;

Constructor & Destructor Documentation

◆ ObjTypeInfo()

ObjTypeInfo::ObjTypeInfo ( const SVFType t,
u32_t  max 
)

Constructors.

Definition at line 45 of file SymbolTableInfo.cpp.

45 : type(t), flags(0), maxOffsetLimit(max), elemNum(max)
46{
47 assert(t && "no type information for this object?");
48}
const SVFType * type
SVF type.
u32_t elemNum
Size of the object or number of elements.
u32_t flags
Type flags.
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~ObjTypeInfo()

virtual SVF::ObjTypeInfo::~ObjTypeInfo ( )
inlinevirtual

Destructor.

Definition at line 532 of file SymbolTableInfo.h.

533 {
534 }

Member Function Documentation

◆ getByteSizeOfObj()

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

Get the byte size of this object.

Definition at line 568 of file SymbolTableInfo.h.

569 {
570 assert(isConstantByteSize() && "This Obj's byte size is not constant.");
571 return byteSize;
572 }
bool isConstantByteSize() const
Check if byte size is a const value.
u32_t byteSize
Byte size of object.

◆ getMaxFieldOffsetLimit()

u32_t SVF::ObjTypeInfo::getMaxFieldOffsetLimit ( )
inline

Get max field offset limit.

Definition at line 543 of file SymbolTableInfo.h.

544 {
545 return maxOffsetLimit;
546 }

◆ getNumOfElements()

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

Get the number of elements of this object.

Definition at line 562 of file SymbolTableInfo.h.

563 {
564 return elemNum;
565 }

◆ getType()

const SVFType * SVF::ObjTypeInfo::getType ( ) const
inline

Get LLVM type.

Definition at line 537 of file SymbolTableInfo.h.

538 {
539 return type;
540 }

◆ hasFlag()

bool SVF::ObjTypeInfo::hasFlag ( MEMTYPE  mask)
inline

Definition at line 592 of file SymbolTableInfo.h.

593 {
594 return (flags & mask) == mask;
595 }

◆ isArray()

bool SVF::ObjTypeInfo::isArray ( )
inline

Definition at line 645 of file SymbolTableInfo.h.

646 {
648 }
bool hasFlag(MEMTYPE mask)

◆ isConstantArray()

bool SVF::ObjTypeInfo::isConstantArray ( )
inline

Definition at line 641 of file SymbolTableInfo.h.

642 {
643 return hasFlag(CONST_ARRAY_OBJ);
644 }

◆ isConstantByteSize()

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

Check if byte size is a const value.

Definition at line 581 of file SymbolTableInfo.h.

582 {
583 return byteSize != 0;
584 }

◆ isConstantStruct()

bool SVF::ObjTypeInfo::isConstantStruct ( )
inline

Definition at line 629 of file SymbolTableInfo.h.

630 {
632 }

◆ isConstDataOrAggData()

bool SVF::ObjTypeInfo::isConstDataOrAggData ( )
inline

Definition at line 653 of file SymbolTableInfo.h.

654 {
655 return hasFlag(CONST_DATA);
656 }

◆ isConstDataOrConstGlobal()

bool SVF::ObjTypeInfo::isConstDataOrConstGlobal ( )
inline

Definition at line 649 of file SymbolTableInfo.h.

650 {
652 }

◆ isFunction()

bool SVF::ObjTypeInfo::isFunction ( )
inline

Object attributes.

Definition at line 600 of file SymbolTableInfo.h.

601 {
602 return hasFlag(FUNCTION_OBJ);
603 }

◆ isGlobalObj()

bool SVF::ObjTypeInfo::isGlobalObj ( )
inline

Definition at line 604 of file SymbolTableInfo.h.

605 {
606 return hasFlag(GLOBVAR_OBJ);
607 }

◆ isHeap()

bool SVF::ObjTypeInfo::isHeap ( )
inline

Definition at line 616 of file SymbolTableInfo.h.

617 {
618 return hasFlag(HEAP_OBJ);
619 }

◆ isStack()

bool SVF::ObjTypeInfo::isStack ( )
inline

Definition at line 612 of file SymbolTableInfo.h.

613 {
614 return hasFlag(STACK_OBJ);
615 }

◆ isStaticObj()

bool SVF::ObjTypeInfo::isStaticObj ( )
inline

Definition at line 608 of file SymbolTableInfo.h.

609 {
610 return hasFlag(STATIC_OBJ);
611 }

◆ isStruct()

bool SVF::ObjTypeInfo::isStruct ( )
inline

Definition at line 633 of file SymbolTableInfo.h.

634 {
636 }

◆ isVarArray()

bool SVF::ObjTypeInfo::isVarArray ( )
inline

Definition at line 637 of file SymbolTableInfo.h.

638 {
639 return hasFlag(VAR_ARRAY_OBJ);
640 }

◆ isVarStruct()

bool SVF::ObjTypeInfo::isVarStruct ( )
inline

Object attributes (noted that an object can be a nested compound types) e.g. both isStruct and isArray can return true

Definition at line 625 of file SymbolTableInfo.h.

626 {
627 return hasFlag(VAR_STRUCT_OBJ);
628 }

◆ resetTypeForHeapStaticObj()

void ObjTypeInfo::resetTypeForHeapStaticObj ( const SVFType type)
private

Definition at line 51 of file SymbolTableInfo.cpp.

52{
53 assert((isStaticObj() || isHeap()) && "can only reset the inferred type for heap and static objects!");
54 type = t;
55}

◆ setByteSizeOfObj()

void SVF::ObjTypeInfo::setByteSizeOfObj ( u32_t  size)
inline

Set the byte size of this object.

Definition at line 575 of file SymbolTableInfo.h.

576 {
577 byteSize = size;
578 }

◆ setFlag()

void SVF::ObjTypeInfo::setFlag ( MEMTYPE  mask)
inline

Flag for this object type.

Definition at line 588 of file SymbolTableInfo.h.

589 {
590 flags |= mask;
591 }

◆ setMaxFieldOffsetLimit()

void SVF::ObjTypeInfo::setMaxFieldOffsetLimit ( u32_t  limit)
inline

Get max field offset limit.

Definition at line 549 of file SymbolTableInfo.h.

550 {
552 }

◆ setNumOfElements()

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

Set the number of elements of this object.

Definition at line 555 of file SymbolTableInfo.h.

556 {
557 elemNum = num;
559 }
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.

Friends And Related Symbol Documentation

◆ SVFIRReader

Definition at line 491 of file SymbolTableInfo.h.

◆ SVFIRWriter

Definition at line 490 of file SymbolTableInfo.h.

◆ SymbolTableBuilder

Definition at line 492 of file SymbolTableInfo.h.

Member Data Documentation

◆ byteSize

u32_t SVF::ObjTypeInfo::byteSize
private

Byte size of object.

Definition at line 523 of file SymbolTableInfo.h.

◆ elemNum

u32_t SVF::ObjTypeInfo::elemNum
private

Size of the object or number of elements.

Definition at line 520 of file SymbolTableInfo.h.

◆ flags

u32_t SVF::ObjTypeInfo::flags
private

Type flags.

Definition at line 514 of file SymbolTableInfo.h.

◆ maxOffsetLimit

u32_t SVF::ObjTypeInfo::maxOffsetLimit
private

Max offset for flexible field sensitive analysis maximum number of field object can be created minimum number is 0 (field insensitive analysis)

Definition at line 518 of file SymbolTableInfo.h.

◆ type

const SVFType* SVF::ObjTypeInfo::type
private

SVF type.

Definition at line 512 of file SymbolTableInfo.h.


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