svf-tools 1.0.1041 → 1.0.1042
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 +1 -1
- package/svf/include/DDA/DDAVFSolver.h +4 -4
- package/svf/include/Graphs/{PTACallGraph.h → CallGraph.h} +38 -38
- package/svf/include/Graphs/ICFG.h +2 -2
- package/svf/include/Graphs/ThreadCallGraph.h +25 -25
- package/svf/include/Graphs/VFG.h +4 -4
- package/svf/include/MSSA/MemRegion.h +4 -4
- package/svf/include/MTA/LockAnalysis.h +1 -1
- package/svf/include/MTA/MHP.h +2 -2
- package/svf/include/MTA/TCT.h +6 -6
- package/svf/include/MemoryModel/PointerAnalysis.h +5 -5
- package/svf/include/SABER/SaberSVFGBuilder.h +1 -1
- package/svf/include/SABER/SrcSnkDDA.h +2 -2
- package/svf/include/SVFIR/SVFIR.h +3 -3
- package/svf/include/Util/CallGraphBuilder.h +2 -2
- package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +3 -3
- package/svf/lib/DDA/DDAClient.cpp +2 -2
- package/svf/lib/Graphs/{PTACallGraph.cpp → CallGraph.cpp} +78 -78
- package/svf/lib/Graphs/ICFG.cpp +6 -6
- package/svf/lib/Graphs/SVFG.cpp +4 -4
- package/svf/lib/Graphs/SVFGReadWrite.cpp +4 -4
- package/svf/lib/Graphs/SVFGStat.cpp +1 -1
- package/svf/lib/Graphs/ThreadCallGraph.cpp +13 -13
- package/svf/lib/Graphs/VFG.cpp +1 -1
- package/svf/lib/MSSA/MemRegion.cpp +8 -8
- package/svf/lib/MSSA/MemSSA.cpp +2 -2
- package/svf/lib/MSSA/SVFGBuilder.cpp +2 -2
- package/svf/lib/MTA/LockAnalysis.cpp +18 -18
- package/svf/lib/MTA/MHP.cpp +19 -19
- package/svf/lib/MTA/MTAStat.cpp +1 -1
- package/svf/lib/MTA/TCT.cpp +25 -25
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +1 -1
- package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +1 -1
- package/svf/lib/SABER/LeakChecker.cpp +4 -4
- package/svf/lib/SABER/SaberCondAllocator.cpp +2 -2
- package/svf/lib/SABER/SaberSVFGBuilder.cpp +3 -3
- package/svf/lib/SVFIR/SVFIR.cpp +1 -1
- package/svf/lib/SVFIR/SVFVariables.cpp +1 -1
- package/svf/lib/Util/CDGBuilder.cpp +2 -2
- package/svf/lib/Util/CallGraphBuilder.cpp +7 -7
- package/svf/lib/Util/PTAStat.cpp +7 -7
- package/svf/lib/Util/SVFStat.cpp +2 -2
- package/svf/lib/Util/SVFUtil.cpp +5 -5
- package/svf/lib/Util/ThreadAPI.cpp +2 -2
- package/svf/lib/WPA/VersionedFlowSensitive.cpp +1 -1
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +1 -1
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/svf-llvm/lib/LLVMModule.cpp +1 -1
- package/svf-llvm/lib/LLVMUtil.cpp +1 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +6 -6
- package/svf-llvm/lib/SVFIRExtAPI.cpp +1 -1
- package/svf-llvm/tools/AE/ae.cpp +1 -1
- package/svf-llvm/tools/Example/svf-ex.cpp +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1042",
|
|
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": {
|
|
@@ -49,8 +49,8 @@ class DDAVFSolver
|
|
|
49
49
|
friend class DDAStat;
|
|
50
50
|
public:
|
|
51
51
|
typedef SCCDetection<SVFG*> SVFGSCC;
|
|
52
|
-
typedef SCCDetection<
|
|
53
|
-
typedef
|
|
52
|
+
typedef SCCDetection<CallGraph*> CallGraphSCC;
|
|
53
|
+
typedef CallGraphEdge::CallInstSet CallInstSet;
|
|
54
54
|
typedef SVFIR::CallSiteSet CallSiteSet;
|
|
55
55
|
typedef OrderedSet<DPIm> DPTItemSet;
|
|
56
56
|
typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
|
|
@@ -624,7 +624,7 @@ protected:
|
|
|
624
624
|
return (getSVFGSCCRepNode(edge->getSrcID()) == getSVFGSCCRepNode(edge->getDstID()));
|
|
625
625
|
}
|
|
626
626
|
/// Set callgraph
|
|
627
|
-
inline void setCallGraph (
|
|
627
|
+
inline void setCallGraph (CallGraph* cg)
|
|
628
628
|
{
|
|
629
629
|
_callGraph = cg;
|
|
630
630
|
}
|
|
@@ -774,7 +774,7 @@ protected:
|
|
|
774
774
|
SVFG* _svfg; ///< SVFG
|
|
775
775
|
AndersenWaveDiff* _ander; ///< Andersen's analysis
|
|
776
776
|
NodeBS candidateQueries; ///< candidate pointers;
|
|
777
|
-
|
|
777
|
+
CallGraph* _callGraph; ///< PTACallGraph
|
|
778
778
|
CallGraphSCC* _callGraphSCC; ///< SCC for PTACallGraph
|
|
779
779
|
SVFGSCC* _svfgSCC; ///< SCC for SVFG
|
|
780
780
|
DPTItemSet backwardVisited; ///< visited map during backward traversing
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class CallGraphNode;
|
|
42
42
|
class SVFModule;
|
|
43
43
|
class CallGraph;
|
|
44
44
|
|
|
@@ -48,8 +48,8 @@ class CallGraph;
|
|
|
48
48
|
* Multiple calls from function A to B are merged into one call edge
|
|
49
49
|
* Each call edge has a set of direct callsites and a set of indirect callsites
|
|
50
50
|
*/
|
|
51
|
-
typedef GenericEdge<
|
|
52
|
-
class
|
|
51
|
+
typedef GenericEdge<CallGraphNode> GenericPTACallGraphEdgeTy;
|
|
52
|
+
class CallGraphEdge : public GenericPTACallGraphEdgeTy
|
|
53
53
|
{
|
|
54
54
|
|
|
55
55
|
public:
|
|
@@ -66,12 +66,12 @@ private:
|
|
|
66
66
|
CallSiteID csId;
|
|
67
67
|
public:
|
|
68
68
|
/// Constructor
|
|
69
|
-
|
|
69
|
+
CallGraphEdge(CallGraphNode* s, CallGraphNode* d, CEDGEK kind, CallSiteID cs) :
|
|
70
70
|
GenericPTACallGraphEdgeTy(s, d, makeEdgeFlagWithInvokeID(kind, cs)), csId(cs)
|
|
71
71
|
{
|
|
72
72
|
}
|
|
73
73
|
/// Destructor
|
|
74
|
-
virtual ~
|
|
74
|
+
virtual ~CallGraphEdge()
|
|
75
75
|
{
|
|
76
76
|
}
|
|
77
77
|
/// Compute the unique edgeFlag value from edge kind and CallSiteID.
|
|
@@ -141,21 +141,21 @@ public:
|
|
|
141
141
|
|
|
142
142
|
/// ClassOf
|
|
143
143
|
//@{
|
|
144
|
-
static inline bool classof(const
|
|
144
|
+
static inline bool classof(const CallGraphEdge*)
|
|
145
145
|
{
|
|
146
146
|
return true;
|
|
147
147
|
}
|
|
148
148
|
static inline bool classof(const GenericPTACallGraphEdgeTy *edge)
|
|
149
149
|
{
|
|
150
|
-
return edge->getEdgeKind() ==
|
|
151
|
-
edge->getEdgeKind() ==
|
|
152
|
-
edge->getEdgeKind() ==
|
|
150
|
+
return edge->getEdgeKind() == CallGraphEdge::CallRetEdge ||
|
|
151
|
+
edge->getEdgeKind() == CallGraphEdge::TDForkEdge ||
|
|
152
|
+
edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
|
|
153
153
|
}
|
|
154
154
|
//@}
|
|
155
155
|
|
|
156
156
|
/// Overloading operator << for dumping ICFG node ID
|
|
157
157
|
//@{
|
|
158
|
-
friend OutStream& operator<< (OutStream &o, const
|
|
158
|
+
friend OutStream& operator<< (OutStream &o, const CallGraphEdge&edge)
|
|
159
159
|
{
|
|
160
160
|
o << edge.toString();
|
|
161
161
|
return o;
|
|
@@ -164,22 +164,22 @@ public:
|
|
|
164
164
|
|
|
165
165
|
virtual const std::string toString() const;
|
|
166
166
|
|
|
167
|
-
typedef GenericNode<
|
|
167
|
+
typedef GenericNode<CallGraphNode, CallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;
|
|
168
168
|
|
|
169
169
|
};
|
|
170
170
|
|
|
171
171
|
/*
|
|
172
172
|
* Call Graph node representing a function
|
|
173
173
|
*/
|
|
174
|
-
typedef GenericNode<
|
|
175
|
-
class
|
|
174
|
+
typedef GenericNode<CallGraphNode, CallGraphEdge> GenericPTACallGraphNodeTy;
|
|
175
|
+
class CallGraphNode : public GenericPTACallGraphNodeTy
|
|
176
176
|
{
|
|
177
177
|
private:
|
|
178
178
|
const SVFFunction* fun;
|
|
179
179
|
|
|
180
180
|
public:
|
|
181
181
|
/// Constructor
|
|
182
|
-
|
|
182
|
+
CallGraphNode(NodeID i, const SVFFunction* f) : GenericPTACallGraphNodeTy(i,CallNodeKd), fun(f)
|
|
183
183
|
{
|
|
184
184
|
|
|
185
185
|
}
|
|
@@ -201,7 +201,7 @@ public:
|
|
|
201
201
|
|
|
202
202
|
/// Overloading operator << for dumping ICFG node ID
|
|
203
203
|
//@{
|
|
204
|
-
friend OutStream& operator<< (OutStream &o, const
|
|
204
|
+
friend OutStream& operator<< (OutStream &o, const CallGraphNode&node)
|
|
205
205
|
{
|
|
206
206
|
o << node.toString();
|
|
207
207
|
return o;
|
|
@@ -212,7 +212,7 @@ public:
|
|
|
212
212
|
|
|
213
213
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
214
214
|
//@{
|
|
215
|
-
static inline bool classof(const
|
|
215
|
+
static inline bool classof(const CallGraphNode*)
|
|
216
216
|
{
|
|
217
217
|
return true;
|
|
218
218
|
}
|
|
@@ -232,13 +232,13 @@ public:
|
|
|
232
232
|
/*!
|
|
233
233
|
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
234
234
|
*/
|
|
235
|
-
typedef GenericGraph<
|
|
236
|
-
class
|
|
235
|
+
typedef GenericGraph<CallGraphNode, CallGraphEdge> GenericPTACallGraphTy;
|
|
236
|
+
class CallGraph : public GenericPTACallGraphTy
|
|
237
237
|
{
|
|
238
238
|
|
|
239
239
|
public:
|
|
240
|
-
typedef
|
|
241
|
-
typedef Map<const SVFFunction*,
|
|
240
|
+
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
241
|
+
typedef Map<const SVFFunction*, CallGraphNode*> FunToCallGraphNodeMap;
|
|
242
242
|
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
|
|
243
243
|
typedef std::pair<const CallICFGNode*, const SVFFunction*> CallSitePair;
|
|
244
244
|
typedef Map<CallSitePair, CallSiteID> CallSiteToIdMap;
|
|
@@ -291,7 +291,7 @@ protected:
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/// Add call graph edge
|
|
294
|
-
inline void addEdge(
|
|
294
|
+
inline void addEdge(CallGraphEdge* edge)
|
|
295
295
|
{
|
|
296
296
|
edge->getDstNode()->addIncomingEdge(edge);
|
|
297
297
|
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
@@ -299,13 +299,13 @@ protected:
|
|
|
299
299
|
|
|
300
300
|
public:
|
|
301
301
|
/// Constructor
|
|
302
|
-
|
|
302
|
+
CallGraph(CGEK k = NormCallGraph);
|
|
303
303
|
|
|
304
304
|
/// Copy constructor
|
|
305
|
-
|
|
305
|
+
CallGraph(const CallGraph& other);
|
|
306
306
|
|
|
307
307
|
/// Destructor
|
|
308
|
-
virtual ~
|
|
308
|
+
virtual ~CallGraph()
|
|
309
309
|
{
|
|
310
310
|
destroy();
|
|
311
311
|
}
|
|
@@ -359,13 +359,13 @@ public:
|
|
|
359
359
|
/// Get call graph node
|
|
360
360
|
//@{
|
|
361
361
|
|
|
362
|
-
const
|
|
362
|
+
const CallGraphNode* getCallGraphNode(const std::string& name);
|
|
363
363
|
|
|
364
|
-
inline
|
|
364
|
+
inline CallGraphNode* getCallGraphNode(NodeID id) const
|
|
365
365
|
{
|
|
366
366
|
return getGNode(id);
|
|
367
367
|
}
|
|
368
|
-
inline
|
|
368
|
+
inline CallGraphNode* getCallGraphNode(const SVFFunction* fun) const
|
|
369
369
|
{
|
|
370
370
|
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
|
|
371
371
|
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
|
|
@@ -409,11 +409,11 @@ public:
|
|
|
409
409
|
}
|
|
410
410
|
//@}
|
|
411
411
|
/// Whether we have already created this call graph edge
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
CallGraphEdge* hasGraphEdge(CallGraphNode* src, CallGraphNode* dst,
|
|
413
|
+
CallGraphEdge::CEDGEK kind, CallSiteID csId) const;
|
|
414
414
|
/// Get call graph edge via nodes
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
CallGraphEdge* getGraphEdge(CallGraphNode* src, CallGraphNode* dst,
|
|
416
|
+
CallGraphEdge::CEDGEK kind, CallSiteID csId);
|
|
417
417
|
|
|
418
418
|
/// Get all callees for a callsite
|
|
419
419
|
inline void getCallees(const CallICFGNode* cs, FunctionSet& callees)
|
|
@@ -459,9 +459,9 @@ public:
|
|
|
459
459
|
|
|
460
460
|
/// Get callsites invoking the callee
|
|
461
461
|
//@{
|
|
462
|
-
void getAllCallSitesInvokingCallee(const SVFFunction* callee,
|
|
463
|
-
void getDirCallSitesInvokingCallee(const SVFFunction* callee,
|
|
464
|
-
void getIndCallSitesInvokingCallee(const SVFFunction* callee,
|
|
462
|
+
void getAllCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
463
|
+
void getDirCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
464
|
+
void getIndCallSitesInvokingCallee(const SVFFunction* callee, CallGraphEdge::CallInstSet& csSet);
|
|
465
465
|
//@}
|
|
466
466
|
|
|
467
467
|
/// Whether its reachable between two functions
|
|
@@ -482,19 +482,19 @@ namespace SVF
|
|
|
482
482
|
* GenericGraphTraits specializations for generic graph algorithms.
|
|
483
483
|
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
484
484
|
*/
|
|
485
|
-
template<> struct GenericGraphTraits<SVF::
|
|
485
|
+
template<> struct GenericGraphTraits<SVF::CallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
486
486
|
{
|
|
487
487
|
};
|
|
488
488
|
|
|
489
489
|
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
490
490
|
template<>
|
|
491
|
-
struct GenericGraphTraits<Inverse<SVF::
|
|
491
|
+
struct GenericGraphTraits<Inverse<SVF::CallGraphNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* > >
|
|
492
492
|
{
|
|
493
493
|
};
|
|
494
494
|
|
|
495
|
-
template<> struct GenericGraphTraits<SVF::
|
|
495
|
+
template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
496
496
|
{
|
|
497
|
-
typedef SVF::
|
|
497
|
+
typedef SVF::CallGraphNode*NodeRef;
|
|
498
498
|
};
|
|
499
499
|
|
|
500
500
|
} // End namespace llvm
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class CallGraph;
|
|
42
42
|
|
|
43
43
|
/*!
|
|
44
44
|
* Interprocedural Control-Flow Graph (ICFG)
|
|
@@ -111,7 +111,7 @@ public:
|
|
|
111
111
|
void view();
|
|
112
112
|
|
|
113
113
|
/// update ICFG for indirect calls
|
|
114
|
-
void updateCallGraph(
|
|
114
|
+
void updateCallGraph(CallGraph* callgraph);
|
|
115
115
|
|
|
116
116
|
/// Whether node is in a loop
|
|
117
117
|
inline bool isInLoop(const ICFGNode *node)
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef RCG_H_
|
|
31
31
|
#define RCG_H_
|
|
32
32
|
|
|
33
|
-
#include "Graphs/
|
|
33
|
+
#include "Graphs/CallGraph.h"
|
|
34
34
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
@@ -41,13 +41,13 @@ class PointerAnalysis;
|
|
|
41
41
|
/*!
|
|
42
42
|
* PTA thread fork edge from fork site to the entry of a start routine function
|
|
43
43
|
*/
|
|
44
|
-
class ThreadForkEdge: public
|
|
44
|
+
class ThreadForkEdge: public CallGraphEdge
|
|
45
45
|
{
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
/// Constructor
|
|
49
|
-
ThreadForkEdge(
|
|
50
|
-
|
|
49
|
+
ThreadForkEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
50
|
+
CallGraphEdge(s, d, CallGraphEdge::TDForkEdge, csId)
|
|
51
51
|
{
|
|
52
52
|
}
|
|
53
53
|
/// Destructor
|
|
@@ -61,9 +61,9 @@ public:
|
|
|
61
61
|
{
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
static inline bool classof(const
|
|
64
|
+
static inline bool classof(const CallGraphEdge*edge)
|
|
65
65
|
{
|
|
66
|
-
return edge->getEdgeKind() ==
|
|
66
|
+
return edge->getEdgeKind() == CallGraphEdge::TDForkEdge;
|
|
67
67
|
}
|
|
68
68
|
//@}
|
|
69
69
|
|
|
@@ -78,19 +78,19 @@ public:
|
|
|
78
78
|
return rawstr.str();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
typedef GenericNode<
|
|
81
|
+
typedef GenericNode<CallGraphNode, ThreadForkEdge>::GEdgeSetTy ForkEdgeSet;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/*!
|
|
85
85
|
* PTA thread join edge from the exit of a start routine function to a join point of the thread
|
|
86
86
|
*/
|
|
87
|
-
class ThreadJoinEdge: public
|
|
87
|
+
class ThreadJoinEdge: public CallGraphEdge
|
|
88
88
|
{
|
|
89
89
|
|
|
90
90
|
public:
|
|
91
91
|
/// Constructor
|
|
92
|
-
ThreadJoinEdge(
|
|
93
|
-
|
|
92
|
+
ThreadJoinEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
93
|
+
CallGraphEdge(s, d, CallGraphEdge::TDJoinEdge, csId)
|
|
94
94
|
{
|
|
95
95
|
}
|
|
96
96
|
/// Destructor
|
|
@@ -102,9 +102,9 @@ public:
|
|
|
102
102
|
{
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
|
-
static inline bool classof(const
|
|
105
|
+
static inline bool classof(const CallGraphEdge*edge)
|
|
106
106
|
{
|
|
107
|
-
return edge->getEdgeKind() ==
|
|
107
|
+
return edge->getEdgeKind() == CallGraphEdge::TDJoinEdge;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
virtual const std::string toString() const
|
|
@@ -118,19 +118,19 @@ public:
|
|
|
118
118
|
return rawstr.str();
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
typedef GenericNode<
|
|
121
|
+
typedef GenericNode<CallGraphNode, ThreadJoinEdge>::GEdgeSetTy JoinEdgeSet;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
/*!
|
|
125
125
|
* hare_parallel_for edge from fork site to the entry of a start routine function
|
|
126
126
|
*/
|
|
127
|
-
class HareParForEdge: public
|
|
127
|
+
class HareParForEdge: public CallGraphEdge
|
|
128
128
|
{
|
|
129
129
|
|
|
130
130
|
public:
|
|
131
131
|
/// Constructor
|
|
132
|
-
HareParForEdge(
|
|
133
|
-
|
|
132
|
+
HareParForEdge(CallGraphNode* s, CallGraphNode* d, CallSiteID csId) :
|
|
133
|
+
CallGraphEdge(s, d, CallGraphEdge::HareParForEdge, csId)
|
|
134
134
|
{
|
|
135
135
|
}
|
|
136
136
|
/// Destructor
|
|
@@ -144,20 +144,20 @@ public:
|
|
|
144
144
|
{
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
|
-
static inline bool classof(const
|
|
147
|
+
static inline bool classof(const CallGraphEdge*edge)
|
|
148
148
|
{
|
|
149
|
-
return edge->getEdgeKind() ==
|
|
149
|
+
return edge->getEdgeKind() == CallGraphEdge::HareParForEdge;
|
|
150
150
|
}
|
|
151
151
|
//@}
|
|
152
152
|
|
|
153
|
-
typedef GenericNode<
|
|
153
|
+
typedef GenericNode<CallGraphNode, HareParForEdge>::GEdgeSetTy ParForEdgeSet;
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
/*!
|
|
158
158
|
* Thread sensitive call graph
|
|
159
159
|
*/
|
|
160
|
-
class ThreadCallGraph: public
|
|
160
|
+
class ThreadCallGraph: public CallGraph
|
|
161
161
|
{
|
|
162
162
|
|
|
163
163
|
public:
|
|
@@ -172,7 +172,7 @@ public:
|
|
|
172
172
|
typedef Map<const CallICFGNode*, ParForEdgeSet> CallInstToParForEdgesMap;
|
|
173
173
|
|
|
174
174
|
/// Constructor
|
|
175
|
-
ThreadCallGraph(const
|
|
175
|
+
ThreadCallGraph(const CallGraph& cg);
|
|
176
176
|
|
|
177
177
|
ThreadCallGraph(ThreadCallGraph& cg) = delete;
|
|
178
178
|
|
|
@@ -187,9 +187,9 @@ public:
|
|
|
187
187
|
{
|
|
188
188
|
return true;
|
|
189
189
|
}
|
|
190
|
-
static inline bool classof(const
|
|
190
|
+
static inline bool classof(const CallGraph*g)
|
|
191
191
|
{
|
|
192
|
-
return g->getKind() ==
|
|
192
|
+
return g->getKind() == CallGraph::ThdCallGraph;
|
|
193
193
|
}
|
|
194
194
|
//@}
|
|
195
195
|
|
|
@@ -239,7 +239,7 @@ public:
|
|
|
239
239
|
assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
|
|
240
240
|
return it->second.end();
|
|
241
241
|
}
|
|
242
|
-
inline void getJoinSites(const
|
|
242
|
+
inline void getJoinSites(const CallGraphNode* routine, InstSet& csSet)
|
|
243
243
|
{
|
|
244
244
|
for(CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.begin(), eit = callinstToThreadJoinEdgesMap.end(); it!=eit; ++it)
|
|
245
245
|
{
|
|
@@ -390,7 +390,7 @@ public:
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
/// has thread join edge
|
|
393
|
-
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call,
|
|
393
|
+
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call, CallGraphNode* joinFunNode, CallGraphNode* threadRoutineFunNode, CallSiteID csId) const
|
|
394
394
|
{
|
|
395
395
|
ThreadJoinEdge joinEdge(joinFunNode,threadRoutineFunNode, csId);
|
|
396
396
|
CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(call);
|
package/svf/include/Graphs/VFG.h
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
#include "SVFIR/SVFIR.h"
|
|
35
|
-
#include "Graphs/
|
|
35
|
+
#include "Graphs/CallGraph.h"
|
|
36
36
|
#include "Graphs/VFGNode.h"
|
|
37
37
|
#include "Graphs/VFGEdge.h"
|
|
38
38
|
|
|
@@ -100,7 +100,7 @@ protected:
|
|
|
100
100
|
FunToVFGNodesMapTy funToVFGNodesMap; ///< map a function to its VFGNodes;
|
|
101
101
|
|
|
102
102
|
GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
|
|
103
|
-
|
|
103
|
+
CallGraph* callgraph;
|
|
104
104
|
SVFIR* pag;
|
|
105
105
|
VFGK kind;
|
|
106
106
|
|
|
@@ -109,7 +109,7 @@ protected:
|
|
|
109
109
|
|
|
110
110
|
public:
|
|
111
111
|
/// Constructor
|
|
112
|
-
VFG(
|
|
112
|
+
VFG(CallGraph* callgraph, VFGK k = FULLSVFG);
|
|
113
113
|
|
|
114
114
|
/// Destructor
|
|
115
115
|
virtual ~VFG()
|
|
@@ -136,7 +136,7 @@ public:
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/// Return PTACallGraph
|
|
139
|
-
inline
|
|
139
|
+
inline CallGraph* getCallGraph() const
|
|
140
140
|
{
|
|
141
141
|
return callgraph;
|
|
142
142
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
#define MEMORYREGION_H_
|
|
36
36
|
|
|
37
37
|
#include "Graphs/ICFG.h"
|
|
38
|
-
#include "Graphs/
|
|
38
|
+
#include "Graphs/CallGraph.h"
|
|
39
39
|
#include "Graphs/SCC.h"
|
|
40
40
|
#include "SVFIR/SVFIR.h"
|
|
41
41
|
#include "Util/WorkList.h"
|
|
@@ -175,7 +175,7 @@ public:
|
|
|
175
175
|
/// SVFIR edge list
|
|
176
176
|
typedef SVFIR::SVFStmtList SVFStmtList;
|
|
177
177
|
/// Call Graph SCC
|
|
178
|
-
typedef SCCDetection<
|
|
178
|
+
typedef SCCDetection<CallGraph*> SCC;
|
|
179
179
|
|
|
180
180
|
MRSet& getMRSet()
|
|
181
181
|
{
|
|
@@ -196,7 +196,7 @@ private:
|
|
|
196
196
|
|
|
197
197
|
BVDataPTAImpl* pta;
|
|
198
198
|
SCC* callGraphSCC;
|
|
199
|
-
|
|
199
|
+
CallGraph* callGraph;
|
|
200
200
|
bool ptrOnlyMSSA;
|
|
201
201
|
|
|
202
202
|
/// Map a function to all its memory regions
|
|
@@ -328,7 +328,7 @@ protected:
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/// Mod-Ref analysis for callsite invoking this callGraphNode
|
|
331
|
-
virtual void modRefAnalysis(
|
|
331
|
+
virtual void modRefAnalysis(CallGraphNode* callGraphNode, WorkList& worklist);
|
|
332
332
|
|
|
333
333
|
/// Get Mod-Ref of a callee function
|
|
334
334
|
virtual bool handleCallsiteModRef(NodeBS& mod, NodeBS& ref, const CallICFGNode* cs, const SVFFunction* fun);
|
|
@@ -339,7 +339,7 @@ private:
|
|
|
339
339
|
void handleIntra(const CxtStmt& cts);
|
|
340
340
|
|
|
341
341
|
/// Handle call relations
|
|
342
|
-
void handleCallRelation(CxtLockProc& clp, const
|
|
342
|
+
void handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
|
|
343
343
|
|
|
344
344
|
/// Return true it a lock matches an unlock
|
|
345
345
|
bool isAliasedLocks(const CxtLock& cl1, const CxtLock& cl2)
|
package/svf/include/MTA/MHP.h
CHANGED
|
@@ -123,7 +123,7 @@ public:
|
|
|
123
123
|
|
|
124
124
|
private:
|
|
125
125
|
|
|
126
|
-
inline const
|
|
126
|
+
inline const CallGraph::FunctionSet& getCallee(const CallICFGNode* inst, CallGraph::FunctionSet& callees)
|
|
127
127
|
{
|
|
128
128
|
tcg->getCallees(inst, callees);
|
|
129
129
|
return callees;
|
|
@@ -482,7 +482,7 @@ private:
|
|
|
482
482
|
{
|
|
483
483
|
return getTCG()->getThreadAPI()->getJoinedThread(call);
|
|
484
484
|
}
|
|
485
|
-
inline const
|
|
485
|
+
inline const CallGraph::FunctionSet& getCallee(const ICFGNode* inst, CallGraph::FunctionSet& callees)
|
|
486
486
|
{
|
|
487
487
|
getTCG()->getCallees(SVFUtil::cast<CallICFGNode>(inst), callees);
|
|
488
488
|
return callees;
|
package/svf/include/MTA/TCT.h
CHANGED
|
@@ -160,14 +160,14 @@ public:
|
|
|
160
160
|
typedef Set<const SVFFunction*> FunSet;
|
|
161
161
|
typedef std::vector<const ICFGNode*> InstVec;
|
|
162
162
|
typedef Set<const ICFGNode*> InstSet;
|
|
163
|
-
typedef Set<const
|
|
163
|
+
typedef Set<const CallGraphNode*> PTACGNodeSet;
|
|
164
164
|
typedef Map<CxtThread,TCTNode*> CxtThreadToNodeMap;
|
|
165
165
|
typedef Map<CxtThread,CallStrCxt> CxtThreadToForkCxt;
|
|
166
166
|
typedef Map<CxtThread,const SVFFunction*> CxtThreadToFun;
|
|
167
167
|
typedef Map<const ICFGNode*, LoopBBs> InstToLoopMap;
|
|
168
168
|
typedef FIFOWorkList<CxtThreadProc> CxtThreadProcVec;
|
|
169
169
|
typedef Set<CxtThreadProc> CxtThreadProcSet;
|
|
170
|
-
typedef SCCDetection<
|
|
170
|
+
typedef SCCDetection<CallGraph*> ThreadCallGraphSCC;
|
|
171
171
|
|
|
172
172
|
/// Constructor
|
|
173
173
|
TCT(PointerAnalysis* p) :pta(p),TCTNodeNum(0),TCTEdgeNum(0),MaxCxtSize(0)
|
|
@@ -288,9 +288,9 @@ public:
|
|
|
288
288
|
//@}
|
|
289
289
|
|
|
290
290
|
/// Whether it is a candidate function for indirect call
|
|
291
|
-
inline bool isCandidateFun(const
|
|
291
|
+
inline bool isCandidateFun(const CallGraph::FunctionSet& callees) const
|
|
292
292
|
{
|
|
293
|
-
for(
|
|
293
|
+
for(CallGraph::FunctionSet::const_iterator cit = callees.begin(),
|
|
294
294
|
ecit = callees.end(); cit!=ecit; cit++)
|
|
295
295
|
{
|
|
296
296
|
if(candidateFuncSet.find((*cit))!=candidateFuncSet.end())
|
|
@@ -303,7 +303,7 @@ public:
|
|
|
303
303
|
return candidateFuncSet.find(fun)!=candidateFuncSet.end();
|
|
304
304
|
}
|
|
305
305
|
/// Whether two functions in the same callgraph scc
|
|
306
|
-
inline bool inSameCallGraphSCC(const
|
|
306
|
+
inline bool inSameCallGraphSCC(const CallGraphNode* src,const CallGraphNode* dst)
|
|
307
307
|
{
|
|
308
308
|
return (tcgSCC->repNode(src->getId()) == tcgSCC->repNode(dst->getId()));
|
|
309
309
|
}
|
|
@@ -506,7 +506,7 @@ private:
|
|
|
506
506
|
//@}
|
|
507
507
|
|
|
508
508
|
/// Handle call relations
|
|
509
|
-
void handleCallRelation(CxtThreadProc& ctp, const
|
|
509
|
+
void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
|
|
510
510
|
|
|
511
511
|
/// Get or create a tct node based on CxtThread
|
|
512
512
|
//@{
|
|
@@ -103,7 +103,7 @@ public:
|
|
|
103
103
|
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
|
|
104
104
|
typedef Set<const SVFFunction*> FunctionSet;
|
|
105
105
|
typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
|
|
106
|
-
typedef SCCDetection<
|
|
106
|
+
typedef SCCDetection<CallGraph*> CallGraphSCC;
|
|
107
107
|
typedef Set<const GlobalObjVar*> VTableSet;
|
|
108
108
|
typedef Set<const SVFFunction*> VFunSet;
|
|
109
109
|
//@}
|
|
@@ -148,7 +148,7 @@ protected:
|
|
|
148
148
|
/// Statistics
|
|
149
149
|
PTAStat* stat;
|
|
150
150
|
/// Call graph used for pointer analysis
|
|
151
|
-
|
|
151
|
+
CallGraph* callgraph;
|
|
152
152
|
/// SCC for PTACallGraph
|
|
153
153
|
CallGraphSCC* callGraphSCC;
|
|
154
154
|
/// Interprocedural control-flow graph
|
|
@@ -168,7 +168,7 @@ public:
|
|
|
168
168
|
return getCallGraph()->getNumOfResolvedIndCallEdge();
|
|
169
169
|
}
|
|
170
170
|
/// Return call graph
|
|
171
|
-
inline
|
|
171
|
+
inline CallGraph* getCallGraph() const
|
|
172
172
|
{
|
|
173
173
|
return callgraph;
|
|
174
174
|
}
|
|
@@ -398,8 +398,8 @@ public:
|
|
|
398
398
|
/// Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
|
|
399
399
|
inline bool inSameCallGraphSCC(const SVFFunction* fun1,const SVFFunction* fun2)
|
|
400
400
|
{
|
|
401
|
-
const
|
|
402
|
-
const
|
|
401
|
+
const CallGraphNode* src = callgraph->getCallGraphNode(fun1);
|
|
402
|
+
const CallGraphNode* dst = callgraph->getCallGraphNode(fun2);
|
|
403
403
|
return (getCallGraphSCCRepNode(src->getId()) == getCallGraphSCCRepNode(dst->getId()));
|
|
404
404
|
}
|
|
405
405
|
inline bool isInRecursion(const SVFFunction* fun) const
|
|
@@ -89,7 +89,7 @@ protected:
|
|
|
89
89
|
|
|
90
90
|
/// Add actual parameter SVFGNode for 1st argument of a deallocation like external function
|
|
91
91
|
/// In order to path sensitive leak detection
|
|
92
|
-
virtual void AddExtActualParmSVFGNodes(
|
|
92
|
+
virtual void AddExtActualParmSVFGNodes(CallGraph* callgraph);
|
|
93
93
|
|
|
94
94
|
/// Collect memory pointed global pointers,
|
|
95
95
|
/// note that this collection is recursively performed, for example gp-->obj-->obj'
|
|
@@ -76,7 +76,7 @@ private:
|
|
|
76
76
|
protected:
|
|
77
77
|
SaberSVFGBuilder memSSA;
|
|
78
78
|
SVFG* svfg;
|
|
79
|
-
|
|
79
|
+
CallGraph* callgraph;
|
|
80
80
|
SVFBugReport report; /// Bug Reporter
|
|
81
81
|
|
|
82
82
|
public:
|
|
@@ -129,7 +129,7 @@ public:
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/// Get Callgraph
|
|
132
|
-
inline
|
|
132
|
+
inline CallGraph* getCallgraph() const
|
|
133
133
|
{
|
|
134
134
|
return callgraph;
|
|
135
135
|
}
|