svf-lib 1.0.2079 → 1.0.2080

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.
Files changed (36) hide show
  1. package/SVF-osx/Release-build/bin/ae +0 -0
  2. package/SVF-osx/Release-build/bin/cfl +0 -0
  3. package/SVF-osx/Release-build/bin/dvf +0 -0
  4. package/SVF-osx/Release-build/bin/llvm2svf +0 -0
  5. package/SVF-osx/Release-build/bin/mta +0 -0
  6. package/SVF-osx/Release-build/bin/saber +0 -0
  7. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  8. package/SVF-osx/Release-build/bin/wpa +0 -0
  9. package/SVF-osx/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
  10. package/SVF-osx/Release-build/include/DDA/ContextDDA.h +2 -2
  11. package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +5 -5
  12. package/SVF-osx/Release-build/include/DDA/FlowDDA.h +1 -1
  13. package/SVF-osx/Release-build/include/Graphs/{PTACallGraph.h → CallGraph.h} +41 -41
  14. package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
  15. package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +24 -30
  16. package/SVF-osx/Release-build/include/Graphs/VFG.h +4 -4
  17. package/SVF-osx/Release-build/include/MSSA/MemRegion.h +4 -4
  18. package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +42 -32
  19. package/SVF-osx/Release-build/include/MTA/MHP.h +34 -54
  20. package/SVF-osx/Release-build/include/MTA/MTAStat.h +1 -2
  21. package/SVF-osx/Release-build/include/MTA/TCT.h +43 -25
  22. package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +13 -13
  23. package/SVF-osx/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
  24. package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +7 -7
  25. package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
  26. package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +5 -5
  27. package/SVF-osx/Release-build/include/Util/CxtStmt.h +13 -12
  28. package/SVF-osx/Release-build/include/Util/Options.h +1 -20
  29. package/SVF-osx/Release-build/include/Util/SVFUtil.h +8 -43
  30. package/SVF-osx/Release-build/include/Util/ThreadAPI.h +42 -85
  31. package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
  32. package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
  33. package/package.json +1 -1
  34. package/SVF-osx/Release-build/include/MTA/FSMPTA.h +0 -270
  35. package/SVF-osx/Release-build/include/MTA/MTAResultValidator.h +0 -448
  36. package/SVF-osx/Release-build/include/MTA/PCG.h +0 -229
@@ -34,7 +34,7 @@
34
34
  #include <signal.h>
35
35
 
36
36
  #include "Graphs/CHG.h"
37
- #include "Graphs/PTACallGraph.h"
37
+ #include "Graphs/CallGraph.h"
38
38
  #include "Graphs/SCC.h"
39
39
  #include "MemoryModel/AbstractPointsToDS.h"
40
40
  #include "MemoryModel/ConditionalPT.h"
@@ -103,7 +103,7 @@ public:
103
103
  typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
104
104
  typedef Set<const SVFFunction*> FunctionSet;
105
105
  typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
106
- typedef SCCDetection<PTACallGraph*> CallGraphSCC;
106
+ typedef SCCDetection<CallGraph*> CallGraphSCC;
107
107
  typedef Set<const SVFGlobalValue*> VTableSet;
108
108
  typedef Set<const SVFFunction*> VFunSet;
109
109
  //@}
@@ -148,7 +148,7 @@ protected:
148
148
  /// Statistics
149
149
  PTAStat* stat;
150
150
  /// Call graph used for pointer analysis
151
- PTACallGraph* ptaCallGraph;
151
+ CallGraph* callgraph;
152
152
  /// SCC for CallGraph
153
153
  CallGraphSCC* callGraphSCC;
154
154
  /// Interprocedural control-flow graph
@@ -165,12 +165,12 @@ public:
165
165
  /// Return number of resolved indirect call edges
166
166
  inline u32_t getNumOfResolvedIndCallEdge() const
167
167
  {
168
- return getPTACallGraph()->getNumOfResolvedIndCallEdge();
168
+ return getCallGraph()->getNumOfResolvedIndCallEdge();
169
169
  }
170
170
  /// Return call graph
171
- inline PTACallGraph* getPTACallGraph() const
171
+ inline CallGraph* getCallGraph() const
172
172
  {
173
- return ptaCallGraph;
173
+ return callgraph;
174
174
  }
175
175
  /// Return call graph SCC
176
176
  inline CallGraphSCC* getCallGraphSCC() const
@@ -367,15 +367,15 @@ public:
367
367
  //@{
368
368
  inline CallEdgeMap& getIndCallMap()
369
369
  {
370
- return getPTACallGraph()->getIndCallMap();
370
+ return getCallGraph()->getIndCallMap();
371
371
  }
372
372
  inline bool hasIndCSCallees(const CallICFGNode* cs) const
373
373
  {
374
- return getPTACallGraph()->hasIndCSCallees(cs);
374
+ return getCallGraph()->hasIndCSCallees(cs);
375
375
  }
376
376
  inline const FunctionSet& getIndCSCallees(const CallICFGNode* cs) const
377
377
  {
378
- return getPTACallGraph()->getIndCSCallees(cs);
378
+ return getCallGraph()->getIndCSCallees(cs);
379
379
  }
380
380
  //@}
381
381
 
@@ -388,7 +388,7 @@ public:
388
388
  inline void callGraphSCCDetection()
389
389
  {
390
390
  if(callGraphSCC==nullptr)
391
- callGraphSCC = new CallGraphSCC(ptaCallGraph);
391
+ callGraphSCC = new CallGraphSCC(callgraph);
392
392
 
393
393
  callGraphSCC->find();
394
394
  }
@@ -400,13 +400,13 @@ public:
400
400
  /// Return TRUE if this edge is inside a CallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
401
401
  inline bool inSameCallGraphSCC(const SVFFunction* fun1,const SVFFunction* fun2)
402
402
  {
403
- const PTACallGraphNode* src = ptaCallGraph->getCallGraphNode(fun1);
404
- const PTACallGraphNode* dst = ptaCallGraph->getCallGraphNode(fun2);
403
+ const CallGraphNode* src = callgraph->getCallGraphNode(fun1);
404
+ const CallGraphNode* dst = callgraph->getCallGraphNode(fun2);
405
405
  return (getCallGraphSCCRepNode(src->getId()) == getCallGraphSCCRepNode(dst->getId()));
406
406
  }
407
407
  inline bool isInRecursion(const SVFFunction* fun) const
408
408
  {
409
- return callGraphSCC->isInCycle(ptaCallGraph->getCallGraphNode(fun)->getId());
409
+ return callGraphSCC->isInCycle(callgraph->getCallGraphNode(fun)->getId());
410
410
  }
411
411
  /// Whether a local variable is in function recursions
412
412
  bool isLocalVarInRecursiveFun(NodeID id) const;
@@ -89,7 +89,7 @@ protected:
89
89
 
90
90
  /// Add actual parameter SVFGNode for 1st argument of a deallocation like external function
91
91
  /// In order to path sensitive leak detection
92
- virtual void AddExtActualParmSVFGNodes(PTACallGraph* callgraph);
92
+ virtual void AddExtActualParmSVFGNodes(CallGraph* callgraph);
93
93
 
94
94
  /// Collect memory pointed global pointers,
95
95
  /// note that this collection is recursively performed, for example gp-->obj-->obj'
@@ -76,13 +76,13 @@ private:
76
76
  protected:
77
77
  SaberSVFGBuilder memSSA;
78
78
  SVFG* svfg;
79
- PTACallGraph* ptaCallGraph;
79
+ CallGraph* callgraph;
80
80
  SVFBugReport report; /// Bug Reporter
81
81
 
82
82
  public:
83
83
 
84
84
  /// Constructor
85
- SrcSnkDDA() : _curSlice(nullptr), svfg(nullptr), ptaCallGraph(nullptr)
85
+ SrcSnkDDA() : _curSlice(nullptr), svfg(nullptr), callgraph(nullptr)
86
86
  {
87
87
  saberCondAllocator = std::make_unique<SaberCondAllocator>();
88
88
  }
@@ -95,9 +95,9 @@ public:
95
95
  _curSlice = nullptr;
96
96
 
97
97
  /// the following shared by multiple checkers, thus can not be released.
98
- //if (ptaCallGraph != nullptr)
99
- // delete ptaCallGraph;
100
- //ptaCallGraph = nullptr;
98
+ //if (callgraph != nullptr)
99
+ // delete callgraph;
100
+ //callgraph = nullptr;
101
101
 
102
102
  //if(pathCondAllocator)
103
103
  // delete pathCondAllocator;
@@ -129,9 +129,9 @@ public:
129
129
  }
130
130
 
131
131
  /// Get Callgraph
132
- inline PTACallGraph* getCallgraph() const
132
+ inline CallGraph* getCallgraph() const
133
133
  {
134
- return ptaCallGraph;
134
+ return callgraph;
135
135
  }
136
136
 
137
137
  /// Whether this svfg node may access global variable
@@ -201,7 +201,7 @@ public:
201
201
  //}@
202
202
 
203
203
  /// connect PAG edges based on callgraph
204
- void updateCallGraph(PTACallGraph* callgraph);
204
+ void updateCallGraph(CallGraph* callgraph);
205
205
 
206
206
  protected:
207
207
  /// Handle globals including (global variable and functions)
@@ -31,7 +31,7 @@
31
31
  #ifndef INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
32
32
  #define INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
33
33
 
34
- #include "Graphs/PTACallGraph.h"
34
+ #include "Graphs/CallGraph.h"
35
35
  #include "Graphs/ThreadCallGraph.h"
36
36
 
37
37
  namespace SVF
@@ -43,15 +43,15 @@ class CallGraphBuilder
43
43
  {
44
44
 
45
45
  protected:
46
- PTACallGraph* callgraph;
46
+ CallGraph* callgraph;
47
47
  ICFG* icfg;
48
48
  public:
49
- CallGraphBuilder(PTACallGraph* cg, ICFG* i): callgraph(cg),icfg(i)
49
+ CallGraphBuilder(CallGraph* cg, ICFG* i): callgraph(cg),icfg(i)
50
50
  {
51
51
  }
52
52
 
53
53
  /// Build normal callgraph
54
- PTACallGraph* buildCallGraph(SVFModule* svfModule);
54
+ CallGraph* buildCallGraph(SVFModule* svfModule);
55
55
 
56
56
  };
57
57
 
@@ -64,7 +64,7 @@ public:
64
64
  }
65
65
 
66
66
  /// Build thread-aware callgraph
67
- PTACallGraph* buildThreadCallGraph(SVFModule* svfModule);
67
+ CallGraph* buildThreadCallGraph(SVFModule* svfModule);
68
68
 
69
69
  };
70
70
 
@@ -35,6 +35,7 @@
35
35
  namespace SVF
36
36
  {
37
37
 
38
+ class ICFGNode;
38
39
  /*!
39
40
  * Context-sensitive thread statement <c,s>
40
41
  */
@@ -42,7 +43,7 @@ class CxtStmt
42
43
  {
43
44
  public:
44
45
  /// Constructor
45
- CxtStmt(const CallStrCxt& c, const SVFInstruction* f) :cxt(c), inst(f)
46
+ CxtStmt(const CallStrCxt& c, const ICFGNode* f) :cxt(c), inst(f)
46
47
  {
47
48
  }
48
49
  /// Copy constructor
@@ -59,7 +60,7 @@ public:
59
60
  return cxt;
60
61
  }
61
62
  /// Return current statement
62
- inline const SVFInstruction* getStmt() const
63
+ inline const ICFGNode* getStmt() const
63
64
  {
64
65
  return inst;
65
66
  }
@@ -108,12 +109,12 @@ public:
108
109
  /// Dump CxtStmt
109
110
  inline void dump() const
110
111
  {
111
- SVFUtil::outs() << "[ Current Stmt: " << inst->getSourceLoc() << " " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
112
+ SVFUtil::outs() << "[ Current Stmt: " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
112
113
  }
113
114
 
114
115
  protected:
115
116
  CallStrCxt cxt;
116
- const SVFInstruction* inst;
117
+ const ICFGNode* inst;
117
118
  };
118
119
 
119
120
 
@@ -124,7 +125,7 @@ class CxtThreadStmt : public CxtStmt
124
125
  {
125
126
  public:
126
127
  /// Constructor
127
- CxtThreadStmt(NodeID t, const CallStrCxt& c, const SVFInstruction* f) :CxtStmt(c,f), tid(t)
128
+ CxtThreadStmt(NodeID t, const CallStrCxt& c, const ICFGNode* f) :CxtStmt(c,f), tid(t)
128
129
  {
129
130
  }
130
131
  /// Copy constructor
@@ -174,7 +175,7 @@ public:
174
175
  /// Dump CxtThreadStmt
175
176
  inline void dump() const
176
177
  {
177
- SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " << inst->getSourceLoc() << " " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
178
+ SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
178
179
  }
179
180
 
180
181
  private:
@@ -189,7 +190,7 @@ class CxtThread
189
190
  {
190
191
  public:
191
192
  /// Constructor
192
- CxtThread(const CallStrCxt& c, const SVFInstruction* fork) : cxt(c), forksite(fork), inloop(false), incycle(false)
193
+ CxtThread(const CallStrCxt& c, const ICFGNode* fork) : cxt(c), forksite(fork), inloop(false), incycle(false)
193
194
  {
194
195
  }
195
196
  /// Copy constructor
@@ -207,7 +208,7 @@ public:
207
208
  return cxt;
208
209
  }
209
210
  /// Return forksite
210
- inline const SVFInstruction* getThread() const
211
+ inline const ICFGNode* getThread() const
211
212
  {
212
213
  return forksite;
213
214
  }
@@ -282,7 +283,7 @@ public:
282
283
 
283
284
  if(forksite)
284
285
  {
285
- SVFUtil::outs() << "[ Thread: $" << forksite->getSourceLoc() << "$ "
286
+ SVFUtil::outs() << "[ Thread: "
286
287
  << forksite->toString() << "\t Contexts: " << cxtToStr()
287
288
  << loop << cycle <<" ]\n";
288
289
  }
@@ -294,7 +295,7 @@ public:
294
295
  }
295
296
  protected:
296
297
  CallStrCxt cxt;
297
- const SVFInstruction* forksite;
298
+ const ICFGNode* forksite;
298
299
  bool inloop;
299
300
  bool incycle;
300
301
  };
@@ -484,8 +485,8 @@ template <> struct std::hash<SVF::CxtStmt>
484
485
  {
485
486
  size_t operator()(const SVF::CxtStmt& cs) const
486
487
  {
487
- std::hash<SVF::SVFInstruction*> h;
488
- SVF::SVFInstruction* inst = const_cast<SVF::SVFInstruction*> (cs.getStmt());
488
+ std::hash<SVF::ICFGNode*> h;
489
+ SVF::ICFGNode* inst = const_cast<SVF::ICFGNode*> (cs.getStmt());
489
490
  return h(inst);
490
491
  }
491
492
  };
@@ -151,36 +151,17 @@ public:
151
151
  static const Option<std::string> WriteSVFG;
152
152
  static const Option<std::string> ReadSVFG;
153
153
 
154
- // FSMPTA.cpp
155
- static const Option<bool> UsePCG;
156
- static const Option<bool> IntraLock;
157
- static const Option<bool> ReadPrecisionTDEdge;
158
- static const Option<u32_t> AddModelFlag;
159
-
160
154
  // LockAnalysis.cpp
155
+ static const Option<bool> IntraLock;
161
156
  static const Option<bool> PrintLockSpan;
162
157
 
163
158
  // MHP.cpp
164
159
  static const Option<bool> PrintInterLev;
165
160
  static const Option<bool> DoLockAnalysis;
166
161
 
167
- // MTA.cpp
168
- static const Option<bool> AndersenAnno;
169
- static const Option<bool> FSAnno;
170
-
171
- // MTAAnnotator.cpp
172
- static const Option<u32_t> AnnoFlag;
173
-
174
- // MTAResultValidator.cpp
175
- static const Option<bool> PrintValidRes;
176
-
177
- static const Option<bool> LockValid;
178
162
  //MTAStat.cpp
179
163
  static const Option<bool> AllPairMHP;
180
164
 
181
- // PCG.cpp
182
- //const Option<bool> TDPrint
183
-
184
165
  // TCT.cpp
185
166
  static const Option<bool> TCTDotGraph;
186
167
 
@@ -404,7 +404,7 @@ inline bool isArgOfUncalledFunction(const SVFValue* svfval)
404
404
  //@{
405
405
  inline const SVFValue* getForkedFun(const CallSite cs)
406
406
  {
407
- return ThreadAPI::getThreadAPI()->getForkedFun(cs);
407
+ return ThreadAPI::getThreadAPI()->getForkedFun(cs.getInstruction());
408
408
  }
409
409
  inline const SVFValue* getForkedFun(const SVFInstruction *inst)
410
410
  {
@@ -490,7 +490,7 @@ inline bool isReallocExtCall(const SVFInstruction *inst)
490
490
  ///@{
491
491
  inline bool isThreadForkCall(const CallSite cs)
492
492
  {
493
- return ThreadAPI::getThreadAPI()->isTDFork(cs);
493
+ return ThreadAPI::getThreadAPI()->isTDFork(cs.getInstruction());
494
494
  }
495
495
  inline bool isThreadForkCall(const SVFInstruction *inst)
496
496
  {
@@ -498,23 +498,11 @@ inline bool isThreadForkCall(const SVFInstruction *inst)
498
498
  }
499
499
  //@}
500
500
 
501
- /// Return true if this is a hare_parallel_for call
502
- ///@{
503
- inline bool isHareParForCall(const CallSite cs)
504
- {
505
- return ThreadAPI::getThreadAPI()->isHareParFor(cs);
506
- }
507
- inline bool isHareParForCall(const SVFInstruction *inst)
508
- {
509
- return ThreadAPI::getThreadAPI()->isHareParFor(inst);
510
- }
511
- //@}
512
-
513
501
  /// Return true if this is a thread join call
514
502
  ///@{
515
503
  inline bool isThreadJoinCall(const CallSite cs)
516
504
  {
517
- return ThreadAPI::getThreadAPI()->isTDJoin(cs);
505
+ return ThreadAPI::getThreadAPI()->isTDJoin(cs.getInstruction());
518
506
  }
519
507
  inline bool isThreadJoinCall(const SVFInstruction *inst)
520
508
  {
@@ -526,7 +514,7 @@ inline bool isThreadJoinCall(const SVFInstruction *inst)
526
514
  ///@{
527
515
  inline bool isThreadExitCall(const CallSite cs)
528
516
  {
529
- return ThreadAPI::getThreadAPI()->isTDExit(cs);
517
+ return ThreadAPI::getThreadAPI()->isTDExit(cs.getInstruction());
530
518
  }
531
519
  inline bool isThreadExitCall(const SVFInstruction *inst)
532
520
  {
@@ -538,7 +526,7 @@ inline bool isThreadExitCall(const SVFInstruction *inst)
538
526
  ///@{
539
527
  inline bool isLockAquireCall(const CallSite cs)
540
528
  {
541
- return ThreadAPI::getThreadAPI()->isTDAcquire(cs);
529
+ return ThreadAPI::getThreadAPI()->isTDAcquire(cs.getInstruction());
542
530
  }
543
531
  inline bool isLockAquireCall(const SVFInstruction *inst)
544
532
  {
@@ -550,7 +538,7 @@ inline bool isLockAquireCall(const SVFInstruction *inst)
550
538
  ///@{
551
539
  inline bool isLockReleaseCall(const CallSite cs)
552
540
  {
553
- return ThreadAPI::getThreadAPI()->isTDRelease(cs);
541
+ return ThreadAPI::getThreadAPI()->isTDRelease(cs.getInstruction());
554
542
  }
555
543
  inline bool isLockReleaseCall(const SVFInstruction *inst)
556
544
  {
@@ -562,7 +550,7 @@ inline bool isLockReleaseCall(const SVFInstruction *inst)
562
550
  //@{
563
551
  inline bool isBarrierWaitCall(const CallSite cs)
564
552
  {
565
- return ThreadAPI::getThreadAPI()->isTDBarWait(cs);
553
+ return ThreadAPI::getThreadAPI()->isTDBarWait(cs.getInstruction());
566
554
  }
567
555
  inline bool isBarrierWaitCall(const SVFInstruction *inst)
568
556
  {
@@ -574,7 +562,7 @@ inline bool isBarrierWaitCall(const SVFInstruction *inst)
574
562
  //@{
575
563
  inline const SVFValue* getActualParmAtForkSite(const CallSite cs)
576
564
  {
577
- return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
565
+ return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs.getInstruction());
578
566
  }
579
567
  inline const SVFValue* getActualParmAtForkSite(const SVFInstruction *inst)
580
568
  {
@@ -582,29 +570,6 @@ inline const SVFValue* getActualParmAtForkSite(const SVFInstruction *inst)
582
570
  }
583
571
  //@}
584
572
 
585
- /// Return the task function of the parallel_for routine
586
- //@{
587
- inline const SVFValue* getTaskFuncAtHareParForSite(const CallSite cs)
588
- {
589
- return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(cs);
590
- }
591
- inline const SVFValue* getTaskFuncAtHareParForSite(const SVFInstruction *inst)
592
- {
593
- return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(inst);
594
- }
595
- //@}
596
-
597
- /// Return the task data argument of the parallel_for routine
598
- //@{
599
- inline const SVFValue* getTaskDataAtHareParForSite(const CallSite cs)
600
- {
601
- return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(cs);
602
- }
603
- inline const SVFValue* getTaskDataAtHareParForSite(const SVFInstruction *inst)
604
- {
605
- return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(inst);
606
- }
607
- //@}
608
573
 
609
574
  inline bool isProgExitCall(const CallSite cs)
610
575
  {