svf-lib 1.0.2211 → 1.0.2213
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/CFL/CFLAlias.h +1 -1
- package/SVF-linux/Release-build/include/DDA/ContextDDA.h +6 -6
- package/SVF-linux/Release-build/include/DDA/DDAVFSolver.h +2 -2
- package/SVF-linux/Release-build/include/DDA/FlowDDA.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/BasicBlockG.h +17 -9
- package/SVF-linux/Release-build/include/Graphs/CHG.h +7 -7
- package/SVF-linux/Release-build/include/Graphs/CallGraph.h +23 -27
- package/SVF-linux/Release-build/include/Graphs/ConsG.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +11 -11
- package/SVF-linux/Release-build/include/Graphs/ICFGNode.h +12 -18
- package/SVF-linux/Release-build/include/Graphs/IRGraph.h +11 -9
- package/SVF-linux/Release-build/include/Graphs/SVFG.h +13 -13
- package/SVF-linux/Release-build/include/Graphs/SVFGNode.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +3 -21
- package/SVF-linux/Release-build/include/Graphs/VFG.h +15 -15
- package/SVF-linux/Release-build/include/Graphs/VFGNode.h +10 -10
- package/SVF-linux/Release-build/include/MSSA/MSSAMuChi.h +6 -6
- package/SVF-linux/Release-build/include/MSSA/MemPartition.h +12 -12
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +21 -21
- package/SVF-linux/Release-build/include/MSSA/MemSSA.h +10 -10
- package/SVF-linux/Release-build/include/MTA/LockAnalysis.h +4 -4
- package/SVF-linux/Release-build/include/MTA/MHP.h +8 -8
- package/SVF-linux/Release-build/include/MTA/TCT.h +10 -10
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +4 -4
- package/SVF-linux/Release-build/include/SABER/DoubleFreeChecker.h +2 -2
- package/SVF-linux/Release-build/include/SABER/FileChecker.h +2 -2
- package/SVF-linux/Release-build/include/SABER/LeakChecker.h +4 -4
- package/SVF-linux/Release-build/include/SABER/SaberCheckerAPI.h +6 -5
- package/SVF-linux/Release-build/include/SABER/SaberCondAllocator.h +5 -5
- package/SVF-linux/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMModule.h +83 -7
- package/SVF-linux/Release-build/include/SVF-LLVM/LLVMUtil.h +9 -1
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +5 -2
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +20 -27
- package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +3 -2
- package/SVF-linux/Release-build/include/SVFIR/SVFVariables.h +271 -71
- package/SVF-linux/Release-build/include/Util/CDGBuilder.h +1 -1
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +1 -1
- package/SVF-linux/Release-build/include/Util/CxtStmt.h +6 -6
- package/SVF-linux/Release-build/include/Util/ExtAPI.h +20 -16
- package/SVF-linux/Release-build/include/Util/SVFUtil.h +16 -30
- package/SVF-linux/Release-build/include/Util/ThreadAPI.h +2 -11
- package/SVF-linux/Release-build/include/WPA/Andersen.h +2 -2
- 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/DDA/DDAClient.h +6 -11
- package/SVF-osx/Release-build/include/DDA/DDAPass.h +1 -1
- package/SVF-osx/Release-build/include/Graphs/CHG.h +2 -3
- package/SVF-osx/Release-build/include/Graphs/GenericGraph.h +1 -286
- package/SVF-osx/Release-build/include/MTA/MTA.h +2 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +0 -6
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +1 -7
- package/SVF-osx/Release-build/include/SABER/DoubleFreeChecker.h +1 -1
- package/SVF-osx/Release-build/include/SABER/FileChecker.h +1 -1
- package/SVF-osx/Release-build/include/SABER/LeakChecker.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SaberCondAllocator.h +1 -2
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +2 -2
- package/SVF-osx/Release-build/include/SVF-LLVM/BreakConstantExpr.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/CppUtil.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/DCHG.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMLoopAnalysis.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMModule.h +2 -2
- package/SVF-osx/Release-build/include/SVF-LLVM/LLVMUtil.h +1 -1
- package/SVF-osx/Release-build/include/SVF-LLVM/ObjTypeInference.h +1 -1
- package/SVF-osx/Release-build/include/{SVFIR → SVF-LLVM}/SVFModule.h +1 -36
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFValue.h +805 -0
- package/SVF-osx/Release-build/include/SVFIR/ObjTypeInfo.h +0 -1
- package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +38 -11
- package/SVF-osx/Release-build/include/SVFIR/SVFStatements.h +1 -0
- package/SVF-osx/Release-build/include/SVFIR/SVFValue.h +202 -799
- package/SVF-osx/Release-build/include/Util/CDGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/Util/GeneralType.h +1 -0
- package/SVF-osx/Release-build/include/Util/SVFLoopAndDomInfo.h +169 -0
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +3 -1
- package/SVF-osx/Release-build/include/Util/ThreadAPI.h +2 -1
- package/SVF-osx/Release-build/include/WPA/FlowSensitive.h +1 -1
- 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
|
@@ -57,12 +57,11 @@ public:
|
|
|
57
57
|
typedef std::vector<const SVFStmt*> SVFStmtList;
|
|
58
58
|
typedef std::vector<const SVFVar*> SVFVarList;
|
|
59
59
|
typedef Map<const SVFVar*,PhiStmt*> PHINodeMap;
|
|
60
|
-
typedef Map<const
|
|
60
|
+
typedef Map<const FunObjVar*,SVFVarList> FunToArgsListMap;
|
|
61
61
|
typedef Map<const CallICFGNode*,SVFVarList> CSToArgsListMap;
|
|
62
62
|
typedef Map<const RetICFGNode*,const SVFVar*> CSToRetMap;
|
|
63
|
-
typedef Map<const
|
|
64
|
-
typedef Map<const
|
|
65
|
-
typedef Map<const SVFFunction*,SVFStmtSet> FunToPAGEdgeSetMap;
|
|
63
|
+
typedef Map<const FunObjVar*,const SVFVar*> FunToRetMap;
|
|
64
|
+
typedef Map<const FunObjVar*,SVFStmtSet> FunToPAGEdgeSetMap;
|
|
66
65
|
typedef Map<const ICFGNode*,SVFStmtList> ICFGNode2SVFStmtsMap;
|
|
67
66
|
typedef Map<NodeID, NodeID> NodeToNodeMap;
|
|
68
67
|
typedef std::pair<NodeID, APOffset> NodeOffset;
|
|
@@ -89,7 +88,6 @@ private:
|
|
|
89
88
|
CSToArgsListMap callSiteArgsListMap; ///< Map a callsite to a list of all its actual parameters
|
|
90
89
|
CSToRetMap callSiteRetMap; ///< Map a callsite to its callsite returns PAGNodes
|
|
91
90
|
FunToRetMap funRetMap; ///< Map a function to its unique function return PAGNodes
|
|
92
|
-
FunToFunObjVarMap funToFunObjvarMap; ///< Map a function to its unique function object PAGNodes
|
|
93
91
|
CallSiteToFunPtrMap indCallSiteToFunPtrMap; ///< Map an indirect callsite to its function pointer
|
|
94
92
|
FunPtrToCallSitesMap funPtrToCallSitesMap; ///< Map a function pointer to the callsites where it is used
|
|
95
93
|
/// Valid pointers for pointer analysis resolution connected by SVFIR edges (constraints)
|
|
@@ -196,6 +194,8 @@ public:
|
|
|
196
194
|
return callGraph;
|
|
197
195
|
}
|
|
198
196
|
|
|
197
|
+
const FunObjVar* getFunObjVar(const std::string& name);
|
|
198
|
+
|
|
199
199
|
/// Get/set methods to get SVFStmts based on their kinds and ICFGNodes
|
|
200
200
|
//@{
|
|
201
201
|
/// Get edges set according to its kind
|
|
@@ -263,7 +263,7 @@ public:
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
/// Function has arguments list
|
|
266
|
-
inline bool hasFunArgsList(const
|
|
266
|
+
inline bool hasFunArgsList(const FunObjVar* func) const
|
|
267
267
|
{
|
|
268
268
|
return (funArgsListMap.find(func) != funArgsListMap.end());
|
|
269
269
|
}
|
|
@@ -273,7 +273,7 @@ public:
|
|
|
273
273
|
return funArgsListMap;
|
|
274
274
|
}
|
|
275
275
|
/// Get function arguments list
|
|
276
|
-
inline const SVFVarList& getFunArgsList(const
|
|
276
|
+
inline const SVFVarList& getFunArgsList(const FunObjVar* func) const
|
|
277
277
|
{
|
|
278
278
|
FunToArgsListMap::const_iterator it = funArgsListMap.find(func);
|
|
279
279
|
assert(it != funArgsListMap.end() && "this function doesn't have arguments");
|
|
@@ -318,24 +318,18 @@ public:
|
|
|
318
318
|
return funRetMap;
|
|
319
319
|
}
|
|
320
320
|
/// Get function return list
|
|
321
|
-
inline const SVFVar* getFunRet(const
|
|
321
|
+
inline const SVFVar* getFunRet(const FunObjVar* func) const
|
|
322
322
|
{
|
|
323
323
|
FunToRetMap::const_iterator it = funRetMap.find(func);
|
|
324
324
|
assert(it != funRetMap.end() && "this function doesn't have return");
|
|
325
325
|
return it->second;
|
|
326
326
|
}
|
|
327
|
-
inline bool funHasRet(const
|
|
327
|
+
inline bool funHasRet(const FunObjVar* func) const
|
|
328
328
|
{
|
|
329
329
|
return funRetMap.find(func) != funRetMap.end();
|
|
330
330
|
}
|
|
331
331
|
//@}
|
|
332
332
|
|
|
333
|
-
inline const FunObjVar* getFunObjVar(const SVFFunction* node) const
|
|
334
|
-
{
|
|
335
|
-
FunToFunObjVarMap::const_iterator it = funToFunObjvarMap.find(node);
|
|
336
|
-
assert(it != funToFunObjvarMap.end() && "this function doesn't have funobjvar");
|
|
337
|
-
return it->second;
|
|
338
|
-
}
|
|
339
333
|
/// Node and edge statistics
|
|
340
334
|
//@{
|
|
341
335
|
inline u32_t getFieldValNodeNum() const
|
|
@@ -503,14 +497,14 @@ private:
|
|
|
503
497
|
/// Get/set method for function/callsite arguments and returns
|
|
504
498
|
//@{
|
|
505
499
|
/// Add function arguments
|
|
506
|
-
inline void addFunArgs(const
|
|
500
|
+
inline void addFunArgs(const FunObjVar* fun, const SVFVar* arg)
|
|
507
501
|
{
|
|
508
502
|
FunEntryICFGNode* funEntryBlockNode = icfg->getFunEntryICFGNode(fun);
|
|
509
503
|
funEntryBlockNode->addFormalParms(arg);
|
|
510
504
|
funArgsListMap[fun].push_back(arg);
|
|
511
505
|
}
|
|
512
506
|
/// Add function returns
|
|
513
|
-
inline void addFunRet(const
|
|
507
|
+
inline void addFunRet(const FunObjVar* fun, const SVFVar* ret)
|
|
514
508
|
{
|
|
515
509
|
FunExitICFGNode* funExitBlockNode = icfg->getFunExitICFGNode(fun);
|
|
516
510
|
funExitBlockNode->addFormalRet(ret);
|
|
@@ -546,13 +540,13 @@ private:
|
|
|
546
540
|
return addValNode(node);
|
|
547
541
|
}
|
|
548
542
|
|
|
549
|
-
NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const
|
|
543
|
+
NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const FunObjVar* funObjVar, const SVFType* type)
|
|
550
544
|
{
|
|
551
|
-
FunValVar* node = new FunValVar(i, icfgNode,
|
|
545
|
+
FunValVar* node = new FunValVar(i, icfgNode, funObjVar, type);
|
|
552
546
|
return addValNode(node);
|
|
553
547
|
}
|
|
554
548
|
|
|
555
|
-
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const
|
|
549
|
+
NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const FunObjVar* callGraphNode, const SVFType* type)
|
|
556
550
|
{
|
|
557
551
|
ArgValVar* node =
|
|
558
552
|
new ArgValVar(i, argNo, icfgNode, callGraphNode, type);
|
|
@@ -624,11 +618,10 @@ private:
|
|
|
624
618
|
return addObjNode(stackObj);
|
|
625
619
|
}
|
|
626
620
|
|
|
627
|
-
NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const
|
|
621
|
+
NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node)
|
|
628
622
|
{
|
|
629
623
|
memToFieldsMap[id].set(id);
|
|
630
|
-
FunObjVar* funObj = new FunObjVar(id, ti,
|
|
631
|
-
funToFunObjvarMap[callGraphNode] = funObj;
|
|
624
|
+
FunObjVar* funObj = new FunObjVar(id, ti, type, node);
|
|
632
625
|
return addObjNode(funObj);
|
|
633
626
|
}
|
|
634
627
|
|
|
@@ -677,13 +670,13 @@ private:
|
|
|
677
670
|
}
|
|
678
671
|
|
|
679
672
|
/// Add a unique return node for a procedure
|
|
680
|
-
inline NodeID addRetNode(NodeID i, const
|
|
673
|
+
inline NodeID addRetNode(NodeID i, const FunObjVar* callGraphNode, const SVFType* type, const ICFGNode* icn)
|
|
681
674
|
{
|
|
682
675
|
SVFVar *node = new RetValPN(i, callGraphNode, type, icn);
|
|
683
676
|
return addRetNode(callGraphNode, node);
|
|
684
677
|
}
|
|
685
678
|
/// Add a unique vararg node for a procedure
|
|
686
|
-
inline NodeID addVarargNode(NodeID i, const
|
|
679
|
+
inline NodeID addVarargNode(NodeID i, const FunObjVar* val, const SVFType* type, const ICFGNode* n)
|
|
687
680
|
{
|
|
688
681
|
SVFVar *node = new VarArgValPN(i, val, type, n);
|
|
689
682
|
return addNode(node);
|
|
@@ -757,12 +750,12 @@ private:
|
|
|
757
750
|
return addNode(node);
|
|
758
751
|
}
|
|
759
752
|
/// Add a unique return node for a procedure
|
|
760
|
-
inline NodeID addRetNode(const
|
|
753
|
+
inline NodeID addRetNode(const FunObjVar*, SVFVar *node)
|
|
761
754
|
{
|
|
762
755
|
return addNode(node);
|
|
763
756
|
}
|
|
764
757
|
/// Add a unique vararg node for a procedure
|
|
765
|
-
inline NodeID addVarargNode(const
|
|
758
|
+
inline NodeID addVarargNode(const FunObjVar*, SVFVar *node)
|
|
766
759
|
{
|
|
767
760
|
return addNode(node);
|
|
768
761
|
}
|
|
@@ -522,6 +522,7 @@ public:
|
|
|
522
522
|
};
|
|
523
523
|
|
|
524
524
|
class ICFGNode;
|
|
525
|
+
class FunObjVar;
|
|
525
526
|
|
|
526
527
|
class SVFInstruction : public SVFValue
|
|
527
528
|
{
|
|
@@ -551,7 +552,7 @@ public:
|
|
|
551
552
|
return bb;
|
|
552
553
|
}
|
|
553
554
|
|
|
554
|
-
inline const
|
|
555
|
+
inline const FunObjVar* getFunction() const
|
|
555
556
|
{
|
|
556
557
|
return bb->getParent();
|
|
557
558
|
}
|
|
@@ -630,7 +631,7 @@ public:
|
|
|
630
631
|
{
|
|
631
632
|
return SVFUtil::dyn_cast<SVFFunction>(calledVal);
|
|
632
633
|
}
|
|
633
|
-
inline const
|
|
634
|
+
inline const FunObjVar* getCaller() const
|
|
634
635
|
{
|
|
635
636
|
return getFunction();
|
|
636
637
|
}
|
|
@@ -101,7 +101,7 @@ public:
|
|
|
101
101
|
virtual const std::string getValueName() const = 0;
|
|
102
102
|
|
|
103
103
|
/// Get containing function, or null for globals/constants
|
|
104
|
-
virtual inline const
|
|
104
|
+
virtual inline const FunObjVar* getFunction() const
|
|
105
105
|
{
|
|
106
106
|
return nullptr;
|
|
107
107
|
}
|
|
@@ -183,17 +183,7 @@ public:
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/// Check if this pointer is in an uncalled function
|
|
186
|
-
|
|
187
|
-
{
|
|
188
|
-
if (const SVFFunction* fun = getFunction())
|
|
189
|
-
{
|
|
190
|
-
return fun->isUncalledFunction();
|
|
191
|
-
}
|
|
192
|
-
else
|
|
193
|
-
{
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
186
|
+
virtual bool ptrInUncalledFunction() const;
|
|
197
187
|
|
|
198
188
|
/// Check if this variable represents constant/aggregate data
|
|
199
189
|
virtual bool isConstDataOrAggData() const
|
|
@@ -302,7 +292,7 @@ public:
|
|
|
302
292
|
return icfgNode;
|
|
303
293
|
}
|
|
304
294
|
|
|
305
|
-
virtual const
|
|
295
|
+
virtual const FunObjVar* getFunction() const;
|
|
306
296
|
|
|
307
297
|
virtual const std::string toString() const;
|
|
308
298
|
};
|
|
@@ -366,7 +356,7 @@ class ArgValVar: public ValVar
|
|
|
366
356
|
friend class SVFIRReader;
|
|
367
357
|
|
|
368
358
|
private:
|
|
369
|
-
const
|
|
359
|
+
const FunObjVar* cgNode;
|
|
370
360
|
u32_t argNo;
|
|
371
361
|
|
|
372
362
|
protected:
|
|
@@ -399,7 +389,7 @@ public:
|
|
|
399
389
|
//@}
|
|
400
390
|
|
|
401
391
|
/// Constructor
|
|
402
|
-
ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const
|
|
392
|
+
ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const FunObjVar* callGraphNode,
|
|
403
393
|
const SVFType* svfType);
|
|
404
394
|
|
|
405
395
|
/// Return name of a LLVM value
|
|
@@ -408,9 +398,9 @@ public:
|
|
|
408
398
|
return getName() + " (argument valvar)";
|
|
409
399
|
}
|
|
410
400
|
|
|
411
|
-
virtual const
|
|
401
|
+
virtual const FunObjVar* getFunction() const;
|
|
412
402
|
|
|
413
|
-
const
|
|
403
|
+
const FunObjVar* getParent() const;
|
|
414
404
|
|
|
415
405
|
/// Return the index of this formal argument in its containing function.
|
|
416
406
|
/// For example in "void foo(int a, float b)" a is 0 and b is 1.
|
|
@@ -419,10 +409,7 @@ public:
|
|
|
419
409
|
return argNo;
|
|
420
410
|
}
|
|
421
411
|
|
|
422
|
-
|
|
423
|
-
{
|
|
424
|
-
return getFunction()->isUncalledFunction();
|
|
425
|
-
}
|
|
412
|
+
bool isArgOfUncalledFunction() const;
|
|
426
413
|
|
|
427
414
|
virtual bool isPointer() const;
|
|
428
415
|
|
|
@@ -506,7 +493,7 @@ public:
|
|
|
506
493
|
return gepValType;
|
|
507
494
|
}
|
|
508
495
|
|
|
509
|
-
virtual const
|
|
496
|
+
virtual const FunObjVar* getFunction() const
|
|
510
497
|
{
|
|
511
498
|
return base->getFunction();
|
|
512
499
|
}
|
|
@@ -725,7 +712,7 @@ public:
|
|
|
725
712
|
typeInfo = nullptr;
|
|
726
713
|
}
|
|
727
714
|
|
|
728
|
-
virtual const
|
|
715
|
+
virtual const FunObjVar* getFunction() const;
|
|
729
716
|
|
|
730
717
|
};
|
|
731
718
|
|
|
@@ -807,7 +794,7 @@ public:
|
|
|
807
794
|
return getName() + "_" + std::to_string(apOffset);
|
|
808
795
|
}
|
|
809
796
|
|
|
810
|
-
virtual const
|
|
797
|
+
virtual const FunObjVar* getFunction() const
|
|
811
798
|
{
|
|
812
799
|
return base->getFunction();
|
|
813
800
|
}
|
|
@@ -963,113 +950,326 @@ public:
|
|
|
963
950
|
|
|
964
951
|
class CallGraphNode;
|
|
965
952
|
|
|
966
|
-
class
|
|
953
|
+
class FunObjVar : public BaseObjVar
|
|
967
954
|
{
|
|
968
955
|
friend class SVFIRWriter;
|
|
969
956
|
friend class SVFIRReader;
|
|
957
|
+
friend class SVFIRBuilder;
|
|
958
|
+
|
|
959
|
+
public:
|
|
960
|
+
typedef SVFLoopAndDomInfo::BBSet BBSet;
|
|
961
|
+
typedef SVFLoopAndDomInfo::BBList BBList;
|
|
962
|
+
typedef SVFLoopAndDomInfo::LoopBBs LoopBBs;
|
|
963
|
+
|
|
964
|
+
typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator;
|
|
965
|
+
|
|
966
|
+
|
|
970
967
|
private:
|
|
971
|
-
|
|
968
|
+
bool isDecl; /// return true if this function does not have a body
|
|
969
|
+
bool intrinsic; /// return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the application code
|
|
970
|
+
bool isAddrTaken; /// return true if this function is address-taken (for indirect call purposes)
|
|
971
|
+
bool isUncalled; /// return true if this function is never called
|
|
972
|
+
bool isNotRet; /// return true if this function never returns
|
|
973
|
+
bool supVarArg; /// return true if this function supports variable arguments
|
|
974
|
+
const SVFFunctionType* funcType; /// FunctionType, which is different from the type (PointerType) of this SVF Function
|
|
975
|
+
SVFLoopAndDomInfo* loopAndDom; /// the loop and dominate information
|
|
976
|
+
const FunObjVar * realDefFun; /// the definition of a function across multiple modules
|
|
977
|
+
BasicBlockGraph* bbGraph; /// the basic block graph of this function
|
|
978
|
+
std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
|
|
979
|
+
SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
private:
|
|
983
|
+
/// Constructor to create empty ObjVar (for SVFIRReader/deserialization)
|
|
984
|
+
FunObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i,node, FunObjNode) {}
|
|
972
985
|
|
|
973
986
|
public:
|
|
974
987
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
975
988
|
//@{
|
|
976
|
-
static inline bool classof(const
|
|
989
|
+
static inline bool classof(const FunObjVar*)
|
|
977
990
|
{
|
|
978
991
|
return true;
|
|
979
992
|
}
|
|
980
|
-
static inline bool classof(const
|
|
993
|
+
static inline bool classof(const BaseObjVar* node)
|
|
981
994
|
{
|
|
982
|
-
return node->getNodeKind() ==
|
|
995
|
+
return node->getNodeKind() == FunObjNode;
|
|
996
|
+
}
|
|
997
|
+
static inline bool classof(const ObjVar* node)
|
|
998
|
+
{
|
|
999
|
+
return node->getNodeKind() == FunObjNode;
|
|
983
1000
|
}
|
|
984
1001
|
static inline bool classof(const SVFVar* node)
|
|
985
1002
|
{
|
|
986
|
-
return node->getNodeKind() ==
|
|
1003
|
+
return node->getNodeKind() == FunObjNode;
|
|
987
1004
|
}
|
|
988
1005
|
static inline bool classof(const GenericPAGNodeTy* node)
|
|
989
1006
|
{
|
|
990
|
-
return node->getNodeKind() ==
|
|
1007
|
+
return node->getNodeKind() == FunObjNode;
|
|
991
1008
|
}
|
|
992
1009
|
static inline bool classof(const SVFBaseNode* node)
|
|
993
1010
|
{
|
|
994
|
-
return node->getNodeKind() ==
|
|
1011
|
+
return node->getNodeKind() == FunObjNode;
|
|
995
1012
|
}
|
|
996
1013
|
//@}
|
|
997
1014
|
|
|
998
|
-
|
|
1015
|
+
/// Constructor
|
|
1016
|
+
FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node);
|
|
1017
|
+
|
|
1018
|
+
void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
|
|
1019
|
+
SVFLoopAndDomInfo *ld, const FunObjVar *real, BasicBlockGraph *bbg,
|
|
1020
|
+
const std::vector<const ArgValVar *> &allarg, SVFBasicBlock *exit);
|
|
1021
|
+
|
|
1022
|
+
void setRelDefFun(const FunObjVar *real)
|
|
999
1023
|
{
|
|
1000
|
-
|
|
1024
|
+
realDefFun = real;
|
|
1001
1025
|
}
|
|
1002
1026
|
|
|
1003
|
-
|
|
1004
|
-
FunValVar(NodeID i, const ICFGNode* icn, const SVFFunction* cgn, const SVFType* svfType);
|
|
1027
|
+
virtual const FunObjVar*getFunction() const;
|
|
1005
1028
|
|
|
1029
|
+
inline void addArgument(const ArgValVar *arg)
|
|
1030
|
+
{
|
|
1031
|
+
allArgs.push_back(arg);
|
|
1032
|
+
}
|
|
1033
|
+
inline bool isDeclaration() const
|
|
1034
|
+
{
|
|
1035
|
+
return isDecl;
|
|
1036
|
+
}
|
|
1006
1037
|
|
|
1007
|
-
|
|
1038
|
+
inline bool isIntrinsic() const
|
|
1008
1039
|
{
|
|
1009
|
-
return
|
|
1040
|
+
return intrinsic;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
inline bool hasAddressTaken() const
|
|
1044
|
+
{
|
|
1045
|
+
return isAddrTaken;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
inline bool isVarArg() const
|
|
1049
|
+
{
|
|
1050
|
+
return supVarArg;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
inline bool isUncalledFunction() const
|
|
1054
|
+
{
|
|
1055
|
+
return isUncalled;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
inline bool hasReturn() const
|
|
1059
|
+
{
|
|
1060
|
+
return !isNotRet;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/// Returns the FunctionType
|
|
1064
|
+
inline const SVFFunctionType* getFunctionType() const
|
|
1065
|
+
{
|
|
1066
|
+
return funcType;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/// Returns the FunctionType
|
|
1070
|
+
inline const SVFType* getReturnType() const
|
|
1071
|
+
{
|
|
1072
|
+
return funcType->getReturnType();
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
inline SVFLoopAndDomInfo* getLoopAndDomInfo()
|
|
1076
|
+
{
|
|
1077
|
+
return loopAndDom;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
|
|
1081
|
+
{
|
|
1082
|
+
return loopAndDom->getReachableBBs();
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
|
|
1086
|
+
{
|
|
1087
|
+
return loopAndDom->getExitBlocksOfLoop(bb,exitbbs);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
inline bool hasLoopInfo(const SVFBasicBlock* bb) const
|
|
1091
|
+
{
|
|
1092
|
+
return loopAndDom->hasLoopInfo(bb);
|
|
1010
1093
|
}
|
|
1011
1094
|
|
|
1095
|
+
const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
|
|
1096
|
+
{
|
|
1097
|
+
return loopAndDom->getLoopInfo(bb);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
|
|
1101
|
+
{
|
|
1102
|
+
return loopAndDom->getLoopHeader(lp);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
|
|
1106
|
+
{
|
|
1107
|
+
return loopAndDom->loopContainsBB(lp,bb);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
inline const Map<const SVFBasicBlock*,BBSet>& getDomTreeMap() const
|
|
1111
|
+
{
|
|
1112
|
+
return loopAndDom->getDomTreeMap();
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
inline const Map<const SVFBasicBlock*,BBSet>& getDomFrontierMap() const
|
|
1116
|
+
{
|
|
1117
|
+
return loopAndDom->getDomFrontierMap();
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
inline bool isLoopHeader(const SVFBasicBlock* bb) const
|
|
1121
|
+
{
|
|
1122
|
+
return loopAndDom->isLoopHeader(bb);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
|
|
1126
|
+
{
|
|
1127
|
+
return loopAndDom->dominate(bbKey,bbValue);
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
|
|
1131
|
+
{
|
|
1132
|
+
return loopAndDom->postDominate(bbKey,bbValue);
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
inline const FunObjVar* getDefFunForMultipleModule() const
|
|
1136
|
+
{
|
|
1137
|
+
if(realDefFun==nullptr)
|
|
1138
|
+
return this;
|
|
1139
|
+
return realDefFun;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
void setBasicBlockGraph(BasicBlockGraph* graph)
|
|
1143
|
+
{
|
|
1144
|
+
this->bbGraph = graph;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
BasicBlockGraph* getBasicBlockGraph()
|
|
1148
|
+
{
|
|
1149
|
+
return bbGraph;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
const BasicBlockGraph* getBasicBlockGraph() const
|
|
1153
|
+
{
|
|
1154
|
+
return bbGraph;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
inline bool hasBasicBlock() const
|
|
1158
|
+
{
|
|
1159
|
+
return bbGraph && bbGraph->begin() != bbGraph->end();
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
inline const SVFBasicBlock* getEntryBlock() const
|
|
1163
|
+
{
|
|
1164
|
+
assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
|
|
1165
|
+
assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
|
|
1166
|
+
return bbGraph->begin()->second;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
inline const SVFBasicBlock* getExitBB() const
|
|
1170
|
+
{
|
|
1171
|
+
assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
|
|
1172
|
+
assert(exitBlock && "must have an exitBlock");
|
|
1173
|
+
return exitBlock;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
inline void setExitBlock(SVFBasicBlock *bb)
|
|
1177
|
+
{
|
|
1178
|
+
assert(!exitBlock && "have already set exit Basicblock!");
|
|
1179
|
+
exitBlock = bb;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
u32_t inline arg_size() const
|
|
1184
|
+
{
|
|
1185
|
+
return allArgs.size();
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
inline const ArgValVar* getArg(u32_t idx) const
|
|
1189
|
+
{
|
|
1190
|
+
assert (idx < allArgs.size() && "getArg() out of range!");
|
|
1191
|
+
return allArgs[idx];
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
inline const SVFBasicBlock* front() const
|
|
1195
|
+
{
|
|
1196
|
+
return getEntryBlock();
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
inline const SVFBasicBlock* back() const
|
|
1200
|
+
{
|
|
1201
|
+
assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
|
|
1202
|
+
/// Carefully! 'back' is just the last basic block of function,
|
|
1203
|
+
/// but not necessarily a exit basic block
|
|
1204
|
+
/// more refer to: https://github.com/SVF-tools/SVF/pull/1262
|
|
1205
|
+
return std::prev(bbGraph->end())->second;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
inline const_bb_iterator begin() const
|
|
1209
|
+
{
|
|
1210
|
+
return bbGraph->begin();
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
inline const_bb_iterator end() const
|
|
1214
|
+
{
|
|
1215
|
+
return bbGraph->end();
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
virtual bool isIsolatedNode() const;
|
|
1219
|
+
|
|
1012
1220
|
virtual const std::string toString() const;
|
|
1013
1221
|
};
|
|
1014
|
-
|
|
1015
|
-
class FunObjVar : public BaseObjVar
|
|
1222
|
+
class FunValVar : public ValVar
|
|
1016
1223
|
{
|
|
1017
1224
|
friend class SVFIRWriter;
|
|
1018
1225
|
friend class SVFIRReader;
|
|
1019
|
-
|
|
1020
|
-
private:
|
|
1021
|
-
const SVFFunction* callGraphNode;
|
|
1022
|
-
|
|
1023
1226
|
private:
|
|
1024
|
-
|
|
1025
|
-
FunObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i,node, FunObjNode) {}
|
|
1227
|
+
const FunObjVar* funObjVar;
|
|
1026
1228
|
|
|
1027
1229
|
public:
|
|
1028
1230
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
1029
1231
|
//@{
|
|
1030
|
-
static inline bool classof(const
|
|
1232
|
+
static inline bool classof(const FunValVar*)
|
|
1031
1233
|
{
|
|
1032
1234
|
return true;
|
|
1033
1235
|
}
|
|
1034
|
-
static inline bool classof(const
|
|
1035
|
-
{
|
|
1036
|
-
return node->getNodeKind() == FunObjNode;
|
|
1037
|
-
}
|
|
1038
|
-
static inline bool classof(const ObjVar* node)
|
|
1236
|
+
static inline bool classof(const ValVar* node)
|
|
1039
1237
|
{
|
|
1040
|
-
return node->getNodeKind() ==
|
|
1238
|
+
return node->getNodeKind() == FunValNode;
|
|
1041
1239
|
}
|
|
1042
1240
|
static inline bool classof(const SVFVar* node)
|
|
1043
1241
|
{
|
|
1044
|
-
return node->getNodeKind() ==
|
|
1242
|
+
return node->getNodeKind() == FunValNode;
|
|
1045
1243
|
}
|
|
1046
1244
|
static inline bool classof(const GenericPAGNodeTy* node)
|
|
1047
1245
|
{
|
|
1048
|
-
return node->getNodeKind() ==
|
|
1246
|
+
return node->getNodeKind() == FunValNode;
|
|
1049
1247
|
}
|
|
1050
1248
|
static inline bool classof(const SVFBaseNode* node)
|
|
1051
1249
|
{
|
|
1052
|
-
return node->getNodeKind() ==
|
|
1250
|
+
return node->getNodeKind() == FunValNode;
|
|
1053
1251
|
}
|
|
1054
1252
|
//@}
|
|
1055
1253
|
|
|
1056
|
-
|
|
1057
|
-
FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFFunction* cgNode, const SVFType* svfType, const ICFGNode* node);
|
|
1058
|
-
|
|
1059
|
-
inline const SVFFunction* getCallGraphNode() const
|
|
1254
|
+
inline virtual const FunObjVar* getFunction() const
|
|
1060
1255
|
{
|
|
1061
|
-
return
|
|
1256
|
+
return funObjVar->getFunction();
|
|
1062
1257
|
}
|
|
1063
1258
|
|
|
1064
|
-
|
|
1259
|
+
/// Constructor
|
|
1260
|
+
FunValVar(NodeID i, const ICFGNode* icn, const FunObjVar* cgn, const SVFType* svfType);
|
|
1065
1261
|
|
|
1066
|
-
virtual bool isPointer() const;
|
|
1067
1262
|
|
|
1068
|
-
virtual bool
|
|
1263
|
+
virtual bool isPointer() const
|
|
1264
|
+
{
|
|
1265
|
+
return true;
|
|
1266
|
+
}
|
|
1069
1267
|
|
|
1070
1268
|
virtual const std::string toString() const;
|
|
1071
1269
|
};
|
|
1072
1270
|
|
|
1271
|
+
|
|
1272
|
+
|
|
1073
1273
|
class GlobalValVar : public ValVar
|
|
1074
1274
|
{
|
|
1075
1275
|
friend class SVFIRWriter;
|
|
@@ -1782,7 +1982,7 @@ class RetValPN : public ValVar
|
|
|
1782
1982
|
friend class SVFIRReader;
|
|
1783
1983
|
|
|
1784
1984
|
private:
|
|
1785
|
-
const
|
|
1985
|
+
const FunObjVar* callGraphNode;
|
|
1786
1986
|
private:
|
|
1787
1987
|
/// Constructor to create empty RetValPN (for SVFIRReader/deserialization)
|
|
1788
1988
|
RetValPN(NodeID i) : ValVar(i, RetValNode) {}
|
|
@@ -1813,14 +2013,14 @@ public:
|
|
|
1813
2013
|
|
|
1814
2014
|
|
|
1815
2015
|
/// Constructor
|
|
1816
|
-
RetValPN(NodeID i, const
|
|
2016
|
+
RetValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn);
|
|
1817
2017
|
|
|
1818
|
-
inline const
|
|
2018
|
+
inline const FunObjVar* getCallGraphNode() const
|
|
1819
2019
|
{
|
|
1820
2020
|
return callGraphNode;
|
|
1821
2021
|
}
|
|
1822
2022
|
|
|
1823
|
-
virtual const
|
|
2023
|
+
virtual const FunObjVar* getFunction() const;
|
|
1824
2024
|
|
|
1825
2025
|
virtual bool isPointer() const;
|
|
1826
2026
|
|
|
@@ -1838,7 +2038,7 @@ class VarArgValPN : public ValVar
|
|
|
1838
2038
|
friend class SVFIRWriter;
|
|
1839
2039
|
friend class SVFIRReader;
|
|
1840
2040
|
private:
|
|
1841
|
-
const
|
|
2041
|
+
const FunObjVar* callGraphNode;
|
|
1842
2042
|
|
|
1843
2043
|
private:
|
|
1844
2044
|
/// Constructor to create empty VarArgValPN (for SVFIRReader/deserialization)
|
|
@@ -1869,12 +2069,12 @@ public:
|
|
|
1869
2069
|
//@}
|
|
1870
2070
|
|
|
1871
2071
|
/// Constructor
|
|
1872
|
-
VarArgValPN(NodeID i, const
|
|
2072
|
+
VarArgValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn)
|
|
1873
2073
|
: ValVar(i, svfType, icn, VarargValNode), callGraphNode(node)
|
|
1874
2074
|
{
|
|
1875
2075
|
}
|
|
1876
2076
|
|
|
1877
|
-
virtual const
|
|
2077
|
+
virtual const FunObjVar* getFunction() const;
|
|
1878
2078
|
|
|
1879
2079
|
/// Return name of a LLVM value
|
|
1880
2080
|
const std::string getValueName() const;
|