svf-tools 1.0.693 → 1.0.694
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.694",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -92,44 +92,43 @@ template <class T> struct Hash
|
|
|
92
92
|
|
|
93
93
|
template <typename Key, typename Hash = Hash<Key>,
|
|
94
94
|
typename KeyEqual = std::equal_to<Key>,
|
|
95
|
-
typename Allocator = std::allocator<Key
|
|
95
|
+
typename Allocator = std::allocator<Key> >
|
|
96
96
|
using Set = std::unordered_set<Key, Hash, KeyEqual, Allocator>;
|
|
97
97
|
|
|
98
98
|
template <typename Key, typename Value, typename Hash = Hash<Key>,
|
|
99
99
|
typename KeyEqual = std::equal_to<Key>,
|
|
100
|
-
typename Allocator = std::allocator<std::pair<const Key, Value
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
class StInfo
|
|
100
|
+
typename Allocator = std::allocator<std::pair<const Key, Value> > >
|
|
101
|
+
using Map = std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>;
|
|
102
|
+
|
|
103
|
+
template <typename Key, typename Compare = std::less<Key>,
|
|
104
|
+
typename Allocator = std::allocator<Key> >
|
|
105
|
+
using OrderedSet = std::set<Key, Compare, Allocator>;
|
|
106
|
+
|
|
107
|
+
template <typename Key, typename Value, typename Compare = std::less<Key>,
|
|
108
|
+
typename Allocator = std::allocator<std::pair<const Key, Value> > >
|
|
109
|
+
using OrderedMap = std::map<Key, Value, Compare, Allocator>;
|
|
110
|
+
|
|
111
|
+
typedef std::pair<NodeID, NodeID> NodePair;
|
|
112
|
+
typedef OrderedSet<NodeID> OrderedNodeSet;
|
|
113
|
+
typedef Set<NodeID> NodeSet;
|
|
114
|
+
typedef Set<NodePair> NodePairSet;
|
|
115
|
+
typedef Map<NodePair, NodeID> NodePairMap;
|
|
116
|
+
typedef std::vector<NodeID> NodeVector;
|
|
117
|
+
typedef std::vector<EdgeID> EdgeVector;
|
|
118
|
+
typedef std::stack<NodeID> NodeStack;
|
|
119
|
+
typedef std::list<NodeID> NodeList;
|
|
120
|
+
typedef std::deque<NodeID> NodeDeque;
|
|
121
|
+
typedef NodeSet EdgeSet;
|
|
122
|
+
typedef std::vector<u32_t> CallStrCxt;
|
|
123
|
+
typedef unsigned Version;
|
|
124
|
+
typedef Set<Version> VersionSet;
|
|
125
|
+
typedef std::pair<NodeID, Version> VersionedVar;
|
|
126
|
+
typedef Set<VersionedVar> VersionedVarSet;
|
|
127
|
+
|
|
128
|
+
/*!
|
|
129
|
+
* Flattened type information of StructType, ArrayType and SingleValueType
|
|
130
|
+
*/
|
|
131
|
+
class StInfo
|
|
133
132
|
{
|
|
134
133
|
friend class SVFModuleWrite;
|
|
135
134
|
friend class SVFModuleRead;
|
|
@@ -329,8 +329,13 @@ public:
|
|
|
329
329
|
|
|
330
330
|
inline void addTypeInfo(const SVFType* ty)
|
|
331
331
|
{
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
bool inserted = svfTypes.insert(ty).second;
|
|
333
|
+
assert(inserted && "this type info has been added before");
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
inline void addStInfo(StInfo* stInfo)
|
|
337
|
+
{
|
|
338
|
+
stInfos.insert(stInfo);
|
|
334
339
|
}
|
|
335
340
|
|
|
336
341
|
protected:
|
|
@@ -341,11 +346,15 @@ protected:
|
|
|
341
346
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
342
347
|
ObjTypeInfo* createObjTypeInfo(const SVFType* type);
|
|
343
348
|
|
|
349
|
+
/// (owned) All SVF Types
|
|
344
350
|
/// Every type T is mapped to StInfo
|
|
345
351
|
/// which contains size (fsize) , offset(foffset)
|
|
346
352
|
/// fsize[i] is the number of fields in the largest such struct, else fsize[i] = 1.
|
|
347
353
|
/// fsize[0] is always the size of the expanded struct.
|
|
348
354
|
SVFTypeSet svfTypes;
|
|
355
|
+
|
|
356
|
+
/// @brief (owned) All StInfo
|
|
357
|
+
Set<StInfo*> stInfos;
|
|
349
358
|
};
|
|
350
359
|
|
|
351
360
|
|
|
@@ -143,17 +143,20 @@ LocationSet SymbolTableInfo::getModulusOffset(const MemObj* obj, const LocationS
|
|
|
143
143
|
void SymbolTableInfo::destroy()
|
|
144
144
|
{
|
|
145
145
|
|
|
146
|
-
for (
|
|
147
|
-
++iter)
|
|
146
|
+
for (auto &pair: objMap)
|
|
148
147
|
{
|
|
149
|
-
if (
|
|
150
|
-
delete
|
|
148
|
+
if (MemObj* memObj = pair.second)
|
|
149
|
+
delete memObj;
|
|
151
150
|
}
|
|
152
151
|
|
|
153
152
|
for (const SVFType* type : svfTypes)
|
|
154
153
|
delete type;
|
|
155
154
|
svfTypes.clear();
|
|
156
155
|
|
|
156
|
+
for (StInfo* st : stInfos)
|
|
157
|
+
delete st;
|
|
158
|
+
stInfos.clear();
|
|
159
|
+
|
|
157
160
|
mod = nullptr;
|
|
158
161
|
}
|
|
159
162
|
|
|
@@ -84,11 +84,10 @@ private:
|
|
|
84
84
|
SVFValue2LLVMValueMap SVFValue2LLVMValue;
|
|
85
85
|
LLVMType2SVFTypeMap LLVMType2SVFType;
|
|
86
86
|
Type2TypeInfoMap Type2TypeInfo;
|
|
87
|
-
Set<const StInfo*> StInfos;
|
|
88
87
|
|
|
89
88
|
/// Constructor
|
|
90
89
|
LLVMModuleSet();
|
|
91
|
-
~LLVMModuleSet();
|
|
90
|
+
~LLVMModuleSet() = default;
|
|
92
91
|
|
|
93
92
|
void build();
|
|
94
93
|
|
|
@@ -330,8 +329,8 @@ private:
|
|
|
330
329
|
SVFType* addSVFTypeInfo(const Type* t);
|
|
331
330
|
/// Collect a type info
|
|
332
331
|
StInfo* collectTypeInfo(const Type* ty);
|
|
333
|
-
/// Collect the struct info
|
|
334
|
-
StInfo* collectStructInfo(const StructType
|
|
332
|
+
/// Collect the struct info and set the number of fields after flattening
|
|
333
|
+
StInfo* collectStructInfo(const StructType* structTy, u32_t& numFields);
|
|
335
334
|
/// Collect the array info
|
|
336
335
|
StInfo* collectArrayInfo(const ArrayType* T);
|
|
337
336
|
/// Collect simple type (non-aggregate) info
|
|
@@ -78,14 +78,6 @@ LLVMModuleSet::LLVMModuleSet(): svfModule(nullptr), cxts(nullptr), preProcessed(
|
|
|
78
78
|
symInfo = SymbolTableInfo::SymbolInfo();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
LLVMModuleSet::~LLVMModuleSet()
|
|
82
|
-
{
|
|
83
|
-
for (auto *it: StInfos)
|
|
84
|
-
{
|
|
85
|
-
delete(it);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
81
|
SVFModule* LLVMModuleSet::buildSVFModule(Module &mod)
|
|
90
82
|
{
|
|
91
83
|
double startSVFModuleTime = SVFStat::getClk(true);
|
|
@@ -944,59 +936,63 @@ const Type* LLVMModuleSet::getLLVMType(const SVFType* T) const
|
|
|
944
936
|
*/
|
|
945
937
|
SVFType* LLVMModuleSet::getSVFType(const Type* T)
|
|
946
938
|
{
|
|
947
|
-
assert(T);
|
|
939
|
+
assert(T && "SVFType should not be null");
|
|
948
940
|
LLVMType2SVFTypeMap::const_iterator it = LLVMType2SVFType.find(T);
|
|
949
|
-
if (it!=LLVMType2SVFType.end())
|
|
941
|
+
if (it != LLVMType2SVFType.end())
|
|
950
942
|
return it->second;
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
943
|
+
|
|
944
|
+
SVFType* svfType = addSVFTypeInfo(T);
|
|
945
|
+
StInfo* stinfo = collectTypeInfo(T);
|
|
946
|
+
svfType->setTypeInfo(stinfo);
|
|
947
|
+
/// TODO: set the void* to every element for now (imprecise)
|
|
948
|
+
/// For example,
|
|
949
|
+
/// [getPointerTo(): char ----> i8*]
|
|
950
|
+
/// [getPointerTo(): int ----> i8*]
|
|
951
|
+
/// [getPointerTo(): struct ----> i8*]
|
|
952
|
+
PointerType* ptrTy =
|
|
953
|
+
PointerType::getInt8PtrTy(getContext())->getPointerTo();
|
|
954
|
+
svfType->setPointerTo(SVFUtil::cast<SVFPointerType>(getSVFType(ptrTy)));
|
|
955
|
+
return svfType;
|
|
962
956
|
}
|
|
963
957
|
|
|
964
958
|
StInfo* LLVMModuleSet::collectTypeInfo(const Type* T)
|
|
965
959
|
{
|
|
966
|
-
StInfo* stinfo = nullptr;
|
|
967
|
-
|
|
968
960
|
Type2TypeInfoMap::iterator tit = Type2TypeInfo.find(T);
|
|
969
|
-
if(tit != Type2TypeInfo.end())
|
|
961
|
+
if (tit != Type2TypeInfo.end())
|
|
970
962
|
{
|
|
971
|
-
|
|
963
|
+
return tit->second;
|
|
972
964
|
}
|
|
973
|
-
|
|
965
|
+
// No such StInfo for T, create it now.
|
|
966
|
+
StInfo* stInfo;
|
|
967
|
+
if (const ArrayType* aty = SVFUtil::dyn_cast<ArrayType>(T))
|
|
968
|
+
{
|
|
969
|
+
stInfo = collectArrayInfo(aty);
|
|
970
|
+
}
|
|
971
|
+
else if (const StructType* sty = SVFUtil::dyn_cast<StructType>(T))
|
|
974
972
|
{
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
973
|
+
u32_t nf;
|
|
974
|
+
stInfo = collectStructInfo(sty, nf);
|
|
975
|
+
if (nf > symInfo->maxStSize)
|
|
978
976
|
{
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
if (nf > symInfo->maxStSize)
|
|
982
|
-
{
|
|
983
|
-
symInfo->maxStruct = getSVFType(sty);
|
|
984
|
-
symInfo->maxStSize = nf;
|
|
985
|
-
}
|
|
977
|
+
symInfo->maxStruct = getSVFType(sty);
|
|
978
|
+
symInfo->maxStSize = nf;
|
|
986
979
|
}
|
|
987
|
-
else
|
|
988
|
-
stinfo = collectSimpleTypeInfo(T);
|
|
989
|
-
StInfos.insert(stinfo);
|
|
990
|
-
Type2TypeInfo[T] = stinfo;
|
|
991
980
|
}
|
|
992
|
-
|
|
981
|
+
else
|
|
982
|
+
{
|
|
983
|
+
stInfo = collectSimpleTypeInfo(T);
|
|
984
|
+
}
|
|
985
|
+
Type2TypeInfo.emplace(T, stInfo);
|
|
986
|
+
symInfo->addStInfo(stInfo);
|
|
987
|
+
return stInfo;
|
|
993
988
|
}
|
|
994
989
|
|
|
995
990
|
SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
|
|
996
991
|
{
|
|
997
|
-
assert(LLVMType2SVFType.find(T)==LLVMType2SVFType.end() &&
|
|
992
|
+
assert(LLVMType2SVFType.find(T) == LLVMType2SVFType.end() &&
|
|
993
|
+
"SVFType has been added before");
|
|
998
994
|
|
|
999
|
-
SVFType* svftype
|
|
995
|
+
SVFType* svftype;
|
|
1000
996
|
if (const PointerType* pt = SVFUtil::dyn_cast<PointerType>(T))
|
|
1001
997
|
svftype = new SVFPointerType(getSVFType(LLVMUtil::getPtrElementType(pt)));
|
|
1002
998
|
else if (SVFUtil::isa<IntegerType>(T))
|
|
@@ -1009,6 +1005,7 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
|
|
|
1009
1005
|
svftype = new SVFArrayType();
|
|
1010
1006
|
else
|
|
1011
1007
|
svftype = new SVFOtherType(T->isSingleValueType());
|
|
1008
|
+
|
|
1012
1009
|
symInfo->addTypeInfo(svftype);
|
|
1013
1010
|
LLVMType2SVFType[T] = svftype;
|
|
1014
1011
|
return svftype;
|
|
@@ -1027,16 +1024,17 @@ StInfo* LLVMModuleSet::collectArrayInfo(const ArrayType* ty)
|
|
|
1027
1024
|
elemTy = aty->getElementType();
|
|
1028
1025
|
}
|
|
1029
1026
|
|
|
1030
|
-
StInfo*
|
|
1027
|
+
StInfo* stInfo = new StInfo(totalElemNum);
|
|
1028
|
+
const SVFType* elemSvfType = getSVFType(elemTy);
|
|
1031
1029
|
|
|
1032
1030
|
/// array without any element (this is not true in C/C++ arrays) we assume there is an empty dummy element
|
|
1033
|
-
if(totalElemNum==0)
|
|
1031
|
+
if (totalElemNum == 0)
|
|
1034
1032
|
{
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
return
|
|
1033
|
+
stInfo->addFldWithType(0, elemSvfType, 0);
|
|
1034
|
+
stInfo->setNumOfFieldsAndElems(1, 1);
|
|
1035
|
+
stInfo->getFlattenFieldTypes().push_back(elemSvfType);
|
|
1036
|
+
stInfo->getFlattenElementTypes().push_back(elemSvfType);
|
|
1037
|
+
return stInfo;
|
|
1040
1038
|
}
|
|
1041
1039
|
|
|
1042
1040
|
/// Array's flatten field infor is the same as its element's
|
|
@@ -1046,83 +1044,90 @@ StInfo* LLVMModuleSet::collectArrayInfo(const ArrayType* ty)
|
|
|
1046
1044
|
for (u32_t j = 0; j < nfE; j++)
|
|
1047
1045
|
{
|
|
1048
1046
|
const SVFType* fieldTy = elemStInfo->getFlattenFieldTypes()[j];
|
|
1049
|
-
|
|
1047
|
+
stInfo->getFlattenFieldTypes().push_back(fieldTy);
|
|
1050
1048
|
}
|
|
1051
1049
|
|
|
1052
1050
|
/// Flatten arrays, map each array element index `i` to flattened index `(i * nfE * totalElemNum)/outArrayElemNum`
|
|
1053
1051
|
/// nfE>1 if the array element is a struct with more than one field.
|
|
1054
1052
|
u32_t outArrayElemNum = ty->getNumElements();
|
|
1055
|
-
for(u32_t i = 0; i < outArrayElemNum; i
|
|
1056
|
-
|
|
1053
|
+
for (u32_t i = 0; i < outArrayElemNum; ++i)
|
|
1054
|
+
{
|
|
1055
|
+
auto idx = (i * nfE * totalElemNum) / outArrayElemNum;
|
|
1056
|
+
stInfo->addFldWithType(0, elemSvfType, idx);
|
|
1057
|
+
}
|
|
1057
1058
|
|
|
1058
|
-
for(u32_t i = 0; i < totalElemNum; i
|
|
1059
|
+
for (u32_t i = 0; i < totalElemNum; ++i)
|
|
1059
1060
|
{
|
|
1060
|
-
for(u32_t j = 0; j < nfE; j
|
|
1061
|
+
for (u32_t j = 0; j < nfE; ++j)
|
|
1061
1062
|
{
|
|
1062
|
-
|
|
1063
|
+
const SVFType* et = elemStInfo->getFlattenFieldTypes()[j];
|
|
1064
|
+
stInfo->getFlattenElementTypes().push_back(et);
|
|
1063
1065
|
}
|
|
1064
1066
|
}
|
|
1065
1067
|
|
|
1066
|
-
assert(
|
|
1067
|
-
|
|
1068
|
+
assert(stInfo->getFlattenElementTypes().size() == nfE * totalElemNum &&
|
|
1069
|
+
"typeForArray size incorrect!!!");
|
|
1070
|
+
stInfo->setNumOfFieldsAndElems(nfE, nfE * totalElemNum);
|
|
1068
1071
|
|
|
1069
|
-
return
|
|
1072
|
+
return stInfo;
|
|
1070
1073
|
}
|
|
1071
1074
|
|
|
1072
|
-
|
|
1073
1075
|
/*!
|
|
1074
1076
|
* Fill in struct_info for T.
|
|
1075
1077
|
* Given a Struct type, we recursively extend and record its fields and types.
|
|
1076
1078
|
*/
|
|
1077
|
-
StInfo* LLVMModuleSet::collectStructInfo(const StructType
|
|
1079
|
+
StInfo* LLVMModuleSet::collectStructInfo(const StructType* structTy,
|
|
1080
|
+
u32_t& numFields)
|
|
1078
1081
|
{
|
|
1079
1082
|
/// The struct info should not be processed before
|
|
1080
|
-
StInfo*
|
|
1083
|
+
StInfo* stInfo = new StInfo(1);
|
|
1081
1084
|
|
|
1082
1085
|
// Number of fields after flattening the struct
|
|
1083
|
-
|
|
1086
|
+
numFields = 0;
|
|
1084
1087
|
// The offset when considering array stride info
|
|
1085
1088
|
u32_t strideOffset = 0;
|
|
1086
|
-
for (
|
|
1087
|
-
sty->element_end(); it != ie; ++it)
|
|
1089
|
+
for (const Type* elemTy : structTy->elements())
|
|
1088
1090
|
{
|
|
1089
|
-
const
|
|
1090
|
-
|
|
1091
|
-
|
|
1091
|
+
const SVFType* elemSvfTy = getSVFType(elemTy);
|
|
1092
|
+
// offset with int_32 (s32_t) is large enough and won't overflow
|
|
1093
|
+
stInfo->addFldWithType(numFields, elemSvfTy, strideOffset);
|
|
1092
1094
|
|
|
1093
|
-
if (SVFUtil::isa<StructType, ArrayType>(
|
|
1095
|
+
if (SVFUtil::isa<StructType, ArrayType>(elemTy))
|
|
1094
1096
|
{
|
|
1095
|
-
StInfo
|
|
1096
|
-
u32_t nfE =
|
|
1097
|
-
//Copy ST's info, whose element 0 is the size of ST itself.
|
|
1098
|
-
for (u32_t j = 0; j < nfE; j
|
|
1097
|
+
StInfo* subStInfo = collectTypeInfo(elemTy);
|
|
1098
|
+
u32_t nfE = subStInfo->getNumOfFlattenFields();
|
|
1099
|
+
// Copy ST's info, whose element 0 is the size of ST itself.
|
|
1100
|
+
for (u32_t j = 0; j < nfE; ++j)
|
|
1099
1101
|
{
|
|
1100
|
-
const SVFType* elemTy =
|
|
1101
|
-
|
|
1102
|
+
const SVFType* elemTy = subStInfo->getFlattenFieldTypes()[j];
|
|
1103
|
+
stInfo->getFlattenFieldTypes().push_back(elemTy);
|
|
1102
1104
|
}
|
|
1103
|
-
|
|
1104
|
-
strideOffset += nfE *
|
|
1105
|
-
for(u32_t tpi = 0; tpi <
|
|
1105
|
+
numFields += nfE;
|
|
1106
|
+
strideOffset += nfE * subStInfo->getStride();
|
|
1107
|
+
for (u32_t tpi = 0; tpi < subStInfo->getStride(); ++tpi)
|
|
1106
1108
|
{
|
|
1107
|
-
for(u32_t tpj = 0; tpj < nfE; tpj
|
|
1109
|
+
for (u32_t tpj = 0; tpj < nfE; ++tpj)
|
|
1108
1110
|
{
|
|
1109
|
-
|
|
1111
|
+
const SVFType* ty = subStInfo->getFlattenFieldTypes()[tpj];
|
|
1112
|
+
stInfo->getFlattenElementTypes().push_back(ty);
|
|
1110
1113
|
}
|
|
1111
1114
|
}
|
|
1112
1115
|
}
|
|
1113
|
-
else
|
|
1116
|
+
else
|
|
1114
1117
|
{
|
|
1115
|
-
|
|
1118
|
+
// Simple type
|
|
1119
|
+
numFields += 1;
|
|
1116
1120
|
strideOffset += 1;
|
|
1117
|
-
|
|
1118
|
-
|
|
1121
|
+
stInfo->getFlattenFieldTypes().push_back(elemSvfTy);
|
|
1122
|
+
stInfo->getFlattenElementTypes().push_back(elemSvfTy);
|
|
1119
1123
|
}
|
|
1120
1124
|
}
|
|
1121
1125
|
|
|
1122
|
-
assert(
|
|
1123
|
-
|
|
1126
|
+
assert(stInfo->getFlattenElementTypes().size() == strideOffset &&
|
|
1127
|
+
"typeForStruct size incorrect!");
|
|
1128
|
+
stInfo->setNumOfFieldsAndElems(numFields,strideOffset);
|
|
1124
1129
|
|
|
1125
|
-
return
|
|
1130
|
+
return stInfo;
|
|
1126
1131
|
}
|
|
1127
1132
|
|
|
1128
1133
|
|
|
@@ -1132,12 +1137,13 @@ StInfo* LLVMModuleSet::collectStructInfo(const StructType *sty, u32_t &nf)
|
|
|
1132
1137
|
StInfo* LLVMModuleSet::collectSimpleTypeInfo(const Type* ty)
|
|
1133
1138
|
{
|
|
1134
1139
|
/// Only one field
|
|
1135
|
-
StInfo*
|
|
1136
|
-
|
|
1140
|
+
StInfo* stInfo = new StInfo(1);
|
|
1141
|
+
SVFType* svfType = getSVFType(ty);
|
|
1142
|
+
stInfo->addFldWithType(0, svfType, 0);
|
|
1137
1143
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1144
|
+
stInfo->getFlattenFieldTypes().push_back(svfType);
|
|
1145
|
+
stInfo->getFlattenElementTypes().push_back(svfType);
|
|
1146
|
+
stInfo->setNumOfFieldsAndElems(1,1);
|
|
1141
1147
|
|
|
1142
|
-
return
|
|
1148
|
+
return stInfo;
|
|
1143
1149
|
}
|