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

#include <SVFType.h>

Public Member Functions

 StInfo ()=delete
 Max field limit.
 StInfo (const StInfo &st)=delete
void operator= (const StInfo &)=delete
 StInfo (u32_t s)
 Constructor.
 ~StInfo ()=default
 Destructor.
const SVFType * getOriginalElemType (u32_t fldIdx) const
std::vector< u32_t > & getFlattenedFieldIdxVec ()
std::vector< u32_t > & getFlattenedElemIdxVec ()
std::vector< const SVFType * > & getFlattenElementTypes ()
std::vector< const SVFType * > & getFlattenFieldTypes ()
const std::vector< u32_t > & getFlattenedFieldIdxVec () const
const std::vector< u32_t > & getFlattenedElemIdxVec () const
const std::vector< const SVFType * > & getFlattenElementTypes () const
const std::vector< const SVFType * > & getFlattenFieldTypes () const
void addFldWithType (u32_t fldIdx, const SVFType *type, u32_t elemIdx)
 Add field index and element index and their corresponding type.
void setNumOfFieldsAndElems (u32_t nf, u32_t ne)
 Set number of fields and elements of an aggregate.
u32_t getNumOfFlattenElements () const
 Return number of elements after flattening (including array elements).
u32_t getNumOfFlattenFields () const
 Return the number of fields after flattening (ignoring array elements).
u32_t getStride () const
 Return the stride.

Protected Member Functions

 StInfo (u32_t id, std::vector< u32_t > fldIdxVec, std::vector< u32_t > elemIdxVec, Map< u32_t, const SVFType * > fldIdx2TypeMap, std::vector< const SVFType * > finfo, u32_t stride, u32_t numOfFlattenElements, u32_t numOfFlattenFields, std::vector< const SVFType * > flattenElementTypes)
const u32_t getStinfoId () const
const Map< u32_t, const SVFType * > & getFldIdx2TypeMap () const
void setStinfoId (u32_t id)

Private Attributes

u32_t StInfoId
std::vector< u32_t > fldIdxVec
 flattened field indices of a struct (ignoring arrays)
std::vector< u32_t > elemIdxVec
Map< u32_t, const SVFType * > fldIdx2TypeMap
 Types of all fields of a struct.
std::vector< const SVFType * > finfo
 All field infos after flattening a struct.
u32_t stride
u32_t numOfFlattenElements
 number of elements after flattening (including array elements)
u32_t numOfFlattenFields
 number of fields after flattening (ignoring array elements)
std::vector< const SVFType * > flattenElementTypes
 Type vector of fields.

Friends

class GraphDBClient
class IRGraph

Detailed Description

Flattened type information of StructType, ArrayType and SingleValueType

Definition at line 44 of file SVFType.h.

Constructor & Destructor Documentation

◆ StInfo() [1/4]

SVF::StInfo::StInfo ( u32_t id,
std::vector< u32_t > fldIdxVec,
std::vector< u32_t > elemIdxVec,
Map< u32_t, const SVFType * > fldIdx2TypeMap,
std::vector< const SVFType * > finfo,
u32_t stride,
u32_t numOfFlattenElements,
u32_t numOfFlattenFields,
std::vector< const SVFType * > flattenElementTypes )
inlineprotected

Definition at line 51 of file SVFType.h.

55 {
56
57 }
u32_t stride
Definition SVFType.h:87
std::vector< u32_t > fldIdxVec
flattened field indices of a struct (ignoring arrays)
Definition SVFType.h:77
u32_t numOfFlattenElements
number of elements after flattening (including array elements)
Definition SVFType.h:89
std::vector< u32_t > elemIdxVec
Definition SVFType.h:80
u32_t StInfoId
Definition SVFType.h:75
u32_t numOfFlattenFields
number of fields after flattening (ignoring array elements)
Definition SVFType.h:91
std::vector< const SVFType * > flattenElementTypes
Type vector of fields.
Definition SVFType.h:93
Map< u32_t, const SVFType * > fldIdx2TypeMap
Types of all fields of a struct.
Definition SVFType.h:82
std::vector< const SVFType * > finfo
All field infos after flattening a struct.
Definition SVFType.h:84

◆ StInfo() [2/4]

SVF::StInfo::StInfo ( )
delete

Max field limit.

◆ StInfo() [3/4]

SVF::StInfo::StInfo ( const StInfo & st)
delete

◆ StInfo() [4/4]

SVF::StInfo::StInfo ( u32_t s)
inlineexplicit

Constructor.

Definition at line 102 of file SVFType.h.

104 {
105 }

◆ ~StInfo()

SVF::StInfo::~StInfo ( )
default

Destructor.

Member Function Documentation

◆ addFldWithType()

void StInfo::addFldWithType ( u32_t fldIdx,
const SVFType * type,
u32_t elemIdx )

Add field index and element index and their corresponding type.

Add field (index and offset) with its corresponding type.

Definition at line 58 of file SVFValue.cpp.

59{
60 fldIdxVec.push_back(fldIdx);
61 elemIdxVec.push_back(elemIdx);
62 fldIdx2TypeMap[fldIdx] = type;
63}
newitem type
Definition cJSON.cpp:2739

◆ getFlattenedElemIdxVec() [1/2]

std::vector< u32_t > & SVF::StInfo::getFlattenedElemIdxVec ( )
inline

Definition at line 123 of file SVFType.h.

124 {
125 return elemIdxVec;
126 }

◆ getFlattenedElemIdxVec() [2/2]

const std::vector< u32_t > & SVF::StInfo::getFlattenedElemIdxVec ( ) const
inline

Definition at line 139 of file SVFType.h.

140 {
141 return elemIdxVec;
142 }

◆ getFlattenedFieldIdxVec() [1/2]

std::vector< u32_t > & SVF::StInfo::getFlattenedFieldIdxVec ( )
inline

Definition at line 119 of file SVFType.h.

120 {
121 return fldIdxVec;
122 }

◆ getFlattenedFieldIdxVec() [2/2]

const std::vector< u32_t > & SVF::StInfo::getFlattenedFieldIdxVec ( ) const
inline

Definition at line 135 of file SVFType.h.

136 {
137 return fldIdxVec;
138 }

◆ getFlattenElementTypes() [1/2]

std::vector< const SVFType * > & SVF::StInfo::getFlattenElementTypes ( )
inline

Definition at line 127 of file SVFType.h.

128 {
129 return flattenElementTypes;
130 }

◆ getFlattenElementTypes() [2/2]

const std::vector< const SVFType * > & SVF::StInfo::getFlattenElementTypes ( ) const
inline

Definition at line 143 of file SVFType.h.

144 {
145 return flattenElementTypes;
146 }

◆ getFlattenFieldTypes() [1/2]

std::vector< const SVFType * > & SVF::StInfo::getFlattenFieldTypes ( )
inline

Definition at line 131 of file SVFType.h.

132 {
133 return finfo;
134 }

◆ getFlattenFieldTypes() [2/2]

const std::vector< const SVFType * > & SVF::StInfo::getFlattenFieldTypes ( ) const
inline

Definition at line 147 of file SVFType.h.

148 {
149 return finfo;
150 }

◆ getFldIdx2TypeMap()

const Map< u32_t, const SVFType * > & SVF::StInfo::getFldIdx2TypeMap ( ) const
inlineprotected

Definition at line 64 of file SVFType.h.

65 {
66 return fldIdx2TypeMap;
67 }

◆ getNumOfFlattenElements()

u32_t SVF::StInfo::getNumOfFlattenElements ( ) const
inline

Return number of elements after flattening (including array elements).

Definition at line 164 of file SVFType.h.

165 {
167 }

◆ getNumOfFlattenFields()

u32_t SVF::StInfo::getNumOfFlattenFields ( ) const
inline

Return the number of fields after flattening (ignoring array elements).

Definition at line 170 of file SVFType.h.

171 {
172 return numOfFlattenFields;
173 }

◆ getOriginalElemType()

const SVFType * StInfo::getOriginalElemType ( u32_t fldIdx) const

struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;

OriginalFieldType of b with field_idx 1 : Struct A FlatternedFieldType of b with field_idx 1 : int

Definition at line 69 of file SVFValue.cpp.

70{
71 Map<u32_t, const SVFType*>::const_iterator it = fldIdx2TypeMap.find(fldIdx);
72 if(it!=fldIdx2TypeMap.end())
73 return it->second;
74 return nullptr;
75}

◆ getStinfoId()

const u32_t SVF::StInfo::getStinfoId ( ) const
inlineprotected

Definition at line 59 of file SVFType.h.

60 {
61 return StInfoId;
62 }

◆ getStride()

u32_t SVF::StInfo::getStride ( ) const
inline

Return the stride.

Definition at line 175 of file SVFType.h.

176 {
177 return stride;
178 }

◆ operator=()

void SVF::StInfo::operator= ( const StInfo & )
delete

◆ setNumOfFieldsAndElems()

void SVF::StInfo::setNumOfFieldsAndElems ( u32_t nf,
u32_t ne )
inline

Set number of fields and elements of an aggregate.

Definition at line 157 of file SVFType.h.

158 {
161 }

◆ setStinfoId()

void SVF::StInfo::setStinfoId ( u32_t id)
inlineprotected

Definition at line 69 of file SVFType.h.

70 {
71 StInfoId = id;
72 }

◆ GraphDBClient

friend class GraphDBClient
friend

Definition at line 47 of file SVFType.h.

◆ IRGraph

friend class IRGraph
friend

Definition at line 48 of file SVFType.h.

Member Data Documentation

◆ elemIdxVec

std::vector<u32_t> SVF::StInfo::elemIdxVec
private

flattened element indices including structs and arrays by considering strides

Definition at line 80 of file SVFType.h.

◆ finfo

std::vector<const SVFType*> SVF::StInfo::finfo
private

All field infos after flattening a struct.

Definition at line 84 of file SVFType.h.

◆ flattenElementTypes

std::vector<const SVFType*> SVF::StInfo::flattenElementTypes
private

Type vector of fields.

Definition at line 93 of file SVFType.h.

◆ fldIdx2TypeMap

Map<u32_t, const SVFType*> SVF::StInfo::fldIdx2TypeMap
private

Types of all fields of a struct.

Definition at line 82 of file SVFType.h.

◆ fldIdxVec

std::vector<u32_t> SVF::StInfo::fldIdxVec
private

flattened field indices of a struct (ignoring arrays)

Definition at line 77 of file SVFType.h.

◆ numOfFlattenElements

u32_t SVF::StInfo::numOfFlattenElements
private

number of elements after flattening (including array elements)

Definition at line 89 of file SVFType.h.

◆ numOfFlattenFields

u32_t SVF::StInfo::numOfFlattenFields
private

number of fields after flattening (ignoring array elements)

Definition at line 91 of file SVFType.h.

◆ StInfoId

u32_t SVF::StInfo::StInfoId
private

Definition at line 75 of file SVFType.h.

◆ stride

u32_t SVF::StInfo::stride
private

stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.

Definition at line 87 of file SVFType.h.


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