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

#include <ObjTypeInfo.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 SVFType * getType () 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.
u32_t getFlag () const
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 *t)

Private Attributes

const SVFType * type
 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 SymbolTableBuilder
class GraphDBClient

Detailed Description

Type Info of an abstract memory object

Definition at line 43 of file ObjTypeInfo.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 49 of file ObjTypeInfo.h.

50 {
51 FUNCTION_OBJ = 0x1, // object is a function
52 GLOBVAR_OBJ = 0x2, // object is a global variable
53 STATIC_OBJ = 0x4, // object is a static variable allocated before main
54 STACK_OBJ = 0x8, // object is a stack variable
55 HEAP_OBJ = 0x10, // object is a heap variable
56 VAR_STRUCT_OBJ = 0x20, // object contains struct
57 VAR_ARRAY_OBJ = 0x40, // object contains array
58 CONST_STRUCT_OBJ = 0x80, // constant struct
59 CONST_ARRAY_OBJ = 0x100, // constant array
60 CONST_GLOBAL_OBJ = 0x200, // global constant object
61 CONST_DATA = 0x400, // constant object str e.g. 5, 10, 1.0
62 } MEMTYPE;

Constructor & Destructor Documentation

◆ ObjTypeInfo()

SVF::ObjTypeInfo::ObjTypeInfo ( const SVFType * t,
u32_t max )
inline

Constructors.

Definition at line 87 of file ObjTypeInfo.h.

88 : type(t), flags(0), maxOffsetLimit(max), elemNum(max), byteSize(0)
89 {
90 assert(t && "no type information for this object?");
91 }
const SVFType * type
SVF type.
Definition ObjTypeInfo.h:66
u32_t elemNum
Size of the object or number of elements.
Definition ObjTypeInfo.h:74
u32_t byteSize
Byte size of object.
Definition ObjTypeInfo.h:77
u32_t flags
Type flags.
Definition ObjTypeInfo.h:68

◆ ~ObjTypeInfo()

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

Destructor.

Definition at line 94 of file ObjTypeInfo.h.

95 {
96 }

Member Function Documentation

◆ getByteSizeOfObj()

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

Get the byte size of this object.

Definition at line 130 of file ObjTypeInfo.h.

131 {
132 assert(isConstantByteSize() && "This Obj's byte size is not constant.");
133 return byteSize;
134 }
bool isConstantByteSize() const
Check if byte size is a const value.

◆ getFlag()

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

Definition at line 154 of file ObjTypeInfo.h.

155 {
156 return flags;
157 }

◆ getMaxFieldOffsetLimit()

u32_t SVF::ObjTypeInfo::getMaxFieldOffsetLimit ( )
inline

Get max field offset limit.

Definition at line 105 of file ObjTypeInfo.h.

106 {
107 return maxOffsetLimit;
108 }

◆ getNumOfElements()

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

Get the number of elements of this object.

Definition at line 124 of file ObjTypeInfo.h.

125 {
126 return elemNum;
127 }

◆ getType()

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

Get LLVM type.

Definition at line 99 of file ObjTypeInfo.h.

100 {
101 return type;
102 }

◆ hasFlag()

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

Definition at line 158 of file ObjTypeInfo.h.

159 {
160 return (flags & mask) == mask;
161 }

◆ isArray()

bool SVF::ObjTypeInfo::isArray ( )
inline

Definition at line 211 of file ObjTypeInfo.h.

212 {
214 }
bool hasFlag(MEMTYPE mask)

◆ isConstantArray()

bool SVF::ObjTypeInfo::isConstantArray ( )
inline

Definition at line 207 of file ObjTypeInfo.h.

208 {
209 return hasFlag(CONST_ARRAY_OBJ);
210 }

◆ isConstantByteSize()

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

Check if byte size is a const value.

Definition at line 143 of file ObjTypeInfo.h.

144 {
145 return byteSize != 0;
146 }

◆ isConstantStruct()

bool SVF::ObjTypeInfo::isConstantStruct ( )
inline

Definition at line 195 of file ObjTypeInfo.h.

196 {
198 }

◆ isConstDataOrAggData()

bool SVF::ObjTypeInfo::isConstDataOrAggData ( )
inline

Definition at line 219 of file ObjTypeInfo.h.

220 {
221 return hasFlag(CONST_DATA);
222 }

◆ isConstDataOrConstGlobal()

bool SVF::ObjTypeInfo::isConstDataOrConstGlobal ( )
inline

Definition at line 215 of file ObjTypeInfo.h.

216 {
218 }

◆ isFunction()

bool SVF::ObjTypeInfo::isFunction ( )
inline

Object attributes.

Definition at line 166 of file ObjTypeInfo.h.

167 {
168 return hasFlag(FUNCTION_OBJ);
169 }

◆ isGlobalObj()

bool SVF::ObjTypeInfo::isGlobalObj ( )
inline

Definition at line 170 of file ObjTypeInfo.h.

171 {
172 return hasFlag(GLOBVAR_OBJ);
173 }

◆ isHeap()

bool SVF::ObjTypeInfo::isHeap ( )
inline

Definition at line 182 of file ObjTypeInfo.h.

183 {
184 return hasFlag(HEAP_OBJ);
185 }

◆ isStack()

bool SVF::ObjTypeInfo::isStack ( )
inline

Definition at line 178 of file ObjTypeInfo.h.

179 {
180 return hasFlag(STACK_OBJ);
181 }

◆ isStaticObj()

bool SVF::ObjTypeInfo::isStaticObj ( )
inline

Definition at line 174 of file ObjTypeInfo.h.

175 {
176 return hasFlag(STATIC_OBJ);
177 }

◆ isStruct()

bool SVF::ObjTypeInfo::isStruct ( )
inline

Definition at line 199 of file ObjTypeInfo.h.

200 {
202 }

◆ isVarArray()

bool SVF::ObjTypeInfo::isVarArray ( )
inline

Definition at line 203 of file ObjTypeInfo.h.

204 {
205 return hasFlag(VAR_ARRAY_OBJ);
206 }

◆ 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 191 of file ObjTypeInfo.h.

192 {
193 return hasFlag(VAR_STRUCT_OBJ);
194 }

◆ resetTypeForHeapStaticObj()

void SVF::ObjTypeInfo::resetTypeForHeapStaticObj ( const SVFType * t)
inlineprivate

Definition at line 79 of file ObjTypeInfo.h.

80 {
81 assert((isStaticObj() || isHeap()) && "can only reset the inferred type for heap and static objects!");
82 type = t;
83 }

◆ setByteSizeOfObj()

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

Set the byte size of this object.

Definition at line 137 of file ObjTypeInfo.h.

138 {
139 byteSize = size;
140 }

◆ setFlag()

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

Flag for this object type.

Definition at line 150 of file ObjTypeInfo.h.

151 {
152 flags |= mask;
153 }

◆ setMaxFieldOffsetLimit()

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

Get max field offset limit.

Definition at line 111 of file ObjTypeInfo.h.

112 {
113 maxOffsetLimit = limit;
114 }

◆ setNumOfElements()

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

Set the number of elements of this object.

Definition at line 117 of file ObjTypeInfo.h.

118 {
119 elemNum = num;
121 }
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 46 of file ObjTypeInfo.h.

◆ SymbolTableBuilder

friend class SymbolTableBuilder
friend

Definition at line 45 of file ObjTypeInfo.h.

Member Data Documentation

◆ byteSize

u32_t SVF::ObjTypeInfo::byteSize
private

Byte size of object.

Definition at line 77 of file ObjTypeInfo.h.

◆ elemNum

u32_t SVF::ObjTypeInfo::elemNum
private

Size of the object or number of elements.

Definition at line 74 of file ObjTypeInfo.h.

◆ flags

u32_t SVF::ObjTypeInfo::flags
private

Type flags.

Definition at line 68 of file ObjTypeInfo.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 72 of file ObjTypeInfo.h.

◆ type

const SVFType* SVF::ObjTypeInfo::type
private

SVF type.

Definition at line 66 of file ObjTypeInfo.h.


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