svf-lib 1.0.993 → 1.0.994

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 (71) hide show
  1. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  2. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  3. package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
  4. package/SVF-osx/include/CFL/CFLAlias.h +26 -15
  5. package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
  6. package/SVF-osx/include/CFL/CFLSolver.h +9 -5
  7. package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
  8. package/SVF-osx/include/CUDD/cudd.h +20 -11
  9. package/SVF-osx/include/CUDD/cuddInt.h +48 -31
  10. package/SVF-osx/include/CUDD/epd.h +35 -29
  11. package/SVF-osx/include/CUDD/mtr.h +4 -3
  12. package/SVF-osx/include/CUDD/st.h +7 -4
  13. package/SVF-osx/include/CUDD/util.h +6 -6
  14. package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
  15. package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
  16. package/SVF-osx/include/Graphs/CHG.h +2 -2
  17. package/SVF-osx/include/Graphs/ConsG.h +2 -1
  18. package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
  19. package/SVF-osx/include/Graphs/ICFG.h +2 -2
  20. package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
  21. package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
  22. package/SVF-osx/include/Graphs/IRGraph.h +10 -6
  23. package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
  24. package/SVF-osx/include/Graphs/SVFG.h +4 -3
  25. package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
  26. package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
  27. package/SVF-osx/include/Graphs/VFG.h +45 -39
  28. package/SVF-osx/include/Graphs/VFGNode.h +8 -4
  29. package/SVF-osx/include/MSSA/MemSSA.h +1 -1
  30. package/SVF-osx/include/MTA/FSMPTA.h +55 -44
  31. package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
  32. package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
  33. package/SVF-osx/include/MTA/MHP.h +17 -13
  34. package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
  35. package/SVF-osx/include/MTA/PCG.h +9 -7
  36. package/SVF-osx/include/MTA/TCT.h +27 -22
  37. package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
  38. package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
  39. package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
  40. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
  41. package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
  42. package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
  43. package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
  44. package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
  45. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
  46. package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
  47. package/SVF-osx/include/SABER/ProgSlice.h +2 -1
  48. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
  49. package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
  50. package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
  51. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
  52. package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
  53. package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
  54. package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
  55. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
  56. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
  57. package/SVF-osx/include/Util/BDDExpr.h +32 -16
  58. package/SVF-osx/include/Util/BasicTypes.h +77 -25
  59. package/SVF-osx/include/Util/CoreBitVector.h +2 -1
  60. package/SVF-osx/include/Util/CxtStmt.h +37 -27
  61. package/SVF-osx/include/Util/ExeState.h +42 -22
  62. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  63. package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
  64. package/SVF-osx/include/Util/Options.h +3 -3
  65. package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
  66. package/SVF-osx/include/Util/SVFModule.h +5 -5
  67. package/SVF-osx/include/Util/SVFUtil.h +12 -9
  68. package/SVF-osx/include/Util/Z3Expr.h +191 -144
  69. package/SVF-osx/include/WPA/Andersen.h +11 -11
  70. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
  71. package/package.json +1 -1
@@ -84,9 +84,9 @@ typedef llvm::Use Use;
84
84
  typedef llvm::Loop Loop;
85
85
  typedef llvm::LoopInfo LoopInfo;
86
86
  #if LLVM_VERSION_MAJOR >= 12
87
- typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
87
+ typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
88
88
  #else
89
- typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
89
+ typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
90
90
  #endif
91
91
  typedef llvm::ModulePass ModulePass;
92
92
 
@@ -150,9 +150,9 @@ typedef llvm::LoopInfoWrapperPass LoopInfoWrapperPass;
150
150
  /// LLVM Iterators
151
151
  typedef llvm::inst_iterator inst_iterator;
152
152
  #if LLVM_VERSION_MAJOR >= 11
153
- typedef llvm::const_succ_iterator succ_const_iterator;
153
+ typedef llvm::const_succ_iterator succ_const_iterator;
154
154
  #else
155
- typedef llvm::succ_const_iterator succ_const_iterator;
155
+ typedef llvm::succ_const_iterator succ_const_iterator;
156
156
  #endif
157
157
  typedef llvm::const_inst_iterator const_inst_iterator;
158
158
  typedef llvm::const_pred_iterator const_pred_iterator;
@@ -251,32 +251,82 @@ public:
251
251
 
252
252
  };
253
253
 
254
- class CallSite {
254
+ class CallSite
255
+ {
255
256
  private:
256
257
  CallBase *CB;
257
258
  public:
258
259
  CallSite(Instruction *I) : CB(SVFUtil::dyn_cast<CallBase>(I)) {}
259
260
  CallSite(Value *I) : CB(SVFUtil::dyn_cast<CallBase>(I)) {}
260
261
 
261
- CallBase *getInstruction() const { return CB; }
262
+ CallBase *getInstruction() const
263
+ {
264
+ return CB;
265
+ }
262
266
  using arg_iterator = User::const_op_iterator;
263
- Value *getArgument(unsigned ArgNo) const { return CB->getArgOperand(ArgNo);}
264
- Type *getType() const { return CB->getType(); }
265
- User::const_op_iterator arg_begin() const { return CB->arg_begin();}
266
- User::const_op_iterator arg_end() const { return CB->arg_end();}
267
- unsigned arg_size() const { return CB->arg_size(); }
268
- bool arg_empty() const { return CB->arg_empty(); }
269
- Value *getArgOperand(unsigned i) const { return CB->getArgOperand(i); }
270
- unsigned getNumArgOperands() const { return CB->arg_size(); }
271
- Function *getCalledFunction() const { return CB->getCalledFunction(); }
272
- Value *getCalledValue() const { return CB->getCalledOperand(); }
273
- Function *getCaller() const { return CB->getCaller(); }
274
- FunctionType *getFunctionType() const { return CB->getFunctionType(); }
275
- bool paramHasAttr(unsigned ArgNo, llvm::Attribute::AttrKind Kind) const { return CB->paramHasAttr(ArgNo, Kind); }
276
-
277
- bool operator==(const CallSite &CS) const { return CB == CS.CB; }
278
- bool operator!=(const CallSite &CS) const { return CB != CS.CB; }
279
- bool operator<(const CallSite &CS) const {
267
+ Value *getArgument(unsigned ArgNo) const
268
+ {
269
+ return CB->getArgOperand(ArgNo);
270
+ }
271
+ Type *getType() const
272
+ {
273
+ return CB->getType();
274
+ }
275
+ User::const_op_iterator arg_begin() const
276
+ {
277
+ return CB->arg_begin();
278
+ }
279
+ User::const_op_iterator arg_end() const
280
+ {
281
+ return CB->arg_end();
282
+ }
283
+ unsigned arg_size() const
284
+ {
285
+ return CB->arg_size();
286
+ }
287
+ bool arg_empty() const
288
+ {
289
+ return CB->arg_empty();
290
+ }
291
+ Value *getArgOperand(unsigned i) const
292
+ {
293
+ return CB->getArgOperand(i);
294
+ }
295
+ unsigned getNumArgOperands() const
296
+ {
297
+ return CB->arg_size();
298
+ }
299
+ Function *getCalledFunction() const
300
+ {
301
+ return CB->getCalledFunction();
302
+ }
303
+ Value *getCalledValue() const
304
+ {
305
+ return CB->getCalledOperand();
306
+ }
307
+ Function *getCaller() const
308
+ {
309
+ return CB->getCaller();
310
+ }
311
+ FunctionType *getFunctionType() const
312
+ {
313
+ return CB->getFunctionType();
314
+ }
315
+ bool paramHasAttr(unsigned ArgNo, llvm::Attribute::AttrKind Kind) const
316
+ {
317
+ return CB->paramHasAttr(ArgNo, Kind);
318
+ }
319
+
320
+ bool operator==(const CallSite &CS) const
321
+ {
322
+ return CB == CS.CB;
323
+ }
324
+ bool operator!=(const CallSite &CS) const
325
+ {
326
+ return CB != CS.CB;
327
+ }
328
+ bool operator<(const CallSite &CS) const
329
+ {
280
330
  return getInstruction() < CS.getInstruction();
281
331
  }
282
332
 
@@ -292,8 +342,10 @@ OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
292
342
  } // End namespace SVF
293
343
 
294
344
  /// Specialise hash for CallSites.
295
- template <> struct std::hash<SVF::CallSite> {
296
- size_t operator()(const SVF::CallSite &cs) const {
345
+ template <> struct std::hash<SVF::CallSite>
346
+ {
347
+ size_t operator()(const SVF::CallSite &cs) const
348
+ {
297
349
  std::hash<SVF::Instruction *> h;
298
350
  return h(cs.getInstruction());
299
351
  }
@@ -203,7 +203,8 @@ private:
203
203
  template <>
204
204
  struct Hash<CoreBitVector>
205
205
  {
206
- size_t operator()(const CoreBitVector &cbv) const {
206
+ size_t operator()(const CoreBitVector &cbv) const
207
+ {
207
208
  return cbv.hash();
208
209
  }
209
210
  };
@@ -455,36 +455,46 @@ private:
455
455
 
456
456
  } // End namespace SVF
457
457
  // Specialise has for class defined in this header file
458
- template <> struct std::hash<SVF::CxtThread> {
459
- size_t operator()(const SVF::CxtThread& cs) const {
460
- std::hash<SVF::CallStrCxt> h;
461
- return h(cs.getContext());
462
- }
458
+ template <> struct std::hash<SVF::CxtThread>
459
+ {
460
+ size_t operator()(const SVF::CxtThread& cs) const
461
+ {
462
+ std::hash<SVF::CallStrCxt> h;
463
+ return h(cs.getContext());
464
+ }
463
465
  };
464
- template <> struct std::hash<SVF::CxtThreadProc> {
465
- size_t operator()(const SVF::CxtThreadProc& ctp) const {
466
- std::hash<SVF::NodeID> h;
467
- return h(ctp.getTid());
468
- }
466
+ template <> struct std::hash<SVF::CxtThreadProc>
467
+ {
468
+ size_t operator()(const SVF::CxtThreadProc& ctp) const
469
+ {
470
+ std::hash<SVF::NodeID> h;
471
+ return h(ctp.getTid());
472
+ }
469
473
  };
470
- template <> struct std::hash<SVF::CxtThreadStmt> {
471
- size_t operator()(const SVF::CxtThreadStmt& cts) const {
472
- std::hash<SVF::NodeID> h;
473
- return h(cts.getTid());
474
- }
474
+ template <> struct std::hash<SVF::CxtThreadStmt>
475
+ {
476
+ size_t operator()(const SVF::CxtThreadStmt& cts) const
477
+ {
478
+ std::hash<SVF::NodeID> h;
479
+ return h(cts.getTid());
480
+ }
475
481
  };
476
- template <> struct std::hash<SVF::CxtStmt> {
477
- size_t operator()(const SVF::CxtStmt& cs) const {
478
- std::hash<SVF::Instruction*> h;
479
- SVF::Instruction* inst = const_cast<SVF::Instruction*> (cs.getStmt());
480
- return h(inst);
481
- }
482
+ template <> struct std::hash<SVF::CxtStmt>
483
+ {
484
+ size_t operator()(const SVF::CxtStmt& cs) const
485
+ {
486
+ std::hash<SVF::Instruction*> h;
487
+ SVF::Instruction* inst = const_cast<SVF::Instruction*> (cs.getStmt());
488
+ return h(inst);
489
+ }
482
490
  };
483
- template <> struct std::hash<SVF::CxtProc> {
484
- size_t operator()(const SVF::CxtProc& cs) const {
485
- std::hash<SVF::SVFFunction*> h;
486
- SVF::SVFFunction* fun = const_cast<SVF::SVFFunction*> (cs.getProc());
487
- return h(fun);
488
- }
491
+ template <> struct std::hash<SVF::CxtProc>
492
+ {
493
+ size_t operator()(const SVF::CxtProc& cs) const
494
+ {
495
+ std::hash<SVF::SVFFunction*> h;
496
+ SVF::SVFFunction* fun = const_cast<SVF::SVFFunction*> (cs.getProc());
497
+ return h(fun);
498
+ }
489
499
  };
490
500
  #endif /* INCLUDE_UTIL_CXTSTMT_H_ */
@@ -31,12 +31,14 @@
31
31
  #include "Util/Z3Expr.h"
32
32
  #include "MemoryModel/SVFVariables.h"
33
33
 
34
- namespace SVF {
34
+ namespace SVF
35
+ {
35
36
 
36
37
  #define AddressMask 0x7f000000
37
38
  #define FlippedAddressMask (AddressMask^0xffffffff)
38
39
 
39
- class ExeState {
40
+ class ExeState
41
+ {
40
42
  public:
41
43
  typedef Map<u32_t, Z3Expr> VarToValMap;
42
44
  typedef VarToValMap LocToValMap;
@@ -50,11 +52,12 @@ public:
50
52
  ExeState() : pathConstraint(getContext().bool_val(true)) {}
51
53
 
52
54
  ExeState(const Z3Expr &_pc, VarToValMap &_varToValMap, LocToValMap &_locToValMap) : varToVal(_varToValMap),
53
- locToVal(_locToValMap),
54
- pathConstraint(_pc) {}
55
+ locToVal(_locToValMap),
56
+ pathConstraint(_pc) {}
55
57
 
56
58
  ExeState(const ExeState &rhs) : varToVal(rhs.getVarToVal()), locToVal(rhs.getLocToVal()),
57
- pathConstraint(rhs.getPathConstraint()) {
59
+ pathConstraint(rhs.getPathConstraint())
60
+ {
58
61
 
59
62
  }
60
63
 
@@ -66,7 +69,8 @@ public:
66
69
  bool operator==(const ExeState &rhs) const;
67
70
 
68
71
  /// Overloading Operator!=
69
- inline bool operator!=(const ExeState &rhs) const {
72
+ inline bool operator!=(const ExeState &rhs) const
73
+ {
70
74
  return !(*this == rhs);
71
75
  }
72
76
 
@@ -75,27 +79,33 @@ public:
75
79
 
76
80
 
77
81
 
78
- z3::context &getContext() {
82
+ z3::context &getContext()
83
+ {
79
84
  return Z3Expr::getContext();
80
85
  }
81
86
 
82
- const VarToValMap &getVarToVal() const {
87
+ const VarToValMap &getVarToVal() const
88
+ {
83
89
  return varToVal;
84
90
  }
85
91
 
86
- const LocToValMap &getLocToVal() const {
92
+ const LocToValMap &getLocToVal() const
93
+ {
87
94
  return locToVal;
88
95
  }
89
96
 
90
- const Z3Expr &getPathConstraint() const {
97
+ const Z3Expr &getPathConstraint() const
98
+ {
91
99
  return pathConstraint;
92
100
  }
93
101
 
94
- void setPathConstraint(const Z3Expr &pc) {
102
+ void setPathConstraint(const Z3Expr &pc)
103
+ {
95
104
  pathConstraint = pc.simplify();
96
105
  }
97
106
 
98
- inline Z3Expr &operator[](u32_t varId) {
107
+ inline Z3Expr &operator[](u32_t varId)
108
+ {
99
109
  return getZ3Expr(varId);
100
110
  }
101
111
 
@@ -115,22 +125,26 @@ public:
115
125
  Z3Expr &load(const Z3Expr &loc);
116
126
 
117
127
  /// The physical address starts with 0x7f...... + idx
118
- inline u32_t getVirtualMemAddress(u32_t idx) const {
128
+ inline u32_t getVirtualMemAddress(u32_t idx) const
129
+ {
119
130
  return AddressMask + idx;
120
131
  }
121
132
 
122
133
  /// Check bit value of val start with 0x7F000000, filter by 0xFF000000
123
- inline bool isVirtualMemAddress(u32_t val) {
134
+ inline bool isVirtualMemAddress(u32_t val)
135
+ {
124
136
  return (val & 0xff000000) == AddressMask;
125
137
  }
126
138
 
127
139
  /// Return the internal index if idx is an address otherwise return the value of idx
128
- inline u32_t getInternalID(u32_t idx) const {
140
+ inline u32_t getInternalID(u32_t idx) const
141
+ {
129
142
  return (idx & FlippedAddressMask);
130
143
  }
131
144
 
132
145
  /// Return int value from an expression if it is a numeral, otherwise return an approximate value
133
- inline s32_t z3Expr2NumValue(const Z3Expr &e) {
146
+ inline s32_t z3Expr2NumValue(const Z3Expr &e)
147
+ {
134
148
  assert(e.is_numeral() && "not numeral?");
135
149
  return e.get_numeral_int64();
136
150
  }
@@ -142,30 +156,36 @@ private:
142
156
  bool eqVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs) const;
143
157
  bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs) const;
144
158
  protected:
145
- inline void store(u32_t objId, const Z3Expr &z3Expr) {
159
+ inline void store(u32_t objId, const Z3Expr &z3Expr)
160
+ {
146
161
  locToVal[objId] = z3Expr.simplify();
147
162
  }
148
163
 
149
- inline Z3Expr &load(u32_t objId) {
164
+ inline Z3Expr &load(u32_t objId)
165
+ {
150
166
  return locToVal[objId];
151
167
  }
152
168
  };
153
169
  }
154
170
 
155
171
  template<>
156
- struct std::hash<SVF::ExeState> {
157
- size_t operator()(const SVF::ExeState &exeState) const {
172
+ struct std::hash<SVF::ExeState>
173
+ {
174
+ size_t operator()(const SVF::ExeState &exeState) const
175
+ {
158
176
 
159
177
  size_t h = exeState.getVarToVal().size() * 2;
160
178
  SVF::Hash<SVF::u32_t> hf;
161
- for (const auto &t: exeState.getVarToVal()) {
179
+ for (const auto &t: exeState.getVarToVal())
180
+ {
162
181
  h ^= hf(t.first) + 0x9e3779b9 + (h << 6) + (h >> 2);
163
182
  h ^= hf(t.second.id()) + 0x9e3779b9 + (h << 6) + (h >> 2);
164
183
  }
165
184
 
166
185
  size_t h2 = exeState.getVarToVal().size() * 2;
167
186
 
168
- for (const auto &t: exeState.getLocToVal()) {
187
+ for (const auto &t: exeState.getLocToVal())
188
+ {
169
189
  h2 ^= hf(t.first) + 0x9e3779b9 + (h2 << 6) + (h2 >> 2);
170
190
  h2 ^= hf(t.second.id()) + 0x9e3779b9 + (h2 << 6) + (h2 >> 2);
171
191
  }
@@ -122,7 +122,7 @@ public:
122
122
  }
123
123
 
124
124
  static void destory()
125
- {
125
+ {
126
126
  if (extAPI != nullptr)
127
127
  {
128
128
  delete extAPI;
@@ -74,7 +74,10 @@ public:
74
74
  NodeID endSymbolAllocation(void);
75
75
 
76
76
  /// Returns the total number of memory objects.
77
- NodeID getNumObjects(void) const { return numObjects; }
77
+ NodeID getNumObjects(void) const
78
+ {
79
+ return numObjects;
80
+ }
78
81
 
79
82
  private:
80
83
  /// Builds a node ID allocator with the strategy specified on the command line.
@@ -135,7 +138,7 @@ public:
135
138
  /// based on the points-to sets in pta accessed through keys.
136
139
  /// The second part of the keys pairs are the number of (potential) occurrences of that points-to set
137
140
  /// or a subset, depending on the client's wish.
138
- /// TODO: interfaces are getting unwieldy, an initialised object may be better.
141
+ /// TODO: interfaces are getting unwieldy, an initialised object may be better.
139
142
  /// TODO: kind of sucks pta can't be const here because getPts isn't.
140
143
  static std::vector<NodeID> cluster(BVDataPTAImpl *pta, const std::vector<std::pair<NodeID, unsigned>> keys, std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates, std::string evalSubtitle="");
141
144
 
@@ -180,8 +183,8 @@ public:
180
183
 
181
184
  // From all the candidates, returns the best mapping for pointsToSets (points-to set -> # occurences).
182
185
  static inline std::pair<hclust_fast_methods, std::vector<NodeID>> determineBestMapping(
183
- const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
184
- Map<PointsTo, unsigned> pointsToSets, const std::string &evalSubtitle, double &evalTime);
186
+ const std::vector<std::pair<hclust_fast_methods, std::vector<NodeID>>> &candidates,
187
+ Map<PointsTo, unsigned> pointsToSets, const std::string &evalSubtitle, double &evalTime);
185
188
 
186
189
  };
187
190
  };
@@ -120,7 +120,7 @@ public:
120
120
  // Sparse value-flow graph (VFG.cpp)
121
121
  static const llvm::cl::opt<bool> DumpVFG;
122
122
 
123
- // Location set for modeling abstract memory object (LocationSet.cpp)
123
+ // Location set for modeling abstract memory object (LocationSet.cpp)
124
124
  static const llvm::cl::opt<bool> SingleStride;
125
125
 
126
126
  // Base class of pointer analyses (PointerAnalysis.cpp)
@@ -180,8 +180,8 @@ public:
180
180
 
181
181
  // MTAResultValidator.cpp
182
182
  static const llvm::cl::opt<bool> PrintValidRes;
183
-
184
- static const llvm::cl::opt<bool> LockValid;
183
+
184
+ static const llvm::cl::opt<bool> LockValid;
185
185
  //MTAStat.cpp
186
186
  static const llvm::cl::opt<bool> AllPairMHP;
187
187
 
@@ -55,22 +55,26 @@ namespace SVF
55
55
  /// provide extra hash function for std::pair handling
56
56
  template <class T> struct Hash;
57
57
 
58
- template <class S, class T> struct Hash<std::pair<S, T>> {
58
+ template <class S, class T> struct Hash<std::pair<S, T>>
59
+ {
59
60
  // Pairing function from: http://szudzik.com/ElegantPairing.pdf
60
61
  static size_t szudzik(size_t a, size_t b)
61
62
  {
62
63
  return a > b ? b * b + a : a * a + a + b;
63
64
  }
64
65
 
65
- size_t operator()(const std::pair<S, T> &t) const {
66
+ size_t operator()(const std::pair<S, T> &t) const
67
+ {
66
68
  Hash<decltype(t.first)> first;
67
69
  Hash<decltype(t.second)> second;
68
70
  return szudzik(first(t.first), second(t.second));
69
71
  }
70
72
  };
71
73
 
72
- template <class T> struct Hash {
73
- size_t operator()(const T &t) const {
74
+ template <class T> struct Hash
75
+ {
76
+ size_t operator()(const T &t) const
77
+ {
74
78
  std::hash<T> h;
75
79
  return h(t);
76
80
  }
@@ -97,45 +101,46 @@ typedef PointsTo AliasSet;
97
101
  typedef unsigned PointsToID;
98
102
 
99
103
  template <typename Key, typename Hash = Hash<Key>, typename KeyEqual = std::equal_to<Key>,
100
- typename Allocator = std::allocator<Key>>
104
+ typename Allocator = std::allocator<Key>>
101
105
  using Set = std::unordered_set<Key, Hash, KeyEqual, Allocator>;
102
106
 
103
107
  template<typename Key, typename Value, typename Hash = Hash<Key>,
104
- typename KeyEqual = std::equal_to<Key>,
105
- typename Allocator = std::allocator<std::pair<const Key, Value>>>
106
- using Map = std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>;
107
-
108
- template<typename Key, typename Compare = std::less<Key>, typename Allocator = std::allocator<Key>>
109
- using OrderedSet = std::set<Key, Compare, Allocator>;
110
-
111
- template<typename Key, typename Value, typename Compare = std::less<Key>,
108
+ typename KeyEqual = std::equal_to<Key>,
112
109
  typename Allocator = std::allocator<std::pair<const Key, Value>>>
113
- using OrderedMap = std::map<Key, Value, Compare, Allocator>;
114
-
115
- typedef llvm::SmallVector<llvm::BasicBlock*, 8> SmallBBVector;
116
- typedef std::pair<NodeID, NodeID> NodePair;
117
- typedef OrderedSet<NodeID> OrderedNodeSet;
118
- typedef Set<NodeID> NodeSet;
119
- typedef Set<NodePair> NodePairSet;
120
- typedef Map<NodePair,NodeID> NodePairMap;
121
- typedef std::vector<NodeID> NodeVector;
122
- typedef std::vector<EdgeID> EdgeVector;
123
- typedef std::stack<NodeID> NodeStack;
124
- typedef std::list<NodeID> NodeList;
125
- typedef std::deque<NodeID> NodeDeque;
126
- typedef NodeSet EdgeSet;
127
- typedef std::vector<u32_t> CallStrCxt;
128
- typedef llvm::StringMap<u32_t> StringMap;
129
-
130
- typedef unsigned Version;
131
- typedef Set<Version> VersionSet;
132
- typedef std::pair<NodeID, Version> VersionedVar;
133
- typedef Set<VersionedVar> VersionedVarSet;
110
+ using Map = std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>;
111
+
112
+ template<typename Key, typename Compare = std::less<Key>, typename Allocator = std::allocator<Key>>
113
+ using OrderedSet = std::set<Key, Compare, Allocator>;
114
+
115
+ template<typename Key, typename Value, typename Compare = std::less<Key>,
116
+ typename Allocator = std::allocator<std::pair<const Key, Value>>>
117
+ using OrderedMap = std::map<Key, Value, Compare, Allocator>;
118
+
119
+ typedef llvm::SmallVector<llvm::BasicBlock*, 8> SmallBBVector;
120
+ typedef std::pair<NodeID, NodeID> NodePair;
121
+ typedef OrderedSet<NodeID> OrderedNodeSet;
122
+ typedef Set<NodeID> NodeSet;
123
+ typedef Set<NodePair> NodePairSet;
124
+ typedef Map<NodePair,NodeID> NodePairMap;
125
+ typedef std::vector<NodeID> NodeVector;
126
+ typedef std::vector<EdgeID> EdgeVector;
127
+ typedef std::stack<NodeID> NodeStack;
128
+ typedef std::list<NodeID> NodeList;
129
+ typedef std::deque<NodeID> NodeDeque;
130
+ typedef NodeSet EdgeSet;
131
+ typedef std::vector<u32_t> CallStrCxt;
132
+ typedef llvm::StringMap<u32_t> StringMap;
133
+
134
+ typedef unsigned Version;
135
+ typedef Set<Version> VersionSet;
136
+ typedef std::pair<NodeID, Version> VersionedVar;
137
+ typedef Set<VersionedVar> VersionedVarSet;
134
138
 
135
139
  // TODO: be explicit that this is a pair of 32-bit unsigneds?
136
- template <> struct Hash<NodePair>
140
+ template <> struct Hash<NodePair>
137
141
  {
138
- size_t operator()(const NodePair &p) const {
142
+ size_t operator()(const NodePair &p) const
143
+ {
139
144
  // Make sure our assumptions are sound: use u32_t
140
145
  // and u64_t. If NodeID is not actually u32_t or size_t
141
146
  // is not u64_t we should be fine since we get a
@@ -278,8 +283,10 @@ public:
278
283
  } // End namespace SVF
279
284
 
280
285
 
281
- template <> struct std::hash<SVF::NodePair> {
282
- size_t operator()(const SVF::NodePair &p) const {
286
+ template <> struct std::hash<SVF::NodePair>
287
+ {
288
+ size_t operator()(const SVF::NodePair &p) const
289
+ {
283
290
  // Make sure our assumptions are sound: use u32_t
284
291
  // and u64_t. If NodeID is not actually u32_t or size_t
285
292
  // is not u64_t we should be fine since we get a
@@ -294,7 +301,8 @@ template <> struct std::hash<SVF::NodePair> {
294
301
  template <unsigned N>
295
302
  struct std::hash<llvm::SparseBitVector<N>>
296
303
  {
297
- size_t operator()(const llvm::SparseBitVector<N> &sbv) const {
304
+ size_t operator()(const llvm::SparseBitVector<N> &sbv) const
305
+ {
298
306
  SVF::Hash<std::pair<std::pair<size_t, size_t>, size_t>> h;
299
307
  return h(std::make_pair(std::make_pair(sbv.count(), sbv.find_first()), sbv.find_last()));
300
308
  }
@@ -303,7 +311,8 @@ struct std::hash<llvm::SparseBitVector<N>>
303
311
  template <typename T>
304
312
  struct std::hash<std::vector<T>>
305
313
  {
306
- size_t operator()(const std::vector<T> &v) const {
314
+ size_t operator()(const std::vector<T> &v) const
315
+ {
307
316
  // TODO: repetition with CBV.
308
317
  size_t h = v.size();
309
318
 
@@ -73,11 +73,11 @@ public:
73
73
 
74
74
  ~SVFModule()
75
75
  {
76
- for (auto * f : FunctionSet)
77
- delete f;
78
- NodeIDAllocator::unset();
79
- ThreadAPI::destroy();
80
- ExtAPI::destory();
76
+ for (auto * f : FunctionSet)
77
+ delete f;
78
+ NodeIDAllocator::unset();
79
+ ThreadAPI::destroy();
80
+ ExtAPI::destory();
81
81
  }
82
82
 
83
83
  static inline void setPagFromTXT(std::string txt)
@@ -170,8 +170,9 @@ inline bool isIntrinsicFun(const Function* func)
170
170
  func->getIntrinsicID() == llvm::Intrinsic::dbg_addr ||
171
171
  func->getIntrinsicID() == llvm::Intrinsic::dbg_declare ||
172
172
  func->getIntrinsicID() == llvm::Intrinsic::dbg_label ||
173
- func->getIntrinsicID() == llvm::Intrinsic::dbg_value)) {
174
- return true;
173
+ func->getIntrinsicID() == llvm::Intrinsic::dbg_value))
174
+ {
175
+ return true;
175
176
  }
176
177
  return false;
177
178
  }
@@ -179,9 +180,11 @@ inline bool isIntrinsicFun(const Function* func)
179
180
  /// Return true if it is an intrinsic instruction
180
181
  inline bool isIntrinsicInst(const Instruction* inst)
181
182
  {
182
- if (const llvm::CallBase* call = llvm::dyn_cast<llvm::CallBase>(inst)) {
183
+ if (const llvm::CallBase* call = llvm::dyn_cast<llvm::CallBase>(inst))
184
+ {
183
185
  const Function* func = call->getCalledFunction();
184
- if (isIntrinsicFun(func)) {
186
+ if (isIntrinsicFun(func))
187
+ {
185
188
  return true;
186
189
  }
187
190
  }
@@ -197,10 +200,10 @@ inline bool isCallSite(const Instruction* inst)
197
200
  /// Whether an instruction is a call or invoke instruction
198
201
  inline bool isCallSite(const Value* val)
199
202
  {
200
- if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(val))
201
- return SVFUtil::isCallSite(inst);
202
- else
203
- return false;
203
+ if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(val))
204
+ return SVFUtil::isCallSite(inst);
205
+ else
206
+ return false;
204
207
  }
205
208
  /// Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls
206
209
  inline bool isNonInstricCallSite(const Instruction* inst)
@@ -237,7 +240,7 @@ inline const SVFFunction* getFunction(StringRef name)
237
240
  }
238
241
 
239
242
  /// find the unique defined global across multiple modules
240
- inline const Value* getGlobalRep(const Value* val)
243
+ inline const Value* getGlobalRep(const Value* val)
241
244
  {
242
245
  if(const GlobalVariable* gvar = SVFUtil::dyn_cast<GlobalVariable>(val))
243
246
  {