svf-lib 1.0.2207 → 1.0.2209
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/SVF-linux/Release-build/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/AE/Svfexe/AbstractInterpretation.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/PTACallGraph.h +9 -1
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +1 -1
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMModule.h +1 -12
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +11 -12
- package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +0 -10
- package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +13 -13
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +1 -1
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- package/SVF-osx/Release-build/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +4 -4
- package/SVF-osx/Release-build/include/Graphs/{PTACallGraph.h → CallGraph.h} +38 -38
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +25 -25
- package/SVF-osx/Release-build/include/Graphs/VFG.h +4 -4
- package/SVF-osx/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +1 -1
- package/SVF-osx/Release-build/include/MTA/MHP.h +2 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +6 -6
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +5 -5
- package/SVF-osx/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +3 -3
- package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +2 -2
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
- package/SVF-linux/Release-build/include/Graphs/CallGraph.h +0 -266
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
//===- CallGraph.h -- Call graph representation----------------------------//
|
|
2
|
-
//
|
|
3
|
-
// SVF: Static Value-Flow Analysis
|
|
4
|
-
//
|
|
5
|
-
// Copyright (C) <2013-2017> <Yulei Sui>
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
// This program is free software: you can redistribute it and/or modify
|
|
9
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
10
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
// (at your option) any later version.
|
|
12
|
-
|
|
13
|
-
// This program is distributed in the hope that it will be useful,
|
|
14
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
// GNU Affero General Public License for more details.
|
|
17
|
-
|
|
18
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
//
|
|
21
|
-
//===----------------------------------------------------------------------===//
|
|
22
|
-
|
|
23
|
-
/*
|
|
24
|
-
* CallGraph.h
|
|
25
|
-
*
|
|
26
|
-
* Created on: Nov 7, 2013
|
|
27
|
-
* Author: Yulei Sui
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
#ifndef CALLGRAPH_H_
|
|
31
|
-
#define CALLGRAPH_H_
|
|
32
|
-
|
|
33
|
-
#include "Graphs/GenericGraph.h"
|
|
34
|
-
#include "SVFIR/SVFValue.h"
|
|
35
|
-
#include "Graphs/ICFG.h"
|
|
36
|
-
#include <set>
|
|
37
|
-
|
|
38
|
-
namespace SVF
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
class CallGraphNode;
|
|
42
|
-
class SVFModule;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/*
|
|
46
|
-
* Call Graph edge representing a calling relation between two functions
|
|
47
|
-
* Multiple calls from function A to B are merged into one call edge
|
|
48
|
-
* Each call edge has a set of direct callsites and a set of indirect callsites
|
|
49
|
-
*/
|
|
50
|
-
typedef GenericEdge<CallGraphNode> GenericCallGraphEdgeTy;
|
|
51
|
-
class CallGraphEdge : public GenericCallGraphEdgeTy
|
|
52
|
-
{
|
|
53
|
-
|
|
54
|
-
public:
|
|
55
|
-
typedef Set<const CallICFGNode*> CallInstSet;
|
|
56
|
-
|
|
57
|
-
private:
|
|
58
|
-
CallInstSet directCalls;
|
|
59
|
-
public:
|
|
60
|
-
/// Constructor
|
|
61
|
-
CallGraphEdge(CallGraphNode* s, CallGraphNode* d, const CallICFGNode* icfgNode) :
|
|
62
|
-
GenericCallGraphEdgeTy(s, d, icfgNode->getId())
|
|
63
|
-
{
|
|
64
|
-
}
|
|
65
|
-
/// Destructor
|
|
66
|
-
virtual ~CallGraphEdge()
|
|
67
|
-
{
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/// Add direct callsite
|
|
71
|
-
//@{
|
|
72
|
-
void addDirectCallSite(const CallICFGNode* call);
|
|
73
|
-
//@}
|
|
74
|
-
|
|
75
|
-
/// Iterators for direct and indirect callsites
|
|
76
|
-
//@{
|
|
77
|
-
inline CallInstSet::const_iterator directCallsBegin() const
|
|
78
|
-
{
|
|
79
|
-
return directCalls.begin();
|
|
80
|
-
}
|
|
81
|
-
inline CallInstSet::const_iterator directCallsEnd() const
|
|
82
|
-
{
|
|
83
|
-
return directCalls.end();
|
|
84
|
-
}
|
|
85
|
-
//@}
|
|
86
|
-
|
|
87
|
-
/// ClassOf
|
|
88
|
-
//@{
|
|
89
|
-
static inline bool classof(const CallGraphEdge*)
|
|
90
|
-
{
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
//@}
|
|
94
|
-
|
|
95
|
-
/// Overloading operator << for dumping ICFG node ID
|
|
96
|
-
//@{
|
|
97
|
-
friend OutStream& operator<< (OutStream &o, const CallGraphEdge&edge)
|
|
98
|
-
{
|
|
99
|
-
o << edge.toString();
|
|
100
|
-
return o;
|
|
101
|
-
}
|
|
102
|
-
//@}
|
|
103
|
-
|
|
104
|
-
virtual const std::string toString() const;
|
|
105
|
-
|
|
106
|
-
typedef GenericNode<CallGraphNode, CallGraphEdge>::GEdgeSetTy CallGraphEdgeSet;
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/*
|
|
111
|
-
* Call Graph node representing a function
|
|
112
|
-
*/
|
|
113
|
-
typedef GenericNode<CallGraphNode, CallGraphEdge> GenericCallGraphNodeTy;
|
|
114
|
-
class CallGraphNode : public GenericCallGraphNodeTy
|
|
115
|
-
{
|
|
116
|
-
private:
|
|
117
|
-
const SVFFunction* fun;
|
|
118
|
-
|
|
119
|
-
public:
|
|
120
|
-
/// Constructor
|
|
121
|
-
CallGraphNode(NodeID i, const SVFFunction* f) : GenericCallGraphNodeTy(i,CallNodeKd), fun(f)
|
|
122
|
-
{
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
inline const std::string &getName() const
|
|
126
|
-
{
|
|
127
|
-
return fun->getName();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/// Get function of this call node
|
|
131
|
-
inline const SVFFunction* getFunction() const
|
|
132
|
-
{
|
|
133
|
-
return fun;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/// Overloading operator << for dumping ICFG node ID
|
|
138
|
-
//@{
|
|
139
|
-
friend OutStream& operator<< (OutStream &o, const CallGraphNode&node)
|
|
140
|
-
{
|
|
141
|
-
o << node.toString();
|
|
142
|
-
return o;
|
|
143
|
-
}
|
|
144
|
-
//@}
|
|
145
|
-
|
|
146
|
-
virtual const std::string toString() const;
|
|
147
|
-
|
|
148
|
-
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
149
|
-
//@{
|
|
150
|
-
static inline bool classof(const CallGraphNode*)
|
|
151
|
-
{
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
static inline bool classof(const GenericICFGNodeTy* node)
|
|
156
|
-
{
|
|
157
|
-
return node->getNodeKind() == CallNodeKd;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
static inline bool classof(const SVFBaseNode* node)
|
|
161
|
-
{
|
|
162
|
-
return node->getNodeKind() == CallNodeKd;
|
|
163
|
-
}
|
|
164
|
-
//@}
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/*!
|
|
168
|
-
* Pointer Analysis Call Graph used internally for various pointer analysis
|
|
169
|
-
*/
|
|
170
|
-
typedef GenericGraph<CallGraphNode, CallGraphEdge> GenericCallGraphTy;
|
|
171
|
-
class CallGraph : public GenericCallGraphTy
|
|
172
|
-
{
|
|
173
|
-
friend class PTACallGraph;
|
|
174
|
-
|
|
175
|
-
public:
|
|
176
|
-
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
177
|
-
typedef Map<const SVFFunction*, CallGraphNode*> FunToCallGraphNodeMap;
|
|
178
|
-
typedef Map<const CallICFGNode*, CallGraphEdgeSet> CallInstToCallGraphEdgesMap;
|
|
179
|
-
typedef Set<const SVFFunction*> FunctionSet;
|
|
180
|
-
typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
|
|
181
|
-
|
|
182
|
-
protected:
|
|
183
|
-
FunToCallGraphNodeMap funToCallGraphNodeMap; ///< Call Graph node map
|
|
184
|
-
CallInstToCallGraphEdgesMap callinstToCallGraphEdgesMap; ///< Map a call instruction to its corresponding call edges
|
|
185
|
-
|
|
186
|
-
NodeID callGraphNodeNum;
|
|
187
|
-
|
|
188
|
-
/// Clean up memory
|
|
189
|
-
void destroy();
|
|
190
|
-
|
|
191
|
-
/// Add call graph edge
|
|
192
|
-
inline void addEdge(CallGraphEdge* edge)
|
|
193
|
-
{
|
|
194
|
-
edge->getDstNode()->addIncomingEdge(edge);
|
|
195
|
-
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
public:
|
|
200
|
-
/// Constructor
|
|
201
|
-
CallGraph();
|
|
202
|
-
|
|
203
|
-
void addCallGraphNode(const SVFFunction* fun);
|
|
204
|
-
|
|
205
|
-
const CallGraphNode* getCallGraphNode(const std::string& name);
|
|
206
|
-
|
|
207
|
-
/// Destructor
|
|
208
|
-
virtual ~CallGraph()
|
|
209
|
-
{
|
|
210
|
-
destroy();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/// Get call graph node
|
|
214
|
-
//@{
|
|
215
|
-
inline CallGraphNode* getCallGraphNode(NodeID id) const
|
|
216
|
-
{
|
|
217
|
-
return getGNode(id);
|
|
218
|
-
}
|
|
219
|
-
inline CallGraphNode* getCallGraphNode(const SVFFunction* fun) const
|
|
220
|
-
{
|
|
221
|
-
FunToCallGraphNodeMap::const_iterator it = funToCallGraphNodeMap.find(fun);
|
|
222
|
-
assert(it!=funToCallGraphNodeMap.end() && "call graph node not found!!");
|
|
223
|
-
return it->second;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
//@}
|
|
227
|
-
|
|
228
|
-
/// Whether we have already created this call graph edge
|
|
229
|
-
CallGraphEdge* hasGraphEdge(CallGraphNode* src, CallGraphNode* dst,
|
|
230
|
-
const CallICFGNode* callIcfgNode) const;
|
|
231
|
-
|
|
232
|
-
/// Add direct call edges
|
|
233
|
-
void addDirectCallGraphEdge(const CallICFGNode* call, const SVFFunction* callerFun, const SVFFunction* calleeFun);
|
|
234
|
-
/// Dump the graph
|
|
235
|
-
void dump(const std::string& filename);
|
|
236
|
-
|
|
237
|
-
/// View the graph from the debugger
|
|
238
|
-
void view();
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
} // End namespace SVF
|
|
242
|
-
|
|
243
|
-
namespace SVF
|
|
244
|
-
{
|
|
245
|
-
/* !
|
|
246
|
-
* GenericGraphTraits specializations for generic graph algorithms.
|
|
247
|
-
* Provide graph traits for traversing from a constraint node using standard graph traversals.
|
|
248
|
-
*/
|
|
249
|
-
template<> struct GenericGraphTraits<SVF::CallGraphNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
250
|
-
{
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
/// Inverse GenericGraphTraits specializations for call graph node, it is used for inverse traversal.
|
|
254
|
-
template<>
|
|
255
|
-
struct GenericGraphTraits<Inverse<SVF::CallGraphNode*> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::CallGraphNode,SVF::CallGraphEdge>* > >
|
|
256
|
-
{
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode,SVF::CallGraphEdge>* >
|
|
260
|
-
{
|
|
261
|
-
typedef SVF::CallGraphNode*NodeRef;
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
} // End namespace llvm
|
|
265
|
-
|
|
266
|
-
#endif /* CALLGRAPH_H_ */
|