svf-tools 1.0.1045 → 1.0.1046
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.1046",
|
|
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": {
|
|
@@ -71,10 +71,6 @@ public:
|
|
|
71
71
|
SVFArg,
|
|
72
72
|
SVFConst,
|
|
73
73
|
SVFConstData,
|
|
74
|
-
SVFConstInt,
|
|
75
|
-
SVFConstFP,
|
|
76
|
-
SVFNullPtr,
|
|
77
|
-
SVFBlackHole,
|
|
78
74
|
SVFMetaAsValue,
|
|
79
75
|
SVFOther
|
|
80
76
|
};
|
|
@@ -138,14 +134,6 @@ public:
|
|
|
138
134
|
{
|
|
139
135
|
return ptrInUncalledFun;
|
|
140
136
|
}
|
|
141
|
-
inline bool isblackHole() const
|
|
142
|
-
{
|
|
143
|
-
return getKind() == SVFBlackHole;;
|
|
144
|
-
}
|
|
145
|
-
inline bool isNullPtr() const
|
|
146
|
-
{
|
|
147
|
-
return getKind() == SVFNullPtr;
|
|
148
|
-
}
|
|
149
137
|
inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
|
|
150
138
|
{
|
|
151
139
|
sourceLoc = sourceCodeInfo;
|
|
@@ -526,11 +514,7 @@ public:
|
|
|
526
514
|
{
|
|
527
515
|
return node->getKind() == SVFConst ||
|
|
528
516
|
node->getKind() == SVFGlob ||
|
|
529
|
-
node->getKind() == SVFConstData
|
|
530
|
-
node->getKind() == SVFConstInt ||
|
|
531
|
-
node->getKind() == SVFConstFP ||
|
|
532
|
-
node->getKind() == SVFNullPtr ||
|
|
533
|
-
node->getKind() == SVFBlackHole;
|
|
517
|
+
node->getKind() == SVFConstData;
|
|
534
518
|
}
|
|
535
519
|
|
|
536
520
|
};
|
|
@@ -629,124 +613,11 @@ public:
|
|
|
629
613
|
|
|
630
614
|
static inline bool classof(const SVFLLVMValue *node)
|
|
631
615
|
{
|
|
632
|
-
return node->getKind() == SVFConstData
|
|
633
|
-
node->getKind() == SVFConstInt ||
|
|
634
|
-
node->getKind() == SVFConstFP ||
|
|
635
|
-
node->getKind() == SVFNullPtr ||
|
|
636
|
-
node->getKind() == SVFBlackHole;
|
|
637
|
-
}
|
|
638
|
-
static inline bool classof(const SVFConstantData *node)
|
|
639
|
-
{
|
|
640
|
-
return node->getKind() == SVFConstData ||
|
|
641
|
-
node->getKind() == SVFConstInt ||
|
|
642
|
-
node->getKind() == SVFConstFP ||
|
|
643
|
-
node->getKind() == SVFNullPtr ||
|
|
644
|
-
node->getKind() == SVFBlackHole;
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
class SVFConstantInt : public SVFConstantData
|
|
649
|
-
{
|
|
650
|
-
friend class SVFIRWriter;
|
|
651
|
-
friend class SVFIRReader;
|
|
652
|
-
private:
|
|
653
|
-
u64_t zval;
|
|
654
|
-
s64_t sval;
|
|
655
|
-
public:
|
|
656
|
-
SVFConstantInt(const SVFType* ty, u64_t z, s64_t s)
|
|
657
|
-
: SVFConstantData(ty, SVFLLVMValue::SVFConstInt), zval(z), sval(s)
|
|
658
|
-
{
|
|
659
|
-
}
|
|
660
|
-
SVFConstantInt() = delete;
|
|
661
|
-
|
|
662
|
-
static inline bool classof(const SVFLLVMValue *node)
|
|
663
|
-
{
|
|
664
|
-
return node->getKind() == SVFConstInt;
|
|
665
|
-
}
|
|
666
|
-
static inline bool classof(const SVFConstantData *node)
|
|
667
|
-
{
|
|
668
|
-
return node->getKind() == SVFConstInt;
|
|
669
|
-
}
|
|
670
|
-
// Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate for the type of this constant.
|
|
671
|
-
inline u64_t getZExtValue () const
|
|
672
|
-
{
|
|
673
|
-
return zval;
|
|
674
|
-
}
|
|
675
|
-
// Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the type of this constant
|
|
676
|
-
inline s64_t getSExtValue () const
|
|
677
|
-
{
|
|
678
|
-
return sval;
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
|
|
682
|
-
class SVFConstantFP : public SVFConstantData
|
|
683
|
-
{
|
|
684
|
-
friend class SVFIRWriter;
|
|
685
|
-
friend class SVFIRReader;
|
|
686
|
-
private:
|
|
687
|
-
float dval;
|
|
688
|
-
public:
|
|
689
|
-
SVFConstantFP(const SVFType* ty, double d)
|
|
690
|
-
: SVFConstantData(ty, SVFLLVMValue::SVFConstFP), dval(d)
|
|
691
|
-
{
|
|
692
|
-
}
|
|
693
|
-
SVFConstantFP() = delete;
|
|
694
|
-
|
|
695
|
-
inline double getFPValue () const
|
|
696
|
-
{
|
|
697
|
-
return dval;
|
|
698
|
-
}
|
|
699
|
-
static inline bool classof(const SVFLLVMValue *node)
|
|
700
|
-
{
|
|
701
|
-
return node->getKind() == SVFConstFP;
|
|
702
|
-
}
|
|
703
|
-
static inline bool classof(const SVFConstantData *node)
|
|
704
|
-
{
|
|
705
|
-
return node->getKind() == SVFConstFP;
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
|
|
709
|
-
class SVFConstantNullPtr : public SVFConstantData
|
|
710
|
-
{
|
|
711
|
-
friend class SVFIRWriter;
|
|
712
|
-
friend class SVFIRReader;
|
|
713
|
-
|
|
714
|
-
public:
|
|
715
|
-
SVFConstantNullPtr(const SVFType* ty)
|
|
716
|
-
: SVFConstantData(ty, SVFLLVMValue::SVFNullPtr)
|
|
717
|
-
{
|
|
718
|
-
}
|
|
719
|
-
SVFConstantNullPtr() = delete;
|
|
720
|
-
|
|
721
|
-
static inline bool classof(const SVFLLVMValue *node)
|
|
722
|
-
{
|
|
723
|
-
return node->getKind() == SVFNullPtr;
|
|
724
|
-
}
|
|
725
|
-
static inline bool classof(const SVFConstantData *node)
|
|
726
|
-
{
|
|
727
|
-
return node->getKind() == SVFNullPtr;
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
|
|
731
|
-
class SVFBlackHoleValue : public SVFConstantData
|
|
732
|
-
{
|
|
733
|
-
friend class SVFIRWriter;
|
|
734
|
-
friend class SVFIRReader;
|
|
735
|
-
|
|
736
|
-
public:
|
|
737
|
-
SVFBlackHoleValue(const SVFType* ty)
|
|
738
|
-
: SVFConstantData(ty, SVFLLVMValue::SVFBlackHole)
|
|
739
|
-
{
|
|
740
|
-
}
|
|
741
|
-
SVFBlackHoleValue() = delete;
|
|
742
|
-
|
|
743
|
-
static inline bool classof(const SVFLLVMValue *node)
|
|
744
|
-
{
|
|
745
|
-
return node->getKind() == SVFBlackHole;
|
|
616
|
+
return node->getKind() == SVFConstData;
|
|
746
617
|
}
|
|
747
618
|
static inline bool classof(const SVFConstantData *node)
|
|
748
619
|
{
|
|
749
|
-
return node->getKind() ==
|
|
620
|
+
return node->getKind() == SVFConstData;
|
|
750
621
|
}
|
|
751
622
|
};
|
|
752
623
|
|
|
@@ -1211,9 +1211,10 @@ void LLVMModuleSet::dumpModulesToFile(const std::string& suffix)
|
|
|
1211
1211
|
|
|
1212
1212
|
NodeID LLVMModuleSet::getValueNode(const SVFLLVMValue *val)
|
|
1213
1213
|
{
|
|
1214
|
-
|
|
1214
|
+
auto llvm_value = llvmModuleSet->getLLVMValue(val);
|
|
1215
|
+
if (SVFUtil::isa<ConstantPointerNull>(llvm_value))
|
|
1215
1216
|
return svfir->nullPtrSymID();
|
|
1216
|
-
else if (
|
|
1217
|
+
else if (SVFUtil::isa<UndefValue>(llvm_value))
|
|
1217
1218
|
return svfir->blkPtrSymID();
|
|
1218
1219
|
else
|
|
1219
1220
|
{
|
|
@@ -1224,7 +1225,7 @@ NodeID LLVMModuleSet::getValueNode(const SVFLLVMValue *val)
|
|
|
1224
1225
|
}
|
|
1225
1226
|
bool LLVMModuleSet::hasValueNode(const SVFLLVMValue *val)
|
|
1226
1227
|
{
|
|
1227
|
-
if (
|
|
1228
|
+
if (SVFUtil::isa<ConstantPointerNull, UndefValue>(llvmModuleSet->getLLVMValue(val)))
|
|
1228
1229
|
return true;
|
|
1229
1230
|
else
|
|
1230
1231
|
return (valSymMap.find(val) != valSymMap.end());
|
|
@@ -1326,55 +1327,7 @@ SVFConstantData* LLVMModuleSet::getSVFConstantData(const ConstantData* cd)
|
|
|
1326
1327
|
}
|
|
1327
1328
|
else
|
|
1328
1329
|
{
|
|
1329
|
-
SVFConstantData* svfcd =
|
|
1330
|
-
if(const ConstantInt* cint = SVFUtil::dyn_cast<ConstantInt>(cd))
|
|
1331
|
-
{
|
|
1332
|
-
/// bitwidth == 1 : cint has value from getZExtValue() because `bool true` will be translated to -1 using sign extension (i.e., getSExtValue).
|
|
1333
|
-
/// bitwidth <=64 1 : cint has value from getSExtValue()
|
|
1334
|
-
/// bitwidth >64 1 : cint has value 0 because it represents an invalid int
|
|
1335
|
-
if(cint->getBitWidth() == 1)
|
|
1336
|
-
svfcd = new SVFConstantInt(getSVFType(cint->getType()), cint->getZExtValue(), cint->getZExtValue());
|
|
1337
|
-
else if(cint->getBitWidth() <= 64 && cint->getBitWidth() > 1)
|
|
1338
|
-
svfcd = new SVFConstantInt(getSVFType(cint->getType()), cint->getZExtValue(), cint->getSExtValue());
|
|
1339
|
-
else
|
|
1340
|
-
svfcd = new SVFConstantInt(getSVFType(cint->getType()), 0, 0);
|
|
1341
|
-
}
|
|
1342
|
-
else if(const ConstantFP* cfp = SVFUtil::dyn_cast<ConstantFP>(cd))
|
|
1343
|
-
{
|
|
1344
|
-
double dval = 0;
|
|
1345
|
-
// TODO: Why only double is considered? What about float?
|
|
1346
|
-
if (cfp->isNormalFP())
|
|
1347
|
-
{
|
|
1348
|
-
const llvm::fltSemantics& semantics = cfp->getValueAPF().getSemantics();
|
|
1349
|
-
if (&semantics == &llvm::APFloat::IEEEhalf() ||
|
|
1350
|
-
&semantics == &llvm::APFloat::IEEEsingle() ||
|
|
1351
|
-
&semantics == &llvm::APFloat::IEEEdouble() ||
|
|
1352
|
-
&semantics == &llvm::APFloat::IEEEquad() ||
|
|
1353
|
-
&semantics == &llvm::APFloat::x87DoubleExtended())
|
|
1354
|
-
{
|
|
1355
|
-
dval = cfp->getValueAPF().convertToDouble();
|
|
1356
|
-
}
|
|
1357
|
-
else
|
|
1358
|
-
{
|
|
1359
|
-
assert (false && "Unsupported floating point type");
|
|
1360
|
-
abort();
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
else
|
|
1364
|
-
{
|
|
1365
|
-
// other cfp type, like isZero(), isInfinity(), isNegative(), etc.
|
|
1366
|
-
// do nothing
|
|
1367
|
-
}
|
|
1368
|
-
svfcd = new SVFConstantFP(getSVFType(cd->getType()), dval);
|
|
1369
|
-
}
|
|
1370
|
-
else if(SVFUtil::isa<ConstantPointerNull>(cd))
|
|
1371
|
-
svfcd = new SVFConstantNullPtr(getSVFType(cd->getType()));
|
|
1372
|
-
else if (SVFUtil::isa<UndefValue>(cd))
|
|
1373
|
-
svfcd = new SVFBlackHoleValue(getSVFType(cd->getType()));
|
|
1374
|
-
else
|
|
1375
|
-
svfcd = new SVFConstantData(getSVFType(cd->getType()));
|
|
1376
|
-
|
|
1377
|
-
|
|
1330
|
+
SVFConstantData* svfcd = new SVFConstantData(getSVFType(cd->getType()));
|
|
1378
1331
|
svfModule->addConstant(svfcd);
|
|
1379
1332
|
addConstantDataMap(cd,svfcd);
|
|
1380
1333
|
return svfcd;
|