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

#include <SVFType.h>

Public Member Functions

 StInfo ()=delete
 Max field limit. More...
 
 StInfo (const StInfo &st)=delete
 
void operator= (const StInfo &)=delete
 
 StInfo (u32_t s)
 Constructor. More...
 
 ~StInfo ()=default
 Destructor. More...
 
const SVFTypegetOriginalElemType (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. More...
 
void setNumOfFieldsAndElems (u32_t nf, u32_t ne)
 Set number of fields and elements of an aggregate. More...
 
u32_t getNumOfFlattenElements () const
 Return number of elements after flattening (including array elements) More...
 
u32_t getNumOfFlattenFields () const
 Return the number of fields after flattening (ignoring array elements) More...
 
u32_t getStride () const
 Return the stride. More...
 

Private Attributes

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

Friends

class SVFIRWriter
 
class SVFIRReader
 

Detailed Description

Flattened type information of StructType, ArrayType and SingleValueType

Definition at line 46 of file SVFType.h.

Constructor & Destructor Documentation

◆ StInfo() [1/3]

SVF::StInfo::StInfo ( )
delete

Max field limit.

◆ StInfo() [2/3]

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

◆ StInfo() [3/3]

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

Constructor.

Definition at line 78 of file SVFType.h.

80  {
81  }
u32_t stride
Definition: SVFType.h:63
u32_t numOfFlattenElements
number of elements after flattening (including array elements)
Definition: SVFType.h:65
u32_t numOfFlattenFields
number of fields after flattening (ignoring array elements)
Definition: SVFType.h:67

◆ ~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 9 of file SVFValue.cpp.

10 {
11  fldIdxVec.push_back(fldIdx);
12  elemIdxVec.push_back(elemIdx);
13  fldIdx2TypeMap[fldIdx] = type;
14 }
newitem type
Definition: cJSON.cpp:2739
std::vector< u32_t > fldIdxVec
flattened field indices of a struct (ignoring arrays)
Definition: SVFType.h:53
std::vector< u32_t > elemIdxVec
Definition: SVFType.h:56
Map< u32_t, const SVFType * > fldIdx2TypeMap
Types of all fields of a struct.
Definition: SVFType.h:58

◆ getFlattenedElemIdxVec() [1/2]

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

Definition at line 98 of file SVFType.h.

99  {
100  return elemIdxVec;
101  }

◆ getFlattenedElemIdxVec() [2/2]

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

Definition at line 114 of file SVFType.h.

115  {
116  return elemIdxVec;
117  }

◆ getFlattenedFieldIdxVec() [1/2]

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

Definition at line 94 of file SVFType.h.

95  {
96  return fldIdxVec;
97  }

◆ getFlattenedFieldIdxVec() [2/2]

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

Definition at line 110 of file SVFType.h.

111  {
112  return fldIdxVec;
113  }

◆ getFlattenElementTypes() [1/2]

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

Definition at line 102 of file SVFType.h.

103  {
104  return flattenElementTypes;
105  }
std::vector< const SVFType * > flattenElementTypes
Type vector of fields.
Definition: SVFType.h:69

◆ getFlattenElementTypes() [2/2]

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

Definition at line 118 of file SVFType.h.

119  {
120  return flattenElementTypes;
121  }

◆ getFlattenFieldTypes() [1/2]

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

Definition at line 106 of file SVFType.h.

107  {
108  return finfo;
109  }
std::vector< const SVFType * > finfo
All field infos after flattening a struct.
Definition: SVFType.h:60

◆ getFlattenFieldTypes() [2/2]

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

Definition at line 122 of file SVFType.h.

123  {
124  return finfo;
125  }

◆ getNumOfFlattenElements()

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

Return number of elements after flattening (including array elements)

Definition at line 139 of file SVFType.h.

140  {
141  return numOfFlattenElements;
142  }

◆ getNumOfFlattenFields()

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

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

Definition at line 145 of file SVFType.h.

146  {
147  return numOfFlattenFields;
148  }

◆ 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 20 of file SVFValue.cpp.

21 {
23  if(it!=fldIdx2TypeMap.end())
24  return it->second;
25  return nullptr;
26 }
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
Definition: GeneralType.h:101

◆ getStride()

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

Return the stride.

Definition at line 150 of file SVFType.h.

151  {
152  return stride;
153  }

◆ 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 132 of file SVFType.h.

133  {
134  numOfFlattenFields = nf;
136  }

Friends And Related Function Documentation

◆ SVFIRReader

friend class SVFIRReader
friend

Definition at line 49 of file SVFType.h.

◆ SVFIRWriter

friend class SVFIRWriter
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 56 of file SVFType.h.

◆ finfo

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

All field infos after flattening a struct.

Definition at line 60 of file SVFType.h.

◆ flattenElementTypes

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

Type vector of fields.

Definition at line 69 of file SVFType.h.

◆ fldIdx2TypeMap

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

Types of all fields of a struct.

Definition at line 58 of file SVFType.h.

◆ fldIdxVec

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

flattened field indices of a struct (ignoring arrays)

Definition at line 53 of file SVFType.h.

◆ numOfFlattenElements

u32_t SVF::StInfo::numOfFlattenElements
private

number of elements after flattening (including array elements)

Definition at line 65 of file SVFType.h.

◆ numOfFlattenFields

u32_t SVF::StInfo::numOfFlattenFields
private

number of fields after flattening (ignoring array elements)

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


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