svf-tools 1.0.1243 → 1.0.1245
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 +1 -1
- package/svf/include/AE/Svfexe/AbstractInterpretation.h +0 -10
- package/svf/include/AE/Svfexe/SparseAbstractInterpretation.h +8 -4
- package/svf/include/Graphs/SVFG.h +8 -8
- package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +0 -13
- package/svf/lib/AE/Svfexe/AbstractStateManager.cpp +0 -30
- package/svf/lib/AE/Svfexe/SparseAbstractInterpretation.cpp +31 -11
- package/svf/lib/Graphs/SVFG.cpp +22 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1245",
|
|
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": {
|
|
@@ -189,16 +189,6 @@ public:
|
|
|
189
189
|
return abstractTrace[node];
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
// ---- Def/Use site queries (sparsity-aware) ------------------------
|
|
193
|
-
|
|
194
|
-
virtual Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
195
|
-
virtual Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var) const;
|
|
196
|
-
virtual const ICFGNode* getDefSiteOfValVar(const ValVar* var) const;
|
|
197
|
-
virtual const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
198
|
-
|
|
199
|
-
/// Propagate an ObjVar's abstract value from defSite to all its use-sites.
|
|
200
|
-
void propagateObjVarAbsVal(const ObjVar* var, const ICFGNode* defSite);
|
|
201
|
-
|
|
202
192
|
protected:
|
|
203
193
|
/// Factory-only construction. External callers must use getAEInstance();
|
|
204
194
|
/// `SparseAbstractInterpretation` reaches this via its own ctor.
|
|
@@ -98,10 +98,14 @@ public:
|
|
|
98
98
|
bool hasAbsValue(const ValVar* var, const ICFGNode* node) const override;
|
|
99
99
|
using SemiSparseAbstractInterpretation::hasAbsValue;
|
|
100
100
|
|
|
101
|
-
Set<const ICFGNode*>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var) const;
|
|
102
|
+
const ICFGNode* getDefSiteOfValVar(const ValVar* var) const;
|
|
103
|
+
/// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
|
|
104
|
+
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
105
|
+
const Set<const ICFGNode*> getDefSiteOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
106
|
+
/// Given an ObjVar and its def-site ICFGNode, find all use-site ICFGNodes
|
|
107
|
+
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
108
|
+
const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const ICFGNode* node) const;
|
|
105
109
|
|
|
106
110
|
protected:
|
|
107
111
|
/// Build the SVFG on top of the semi-sparse precompute.
|
|
@@ -179,21 +179,21 @@ public:
|
|
|
179
179
|
return hasDef(valVar) && hasSVFGNode(getDef(valVar));
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
/// Given a ValVar and its SVFGNode, find the definition-site
|
|
182
|
+
/// Given a ValVar and its SVFGNode, find the definition-site SVFGNode
|
|
183
183
|
/// by following incoming direct VFGEdges (asserts unique definition)
|
|
184
|
-
const
|
|
184
|
+
const SVFGNode* getDefSiteOfValVar(const ValVar* var) const;
|
|
185
185
|
|
|
186
|
-
/// Given an ObjVar and its use-site
|
|
186
|
+
/// Given an ObjVar and its use-site SVFGNode, find the definition-site ICFGNode
|
|
187
187
|
/// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
|
|
188
|
-
const
|
|
188
|
+
const Set<const SVFGNode*> getDefSiteOfObjVar(const ObjVar* obj, const SVFGNode* node) const;
|
|
189
189
|
|
|
190
|
-
/// Given a ValVar, find all use-site
|
|
190
|
+
/// Given a ValVar, find all use-site SVFGNodes
|
|
191
191
|
/// by following outgoing direct VFGEdges from its unique definition SVFGNode
|
|
192
|
-
const Set<const
|
|
192
|
+
const Set<const SVFGNode*> getUseSitesOfValVar(const ValVar* var) const;
|
|
193
193
|
|
|
194
|
-
/// Given an ObjVar and its def-site
|
|
194
|
+
/// Given an ObjVar and its def-site SVFGNodes, find all use-site SVFGNodes
|
|
195
195
|
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
196
|
-
const Set<const
|
|
196
|
+
const Set<const SVFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const SVFGNode* node) const;
|
|
197
197
|
|
|
198
198
|
/// Perform statistics
|
|
199
199
|
void performStat();
|
|
@@ -96,19 +96,6 @@ AbstractInterpretation& AbstractInterpretation::getAEInstance()
|
|
|
96
96
|
return *instance;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// State-access methods (getAbsValue / hasAbsValue / updateAbsValue,
|
|
100
|
-
// state ops, GEP / load-store / type helpers, def-use queries) are
|
|
101
|
-
// implemented in AbstractStateManager.cpp for both dense and sparse.
|
|
102
|
-
|
|
103
|
-
void AbstractInterpretation::propagateObjVarAbsVal(const ObjVar* var, const ICFGNode* defSite)
|
|
104
|
-
{
|
|
105
|
-
const AbstractValue& val = getAbsValue(var, defSite);
|
|
106
|
-
for (const ICFGNode* useSite : getUseSitesOfObjVar(var, defSite))
|
|
107
|
-
{
|
|
108
|
-
updateAbsValue(var, val, useSite);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
99
|
|
|
113
100
|
/// Destructor
|
|
114
101
|
AbstractInterpretation::~AbstractInterpretation()
|
|
@@ -397,36 +397,6 @@ u32_t AbstractInterpretation::getAllocaInstByteSize(const AddrStmt* addr)
|
|
|
397
397
|
abort();
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
Set<const ICFGNode*> AbstractInterpretation::getUseSitesOfObjVar(const ObjVar*, const ICFGNode* node) const
|
|
401
|
-
{
|
|
402
|
-
Set<const ICFGNode*> succs;
|
|
403
|
-
for (const auto* edge : node->getOutEdges())
|
|
404
|
-
succs.insert(edge->getDstNode());
|
|
405
|
-
return succs;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
Set<const ICFGNode*> AbstractInterpretation::getUseSitesOfValVar(const ValVar* var) const
|
|
409
|
-
{
|
|
410
|
-
Set<const ICFGNode*> succs;
|
|
411
|
-
if (const ICFGNode* node = var->getICFGNode())
|
|
412
|
-
{
|
|
413
|
-
for (const auto* edge : node->getOutEdges())
|
|
414
|
-
succs.insert(edge->getDstNode());
|
|
415
|
-
}
|
|
416
|
-
return succs;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
const ICFGNode* AbstractInterpretation::getDefSiteOfValVar(const ValVar* var) const
|
|
420
|
-
{
|
|
421
|
-
return var->getICFGNode();
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
const ICFGNode* AbstractInterpretation::getDefSiteOfObjVar(const ObjVar*, const ICFGNode* node) const
|
|
425
|
-
{
|
|
426
|
-
for (const auto* edge : node->getInEdges())
|
|
427
|
-
return edge->getSrcNode();
|
|
428
|
-
return nullptr;
|
|
429
|
-
}
|
|
430
400
|
|
|
431
401
|
// =====================================================================
|
|
432
402
|
// Semi-sparse state-access overrides (used by both SemiSparse and
|
|
@@ -74,34 +74,54 @@ bool FullSparseAbstractInterpretation::hasAbsValue(
|
|
|
74
74
|
abort();
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
Set<const ICFGNode*> FullSparseAbstractInterpretation::
|
|
78
|
-
const
|
|
77
|
+
const Set<const ICFGNode*> FullSparseAbstractInterpretation::getUseSitesOfValVar(
|
|
78
|
+
const ValVar* var) const
|
|
79
79
|
{
|
|
80
80
|
assert(svfg && "SVFG is not built for full-sparse AE");
|
|
81
|
-
|
|
81
|
+
Set<const ICFGNode*> useSites;
|
|
82
|
+
for(const SVFGNode* svfgNode : svfg->getUseSitesOfValVar(var))
|
|
83
|
+
{
|
|
84
|
+
useSites.insert(svfgNode->getICFGNode());
|
|
85
|
+
}
|
|
86
|
+
return useSites;
|
|
82
87
|
}
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
const ICFGNode* FullSparseAbstractInterpretation::getDefSiteOfValVar(
|
|
85
90
|
const ValVar* var) const
|
|
86
91
|
{
|
|
87
92
|
assert(svfg && "SVFG is not built for full-sparse AE");
|
|
88
|
-
return svfg->
|
|
93
|
+
return svfg->getDefSiteOfValVar(var)->getICFGNode();
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
const ICFGNode
|
|
92
|
-
const
|
|
96
|
+
const Set<const ICFGNode*> FullSparseAbstractInterpretation::getDefSiteOfObjVar(
|
|
97
|
+
const ObjVar* obj, const ICFGNode* node) const
|
|
93
98
|
{
|
|
94
99
|
assert(svfg && "SVFG is not built for full-sparse AE");
|
|
95
|
-
|
|
100
|
+
Set<const ICFGNode*> defSites;
|
|
101
|
+
for(auto* vNode : node->getVFGNodes())
|
|
102
|
+
{
|
|
103
|
+
for(const SVFGNode* svfgNode : svfg->getDefSiteOfObjVar(obj, vNode))
|
|
104
|
+
{
|
|
105
|
+
defSites.insert(svfgNode->getICFGNode());
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return defSites;
|
|
96
109
|
}
|
|
97
110
|
|
|
98
|
-
const ICFGNode
|
|
111
|
+
const Set<const ICFGNode*> FullSparseAbstractInterpretation::getUseSitesOfObjVar(
|
|
99
112
|
const ObjVar* obj, const ICFGNode* node) const
|
|
100
113
|
{
|
|
101
114
|
assert(svfg && "SVFG is not built for full-sparse AE");
|
|
102
|
-
|
|
115
|
+
Set<const ICFGNode*> useSites;
|
|
116
|
+
for(auto* vNode : node->getVFGNodes())
|
|
117
|
+
{
|
|
118
|
+
for(const SVFGNode* svfgNode : svfg->getUseSitesOfObjVar(obj, vNode))
|
|
119
|
+
{
|
|
120
|
+
useSites.insert(svfgNode->getICFGNode());
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return useSites;
|
|
103
124
|
}
|
|
104
|
-
|
|
105
125
|
// =====================================================================
|
|
106
126
|
// Semi-sparse cycle helpers (sparse-shape gather / scatter).
|
|
107
127
|
// =====================================================================
|
package/svf/lib/Graphs/SVFG.cpp
CHANGED
|
@@ -760,78 +760,64 @@ void SVFG::performStat()
|
|
|
760
760
|
stat->performStat();
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
-
/// Given a ValVar
|
|
763
|
+
/// Given a ValVar, find the definition-site SVFGNode
|
|
764
764
|
/// by following incoming direct VFGEdges (asserts unique definition)
|
|
765
|
-
const
|
|
765
|
+
const SVFGNode* SVFG::getDefSiteOfValVar(const ValVar* var) const
|
|
766
766
|
{
|
|
767
|
-
return getDefSVFGNode(var)
|
|
767
|
+
return getDefSVFGNode(var);
|
|
768
768
|
}
|
|
769
769
|
|
|
770
|
-
/// Given an ObjVar and its use-site
|
|
770
|
+
/// Given an ObjVar and its use-site SVFGNode, find the definition-site SVFGNodes
|
|
771
771
|
/// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
|
|
772
|
-
const
|
|
772
|
+
const Set<const SVFGNode*> SVFG::getDefSiteOfObjVar(const ObjVar* obj, const SVFGNode* vNode) const
|
|
773
773
|
{
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
for (const VFGNode* vNode : node->getVFGNodes())
|
|
774
|
+
Set<const SVFGNode*> defSites;
|
|
775
|
+
for (auto it = vNode->InEdgeBegin(), eit = vNode->InEdgeEnd(); it != eit; ++it)
|
|
777
776
|
{
|
|
778
|
-
|
|
777
|
+
if (const IndirectSVFGEdge* indEdge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*it))
|
|
779
778
|
{
|
|
780
|
-
if (
|
|
779
|
+
if (indEdge->getPointsTo().test(obj->getId()))
|
|
781
780
|
{
|
|
782
|
-
|
|
783
|
-
{
|
|
784
|
-
assert(defSite == nullptr && "ObjVar should have a unique indirect definition!");
|
|
785
|
-
defSite = indEdge->getSrcNode()->getICFGNode();
|
|
786
|
-
}
|
|
781
|
+
defSites.insert(indEdge->getSrcNode());
|
|
787
782
|
}
|
|
788
783
|
}
|
|
789
784
|
}
|
|
790
|
-
return
|
|
785
|
+
return defSites;
|
|
791
786
|
}
|
|
792
787
|
|
|
793
788
|
/// Given a ValVar, find all use-site ICFGNodes
|
|
794
789
|
/// by following outgoing direct VFGEdges from its unique definition SVFGNode
|
|
795
|
-
const Set<const
|
|
790
|
+
const Set<const SVFGNode*> SVFG::getUseSitesOfValVar(const ValVar* var) const
|
|
796
791
|
{
|
|
797
792
|
const SVFGNode* defNode = getDefSVFGNode(var);
|
|
798
|
-
Set<const
|
|
793
|
+
Set<const SVFGNode*> useSites;
|
|
799
794
|
for (auto it = defNode->OutEdgeBegin(), eit = defNode->OutEdgeEnd(); it != eit; ++it)
|
|
800
795
|
{
|
|
801
796
|
const VFGEdge* edge = *it;
|
|
802
797
|
if (edge->isDirectVFGEdge())
|
|
803
798
|
{
|
|
804
|
-
|
|
805
|
-
useSites.insert(icfgNode);
|
|
806
|
-
else
|
|
807
|
-
assert(false && "The destination node of a direct VFG edge should have an ICFG node!");
|
|
799
|
+
useSites.insert(edge->getDstNode());
|
|
808
800
|
}
|
|
809
801
|
}
|
|
810
802
|
return useSites;
|
|
811
803
|
}
|
|
812
804
|
|
|
813
|
-
/// Given an ObjVar and its def-site
|
|
805
|
+
/// Given an ObjVar and its def-site SVFGNode, find all use-site SVFGNodes
|
|
814
806
|
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
815
|
-
const Set<const
|
|
807
|
+
const Set<const SVFGNode*> SVFG::getUseSitesOfObjVar(const ObjVar* obj, const SVFGNode* vNode) const
|
|
816
808
|
{
|
|
817
|
-
Set<const
|
|
818
|
-
|
|
819
|
-
for (const VFGNode* vNode : node->getVFGNodes())
|
|
809
|
+
Set<const SVFGNode*> useSites;
|
|
810
|
+
for (auto it = vNode->OutEdgeBegin(), eit = vNode->OutEdgeEnd(); it != eit; ++it)
|
|
820
811
|
{
|
|
821
|
-
|
|
812
|
+
if (const IndirectSVFGEdge* indEdge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*it))
|
|
822
813
|
{
|
|
823
|
-
if (
|
|
814
|
+
if (indEdge->getPointsTo().test(obj->getId()))
|
|
824
815
|
{
|
|
825
|
-
|
|
826
|
-
{
|
|
827
|
-
if (const ICFGNode* icfgNode = indEdge->getDstNode()->getICFGNode())
|
|
828
|
-
useSites.insert(icfgNode);
|
|
829
|
-
else
|
|
830
|
-
assert(false && "The destination node of an indirect SVFG edge should have an ICFG node!");
|
|
831
|
-
}
|
|
816
|
+
useSites.insert(indEdge->getDstNode());
|
|
832
817
|
}
|
|
833
818
|
}
|
|
834
819
|
}
|
|
820
|
+
|
|
835
821
|
return useSites;
|
|
836
822
|
}
|
|
837
823
|
|