svf-tools 1.0.1202 → 1.0.1204
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/Graphs/SVFG.h +16 -0
- package/svf/lib/Graphs/SVFG.cpp +78 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1204",
|
|
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": {
|
|
@@ -179,6 +179,22 @@ public:
|
|
|
179
179
|
return hasDef(pagNode) && hasSVFGNode(getDef(pagNode));
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
/// Given a ValVar and its SVFGNode, find the definition-site ICFGNode
|
|
183
|
+
/// by following incoming direct VFGEdges (asserts unique definition)
|
|
184
|
+
const ICFGNode* getDefSiteOfValVar(const ValVar* var, const SVFGNode* node) const;
|
|
185
|
+
|
|
186
|
+
/// Given an ObjVar and its SVFGNode, find the definition-site ICFGNode
|
|
187
|
+
/// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
|
|
188
|
+
const ICFGNode* getDefSiteOfObjVar(const ObjVar* obj, const SVFGNode* node) const;
|
|
189
|
+
|
|
190
|
+
/// Given a ValVar and its SVFStmt, find all use-site ICFGNodes
|
|
191
|
+
/// by following outgoing direct VFGEdges from its definition SVFGNode
|
|
192
|
+
const Set<const ICFGNode*> getUseSitesOfValVar(const ValVar* var, const SVFGNode* vNode) const;
|
|
193
|
+
|
|
194
|
+
/// Given an ObjVar and its SVFStmt, find all use-site ICFGNodes
|
|
195
|
+
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
196
|
+
const Set<const ICFGNode*> getUseSitesOfObjVar(const ObjVar* obj, const SVFGNode* vNode) const;
|
|
197
|
+
|
|
182
198
|
/// Perform statistics
|
|
183
199
|
void performStat();
|
|
184
200
|
|
package/svf/lib/Graphs/SVFG.cpp
CHANGED
|
@@ -760,6 +760,84 @@ void SVFG::performStat()
|
|
|
760
760
|
stat->performStat();
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
+
/// Given a ValVar and its SVFGNode, find the definition-site ICFGNode
|
|
764
|
+
/// by following incoming direct VFGEdges (asserts unique definition)
|
|
765
|
+
const ICFGNode* SVFG::getDefSiteOfValVar(const ValVar* var, const SVFGNode* node) const
|
|
766
|
+
{
|
|
767
|
+
const ICFGNode* defSite = nullptr;
|
|
768
|
+
for (auto it = node->InEdgeBegin(), eit = node->InEdgeEnd(); it != eit; ++it)
|
|
769
|
+
{
|
|
770
|
+
const VFGEdge* edge = *it;
|
|
771
|
+
if (edge->isDirectVFGEdge())
|
|
772
|
+
{
|
|
773
|
+
assert(defSite == nullptr && "ValVar should have a unique direct definition!");
|
|
774
|
+
defSite = edge->getSrcNode()->getICFGNode();
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
return defSite;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/// Given an ObjVar and its SVFGNode, find the definition-site ICFGNode
|
|
781
|
+
/// by following incoming IndirectSVFGEdges whose pts contains the ObjVar (asserts unique definition)
|
|
782
|
+
const ICFGNode* SVFG::getDefSiteOfObjVar(const ObjVar* obj, const SVFGNode* node) const
|
|
783
|
+
{
|
|
784
|
+
const ICFGNode* defSite = nullptr;
|
|
785
|
+
NodeID objId = obj->getId();
|
|
786
|
+
for (auto it = node->InEdgeBegin(), eit = node->InEdgeEnd(); it != eit; ++it)
|
|
787
|
+
{
|
|
788
|
+
if (const IndirectSVFGEdge* indEdge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*it))
|
|
789
|
+
{
|
|
790
|
+
if (indEdge->getPointsTo().test(objId))
|
|
791
|
+
{
|
|
792
|
+
assert(defSite == nullptr && "ObjVar should have a unique indirect definition!");
|
|
793
|
+
defSite = indEdge->getSrcNode()->getICFGNode();
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
return defSite;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/// Given a ValVar and its SVFStmt, find all use-site ICFGNodes
|
|
801
|
+
/// by following outgoing direct VFGEdges from its definition SVFGNode
|
|
802
|
+
const Set<const ICFGNode*> SVFG::getUseSitesOfValVar(const ValVar* var, const SVFGNode* node) const
|
|
803
|
+
{
|
|
804
|
+
Set<const ICFGNode*> useSites;
|
|
805
|
+
for (auto it = node->OutEdgeBegin(), eit = node->OutEdgeEnd(); it != eit; ++it)
|
|
806
|
+
{
|
|
807
|
+
const VFGEdge* edge = *it;
|
|
808
|
+
if (edge->isDirectVFGEdge())
|
|
809
|
+
{
|
|
810
|
+
if (const ICFGNode* icfgNode = edge->getDstNode()->getICFGNode())
|
|
811
|
+
useSites.insert(icfgNode);
|
|
812
|
+
else
|
|
813
|
+
assert(false && "The destination node of a direct VFG edge should have an ICFG node!");
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return useSites;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/// Given an ObjVar and its SVFStmt, find all use-site ICFGNodes
|
|
820
|
+
/// by following outgoing IndirectSVFGEdges whose pts contains the ObjVar
|
|
821
|
+
const Set<const ICFGNode*> SVFG::getUseSitesOfObjVar(const ObjVar* obj, const SVFGNode* node) const
|
|
822
|
+
{
|
|
823
|
+
Set<const ICFGNode*> useSites;
|
|
824
|
+
NodeID objId = obj->getId();
|
|
825
|
+
for (auto it = node->OutEdgeBegin(), eit = node->OutEdgeEnd(); it != eit; ++it)
|
|
826
|
+
{
|
|
827
|
+
if (const IndirectSVFGEdge* indEdge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*it))
|
|
828
|
+
{
|
|
829
|
+
if (indEdge->getPointsTo().test(objId))
|
|
830
|
+
{
|
|
831
|
+
if (const ICFGNode* icfgNode = indEdge->getDstNode()->getICFGNode())
|
|
832
|
+
useSites.insert(icfgNode);
|
|
833
|
+
else
|
|
834
|
+
assert(false && "The destination node of an indirect SVFG edge should have an ICFG node!");
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return useSites;
|
|
839
|
+
}
|
|
840
|
+
|
|
763
841
|
/*!
|
|
764
842
|
* GraphTraits specialization
|
|
765
843
|
*/
|