svf-lib 1.0.2451 → 1.0.2453
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-x86_64/bin/ae +0 -0
- package/SVF-linux-x86_64/bin/cfl +0 -0
- package/SVF-linux-x86_64/bin/dvf +0 -0
- package/SVF-linux-x86_64/bin/mta +0 -0
- package/SVF-linux-x86_64/bin/saber +0 -0
- package/SVF-linux-x86_64/bin/svf-ex +0 -0
- package/SVF-linux-x86_64/bin/wpa +0 -0
- package/SVF-linux-x86_64/include/Graphs/BasicBlockG.h +18 -4
- package/SVF-linux-x86_64/include/Graphs/CHG.h +12 -0
- package/SVF-linux-x86_64/include/Graphs/CallGraph.h +14 -2
- package/SVF-linux-x86_64/include/Graphs/ICFG.h +24 -8
- package/SVF-linux-x86_64/include/Graphs/ICFGEdge.h +1 -0
- package/SVF-linux-x86_64/include/Graphs/ICFGNode.h +39 -6
- package/SVF-linux-x86_64/include/Graphs/IRGraph.h +12 -0
- package/SVF-linux-x86_64/include/MemoryModel/AccessPath.h +7 -1
- package/SVF-linux-x86_64/include/SVF-LLVM/ICFGBuilder.h +1 -1
- package/SVF-linux-x86_64/include/SVF-LLVM/SVFIRBuilder.h +1 -0
- package/SVF-linux-x86_64/include/SVFIR/ObjTypeInfo.h +5 -0
- package/SVF-linux-x86_64/include/SVFIR/SVFIR.h +61 -39
- package/SVF-linux-x86_64/include/SVFIR/SVFStatements.h +125 -10
- package/SVF-linux-x86_64/include/SVFIR/SVFType.h +97 -1
- package/SVF-linux-x86_64/include/SVFIR/SVFValue.h +1 -0
- package/SVF-linux-x86_64/include/SVFIR/SVFVariables.h +164 -4
- package/SVF-linux-x86_64/include/Util/ExtAPI.h +1 -0
- package/SVF-linux-x86_64/include/Util/NodeIDAllocator.h +11 -0
- package/SVF-linux-x86_64/include/Util/SVFLoopAndDomInfo.h +37 -0
- package/SVF-linux-x86_64/lib/libSvfCore.so.3.2 +0 -0
- package/SVF-linux-x86_64/lib/libSvfLLVM.so.3.2 +0 -0
- package/package.json +1 -1
package/SVF-linux-x86_64/bin/ae
CHANGED
|
Binary file
|
package/SVF-linux-x86_64/bin/cfl
CHANGED
|
Binary file
|
package/SVF-linux-x86_64/bin/dvf
CHANGED
|
Binary file
|
package/SVF-linux-x86_64/bin/mta
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/SVF-linux-x86_64/bin/wpa
CHANGED
|
Binary file
|
|
@@ -74,6 +74,7 @@ class SVFBasicBlock : public GenericBasicBlockNodeTy
|
|
|
74
74
|
friend class FunObjVar;
|
|
75
75
|
friend class ICFGBuilder;
|
|
76
76
|
friend class ICFG;
|
|
77
|
+
friend class GraphDBClient;
|
|
77
78
|
|
|
78
79
|
public:
|
|
79
80
|
typedef std::vector<const ICFGNode*>::const_iterator const_iterator;
|
|
@@ -98,6 +99,17 @@ protected:
|
|
|
98
99
|
|
|
99
100
|
/// @}
|
|
100
101
|
|
|
102
|
+
// Getters of predecessor and successor basic blocks, used for writing bb to DB
|
|
103
|
+
const std::vector<const SVFBasicBlock*> getSuccBBs() const
|
|
104
|
+
{
|
|
105
|
+
return succBBs;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const std::vector<const SVFBasicBlock*> getPredBBs() const
|
|
109
|
+
{
|
|
110
|
+
return predBBs;
|
|
111
|
+
}
|
|
112
|
+
|
|
101
113
|
public:
|
|
102
114
|
/// Constructor without name
|
|
103
115
|
SVFBasicBlock(NodeID id, const FunObjVar* f): GenericBasicBlockNodeTy(id, BasicBlockKd), fun(f)
|
|
@@ -289,24 +301,26 @@ public:
|
|
|
289
301
|
typedef GenericGraph<SVFBasicBlock, BasicBlockEdge> GenericBasicBlockGraphTy;
|
|
290
302
|
class BasicBlockGraph: public GenericBasicBlockGraphTy
|
|
291
303
|
{
|
|
292
|
-
private:
|
|
293
|
-
NodeID id{0};
|
|
294
304
|
public:
|
|
305
|
+
NodeID id{0};
|
|
295
306
|
/// Constructor
|
|
296
|
-
BasicBlockGraph()
|
|
307
|
+
BasicBlockGraph(): GenericBasicBlockGraphTy()
|
|
297
308
|
{
|
|
298
309
|
|
|
299
310
|
}
|
|
300
311
|
|
|
312
|
+
|
|
301
313
|
SVFBasicBlock* addBasicBlock(const std::string& bbname)
|
|
302
314
|
{
|
|
303
315
|
id++;
|
|
304
316
|
SVFBasicBlock* bb = new SVFBasicBlock(id, nullptr);
|
|
305
|
-
addGNode(id, bb);
|
|
306
317
|
bb->setName(bbname);
|
|
318
|
+
addBasicBlock(bb);
|
|
307
319
|
return bb;
|
|
308
320
|
}
|
|
309
321
|
|
|
322
|
+
void addBasicBlock(SVFBasicBlock* bb);
|
|
323
|
+
|
|
310
324
|
};
|
|
311
325
|
}
|
|
312
326
|
|
|
@@ -105,6 +105,7 @@ private:
|
|
|
105
105
|
typedef GenericNode<CHNode, CHEdge> GenericCHNodeTy;
|
|
106
106
|
class CHNode: public GenericCHNodeTy
|
|
107
107
|
{
|
|
108
|
+
friend class GraphDBClient;
|
|
108
109
|
|
|
109
110
|
public:
|
|
110
111
|
typedef enum
|
|
@@ -222,6 +223,16 @@ private:
|
|
|
222
223
|
* virtualFunctionVectors = {{Af1, Af2, ...}, {Bg1, Bg2, ...}}
|
|
223
224
|
*/
|
|
224
225
|
std::vector<FuncVector> virtualFunctionVectors;
|
|
226
|
+
|
|
227
|
+
protected:
|
|
228
|
+
inline size_t getFlags() const
|
|
229
|
+
{
|
|
230
|
+
return flags;
|
|
231
|
+
}
|
|
232
|
+
inline void setFlags(size_t f)
|
|
233
|
+
{
|
|
234
|
+
flags = f;
|
|
235
|
+
}
|
|
225
236
|
};
|
|
226
237
|
|
|
227
238
|
/// class hierarchy graph
|
|
@@ -229,6 +240,7 @@ typedef GenericGraph<CHNode, CHEdge> GenericCHGraphTy;
|
|
|
229
240
|
class CHGraph: public CommonCHGraph, public GenericCHGraphTy
|
|
230
241
|
{
|
|
231
242
|
friend class CHGBuilder;
|
|
243
|
+
friend class GraphDBClient;
|
|
232
244
|
|
|
233
245
|
public:
|
|
234
246
|
typedef Set<const CHNode*> CHNodeSetTy;
|
|
@@ -224,6 +224,7 @@ public:
|
|
|
224
224
|
{
|
|
225
225
|
return node->getNodeKind() == CallNodeKd;
|
|
226
226
|
}
|
|
227
|
+
|
|
227
228
|
//@}
|
|
228
229
|
};
|
|
229
230
|
|
|
@@ -233,6 +234,8 @@ public:
|
|
|
233
234
|
typedef GenericGraph<CallGraphNode, CallGraphEdge> GenericPTACallGraphTy;
|
|
234
235
|
class CallGraph : public GenericPTACallGraphTy
|
|
235
236
|
{
|
|
237
|
+
friend class GraphDBClient;
|
|
238
|
+
|
|
236
239
|
|
|
237
240
|
public:
|
|
238
241
|
typedef CallGraphEdge::CallGraphEdgeSet CallGraphEdgeSet;
|
|
@@ -281,13 +284,14 @@ protected:
|
|
|
281
284
|
if(it == csToIdMap.end())
|
|
282
285
|
{
|
|
283
286
|
CallSiteID id = totalCallSiteNum++;
|
|
284
|
-
|
|
285
|
-
idToCSMap.insert(std::make_pair(id, newCS));
|
|
287
|
+
addCallSite(cs,callee,id, newCS);
|
|
286
288
|
return id;
|
|
287
289
|
}
|
|
288
290
|
return it->second;
|
|
289
291
|
}
|
|
290
292
|
|
|
293
|
+
CallSiteID addCallSite(const CallICFGNode* cs, const FunObjVar* callee, const CallSiteID csid, std::pair<const CallICFGNode*, const FunObjVar*> newCS);
|
|
294
|
+
|
|
291
295
|
/// Add call graph edge
|
|
292
296
|
inline void addEdge(CallGraphEdge* edge)
|
|
293
297
|
{
|
|
@@ -295,6 +299,14 @@ protected:
|
|
|
295
299
|
edge->getSrcNode()->addOutgoingEdge(edge);
|
|
296
300
|
}
|
|
297
301
|
|
|
302
|
+
/// add direct call graph edge from database [only used this function when loading cgEdges from db results]
|
|
303
|
+
void addDirectCallGraphEdge(CallGraphEdge* cgEdge);
|
|
304
|
+
|
|
305
|
+
/// add call graph node from database [only used this function when loading cgNodes from db results]
|
|
306
|
+
void addCallGraphNode(CallGraphNode* cgNode);
|
|
307
|
+
|
|
308
|
+
/// Whether we have already created this call graph edge
|
|
309
|
+
CallGraphEdge* hasGraphEdge(CallGraphEdge* cgEdge) const;
|
|
298
310
|
public:
|
|
299
311
|
/// Constructor
|
|
300
312
|
CallGraph(CGEK k = NormCallGraph);
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
#include "Graphs/ICFGEdge.h"
|
|
35
35
|
#include "Util/WorkList.h"
|
|
36
36
|
#include "MemoryModel/SVFLoop.h"
|
|
37
|
+
#include "SVFIR/SVFVariables.h"
|
|
37
38
|
|
|
38
39
|
namespace SVF
|
|
39
40
|
{
|
|
@@ -48,6 +49,7 @@ class ICFG : public GenericICFGTy
|
|
|
48
49
|
{
|
|
49
50
|
friend class ICFGBuilder;
|
|
50
51
|
friend class ICFGSimplification;
|
|
52
|
+
friend class GraphDBClient;
|
|
51
53
|
|
|
52
54
|
public:
|
|
53
55
|
|
|
@@ -198,23 +200,37 @@ protected:
|
|
|
198
200
|
virtual inline FunEntryICFGNode* addFunEntryICFGNode(const FunObjVar* svfFunc)
|
|
199
201
|
{
|
|
200
202
|
FunEntryICFGNode* sNode = new FunEntryICFGNode(totalICFGNode++,svfFunc);
|
|
201
|
-
|
|
202
|
-
return FunToFunEntryNodeMap[svfFunc] = sNode;
|
|
203
|
+
return addFunEntryICFGNode(sNode);
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
virtual inline FunEntryICFGNode* addFunEntryICFGNode(FunEntryICFGNode* funEntryICFGNode)
|
|
207
|
+
{
|
|
208
|
+
addICFGNode(funEntryICFGNode);
|
|
209
|
+
return FunToFunEntryNodeMap[funEntryICFGNode->getFun()] = funEntryICFGNode;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
virtual void addGlobalICFGNode(GlobalICFGNode* globalICFGNode);
|
|
213
|
+
|
|
205
214
|
virtual inline FunExitICFGNode* addFunExitICFGNode(const FunObjVar* svfFunc)
|
|
206
215
|
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
216
|
+
const SVFBasicBlock* bb = nullptr;
|
|
217
|
+
if (svfFunc->begin() != svfFunc->end())
|
|
218
|
+
{
|
|
219
|
+
bb = svfFunc->getExitBB();
|
|
220
|
+
}
|
|
221
|
+
FunExitICFGNode* sNode = new FunExitICFGNode(totalICFGNode++, svfFunc, bb);
|
|
222
|
+
return addFunExitICFGNode(sNode);
|
|
210
223
|
}
|
|
211
224
|
|
|
212
|
-
|
|
213
|
-
virtual inline void addICFGNode(ICFGNode* node)
|
|
225
|
+
virtual inline FunExitICFGNode* addFunExitICFGNode(FunExitICFGNode* funExitICFGNode)
|
|
214
226
|
{
|
|
215
|
-
|
|
227
|
+
addICFGNode(funExitICFGNode);
|
|
228
|
+
return FunToFunExitNodeMap[funExitICFGNode->getFun()] = funExitICFGNode;
|
|
216
229
|
}
|
|
217
230
|
|
|
231
|
+
/// Add a ICFG node
|
|
232
|
+
virtual void addICFGNode(ICFGNode* node);
|
|
233
|
+
|
|
218
234
|
public:
|
|
219
235
|
/// Get a basic block ICFGNode
|
|
220
236
|
/// TODO:: need to fix the assertions
|
|
@@ -140,8 +140,6 @@ public:
|
|
|
140
140
|
return isICFGNodeKinds(node->getNodeKind());
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
143
|
protected:
|
|
146
144
|
const FunObjVar* fun;
|
|
147
145
|
const SVFBasicBlock* bb;
|
|
@@ -192,6 +190,8 @@ public:
|
|
|
192
190
|
*/
|
|
193
191
|
class IntraICFGNode : public ICFGNode
|
|
194
192
|
{
|
|
193
|
+
friend class GraphDBClient;
|
|
194
|
+
|
|
195
195
|
private:
|
|
196
196
|
bool isRet;
|
|
197
197
|
|
|
@@ -270,6 +270,7 @@ public:
|
|
|
270
270
|
*/
|
|
271
271
|
class FunEntryICFGNode : public InterICFGNode
|
|
272
272
|
{
|
|
273
|
+
friend class GraphDBClient;
|
|
273
274
|
|
|
274
275
|
public:
|
|
275
276
|
typedef std::vector<const SVFVar *> FormalParmNodeVec;
|
|
@@ -335,12 +336,18 @@ public:
|
|
|
335
336
|
*/
|
|
336
337
|
class FunExitICFGNode : public InterICFGNode
|
|
337
338
|
{
|
|
339
|
+
friend class GraphDBClient;
|
|
338
340
|
|
|
339
341
|
private:
|
|
340
342
|
const SVFVar *formalRet;
|
|
341
343
|
|
|
342
344
|
public:
|
|
343
|
-
FunExitICFGNode(NodeID id, const FunObjVar* f)
|
|
345
|
+
FunExitICFGNode(NodeID id, const FunObjVar* f, const SVFBasicBlock* b)
|
|
346
|
+
: InterICFGNode(id, FunExitBlock), formalRet(nullptr)
|
|
347
|
+
{
|
|
348
|
+
this->fun = f;
|
|
349
|
+
this->bb = b;
|
|
350
|
+
}
|
|
344
351
|
|
|
345
352
|
/// Return function
|
|
346
353
|
inline const FunObjVar* getFun() const override
|
|
@@ -398,6 +405,7 @@ public:
|
|
|
398
405
|
*/
|
|
399
406
|
class CallICFGNode : public InterICFGNode
|
|
400
407
|
{
|
|
408
|
+
friend class GraphDBClient;
|
|
401
409
|
|
|
402
410
|
public:
|
|
403
411
|
typedef std::vector<const ValVar *> ActualParmNodeVec;
|
|
@@ -411,6 +419,8 @@ protected:
|
|
|
411
419
|
SVFVar* vtabPtr; /// virtual table pointer
|
|
412
420
|
s32_t virtualFunIdx; /// virtual function index of the virtual table(s) at a virtual call
|
|
413
421
|
std::string funNameOfVcall; /// the function name of this virtual call
|
|
422
|
+
const SVFVar* indFunPtr;
|
|
423
|
+
|
|
414
424
|
|
|
415
425
|
public:
|
|
416
426
|
CallICFGNode(NodeID id, const SVFBasicBlock* b, const SVFType* ty,
|
|
@@ -561,6 +571,18 @@ public:
|
|
|
561
571
|
{
|
|
562
572
|
return "CallICFGNode: " + ICFGNode::getSourceLoc();
|
|
563
573
|
}
|
|
574
|
+
|
|
575
|
+
inline void setIndFunPtr(const SVFVar* indFun)
|
|
576
|
+
{
|
|
577
|
+
assert(isIndirectCall() && "not a indirect call?");
|
|
578
|
+
indFunPtr = indFun;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
inline const SVFVar* getIndFunPtr() const
|
|
582
|
+
{
|
|
583
|
+
assert(isIndirectCall() && "not a indirect call?");
|
|
584
|
+
return indFunPtr;
|
|
585
|
+
}
|
|
564
586
|
};
|
|
565
587
|
|
|
566
588
|
|
|
@@ -569,6 +591,14 @@ public:
|
|
|
569
591
|
*/
|
|
570
592
|
class RetICFGNode : public InterICFGNode
|
|
571
593
|
{
|
|
594
|
+
friend class GraphDBClient;
|
|
595
|
+
|
|
596
|
+
protected:
|
|
597
|
+
/// Add call block node from database for the new RetICFGNode [only used this function when loading from db results]
|
|
598
|
+
inline void setCallBlockNode(const CallICFGNode* cb)
|
|
599
|
+
{
|
|
600
|
+
callBlockNode = cb;
|
|
601
|
+
}
|
|
572
602
|
|
|
573
603
|
private:
|
|
574
604
|
const SVFVar *actualRet;
|
|
@@ -578,9 +608,12 @@ public:
|
|
|
578
608
|
RetICFGNode(NodeID id, CallICFGNode* cb) :
|
|
579
609
|
InterICFGNode(id, FunRetBlock), actualRet(nullptr), callBlockNode(cb)
|
|
580
610
|
{
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
611
|
+
if (nullptr != cb)
|
|
612
|
+
{
|
|
613
|
+
fun = cb->getFun();
|
|
614
|
+
bb = cb->getBB();
|
|
615
|
+
type = cb->getType();
|
|
616
|
+
}
|
|
584
617
|
}
|
|
585
618
|
|
|
586
619
|
inline const CallICFGNode* getCallICFGNode() const
|
|
@@ -52,6 +52,7 @@ class IRGraph : public GenericGraph<SVFVar, SVFStmt>
|
|
|
52
52
|
{
|
|
53
53
|
friend class SVFIRBuilder;
|
|
54
54
|
friend class SymbolTableBuilder;
|
|
55
|
+
friend class GraphDBClient;
|
|
55
56
|
|
|
56
57
|
public:
|
|
57
58
|
|
|
@@ -129,6 +130,7 @@ protected:
|
|
|
129
130
|
/// blocks, thus flags are needed to distinguish them
|
|
130
131
|
SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind,
|
|
131
132
|
const ICFGNode* cs);
|
|
133
|
+
SVFStmt* hasEdge(SVFStmt* edge, SVFStmt::PEDGEK kind);
|
|
132
134
|
/// Return MultiOpndStmt since it has more than one operands (we use operand
|
|
133
135
|
/// 2 here to make the flag)
|
|
134
136
|
SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind,
|
|
@@ -270,6 +272,15 @@ public:
|
|
|
270
272
|
return svfTypes;
|
|
271
273
|
}
|
|
272
274
|
|
|
275
|
+
inline const SVFType* getSVFType(u32_t id) const
|
|
276
|
+
{
|
|
277
|
+
for(const SVFType* type : svfTypes)
|
|
278
|
+
{
|
|
279
|
+
if(type->getId() == id)
|
|
280
|
+
return type;
|
|
281
|
+
}
|
|
282
|
+
return nullptr;
|
|
283
|
+
}
|
|
273
284
|
inline const Set<const StInfo*>& getStInfos() const
|
|
274
285
|
{
|
|
275
286
|
return stInfos;
|
|
@@ -360,6 +371,7 @@ public:
|
|
|
360
371
|
|
|
361
372
|
inline void addStInfo(StInfo* stInfo)
|
|
362
373
|
{
|
|
374
|
+
stInfo->setStinfoId(stInfos.size());
|
|
363
375
|
stInfos.insert(stInfo);
|
|
364
376
|
}
|
|
365
377
|
|
|
@@ -51,7 +51,7 @@ class SVFVar;
|
|
|
51
51
|
*/
|
|
52
52
|
class AccessPath
|
|
53
53
|
{
|
|
54
|
-
|
|
54
|
+
friend class GraphDBClient;
|
|
55
55
|
public:
|
|
56
56
|
enum LSRelation
|
|
57
57
|
{
|
|
@@ -161,6 +161,12 @@ public:
|
|
|
161
161
|
/// Dump location set
|
|
162
162
|
std::string dump() const;
|
|
163
163
|
|
|
164
|
+
protected:
|
|
165
|
+
inline void addIdxOperandPair(std::pair<const SVFVar*, const SVFType*> pair)
|
|
166
|
+
{
|
|
167
|
+
idxOperandPairs.push_back(pair);
|
|
168
|
+
}
|
|
169
|
+
|
|
164
170
|
private:
|
|
165
171
|
|
|
166
172
|
/// Check relations of two location sets
|
|
@@ -42,6 +42,7 @@ namespace SVF
|
|
|
42
42
|
class ObjTypeInfo
|
|
43
43
|
{
|
|
44
44
|
friend class SymbolTableBuilder;
|
|
45
|
+
friend class GraphDBClient;
|
|
45
46
|
|
|
46
47
|
public:
|
|
47
48
|
typedef enum
|
|
@@ -148,6 +149,10 @@ public:
|
|
|
148
149
|
{
|
|
149
150
|
flags |= mask;
|
|
150
151
|
}
|
|
152
|
+
inline u32_t getFlag() const
|
|
153
|
+
{
|
|
154
|
+
return flags;
|
|
155
|
+
}
|
|
151
156
|
inline bool hasFlag(MEMTYPE mask)
|
|
152
157
|
{
|
|
153
158
|
return (flags & mask) == mask;
|
|
@@ -46,6 +46,8 @@ class SVFIR : public IRGraph
|
|
|
46
46
|
friend class PAGBuilderFromFile;
|
|
47
47
|
friend class TypeBasedHeapCloning;
|
|
48
48
|
friend class BVDataPTAImpl;
|
|
49
|
+
friend class GraphDBClient;
|
|
50
|
+
friend class GraphDBSVFIRBuilder;
|
|
49
51
|
|
|
50
52
|
public:
|
|
51
53
|
typedef Set<const CallICFGNode*> CallSiteSet;
|
|
@@ -181,6 +183,11 @@ public:
|
|
|
181
183
|
return callGraph;
|
|
182
184
|
}
|
|
183
185
|
|
|
186
|
+
inline void setCallGraph(CallGraph* cg)
|
|
187
|
+
{
|
|
188
|
+
callGraph = cg;
|
|
189
|
+
}
|
|
190
|
+
|
|
184
191
|
const FunObjVar* getFunObjVar(const std::string& name);
|
|
185
192
|
|
|
186
193
|
inline const std::string& getModuleIdentifier() const
|
|
@@ -500,6 +507,22 @@ public:
|
|
|
500
507
|
/// Print SVFIR
|
|
501
508
|
void print();
|
|
502
509
|
|
|
510
|
+
protected:
|
|
511
|
+
inline NodeID addBaseObjNode(BaseObjVar* node)
|
|
512
|
+
{
|
|
513
|
+
memToFieldsMap[node->getId()].set(node->getId());
|
|
514
|
+
return addObjNode(node);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
NodeID addDummyObjNode(DummyObjVar* node);
|
|
518
|
+
|
|
519
|
+
NodeID addGepObjNode(GepObjVar* gepObj, NodeID base, const APOffset& apOffset);
|
|
520
|
+
|
|
521
|
+
inline void addGepValObjFromDB(NodeID curInstID, const GepValVar* gepValvar)
|
|
522
|
+
{
|
|
523
|
+
GepValObjMap[curInstID][std::make_pair(gepValvar->getBaseNode()->getId(), gepValvar->getAccessPath())] = gepValvar->getId();
|
|
524
|
+
}
|
|
525
|
+
|
|
503
526
|
private:
|
|
504
527
|
|
|
505
528
|
/// Map a SVFStatement type to a set of corresponding SVF statements
|
|
@@ -521,6 +544,11 @@ private:
|
|
|
521
544
|
inline void addFunArgs(const FunObjVar* fun, const SVFVar* arg)
|
|
522
545
|
{
|
|
523
546
|
FunEntryICFGNode* funEntryBlockNode = icfg->getFunEntryICFGNode(fun);
|
|
547
|
+
addFunArgs(funEntryBlockNode, fun, arg);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
inline void addFunArgs(FunEntryICFGNode* funEntryBlockNode, const FunObjVar* fun, const SVFVar* arg)
|
|
551
|
+
{
|
|
524
552
|
funEntryBlockNode->addFormalParms(arg);
|
|
525
553
|
funArgsListMap[fun].push_back(arg);
|
|
526
554
|
}
|
|
@@ -528,6 +556,11 @@ private:
|
|
|
528
556
|
inline void addFunRet(const FunObjVar* fun, const SVFVar* ret)
|
|
529
557
|
{
|
|
530
558
|
FunExitICFGNode* funExitBlockNode = icfg->getFunExitICFGNode(fun);
|
|
559
|
+
addFunRet(funExitBlockNode, fun, ret);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
inline void addFunRet(FunExitICFGNode* funExitBlockNode, const FunObjVar* fun, const SVFVar* ret)
|
|
563
|
+
{
|
|
531
564
|
funExitBlockNode->addFormalRet(ret);
|
|
532
565
|
funRetMap[fun] = ret;
|
|
533
566
|
}
|
|
@@ -557,7 +590,7 @@ private:
|
|
|
557
590
|
/// Add a value (pointer) node
|
|
558
591
|
inline NodeID addValNode(NodeID i, const SVFType* type, const ICFGNode* icfgNode)
|
|
559
592
|
{
|
|
560
|
-
|
|
593
|
+
ValVar *node = new ValVar(i, type, icfgNode, ValVar::ValNode);
|
|
561
594
|
return addValNode(node);
|
|
562
595
|
}
|
|
563
596
|
|
|
@@ -624,9 +657,8 @@ private:
|
|
|
624
657
|
*/
|
|
625
658
|
inline NodeID addHeapObjNode(NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
626
659
|
{
|
|
627
|
-
memToFieldsMap[i].set(i);
|
|
628
660
|
HeapObjVar *heapObj = new HeapObjVar(i, ti, node);
|
|
629
|
-
return
|
|
661
|
+
return addBaseObjNode(heapObj);
|
|
630
662
|
}
|
|
631
663
|
|
|
632
664
|
/**
|
|
@@ -634,60 +666,52 @@ private:
|
|
|
634
666
|
*/
|
|
635
667
|
inline NodeID addStackObjNode(NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
636
668
|
{
|
|
637
|
-
memToFieldsMap[i].set(i);
|
|
638
669
|
StackObjVar *stackObj = new StackObjVar(i, ti, node);
|
|
639
|
-
return
|
|
670
|
+
return addBaseObjNode(stackObj);
|
|
640
671
|
}
|
|
641
672
|
|
|
642
673
|
NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const ICFGNode* node)
|
|
643
674
|
{
|
|
644
|
-
memToFieldsMap[id].set(id);
|
|
645
675
|
FunObjVar* funObj = new FunObjVar(id, ti, node);
|
|
646
|
-
return
|
|
676
|
+
return addBaseObjNode(funObj);
|
|
647
677
|
}
|
|
648
678
|
|
|
649
679
|
|
|
650
680
|
inline NodeID addConstantFPObjNode(NodeID i, ObjTypeInfo* ti, double dval, const ICFGNode* node)
|
|
651
681
|
{
|
|
652
|
-
memToFieldsMap[i].set(i);
|
|
653
682
|
ConstFPObjVar* conObj = new ConstFPObjVar(i, dval, ti, node);
|
|
654
|
-
return
|
|
683
|
+
return addBaseObjNode(conObj);
|
|
655
684
|
}
|
|
656
685
|
|
|
657
686
|
|
|
658
687
|
inline NodeID addConstantIntObjNode(NodeID i, ObjTypeInfo* ti, const std::pair<s64_t, u64_t>& intValue, const ICFGNode* node)
|
|
659
688
|
{
|
|
660
|
-
memToFieldsMap[i].set(i);
|
|
661
689
|
ConstIntObjVar* conObj =
|
|
662
690
|
new ConstIntObjVar(i, intValue.first, intValue.second, ti, node);
|
|
663
|
-
return
|
|
691
|
+
return addBaseObjNode(conObj);
|
|
664
692
|
}
|
|
665
693
|
|
|
666
694
|
|
|
667
695
|
inline NodeID addConstantNullPtrObjNode(const NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
668
696
|
{
|
|
669
|
-
memToFieldsMap[i].set(i);
|
|
670
697
|
ConstNullPtrObjVar* conObj = new ConstNullPtrObjVar(i, ti, node);
|
|
671
|
-
return
|
|
698
|
+
return addBaseObjNode(conObj);
|
|
672
699
|
}
|
|
673
700
|
|
|
674
701
|
inline NodeID addGlobalObjNode(const NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
675
702
|
{
|
|
676
|
-
memToFieldsMap[i].set(i);
|
|
677
703
|
GlobalObjVar* gObj = new GlobalObjVar(i, ti, node);
|
|
678
|
-
return
|
|
704
|
+
return addBaseObjNode(gObj);
|
|
679
705
|
}
|
|
680
706
|
inline NodeID addConstantAggObjNode(const NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
681
707
|
{
|
|
682
|
-
memToFieldsMap[i].set(i);
|
|
683
708
|
ConstAggObjVar* conObj = new ConstAggObjVar(i, ti, node);
|
|
684
|
-
return
|
|
709
|
+
return addBaseObjNode(conObj);
|
|
685
710
|
}
|
|
686
711
|
inline NodeID addConstantDataObjNode(const NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
687
712
|
{
|
|
688
|
-
memToFieldsMap[i].set(i);
|
|
689
713
|
ConstDataObjVar* conObj = new ConstDataObjVar(i, ti, node);
|
|
690
|
-
return
|
|
714
|
+
return addBaseObjNode(conObj);
|
|
691
715
|
}
|
|
692
716
|
|
|
693
717
|
/// Add a unique return node for a procedure
|
|
@@ -710,9 +734,8 @@ private:
|
|
|
710
734
|
/// Add a field-insensitive node, this method can only invoked by getFIGepObjNode
|
|
711
735
|
NodeID addFIObjNode(NodeID i, ObjTypeInfo* ti, const ICFGNode* node)
|
|
712
736
|
{
|
|
713
|
-
memToFieldsMap[i].set(i);
|
|
714
737
|
BaseObjVar* baseObj = new BaseObjVar(i, ti, node);
|
|
715
|
-
return
|
|
738
|
+
return addBaseObjNode(baseObj);
|
|
716
739
|
}
|
|
717
740
|
|
|
718
741
|
|
|
@@ -730,11 +753,11 @@ private:
|
|
|
730
753
|
{
|
|
731
754
|
ObjTypeInfo* ti = createObjTypeInfo(type);
|
|
732
755
|
idToObjTypeInfoMap()[i] = ti;
|
|
733
|
-
return
|
|
756
|
+
return addDummyObjNode(new DummyObjVar(i, ti, nullptr));
|
|
734
757
|
}
|
|
735
758
|
else
|
|
736
759
|
{
|
|
737
|
-
return
|
|
760
|
+
return addDummyObjNode(new DummyObjVar(i, getObjTypeInfo(i), nullptr));
|
|
738
761
|
}
|
|
739
762
|
}
|
|
740
763
|
|
|
@@ -753,23 +776,9 @@ private:
|
|
|
753
776
|
//@}
|
|
754
777
|
|
|
755
778
|
/// Add a value (pointer) node
|
|
756
|
-
|
|
757
|
-
{
|
|
758
|
-
assert(node && "node cannot be nullptr.");
|
|
759
|
-
assert(hasGNode(node->getId()) == false &&
|
|
760
|
-
"This NodeID clashes here. Please check NodeIDAllocator. Switch "
|
|
761
|
-
"Strategy::DBUG to SEQ or DENSE");
|
|
762
|
-
return addNode(node);
|
|
763
|
-
}
|
|
779
|
+
NodeID addValNode(ValVar* node);
|
|
764
780
|
/// Add a memory obj node
|
|
765
|
-
|
|
766
|
-
{
|
|
767
|
-
assert(node && "node cannot be nullptr.");
|
|
768
|
-
assert(hasGNode(node->getId()) == false &&
|
|
769
|
-
"This NodeID clashes here. Please check NodeIDAllocator. Switch "
|
|
770
|
-
"Strategy::DBUG to SEQ or DENSE");
|
|
771
|
-
return addNode(node);
|
|
772
|
-
}
|
|
781
|
+
NodeID addObjNode(ObjVar *node);
|
|
773
782
|
/// Add a unique return node for a procedure
|
|
774
783
|
inline NodeID addRetNode(const FunObjVar*, SVFVar *node)
|
|
775
784
|
{
|
|
@@ -795,36 +804,49 @@ private:
|
|
|
795
804
|
//@{
|
|
796
805
|
/// Add Address edge
|
|
797
806
|
AddrStmt* addAddrStmt(NodeID src, NodeID dst);
|
|
807
|
+
void addAddrStmt(AddrStmt* edge);
|
|
798
808
|
/// Add Copy edge
|
|
799
809
|
CopyStmt* addCopyStmt(NodeID src, NodeID dst, CopyStmt::CopyKind type);
|
|
810
|
+
void addCopyStmt(CopyStmt* edge);
|
|
800
811
|
|
|
801
812
|
/// Add phi node information
|
|
802
813
|
PhiStmt* addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred);
|
|
814
|
+
void addPhiStmt(PhiStmt* edge, SVFVar* src, SVFVar* dst);
|
|
803
815
|
/// Add SelectStmt
|
|
804
816
|
SelectStmt* addSelectStmt(NodeID res, NodeID op1, NodeID op2, NodeID cond);
|
|
817
|
+
void addSelectStmt(SelectStmt* edge, SVFVar* src, SVFVar* dst);
|
|
805
818
|
/// Add Copy edge
|
|
806
819
|
CmpStmt* addCmpStmt(NodeID op1, NodeID op2, NodeID dst, u32_t predict);
|
|
820
|
+
void addCmpStmt(CmpStmt* edge, SVFVar* src, SVFVar* dst);
|
|
807
821
|
/// Add Copy edge
|
|
808
822
|
BinaryOPStmt* addBinaryOPStmt(NodeID op1, NodeID op2, NodeID dst,
|
|
809
823
|
u32_t opcode);
|
|
824
|
+
void addBinaryOPStmt(BinaryOPStmt* edge, SVFVar* src, SVFVar* dst);
|
|
810
825
|
/// Add Unary edge
|
|
811
826
|
UnaryOPStmt* addUnaryOPStmt(NodeID src, NodeID dst, u32_t opcode);
|
|
827
|
+
void addUnaryOPStmt(UnaryOPStmt* edge, SVFVar* src, SVFVar* dst);
|
|
812
828
|
/// Add BranchStmt
|
|
813
829
|
BranchStmt* addBranchStmt(NodeID br, NodeID cond,
|
|
814
830
|
const BranchStmt::SuccAndCondPairVec& succs);
|
|
831
|
+
void addBranchStmt(BranchStmt* edge, SVFVar* src, SVFVar* dst);
|
|
815
832
|
/// Add Load edge
|
|
816
833
|
LoadStmt* addLoadStmt(NodeID src, NodeID dst);
|
|
834
|
+
void addLoadStmt(LoadStmt* edge);
|
|
817
835
|
/// Add Store edge
|
|
818
836
|
StoreStmt* addStoreStmt(NodeID src, NodeID dst, const ICFGNode* val);
|
|
837
|
+
void addStoreStmt(StoreStmt* edge, SVFVar* src, SVFVar* dst);
|
|
819
838
|
/// Add Call edge
|
|
820
839
|
CallPE* addCallPE(NodeID src, NodeID dst, const CallICFGNode* cs,
|
|
821
840
|
const FunEntryICFGNode* entry);
|
|
841
|
+
void addCallPE(CallPE* edge, SVFVar* src, SVFVar* dst);
|
|
822
842
|
/// Add Return edge
|
|
823
843
|
RetPE* addRetPE(NodeID src, NodeID dst, const CallICFGNode* cs,
|
|
824
844
|
const FunExitICFGNode* exit);
|
|
845
|
+
void addRetPE(RetPE* edge, SVFVar* src, SVFVar* dst);
|
|
825
846
|
/// Add Gep edge
|
|
826
847
|
GepStmt* addGepStmt(NodeID src, NodeID dst, const AccessPath& ap,
|
|
827
848
|
bool constGep);
|
|
849
|
+
void addGepStmt(GepStmt* edge);
|
|
828
850
|
/// Add Offset(Gep) edge
|
|
829
851
|
GepStmt* addNormalGepStmt(NodeID src, NodeID dst, const AccessPath& ap);
|
|
830
852
|
/// Add Variant(Gep) edge
|