svf-tools 1.0.1094 → 1.0.1096
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.1096",
|
|
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": {
|
|
@@ -197,15 +197,15 @@ private:
|
|
|
197
197
|
StInfo* typeinfo; ///< SVF's TypeInfo
|
|
198
198
|
bool isSingleValTy; ///< The type represents a single value, not struct or
|
|
199
199
|
u32_t byteSize; ///< LLVM Byte Size
|
|
200
|
+
u32_t id;
|
|
200
201
|
///< array
|
|
201
202
|
|
|
202
203
|
protected:
|
|
203
|
-
SVFType(bool svt, SVFTyKind k, u32_t Sz = 1)
|
|
204
|
+
SVFType(bool svt, SVFTyKind k, u32_t i = 0, u32_t Sz = 1)
|
|
204
205
|
: kind(k), typeinfo(nullptr),
|
|
205
|
-
isSingleValTy(svt), byteSize(Sz)
|
|
206
|
+
isSingleValTy(svt), byteSize(Sz), id(i)
|
|
206
207
|
{
|
|
207
208
|
}
|
|
208
|
-
|
|
209
209
|
public:
|
|
210
210
|
SVFType(void) = delete;
|
|
211
211
|
virtual ~SVFType() {}
|
|
@@ -222,6 +222,11 @@ public:
|
|
|
222
222
|
virtual void print(std::ostream& os) const = 0;
|
|
223
223
|
|
|
224
224
|
|
|
225
|
+
u32_t getId() const
|
|
226
|
+
{
|
|
227
|
+
return id;
|
|
228
|
+
}
|
|
229
|
+
|
|
225
230
|
inline void setTypeInfo(StInfo* ti)
|
|
226
231
|
{
|
|
227
232
|
typeinfo = ti;
|
|
@@ -275,8 +280,8 @@ class SVFPointerType : public SVFType
|
|
|
275
280
|
friend class SVFIRReader;
|
|
276
281
|
|
|
277
282
|
public:
|
|
278
|
-
SVFPointerType(u32_t byteSize = 1)
|
|
279
|
-
: SVFType(true, SVFPointerTy, byteSize)
|
|
283
|
+
SVFPointerType(u32_t i, u32_t byteSize = 1)
|
|
284
|
+
: SVFType(true, SVFPointerTy, i, byteSize)
|
|
280
285
|
{
|
|
281
286
|
}
|
|
282
287
|
|
|
@@ -297,7 +302,7 @@ private:
|
|
|
297
302
|
short signAndWidth; ///< For printing
|
|
298
303
|
|
|
299
304
|
public:
|
|
300
|
-
SVFIntegerType(u32_t byteSize = 1) : SVFType(true, SVFIntegerTy, byteSize) {}
|
|
305
|
+
SVFIntegerType(u32_t i, u32_t byteSize = 1) : SVFType(true, SVFIntegerTy, i, byteSize) {}
|
|
301
306
|
static inline bool classof(const SVFType* node)
|
|
302
307
|
{
|
|
303
308
|
return node->getKind() == SVFIntegerTy;
|
|
@@ -327,8 +332,8 @@ private:
|
|
|
327
332
|
bool varArg;
|
|
328
333
|
|
|
329
334
|
public:
|
|
330
|
-
SVFFunctionType(const SVFType* rt, const std::vector<const SVFType*>& p, bool isvararg)
|
|
331
|
-
: SVFType(false, SVFFunctionTy, 1), retTy(rt), params(p), varArg(isvararg)
|
|
335
|
+
SVFFunctionType(u32_t i, const SVFType* rt, const std::vector<const SVFType*>& p, bool isvararg)
|
|
336
|
+
: SVFType(false, SVFFunctionTy, i, 1), retTy(rt), params(p), varArg(isvararg)
|
|
332
337
|
{
|
|
333
338
|
}
|
|
334
339
|
|
|
@@ -363,9 +368,13 @@ class SVFStructType : public SVFType
|
|
|
363
368
|
private:
|
|
364
369
|
/// @brief Field for printing & debugging
|
|
365
370
|
std::string name;
|
|
371
|
+
std::vector<const SVFType*> fields;
|
|
366
372
|
|
|
367
373
|
public:
|
|
368
|
-
SVFStructType(u32_t
|
|
374
|
+
SVFStructType(u32_t i, std::vector<const SVFType *> &f, u32_t byteSize = 1) :
|
|
375
|
+
SVFType(false, SVFStructTy, i, byteSize), fields(f)
|
|
376
|
+
{
|
|
377
|
+
}
|
|
369
378
|
|
|
370
379
|
static inline bool classof(const SVFType* node)
|
|
371
380
|
{
|
|
@@ -386,6 +395,11 @@ public:
|
|
|
386
395
|
{
|
|
387
396
|
name = std::move(structName);
|
|
388
397
|
}
|
|
398
|
+
|
|
399
|
+
const std::vector<const SVFType*>& getFieldTypes() const
|
|
400
|
+
{
|
|
401
|
+
return fields;
|
|
402
|
+
}
|
|
389
403
|
};
|
|
390
404
|
|
|
391
405
|
class SVFArrayType : public SVFType
|
|
@@ -398,8 +412,8 @@ private:
|
|
|
398
412
|
const SVFType* typeOfElement; /// For printing & debugging
|
|
399
413
|
|
|
400
414
|
public:
|
|
401
|
-
SVFArrayType(u32_t byteSize = 1)
|
|
402
|
-
: SVFType(false, SVFArrayTy, byteSize), numOfElement(0), typeOfElement(nullptr)
|
|
415
|
+
SVFArrayType(u32_t i, u32_t byteSize = 1)
|
|
416
|
+
: SVFType(false, SVFArrayTy, i, byteSize), numOfElement(0), typeOfElement(nullptr)
|
|
403
417
|
{
|
|
404
418
|
}
|
|
405
419
|
|
|
@@ -437,7 +451,7 @@ private:
|
|
|
437
451
|
std::string repr; /// Field representation for printing
|
|
438
452
|
|
|
439
453
|
public:
|
|
440
|
-
SVFOtherType(bool isSingleValueTy, u32_t byteSize = 1) : SVFType(isSingleValueTy, SVFOtherTy, byteSize) {}
|
|
454
|
+
SVFOtherType(u32_t i, bool isSingleValueTy, u32_t byteSize = 1) : SVFType(isSingleValueTy, SVFOtherTy, i, byteSize) {}
|
|
441
455
|
|
|
442
456
|
static inline bool classof(const SVFType* node)
|
|
443
457
|
{
|
|
@@ -83,7 +83,7 @@ void AbsExtAPI::initExtFunMap()
|
|
|
83
83
|
}
|
|
84
84
|
else
|
|
85
85
|
{
|
|
86
|
-
SVFUtil::errs() <<"svf_assert
|
|
86
|
+
SVFUtil::errs() << SVFUtil::errMsg("Assertion failure, this svf_assert cannot be verified!!\n") << callNode->toString() << "\n";
|
|
87
87
|
assert(false);
|
|
88
88
|
}
|
|
89
89
|
return;
|
|
@@ -36,12 +36,47 @@ void SVFIntegerType::print(std::ostream& os) const
|
|
|
36
36
|
|
|
37
37
|
void SVFFunctionType::print(std::ostream& os) const
|
|
38
38
|
{
|
|
39
|
-
os << *getReturnType() << "(
|
|
39
|
+
os << *getReturnType() << "(";
|
|
40
|
+
|
|
41
|
+
// Print parameters
|
|
42
|
+
for (size_t i = 0; i < params.size(); ++i)
|
|
43
|
+
{
|
|
44
|
+
os << *params[i];
|
|
45
|
+
// Add comma after all params except the last one
|
|
46
|
+
if (i != params.size() - 1)
|
|
47
|
+
{
|
|
48
|
+
os << ", ";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Add varargs indicator if needed
|
|
53
|
+
if (isVarArg())
|
|
54
|
+
{
|
|
55
|
+
if (!params.empty())
|
|
56
|
+
{
|
|
57
|
+
os << ", ";
|
|
58
|
+
}
|
|
59
|
+
os << "...";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
os << ")";
|
|
40
63
|
}
|
|
41
64
|
|
|
42
65
|
void SVFStructType::print(std::ostream& os) const
|
|
43
66
|
{
|
|
44
|
-
os << "S." << name;
|
|
67
|
+
os << "S." << name << " {";
|
|
68
|
+
|
|
69
|
+
// Print fields
|
|
70
|
+
for (size_t i = 0; i < fields.size(); ++i)
|
|
71
|
+
{
|
|
72
|
+
os << *fields[i];
|
|
73
|
+
// Add comma after all fields except the last one
|
|
74
|
+
if (i != fields.size() - 1)
|
|
75
|
+
{
|
|
76
|
+
os << ", ";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
os << "}";
|
|
45
80
|
}
|
|
46
81
|
|
|
47
82
|
void SVFArrayType::print(std::ostream& os) const
|
|
@@ -1276,13 +1276,15 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
|
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
1278
|
SVFType* svftype;
|
|
1279
|
+
|
|
1280
|
+
u32_t id = svfir->getSVFTypes().size();
|
|
1279
1281
|
if (SVFUtil::isa<PointerType>(T))
|
|
1280
1282
|
{
|
|
1281
|
-
svftype = new SVFPointerType(byteSize);
|
|
1283
|
+
svftype = new SVFPointerType(id, byteSize);
|
|
1282
1284
|
}
|
|
1283
1285
|
else if (const IntegerType* intT = SVFUtil::dyn_cast<IntegerType>(T))
|
|
1284
1286
|
{
|
|
1285
|
-
auto svfIntT = new SVFIntegerType(byteSize);
|
|
1287
|
+
auto svfIntT = new SVFIntegerType(id, byteSize);
|
|
1286
1288
|
unsigned signWidth = intT->getBitWidth();
|
|
1287
1289
|
assert(signWidth < INT16_MAX && "Integer width too big");
|
|
1288
1290
|
svfIntT->setSignAndWidth(intT->getSignBit() ? -signWidth : signWidth);
|
|
@@ -1295,18 +1297,24 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
|
|
|
1295
1297
|
{
|
|
1296
1298
|
paramTypes.push_back(getSVFType(t));
|
|
1297
1299
|
}
|
|
1298
|
-
svftype = new SVFFunctionType(getSVFType(ft->getReturnType()), paramTypes, ft->isVarArg());
|
|
1300
|
+
svftype = new SVFFunctionType(id, getSVFType(ft->getReturnType()), paramTypes, ft->isVarArg());
|
|
1299
1301
|
}
|
|
1300
1302
|
else if (const StructType* st = SVFUtil::dyn_cast<StructType>(T))
|
|
1301
1303
|
{
|
|
1302
|
-
|
|
1304
|
+
std::vector<const SVFType*> fieldTypes;
|
|
1305
|
+
|
|
1306
|
+
for (const auto& t: st->elements())
|
|
1307
|
+
{
|
|
1308
|
+
fieldTypes.push_back(getSVFType(t));
|
|
1309
|
+
}
|
|
1310
|
+
auto svfst = new SVFStructType(id, fieldTypes, byteSize);
|
|
1303
1311
|
if (st->hasName())
|
|
1304
1312
|
svfst->setName(st->getName().str());
|
|
1305
1313
|
svftype = svfst;
|
|
1306
1314
|
}
|
|
1307
1315
|
else if (const auto at = SVFUtil::dyn_cast<ArrayType>(T))
|
|
1308
1316
|
{
|
|
1309
|
-
auto svfat = new SVFArrayType(byteSize);
|
|
1317
|
+
auto svfat = new SVFArrayType(id, byteSize);
|
|
1310
1318
|
svfat->setNumOfElement(at->getNumElements());
|
|
1311
1319
|
svfat->setTypeOfElement(getSVFType(at->getElementType()));
|
|
1312
1320
|
svftype = svfat;
|
|
@@ -1314,7 +1322,7 @@ SVFType* LLVMModuleSet::addSVFTypeInfo(const Type* T)
|
|
|
1314
1322
|
else
|
|
1315
1323
|
{
|
|
1316
1324
|
std::string buffer;
|
|
1317
|
-
auto ot = new SVFOtherType(T->isSingleValueType(), byteSize);
|
|
1325
|
+
auto ot = new SVFOtherType(id, T->isSingleValueType(), byteSize);
|
|
1318
1326
|
llvm::raw_string_ostream(buffer) << *T;
|
|
1319
1327
|
ot->setRepr(std::move(buffer));
|
|
1320
1328
|
svftype = ot;
|