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 <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 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.
 
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 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 SymbolTableBuilder
 
class GraphDBClient
 

Detailed Description

Type Info of an abstract memory object

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

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

Constructor & Destructor Documentation

◆ ObjTypeInfo()

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

Constructors.

Definition at line 86 of file ObjTypeInfo.h.

86 : type(t), flags(0), maxOffsetLimit(max), elemNum(max)
87 {
88 assert(t && "no type information for this object?");
89 }
const SVFType * type
SVF type.
Definition ObjTypeInfo.h:65
u32_t elemNum
Size of the object or number of elements.
Definition ObjTypeInfo.h:73
u32_t flags
Type flags.
Definition ObjTypeInfo.h:67
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~ObjTypeInfo()

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

Destructor.

Definition at line 92 of file ObjTypeInfo.h.

93 {
94 }

Member Function Documentation

◆ getByteSizeOfObj()

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

Get the byte size of this object.

Definition at line 128 of file ObjTypeInfo.h.

129 {
130 assert(isConstantByteSize() && "This Obj's byte size is not constant.");
131 return byteSize;
132 }
bool isConstantByteSize() const
Check if byte size is a const value.
u32_t byteSize
Byte size of object.
Definition ObjTypeInfo.h:76

◆ getFlag()

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

Definition at line 152 of file ObjTypeInfo.h.

153 {
154 return flags;
155 }

◆ getMaxFieldOffsetLimit()

u32_t SVF::ObjTypeInfo::getMaxFieldOffsetLimit ( )
inline

Get max field offset limit.

Definition at line 103 of file ObjTypeInfo.h.

104 {
105 return maxOffsetLimit;
106 }

◆ getNumOfElements()

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

Get the number of elements of this object.

Definition at line 122 of file ObjTypeInfo.h.

123 {
124 return elemNum;
125 }

◆ getType()

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

Get LLVM type.

Definition at line 97 of file ObjTypeInfo.h.

98 {
99 return type;
100 }

◆ hasFlag()

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

Definition at line 156 of file ObjTypeInfo.h.

157 {
158 return (flags & mask) == mask;
159 }

◆ isArray()

bool SVF::ObjTypeInfo::isArray ( )
inline

Definition at line 209 of file ObjTypeInfo.h.

210 {
212 }
bool hasFlag(MEMTYPE mask)

◆ isConstantArray()

bool SVF::ObjTypeInfo::isConstantArray ( )
inline

Definition at line 205 of file ObjTypeInfo.h.

206 {
207 return hasFlag(CONST_ARRAY_OBJ);
208 }

◆ isConstantByteSize()

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

Check if byte size is a const value.

Definition at line 141 of file ObjTypeInfo.h.

142 {
143 return byteSize != 0;
144 }

◆ isConstantStruct()

bool SVF::ObjTypeInfo::isConstantStruct ( )
inline

Definition at line 193 of file ObjTypeInfo.h.

194 {
196 }

◆ isConstDataOrAggData()

bool SVF::ObjTypeInfo::isConstDataOrAggData ( )
inline

Definition at line 217 of file ObjTypeInfo.h.

218 {
219 return hasFlag(CONST_DATA);
220 }

◆ isConstDataOrConstGlobal()

bool SVF::ObjTypeInfo::isConstDataOrConstGlobal ( )
inline

Definition at line 213 of file ObjTypeInfo.h.

214 {
216 }

◆ isFunction()

bool SVF::ObjTypeInfo::isFunction ( )
inline

Object attributes.

Definition at line 164 of file ObjTypeInfo.h.

165 {
166 return hasFlag(FUNCTION_OBJ);
167 }

◆ isGlobalObj()

bool SVF::ObjTypeInfo::isGlobalObj ( )
inline

Definition at line 168 of file ObjTypeInfo.h.

169 {
170 return hasFlag(GLOBVAR_OBJ);
171 }

◆ isHeap()

bool SVF::ObjTypeInfo::isHeap ( )
inline

Definition at line 180 of file ObjTypeInfo.h.

181 {
182 return hasFlag(HEAP_OBJ);
183 }

◆ isStack()

bool SVF::ObjTypeInfo::isStack ( )
inline

Definition at line 176 of file ObjTypeInfo.h.

177 {
178 return hasFlag(STACK_OBJ);
179 }

◆ isStaticObj()

bool SVF::ObjTypeInfo::isStaticObj ( )
inline

Definition at line 172 of file ObjTypeInfo.h.

173 {
174 return hasFlag(STATIC_OBJ);
175 }

◆ isStruct()

bool SVF::ObjTypeInfo::isStruct ( )
inline

Definition at line 197 of file ObjTypeInfo.h.

198 {
200 }

◆ isVarArray()

bool SVF::ObjTypeInfo::isVarArray ( )
inline

Definition at line 201 of file ObjTypeInfo.h.

202 {
203 return hasFlag(VAR_ARRAY_OBJ);
204 }

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

190 {
191 return hasFlag(VAR_STRUCT_OBJ);
192 }

◆ resetTypeForHeapStaticObj()

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

Definition at line 78 of file ObjTypeInfo.h.

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

◆ setByteSizeOfObj()

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

Set the byte size of this object.

Definition at line 135 of file ObjTypeInfo.h.

136 {
137 byteSize = size;
138 }

◆ setFlag()

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

Flag for this object type.

Definition at line 148 of file ObjTypeInfo.h.

149 {
150 flags |= mask;
151 }

◆ setMaxFieldOffsetLimit()

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

Get max field offset limit.

Definition at line 109 of file ObjTypeInfo.h.

110 {
112 }

◆ setNumOfElements()

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

Set the number of elements of this object.

Definition at line 115 of file ObjTypeInfo.h.

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

Friends And Related Symbol Documentation

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 45 of file ObjTypeInfo.h.

◆ SymbolTableBuilder

Definition at line 44 of file ObjTypeInfo.h.

Member Data Documentation

◆ byteSize

u32_t SVF::ObjTypeInfo::byteSize
private

Byte size of object.

Definition at line 76 of file ObjTypeInfo.h.

◆ elemNum

u32_t SVF::ObjTypeInfo::elemNum
private

Size of the object or number of elements.

Definition at line 73 of file ObjTypeInfo.h.

◆ flags

u32_t SVF::ObjTypeInfo::flags
private

Type flags.

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

◆ type

const SVFType* SVF::ObjTypeInfo::type
private

SVF type.

Definition at line 65 of file ObjTypeInfo.h.


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