svf-lib 1.0.728 → 1.0.732
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/lib/libSvf.a +0 -0
- package/SVF-linux/include/DDA/DDAVFSolver.h +1 -1
- package/SVF-linux/include/Graphs/PAG.h +4 -4
- package/SVF-linux/include/Graphs/PAGNode.h +4 -4
- package/SVF-linux/include/MemoryModel/LocationSet.h +0 -1
- package/SVF-linux/include/MemoryModel/SVFIR.h +380 -0
- package/SVF-linux/include/MemoryModel/SVFSymbols.h +648 -0
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +440 -0
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +90 -0
- package/SVF-linux/include/Util/BasicTypes.h +0 -10
- package/SVF-linux/include/Util/SVFUtil.h +11 -0
- package/SVF-linux/include/WPA/Andersen.h +0 -89
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/DDA/DDAVFSolver.h +1 -1
- package/SVF-osx/include/Graphs/PAG.h +4 -4
- package/SVF-osx/include/Graphs/PAGNode.h +4 -4
- package/SVF-osx/include/MemoryModel/LocationSet.h +0 -1
- package/SVF-osx/include/MemoryModel/SVFIR.h +380 -0
- package/SVF-osx/include/MemoryModel/SVFSymbols.h +648 -0
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +440 -0
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +90 -0
- package/SVF-osx/include/Util/BasicTypes.h +0 -10
- package/SVF-osx/include/Util/SVFUtil.h +11 -0
- package/SVF-osx/include/WPA/Andersen.h +0 -89
- package/package.json +1 -1
|
Binary file
|
|
@@ -448,7 +448,7 @@ protected:
|
|
|
448
448
|
assert(obj && "object not found!!");
|
|
449
449
|
if(obj->isStack())
|
|
450
450
|
{
|
|
451
|
-
if(const AllocaInst* local = SVFUtil::dyn_cast<AllocaInst>(obj->
|
|
451
|
+
if(const AllocaInst* local = SVFUtil::dyn_cast<AllocaInst>(obj->getValue()))
|
|
452
452
|
{
|
|
453
453
|
const SVFFunction* fun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(local->getFunction());
|
|
454
454
|
return _callGraphSCC->isInCycle(_callGraph->getCallGraphNode(fun)->getId());
|
|
@@ -561,7 +561,7 @@ public:
|
|
|
561
561
|
/// getObject - return mem object id
|
|
562
562
|
inline NodeID getObjectNode(const MemObj *mem)
|
|
563
563
|
{
|
|
564
|
-
return mem->
|
|
564
|
+
return mem->getId();
|
|
565
565
|
}
|
|
566
566
|
/// Get all PAG Edges that corresponds to an LLVM value
|
|
567
567
|
inline const PAGEdgeSet& getValueEdges(const Value *V)
|
|
@@ -618,7 +618,7 @@ public:
|
|
|
618
618
|
//@{
|
|
619
619
|
inline NodeID getFIObjNode(const MemObj* obj) const
|
|
620
620
|
{
|
|
621
|
-
return obj->
|
|
621
|
+
return obj->getId();
|
|
622
622
|
}
|
|
623
623
|
inline NodeID getFIObjNode(NodeID id) const
|
|
624
624
|
{
|
|
@@ -716,7 +716,7 @@ public:
|
|
|
716
716
|
LocationSet getLocationSetFromBaseNode(NodeID nodeId);
|
|
717
717
|
inline NodeID getBaseObjNode(NodeID id) const
|
|
718
718
|
{
|
|
719
|
-
return getBaseObj(id)->
|
|
719
|
+
return getBaseObj(id)->getId();
|
|
720
720
|
}
|
|
721
721
|
inline const MemObj* getBaseObj(NodeID id) const
|
|
722
722
|
{
|
|
@@ -752,7 +752,7 @@ public:
|
|
|
752
752
|
inline NodeID addObjNode(const Value* val, NodeID i)
|
|
753
753
|
{
|
|
754
754
|
MemObj* mem = symInfo->getObj(symInfo->getObjSym(val));
|
|
755
|
-
assert(((mem->
|
|
755
|
+
assert(((mem->getId() == i)) && "not same object id?");
|
|
756
756
|
return addFIObjNode(mem);
|
|
757
757
|
}
|
|
758
758
|
/// Add a unique return node for a procedure
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
#define PAGNODE_H_
|
|
32
32
|
|
|
33
33
|
#include "Graphs/GenericGraph.h"
|
|
34
|
-
#include "MemoryModel/
|
|
35
|
-
#include "
|
|
34
|
+
#include "MemoryModel/SVFSymbols.h"
|
|
35
|
+
#include "MemoryModel/SymbolTableInfo.h"
|
|
36
36
|
#include "SVF-FE/LLVMUtil.h"
|
|
37
37
|
#include "Graphs/PAGEdge.h"
|
|
38
38
|
|
|
@@ -483,9 +483,9 @@ public:
|
|
|
483
483
|
|
|
484
484
|
/// Constructor
|
|
485
485
|
GepObjPN(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = GepObjNode) :
|
|
486
|
-
ObjPN(mem->
|
|
486
|
+
ObjPN(mem->getValue(), i, mem, ty), ls(l)
|
|
487
487
|
{
|
|
488
|
-
base = mem->
|
|
488
|
+
base = mem->getId();
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
/// offset of the mem object
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
//===- SVFIR.h -- IR of SVF ---------------------------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <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 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 General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* SVFIR.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: 31, 12, 2021
|
|
27
|
+
* Author: Yulei Sui
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef SVFIR_H_
|
|
31
|
+
#define SVFIR_H_
|
|
32
|
+
|
|
33
|
+
#include <set>
|
|
34
|
+
#include <map>
|
|
35
|
+
#include "Util/BasicTypes.h"
|
|
36
|
+
|
|
37
|
+
namespace SVF
|
|
38
|
+
{
|
|
39
|
+
|
|
40
|
+
class SVFStmt{
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
enum SVFSTMTK
|
|
44
|
+
{
|
|
45
|
+
Alloc, Copy, Phi, Store, Load, Call, FunRet, Gep, Cmp, Binary, Unary, Branch
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
SVFStmt(u32_t k): kind(k){
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// ClassOf
|
|
53
|
+
//@{
|
|
54
|
+
static inline bool classof(const SVFStmt*)
|
|
55
|
+
{
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
///@}
|
|
59
|
+
|
|
60
|
+
virtual const std::string toString() const;
|
|
61
|
+
|
|
62
|
+
/// Overloading operator << for printing
|
|
63
|
+
//@{
|
|
64
|
+
friend raw_ostream& operator<< (raw_ostream &o, const SVFStmt &stmt)
|
|
65
|
+
{
|
|
66
|
+
o << stmt.toString();
|
|
67
|
+
return o;
|
|
68
|
+
}
|
|
69
|
+
//@}
|
|
70
|
+
|
|
71
|
+
inline u32_t getKind() const {
|
|
72
|
+
return kind;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private:
|
|
76
|
+
u32_t kind;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
class AllocStmt : public SVFStmt{
|
|
80
|
+
|
|
81
|
+
public:
|
|
82
|
+
|
|
83
|
+
AllocStmt(SymID src, SymID dst) : SVFStmt(SVFSTMTK::Alloc), srcVar(src), dstVar(dst){
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
87
|
+
//@{
|
|
88
|
+
static inline bool classof(const AllocStmt *)
|
|
89
|
+
{
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
93
|
+
{
|
|
94
|
+
return stmt->getKind() == SVFSTMTK::Alloc;
|
|
95
|
+
}
|
|
96
|
+
//@}
|
|
97
|
+
|
|
98
|
+
virtual const std::string toString() const;
|
|
99
|
+
|
|
100
|
+
private:
|
|
101
|
+
SymID srcVar;
|
|
102
|
+
SymID dstVar;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
class CopyStmt : public SVFStmt{
|
|
106
|
+
|
|
107
|
+
CopyStmt(SymID src, SymID dst) : SVFStmt(SVFSTMTK::Copy), srcVar(src), dstVar(dst){
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
111
|
+
//@{
|
|
112
|
+
static inline bool classof(const CopyStmt *)
|
|
113
|
+
{
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
117
|
+
{
|
|
118
|
+
return stmt->getKind() == SVFSTMTK::Copy;
|
|
119
|
+
}
|
|
120
|
+
//@}
|
|
121
|
+
|
|
122
|
+
virtual const std::string toString() const;
|
|
123
|
+
|
|
124
|
+
private:
|
|
125
|
+
SymID srcVar;
|
|
126
|
+
SymID dstVar;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
class PhiStmt : public SVFStmt{
|
|
130
|
+
|
|
131
|
+
PhiStmt(SymID res, SymID op1, SymID op2) : SVFStmt(SVFSTMTK::Phi), resVar(res), op1Var(op1), op2Var(op2){
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
135
|
+
//@{
|
|
136
|
+
static inline bool classof(const PhiStmt *)
|
|
137
|
+
{
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
141
|
+
{
|
|
142
|
+
return stmt->getKind() == SVFSTMTK::Phi;
|
|
143
|
+
}
|
|
144
|
+
//@}
|
|
145
|
+
|
|
146
|
+
virtual const std::string toString() const;
|
|
147
|
+
|
|
148
|
+
private:
|
|
149
|
+
SymID resVar;
|
|
150
|
+
SymID op1Var;
|
|
151
|
+
SymID op2Var;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
class LoadStmt : public SVFStmt{
|
|
155
|
+
|
|
156
|
+
LoadStmt(SymID src, SymID dst) : SVFStmt(SVFSTMTK::Load), srcVar(src), dstVar(dst){
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
160
|
+
//@{
|
|
161
|
+
static inline bool classof(const LoadStmt *)
|
|
162
|
+
{
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
166
|
+
{
|
|
167
|
+
return stmt->getKind() == SVFSTMTK::Load;
|
|
168
|
+
}
|
|
169
|
+
//@}
|
|
170
|
+
|
|
171
|
+
virtual const std::string toString() const;
|
|
172
|
+
|
|
173
|
+
private:
|
|
174
|
+
SymID srcVar;
|
|
175
|
+
SymID dstVar;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
class StoreStmt : public SVFStmt{
|
|
179
|
+
|
|
180
|
+
StoreStmt(SymID src, SymID dst) : SVFStmt(SVFSTMTK::Store), srcVar(src), dstVar(dst){
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
184
|
+
//@{
|
|
185
|
+
static inline bool classof(const StoreStmt *)
|
|
186
|
+
{
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
190
|
+
{
|
|
191
|
+
return stmt->getKind() == SVFSTMTK::Store;
|
|
192
|
+
}
|
|
193
|
+
//@}
|
|
194
|
+
|
|
195
|
+
virtual const std::string toString() const;
|
|
196
|
+
|
|
197
|
+
private:
|
|
198
|
+
SymID srcVar;
|
|
199
|
+
SymID dstVar;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
class GepStmt : public SVFStmt{
|
|
203
|
+
|
|
204
|
+
GepStmt(SymID res, SymID ptr, SymID offset) : SVFStmt(SVFSTMTK::Gep), resVar(res), ptrVar(ptr), offsetVar(offset){
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
208
|
+
//@{
|
|
209
|
+
static inline bool classof(const GepStmt *)
|
|
210
|
+
{
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
214
|
+
{
|
|
215
|
+
return stmt->getKind() == SVFSTMTK::Gep;
|
|
216
|
+
}
|
|
217
|
+
//@}
|
|
218
|
+
|
|
219
|
+
virtual const std::string toString() const;
|
|
220
|
+
|
|
221
|
+
private:
|
|
222
|
+
SymID resVar;
|
|
223
|
+
SymID ptrVar;
|
|
224
|
+
SymID offsetVar;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
class CmpStmt : public SVFStmt{
|
|
228
|
+
|
|
229
|
+
CmpStmt(SymID res, SymID op1, SymID op2) : SVFStmt(SVFSTMTK::Cmp), resVar(res), op1Var(op1), op2Var(op2){
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
233
|
+
//@{
|
|
234
|
+
static inline bool classof(const CmpStmt *)
|
|
235
|
+
{
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
239
|
+
{
|
|
240
|
+
return stmt->getKind() == SVFSTMTK::Cmp;
|
|
241
|
+
}
|
|
242
|
+
//@}
|
|
243
|
+
|
|
244
|
+
virtual const std::string toString() const;
|
|
245
|
+
|
|
246
|
+
private:
|
|
247
|
+
SymID resVar;
|
|
248
|
+
SymID op1Var;
|
|
249
|
+
SymID op2Var;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
class BinaryStmt : public SVFStmt{
|
|
253
|
+
|
|
254
|
+
BinaryStmt(SymID res, SymID op1, SymID op2) : SVFStmt(SVFSTMTK::Binary), resVar(res), op1Var(op1), op2Var(op2){
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
258
|
+
//@{
|
|
259
|
+
static inline bool classof(const BinaryStmt *)
|
|
260
|
+
{
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
264
|
+
{
|
|
265
|
+
return stmt->getKind() == SVFSTMTK::Binary;
|
|
266
|
+
}
|
|
267
|
+
//@}
|
|
268
|
+
|
|
269
|
+
virtual const std::string toString() const;
|
|
270
|
+
|
|
271
|
+
private:
|
|
272
|
+
SymID resVar;
|
|
273
|
+
SymID op1Var;
|
|
274
|
+
SymID op2Var;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
class UnaryStmt : public SVFStmt{
|
|
278
|
+
|
|
279
|
+
UnaryStmt(SymID res, SymID op) : SVFStmt(SVFSTMTK::Unary), resVar(res), opVar(op){
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
283
|
+
//@{
|
|
284
|
+
static inline bool classof(const UnaryStmt *)
|
|
285
|
+
{
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
289
|
+
{
|
|
290
|
+
return stmt->getKind() == SVFSTMTK::Unary;
|
|
291
|
+
}
|
|
292
|
+
//@}
|
|
293
|
+
|
|
294
|
+
virtual const std::string toString() const;
|
|
295
|
+
|
|
296
|
+
private:
|
|
297
|
+
SymID resVar;
|
|
298
|
+
SymID opVar;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
class CallStmt : public SVFStmt{
|
|
302
|
+
|
|
303
|
+
CallStmt(CallSite cs) : SVFStmt(SVFSTMTK::Call), callsite(cs){
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
307
|
+
//@{
|
|
308
|
+
static inline bool classof(const CallStmt *)
|
|
309
|
+
{
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
313
|
+
{
|
|
314
|
+
return stmt->getKind() == SVFSTMTK::Call;
|
|
315
|
+
}
|
|
316
|
+
//@}
|
|
317
|
+
|
|
318
|
+
virtual const std::string toString() const;
|
|
319
|
+
|
|
320
|
+
private:
|
|
321
|
+
CallSite callsite;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
class FunRetStmt : public SVFStmt{
|
|
325
|
+
|
|
326
|
+
FunRetStmt(SVFFunction* f) : SVFStmt(SVFSTMTK::FunRet), fun(f){
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
330
|
+
//@{
|
|
331
|
+
static inline bool classof(const FunRetStmt *)
|
|
332
|
+
{
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
336
|
+
{
|
|
337
|
+
return stmt->getKind() == SVFSTMTK::FunRet;
|
|
338
|
+
}
|
|
339
|
+
//@}
|
|
340
|
+
|
|
341
|
+
virtual const std::string toString() const;
|
|
342
|
+
|
|
343
|
+
private:
|
|
344
|
+
SVFFunction* fun;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
class BranchStmt : public SVFStmt{
|
|
348
|
+
|
|
349
|
+
BranchStmt(SymID cond, SVFStmt* b1, SVFStmt* b2) : SVFStmt(SVFSTMTK::Branch), condition(cond),br1(b1),br2(b2){
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
353
|
+
//@{
|
|
354
|
+
static inline bool classof(const BranchStmt *)
|
|
355
|
+
{
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
static inline bool classof(const SVFStmt *stmt)
|
|
359
|
+
{
|
|
360
|
+
return stmt->getKind() == SVFSTMTK::Branch;
|
|
361
|
+
}
|
|
362
|
+
//@}
|
|
363
|
+
|
|
364
|
+
virtual const std::string toString() const;
|
|
365
|
+
|
|
366
|
+
private:
|
|
367
|
+
SymID condition;
|
|
368
|
+
SVFStmt* br1;
|
|
369
|
+
SVFStmt* br2;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class SVFIR{
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
} // End namespace SVF
|
|
379
|
+
|
|
380
|
+
#endif /* SVFIR_H_ */
|