svf-lib 1.0.1491 → 1.0.1493
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/svf/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf/include/SVFIR/SVFType.h +33 -34
- package/SVF-linux/svf/include/SVFIR/SymbolTableInfo.h +11 -2
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMModule.h +3 -4
- package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/Graphs/CHG.h +4 -1
- package/SVF-osx/svf/include/Graphs/GenericGraph.h +5 -0
- package/SVF-osx/svf/include/Graphs/ICFG.h +1 -0
- package/SVF-osx/svf/include/Graphs/ICFGEdge.h +4 -0
- package/SVF-osx/svf/include/Graphs/ICFGNode.h +28 -2
- package/SVF-osx/svf/include/Graphs/IRGraph.h +1 -0
- package/SVF-osx/svf/include/MemoryModel/LocationSet.h +1 -0
- package/SVF-osx/svf/include/MemoryModel/SVFLoop.h +1 -0
- package/SVF-osx/svf/include/SVFIR/SVFIR.h +1 -0
- package/SVF-osx/svf/include/SVFIR/SVFIRRW.h +864 -186
- package/SVF-osx/svf/include/SVFIR/SVFModule.h +1 -0
- package/SVF-osx/svf/include/SVFIR/SVFModuleRW.h +2 -2
- package/SVF-osx/svf/include/SVFIR/SVFStatements.h +65 -15
- package/SVF-osx/svf/include/SVFIR/SVFType.h +4 -0
- package/SVF-osx/svf/include/SVFIR/SVFValue.h +22 -0
- package/SVF-osx/svf/include/SVFIR/SVFVariables.h +42 -0
- package/SVF-osx/svf/include/SVFIR/SymbolTableInfo.h +17 -1
- package/SVF-osx/svf/include/Util/Options.h +1 -0
- package/SVF-osx/svf/include/Util/SVFUtil.h +49 -0
- package/SVF-osx/svf/include/Util/SparseBitVector.h +2 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -92,44 +92,43 @@ template <class T> struct Hash
|
|
|
92
92
|
|
|
93
93
|
template <typename Key, typename Hash = Hash<Key>,
|
|
94
94
|
typename KeyEqual = std::equal_to<Key>,
|
|
95
|
-
typename Allocator = std::allocator<Key
|
|
95
|
+
typename Allocator = std::allocator<Key> >
|
|
96
96
|
using Set = std::unordered_set<Key, Hash, KeyEqual, Allocator>;
|
|
97
97
|
|
|
98
98
|
template <typename Key, typename Value, typename Hash = Hash<Key>,
|
|
99
99
|
typename KeyEqual = std::equal_to<Key>,
|
|
100
|
-
typename Allocator = std::allocator<std::pair<const Key, Value
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
class StInfo
|
|
100
|
+
typename Allocator = std::allocator<std::pair<const Key, Value> > >
|
|
101
|
+
using Map = std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>;
|
|
102
|
+
|
|
103
|
+
template <typename Key, typename Compare = std::less<Key>,
|
|
104
|
+
typename Allocator = std::allocator<Key> >
|
|
105
|
+
using OrderedSet = std::set<Key, Compare, Allocator>;
|
|
106
|
+
|
|
107
|
+
template <typename Key, typename Value, typename Compare = std::less<Key>,
|
|
108
|
+
typename Allocator = std::allocator<std::pair<const Key, Value> > >
|
|
109
|
+
using OrderedMap = std::map<Key, Value, Compare, Allocator>;
|
|
110
|
+
|
|
111
|
+
typedef std::pair<NodeID, NodeID> NodePair;
|
|
112
|
+
typedef OrderedSet<NodeID> OrderedNodeSet;
|
|
113
|
+
typedef Set<NodeID> NodeSet;
|
|
114
|
+
typedef Set<NodePair> NodePairSet;
|
|
115
|
+
typedef Map<NodePair, NodeID> NodePairMap;
|
|
116
|
+
typedef std::vector<NodeID> NodeVector;
|
|
117
|
+
typedef std::vector<EdgeID> EdgeVector;
|
|
118
|
+
typedef std::stack<NodeID> NodeStack;
|
|
119
|
+
typedef std::list<NodeID> NodeList;
|
|
120
|
+
typedef std::deque<NodeID> NodeDeque;
|
|
121
|
+
typedef NodeSet EdgeSet;
|
|
122
|
+
typedef std::vector<u32_t> CallStrCxt;
|
|
123
|
+
typedef unsigned Version;
|
|
124
|
+
typedef Set<Version> VersionSet;
|
|
125
|
+
typedef std::pair<NodeID, Version> VersionedVar;
|
|
126
|
+
typedef Set<VersionedVar> VersionedVarSet;
|
|
127
|
+
|
|
128
|
+
/*!
|
|
129
|
+
* Flattened type information of StructType, ArrayType and SingleValueType
|
|
130
|
+
*/
|
|
131
|
+
class StInfo
|
|
133
132
|
{
|
|
134
133
|
friend class SVFModuleWrite;
|
|
135
134
|
friend class SVFModuleRead;
|
|
@@ -329,8 +329,13 @@ public:
|
|
|
329
329
|
|
|
330
330
|
inline void addTypeInfo(const SVFType* ty)
|
|
331
331
|
{
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
bool inserted = svfTypes.insert(ty).second;
|
|
333
|
+
assert(inserted && "this type info has been added before");
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
inline void addStInfo(StInfo* stInfo)
|
|
337
|
+
{
|
|
338
|
+
stInfos.insert(stInfo);
|
|
334
339
|
}
|
|
335
340
|
|
|
336
341
|
protected:
|
|
@@ -341,11 +346,15 @@ protected:
|
|
|
341
346
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
342
347
|
ObjTypeInfo* createObjTypeInfo(const SVFType* type);
|
|
343
348
|
|
|
349
|
+
/// (owned) All SVF Types
|
|
344
350
|
/// Every type T is mapped to StInfo
|
|
345
351
|
/// which contains size (fsize) , offset(foffset)
|
|
346
352
|
/// fsize[i] is the number of fields in the largest such struct, else fsize[i] = 1.
|
|
347
353
|
/// fsize[0] is always the size of the expanded struct.
|
|
348
354
|
SVFTypeSet svfTypes;
|
|
355
|
+
|
|
356
|
+
/// @brief (owned) All StInfo
|
|
357
|
+
Set<StInfo*> stInfos;
|
|
349
358
|
};
|
|
350
359
|
|
|
351
360
|
|
|
@@ -84,11 +84,10 @@ private:
|
|
|
84
84
|
SVFValue2LLVMValueMap SVFValue2LLVMValue;
|
|
85
85
|
LLVMType2SVFTypeMap LLVMType2SVFType;
|
|
86
86
|
Type2TypeInfoMap Type2TypeInfo;
|
|
87
|
-
Set<const StInfo*> StInfos;
|
|
88
87
|
|
|
89
88
|
/// Constructor
|
|
90
89
|
LLVMModuleSet();
|
|
91
|
-
~LLVMModuleSet();
|
|
90
|
+
~LLVMModuleSet() = default;
|
|
92
91
|
|
|
93
92
|
void build();
|
|
94
93
|
|
|
@@ -330,8 +329,8 @@ private:
|
|
|
330
329
|
SVFType* addSVFTypeInfo(const Type* t);
|
|
331
330
|
/// Collect a type info
|
|
332
331
|
StInfo* collectTypeInfo(const Type* ty);
|
|
333
|
-
/// Collect the struct info
|
|
334
|
-
StInfo* collectStructInfo(const StructType
|
|
332
|
+
/// Collect the struct info and set the number of fields after flattening
|
|
333
|
+
StInfo* collectStructInfo(const StructType* structTy, u32_t& numFields);
|
|
335
334
|
/// Collect the array info
|
|
336
335
|
StInfo* collectArrayInfo(const ArrayType* T);
|
|
337
336
|
/// Collect simple type (non-aggregate) info
|
|
Binary file
|
|
Binary file
|
|
@@ -78,6 +78,7 @@ typedef GenericEdge<CHNode> GenericCHEdgeTy;
|
|
|
78
78
|
class CHEdge: public GenericCHEdgeTy
|
|
79
79
|
{
|
|
80
80
|
friend class SVFIRWriter;
|
|
81
|
+
friend class SVFIRReader;
|
|
81
82
|
|
|
82
83
|
public:
|
|
83
84
|
typedef enum
|
|
@@ -107,6 +108,7 @@ typedef GenericNode<CHNode, CHEdge> GenericCHNodeTy;
|
|
|
107
108
|
class CHNode: public GenericCHNodeTy
|
|
108
109
|
{
|
|
109
110
|
friend class SVFIRWriter;
|
|
111
|
+
friend class SVFIRReader;
|
|
110
112
|
|
|
111
113
|
public:
|
|
112
114
|
typedef enum
|
|
@@ -118,7 +120,7 @@ public:
|
|
|
118
120
|
|
|
119
121
|
typedef std::vector<const SVFFunction*> FuncVector;
|
|
120
122
|
|
|
121
|
-
CHNode (const std::string name, NodeID i = 0, GNodeK k = 0):
|
|
123
|
+
CHNode (const std::string& name, NodeID i = 0, GNodeK k = 0):
|
|
122
124
|
GenericCHNodeTy(i, k), vtable(nullptr), className(name), flags(0)
|
|
123
125
|
{
|
|
124
126
|
}
|
|
@@ -213,6 +215,7 @@ typedef GenericGraph<CHNode, CHEdge> GenericCHGraphTy;
|
|
|
213
215
|
class CHGraph: public CommonCHGraph, public GenericCHGraphTy
|
|
214
216
|
{
|
|
215
217
|
friend class SVFIRWriter;
|
|
218
|
+
friend class SVFIRReader;
|
|
216
219
|
friend class CHGBuilder;
|
|
217
220
|
|
|
218
221
|
public:
|
|
@@ -39,6 +39,7 @@ namespace SVF
|
|
|
39
39
|
/// Forward declaration of some friend classes
|
|
40
40
|
///@{
|
|
41
41
|
template <typename, typename> class GenericGraphWriter;
|
|
42
|
+
template <typename, typename> class GenericGraphReader;
|
|
42
43
|
///@}
|
|
43
44
|
|
|
44
45
|
/*!
|
|
@@ -48,6 +49,7 @@ template<class NodeTy>
|
|
|
48
49
|
class GenericEdge
|
|
49
50
|
{
|
|
50
51
|
friend class SVFIRWriter;
|
|
52
|
+
friend class SVFIRReader;
|
|
51
53
|
|
|
52
54
|
public:
|
|
53
55
|
/// Node type
|
|
@@ -139,6 +141,7 @@ template<class NodeTy,class EdgeTy>
|
|
|
139
141
|
class GenericNode
|
|
140
142
|
{
|
|
141
143
|
friend class SVFIRWriter;
|
|
144
|
+
friend class SVFIRReader;
|
|
142
145
|
|
|
143
146
|
public:
|
|
144
147
|
typedef NodeTy NodeType;
|
|
@@ -341,7 +344,9 @@ template<class NodeTy, class EdgeTy>
|
|
|
341
344
|
class GenericGraph
|
|
342
345
|
{
|
|
343
346
|
friend class SVFIRWriter;
|
|
347
|
+
friend class SVFIRReader;
|
|
344
348
|
friend class GenericGraphWriter<NodeTy, EdgeTy>;
|
|
349
|
+
friend class GenericGraphReader<NodeTy, EdgeTy>;
|
|
345
350
|
|
|
346
351
|
public:
|
|
347
352
|
typedef NodeTy NodeType;
|
|
@@ -44,6 +44,7 @@ typedef GenericEdge<ICFGNode> GenericICFGEdgeTy;
|
|
|
44
44
|
class ICFGEdge : public GenericICFGEdgeTy
|
|
45
45
|
{
|
|
46
46
|
friend class SVFIRWriter;
|
|
47
|
+
friend class SVFIRReader;
|
|
47
48
|
|
|
48
49
|
public:
|
|
49
50
|
/// ten types of ICFG edge
|
|
@@ -112,6 +113,7 @@ public:
|
|
|
112
113
|
class IntraCFGEdge : public ICFGEdge
|
|
113
114
|
{
|
|
114
115
|
friend class SVFIRWriter;
|
|
116
|
+
friend class SVFIRReader;
|
|
115
117
|
|
|
116
118
|
public:
|
|
117
119
|
/// Constructor
|
|
@@ -174,6 +176,7 @@ private:
|
|
|
174
176
|
class CallCFGEdge : public ICFGEdge
|
|
175
177
|
{
|
|
176
178
|
friend class SVFIRWriter;
|
|
179
|
+
friend class SVFIRReader;
|
|
177
180
|
|
|
178
181
|
private:
|
|
179
182
|
const SVFInstruction* cs;
|
|
@@ -224,6 +227,7 @@ public:
|
|
|
224
227
|
class RetCFGEdge : public ICFGEdge
|
|
225
228
|
{
|
|
226
229
|
friend class SVFIRWriter;
|
|
230
|
+
friend class SVFIRReader;
|
|
227
231
|
|
|
228
232
|
private:
|
|
229
233
|
const SVFInstruction* cs;
|
|
@@ -54,6 +54,7 @@ typedef GenericNode<ICFGNode, ICFGEdge> GenericICFGNodeTy;
|
|
|
54
54
|
class ICFGNode : public GenericICFGNodeTy
|
|
55
55
|
{
|
|
56
56
|
friend class SVFIRWriter;
|
|
57
|
+
friend class SVFIRReader;
|
|
57
58
|
|
|
58
59
|
public:
|
|
59
60
|
/// 22 kinds of ICFG node
|
|
@@ -79,7 +80,6 @@ public:
|
|
|
79
80
|
/// Constructor
|
|
80
81
|
ICFGNode(NodeID i, ICFGNodeK k) : GenericICFGNodeTy(i, k), fun(nullptr), bb(nullptr)
|
|
81
82
|
{
|
|
82
|
-
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/// Return the function of this ICFGNode
|
|
@@ -151,7 +151,6 @@ class GlobalICFGNode : public ICFGNode
|
|
|
151
151
|
public:
|
|
152
152
|
GlobalICFGNode(NodeID id) : ICFGNode(id, GlobalBlock)
|
|
153
153
|
{
|
|
154
|
-
bb = nullptr;
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -181,9 +180,13 @@ public:
|
|
|
181
180
|
class IntraICFGNode : public ICFGNode
|
|
182
181
|
{
|
|
183
182
|
friend class SVFIRWriter;
|
|
183
|
+
friend class SVFIRReader;
|
|
184
184
|
private:
|
|
185
185
|
const SVFInstruction *inst;
|
|
186
186
|
|
|
187
|
+
/// Constructor to create empty IntraICFGNode (for SVFIRReader/deserialization)
|
|
188
|
+
IntraICFGNode(NodeID id) : ICFGNode(id, IntraBlock), inst(nullptr) {}
|
|
189
|
+
|
|
187
190
|
public:
|
|
188
191
|
IntraICFGNode(NodeID id, const SVFInstruction *i) : ICFGNode(id, IntraBlock), inst(i)
|
|
189
192
|
{
|
|
@@ -258,11 +261,16 @@ public:
|
|
|
258
261
|
class FunEntryICFGNode : public InterICFGNode
|
|
259
262
|
{
|
|
260
263
|
friend class SVFIRWriter;
|
|
264
|
+
friend class SVFIRReader;
|
|
261
265
|
|
|
262
266
|
public:
|
|
263
267
|
typedef std::vector<const SVFVar *> FormalParmNodeVec;
|
|
264
268
|
private:
|
|
265
269
|
FormalParmNodeVec FPNodes;
|
|
270
|
+
|
|
271
|
+
/// Constructor to create empty FunEntryICFGNode (for SVFIRReader/deserialization)
|
|
272
|
+
FunEntryICFGNode(NodeID id) : InterICFGNode(id, FunEntryBlock) {}
|
|
273
|
+
|
|
266
274
|
public:
|
|
267
275
|
FunEntryICFGNode(NodeID id, const SVFFunction* f);
|
|
268
276
|
|
|
@@ -316,9 +324,14 @@ public:
|
|
|
316
324
|
class FunExitICFGNode : public InterICFGNode
|
|
317
325
|
{
|
|
318
326
|
friend class SVFIRWriter;
|
|
327
|
+
friend class SVFIRReader;
|
|
319
328
|
|
|
320
329
|
private:
|
|
321
330
|
const SVFVar *formalRet;
|
|
331
|
+
|
|
332
|
+
/// Constructor to create empty FunExitICFGNode (for SVFIRReader/deserialization)
|
|
333
|
+
FunExitICFGNode(NodeID id) : InterICFGNode(id, FunExitBlock), formalRet{} {}
|
|
334
|
+
|
|
322
335
|
public:
|
|
323
336
|
FunExitICFGNode(NodeID id, const SVFFunction* f);
|
|
324
337
|
|
|
@@ -372,6 +385,7 @@ public:
|
|
|
372
385
|
class CallICFGNode : public InterICFGNode
|
|
373
386
|
{
|
|
374
387
|
friend class SVFIRWriter;
|
|
388
|
+
friend class SVFIRReader;
|
|
375
389
|
|
|
376
390
|
public:
|
|
377
391
|
typedef std::vector<const SVFVar *> ActualParmNodeVec;
|
|
@@ -379,6 +393,10 @@ private:
|
|
|
379
393
|
const SVFInstruction* cs;
|
|
380
394
|
const RetICFGNode* ret;
|
|
381
395
|
ActualParmNodeVec APNodes;
|
|
396
|
+
|
|
397
|
+
/// Constructor to create empty CallICFGNode (for SVFIRReader/deserialization)
|
|
398
|
+
CallICFGNode(NodeID id) : InterICFGNode(id, FunCallBlock), cs{}, ret{} {}
|
|
399
|
+
|
|
382
400
|
public:
|
|
383
401
|
CallICFGNode(NodeID id, const SVFInstruction* c)
|
|
384
402
|
: InterICFGNode(id, FunCallBlock), cs(c), ret(nullptr)
|
|
@@ -469,11 +487,19 @@ public:
|
|
|
469
487
|
class RetICFGNode : public InterICFGNode
|
|
470
488
|
{
|
|
471
489
|
friend class SVFIRWriter;
|
|
490
|
+
friend class SVFIRReader;
|
|
472
491
|
|
|
473
492
|
private:
|
|
474
493
|
const SVFInstruction* cs;
|
|
475
494
|
const SVFVar *actualRet;
|
|
476
495
|
const CallICFGNode* callBlockNode;
|
|
496
|
+
|
|
497
|
+
/// Constructor to create empty RetICFGNode (for SVFIRReader/deserialization)
|
|
498
|
+
RetICFGNode(NodeID id)
|
|
499
|
+
: InterICFGNode(id, FunRetBlock), cs{}, actualRet{}, callBlockNode{}
|
|
500
|
+
{
|
|
501
|
+
}
|
|
502
|
+
|
|
477
503
|
public:
|
|
478
504
|
RetICFGNode(NodeID id, const SVFInstruction* c, CallICFGNode* cb) :
|
|
479
505
|
InterICFGNode(id, FunRetBlock), cs(c), actualRet(nullptr), callBlockNode(cb)
|