svf-lib 1.0.992 → 1.0.995

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 (140) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/CFL/CFGNormalizer.h +6 -3
  3. package/SVF-linux/include/CFL/CFLAlias.h +26 -15
  4. package/SVF-linux/include/CFL/CFLGrammar.h +30 -16
  5. package/SVF-linux/include/CFL/CFLSolver.h +9 -5
  6. package/SVF-linux/include/CFL/GrammarBuilder.h +10 -7
  7. package/SVF-linux/include/CUDD/cudd.h +20 -11
  8. package/SVF-linux/include/CUDD/cuddInt.h +48 -31
  9. package/SVF-linux/include/CUDD/epd.h +35 -29
  10. package/SVF-linux/include/CUDD/mtr.h +4 -3
  11. package/SVF-linux/include/CUDD/st.h +7 -4
  12. package/SVF-linux/include/CUDD/util.h +6 -6
  13. package/SVF-linux/include/FastCluster/fastcluster.h +13 -12
  14. package/SVF-linux/include/Graphs/CFLGraph.h +16 -10
  15. package/SVF-linux/include/Graphs/CHG.h +2 -2
  16. package/SVF-linux/include/Graphs/ConsG.h +2 -1
  17. package/SVF-linux/include/Graphs/GenericGraph.h +3 -3
  18. package/SVF-linux/include/Graphs/ICFG.h +2 -2
  19. package/SVF-linux/include/Graphs/ICFGEdge.h +16 -9
  20. package/SVF-linux/include/Graphs/ICFGNode.h +2 -2
  21. package/SVF-linux/include/Graphs/IRGraph.h +10 -6
  22. package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
  23. package/SVF-linux/include/Graphs/SVFG.h +4 -3
  24. package/SVF-linux/include/Graphs/SVFGNode.h +14 -8
  25. package/SVF-linux/include/Graphs/ThreadCallGraph.h +4 -2
  26. package/SVF-linux/include/Graphs/VFG.h +45 -39
  27. package/SVF-linux/include/Graphs/VFGNode.h +8 -4
  28. package/SVF-linux/include/MSSA/MemSSA.h +1 -1
  29. package/SVF-linux/include/MTA/FSMPTA.h +55 -44
  30. package/SVF-linux/include/MTA/LockAnalysis.h +11 -9
  31. package/SVF-linux/include/MTA/LockResultValidator.h +64 -54
  32. package/SVF-linux/include/MTA/MHP.h +17 -13
  33. package/SVF-linux/include/MTA/MTAResultValidator.h +24 -20
  34. package/SVF-linux/include/MTA/PCG.h +9 -7
  35. package/SVF-linux/include/MTA/TCT.h +27 -22
  36. package/SVF-linux/include/MemoryModel/LocationSet.h +5 -3
  37. package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +28 -13
  38. package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +2 -2
  39. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
  40. package/SVF-linux/include/MemoryModel/PointsTo.h +8 -2
  41. package/SVF-linux/include/MemoryModel/SVFIR.h +6 -5
  42. package/SVF-linux/include/MemoryModel/SVFStatements.h +65 -45
  43. package/SVF-linux/include/MemoryModel/SVFVariables.h +6 -5
  44. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +18 -15
  45. package/SVF-linux/include/SABER/PathCondAllocator.h +14 -7
  46. package/SVF-linux/include/SABER/ProgSlice.h +2 -1
  47. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
  48. package/SVF-linux/include/SABER/SrcSnkDDA.h +8 -4
  49. package/SVF-linux/include/SVF-FE/CHGBuilder.h +4 -2
  50. package/SVF-linux/include/SVF-FE/DataFlowUtil.h +10 -9
  51. package/SVF-linux/include/SVF-FE/IRAnnotator.h +8 -8
  52. package/SVF-linux/include/SVF-FE/LLVMModule.h +13 -12
  53. package/SVF-linux/include/SVF-FE/LLVMUtil.h +4 -4
  54. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +13 -9
  55. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +3 -2
  56. package/SVF-linux/include/Util/BDDExpr.h +32 -16
  57. package/SVF-linux/include/Util/BasicTypes.h +77 -25
  58. package/SVF-linux/include/Util/CoreBitVector.h +2 -1
  59. package/SVF-linux/include/Util/CxtStmt.h +37 -27
  60. package/SVF-linux/include/Util/ExeState.h +42 -22
  61. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  62. package/SVF-linux/include/Util/NodeIDAllocator.h +7 -4
  63. package/SVF-linux/include/Util/Options.h +3 -3
  64. package/SVF-linux/include/Util/SVFBasicTypes.h +49 -40
  65. package/SVF-linux/include/Util/SVFModule.h +5 -5
  66. package/SVF-linux/include/Util/SVFUtil.h +12 -9
  67. package/SVF-linux/include/Util/Z3Expr.h +191 -144
  68. package/SVF-linux/include/WPA/Andersen.h +11 -11
  69. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +4 -1
  70. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  71. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  72. package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
  73. package/SVF-osx/include/CFL/CFLAlias.h +26 -15
  74. package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
  75. package/SVF-osx/include/CFL/CFLSolver.h +9 -5
  76. package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
  77. package/SVF-osx/include/CUDD/cudd.h +20 -11
  78. package/SVF-osx/include/CUDD/cuddInt.h +48 -31
  79. package/SVF-osx/include/CUDD/epd.h +35 -29
  80. package/SVF-osx/include/CUDD/mtr.h +4 -3
  81. package/SVF-osx/include/CUDD/st.h +7 -4
  82. package/SVF-osx/include/CUDD/util.h +6 -6
  83. package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
  84. package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
  85. package/SVF-osx/include/Graphs/CHG.h +2 -2
  86. package/SVF-osx/include/Graphs/ConsG.h +2 -1
  87. package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
  88. package/SVF-osx/include/Graphs/ICFG.h +2 -2
  89. package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
  90. package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
  91. package/SVF-osx/include/Graphs/IRGraph.h +10 -6
  92. package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
  93. package/SVF-osx/include/Graphs/SVFG.h +4 -3
  94. package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
  95. package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
  96. package/SVF-osx/include/Graphs/VFG.h +45 -39
  97. package/SVF-osx/include/Graphs/VFGNode.h +8 -4
  98. package/SVF-osx/include/MSSA/MemSSA.h +1 -1
  99. package/SVF-osx/include/MTA/FSMPTA.h +55 -44
  100. package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
  101. package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
  102. package/SVF-osx/include/MTA/MHP.h +17 -13
  103. package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
  104. package/SVF-osx/include/MTA/PCG.h +9 -7
  105. package/SVF-osx/include/MTA/TCT.h +27 -22
  106. package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
  107. package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
  108. package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
  109. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
  110. package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
  111. package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
  112. package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
  113. package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
  114. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
  115. package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
  116. package/SVF-osx/include/SABER/ProgSlice.h +2 -1
  117. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
  118. package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
  119. package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
  120. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
  121. package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
  122. package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
  123. package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
  124. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
  125. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
  126. package/SVF-osx/include/Util/BDDExpr.h +32 -16
  127. package/SVF-osx/include/Util/BasicTypes.h +77 -25
  128. package/SVF-osx/include/Util/CoreBitVector.h +2 -1
  129. package/SVF-osx/include/Util/CxtStmt.h +37 -27
  130. package/SVF-osx/include/Util/ExeState.h +42 -22
  131. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  132. package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
  133. package/SVF-osx/include/Util/Options.h +3 -3
  134. package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
  135. package/SVF-osx/include/Util/SVFModule.h +5 -5
  136. package/SVF-osx/include/Util/SVFUtil.h +12 -9
  137. package/SVF-osx/include/Util/Z3Expr.h +191 -144
  138. package/SVF-osx/include/WPA/Andersen.h +11 -11
  139. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
  140. package/package.json +1 -1
@@ -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
  {
@@ -32,202 +32,249 @@
32
32
  #include "z3++.h"
33
33
  #include "Util/SVFBasicTypes.h"
34
34
 
35
- namespace SVF {
35
+ namespace SVF
36
+ {
36
37
 
37
- class Z3Expr {
38
- public:
39
- static z3::context *ctx;
38
+ class Z3Expr
39
+ {
40
+ public:
41
+ static z3::context *ctx;
40
42
 
41
- private:
42
- z3::expr e;
43
+ private:
44
+ z3::expr e;
43
45
 
44
- Z3Expr(float f); // placeholder don't support floating point expression
45
- Z3Expr(double f); // placeholder don't support floating point expression
46
+ Z3Expr(float f); // placeholder don't support floating point expression
47
+ Z3Expr(double f); // placeholder don't support floating point expression
46
48
 
47
- public:
49
+ public:
48
50
 
49
- Z3Expr() : e(nullExpr()) {
50
- }
51
+ Z3Expr() : e(nullExpr())
52
+ {
53
+ }
51
54
 
52
- Z3Expr(const z3::expr &_e) : e(_e) {
53
- }
55
+ Z3Expr(const z3::expr &_e) : e(_e)
56
+ {
57
+ }
54
58
 
55
- Z3Expr(int i) : e(getContext().int_val(i)) {
56
- }
59
+ Z3Expr(int i) : e(getContext().int_val(i))
60
+ {
61
+ }
57
62
 
58
- Z3Expr(const Z3Expr &z3Expr) : e(z3Expr.getExpr()) {
59
- }
63
+ Z3Expr(const Z3Expr &z3Expr) : e(z3Expr.getExpr())
64
+ {
65
+ }
60
66
 
61
- virtual ~Z3Expr() = default;
67
+ virtual ~Z3Expr() = default;
62
68
 
63
- inline Z3Expr &operator=(const Z3Expr &rhs) {
64
- if (this->id() != rhs.id()) {
65
- e = rhs.getExpr();
66
- }
67
- return *this;
69
+ inline Z3Expr &operator=(const Z3Expr &rhs)
70
+ {
71
+ if (this->id() != rhs.id())
72
+ {
73
+ e = rhs.getExpr();
68
74
  }
75
+ return *this;
76
+ }
69
77
 
70
- const z3::expr &getExpr() const {
71
- return e;
72
- }
78
+ const z3::expr &getExpr() const
79
+ {
80
+ return e;
81
+ }
73
82
 
74
- /// Get z3 context, singleton design here to make sure we only have one context
75
- static z3::context &getContext() {
76
- if (ctx == nullptr) {
77
- ctx = new z3::context();
78
- }
79
- return *ctx;
83
+ /// Get z3 context, singleton design here to make sure we only have one context
84
+ static z3::context &getContext()
85
+ {
86
+ if (ctx == nullptr)
87
+ {
88
+ ctx = new z3::context();
80
89
  }
90
+ return *ctx;
91
+ }
81
92
 
82
- /// release z3 context
83
- static void releaseContext() {
84
- delete ctx;
85
- ctx = nullptr;
86
- }
93
+ /// release z3 context
94
+ static void releaseContext()
95
+ {
96
+ delete ctx;
97
+ ctx = nullptr;
98
+ }
87
99
 
88
- /// null expression
89
- static z3::expr nullExpr() {
90
- return getContext().int_const("null");
91
- }
100
+ /// null expression
101
+ static z3::expr nullExpr()
102
+ {
103
+ return getContext().int_const("null");
104
+ }
92
105
 
93
- /// get id
94
- inline u32_t id() const {
95
- return e.id();
96
- }
106
+ /// get id
107
+ inline u32_t id() const
108
+ {
109
+ return e.id();
110
+ }
97
111
 
98
- inline const std::string to_string() const {
99
- return e.to_string();
100
- }
112
+ inline const std::string to_string() const
113
+ {
114
+ return e.to_string();
115
+ }
101
116
 
102
- inline bool is_numeral() const {
103
- return e.is_numeral();
104
- }
117
+ inline bool is_numeral() const
118
+ {
119
+ return e.is_numeral();
120
+ }
105
121
 
106
- inline bool is_bool() const {
107
- return e.is_bool();
108
- }
122
+ inline bool is_bool() const
123
+ {
124
+ return e.is_bool();
125
+ }
109
126
 
110
- inline Z3Expr simplify() const {
111
- return e.simplify();
112
- }
127
+ inline Z3Expr simplify() const
128
+ {
129
+ return e.simplify();
130
+ }
113
131
 
114
- inline int64_t get_numeral_int64() const {
115
- return e.get_numeral_int64();
116
- }
132
+ inline int64_t get_numeral_int64() const
133
+ {
134
+ return e.get_numeral_int64();
135
+ }
117
136
 
118
- inline int get_numeral_int() const {
119
- return e.get_numeral_int();
120
- }
137
+ inline int get_numeral_int() const
138
+ {
139
+ return e.get_numeral_int();
140
+ }
121
141
 
122
- //{% reload operator
123
- friend Z3Expr operator==(const Z3Expr &lhs, const Z3Expr &rhs) {
124
- return lhs.getExpr() == rhs.getExpr();
125
- }
142
+ //{% reload operator
143
+ friend Z3Expr operator==(const Z3Expr &lhs, const Z3Expr &rhs)
144
+ {
145
+ return lhs.getExpr() == rhs.getExpr();
146
+ }
126
147
 
127
- friend Z3Expr operator!=(const Z3Expr &lhs, const Z3Expr &rhs) {
128
- return lhs.getExpr() != rhs.getExpr();
129
- }
148
+ friend Z3Expr operator!=(const Z3Expr &lhs, const Z3Expr &rhs)
149
+ {
150
+ return lhs.getExpr() != rhs.getExpr();
151
+ }
130
152
 
131
- friend Z3Expr operator>(const Z3Expr &lhs, const Z3Expr &rhs) {
132
- return lhs.getExpr() > rhs.getExpr();
133
- }
153
+ friend Z3Expr operator>(const Z3Expr &lhs, const Z3Expr &rhs)
154
+ {
155
+ return lhs.getExpr() > rhs.getExpr();
156
+ }
134
157
 
135
- friend Z3Expr operator<(const Z3Expr &lhs, const Z3Expr &rhs) {
136
- return lhs.getExpr() < rhs.getExpr();
137
- }
158
+ friend Z3Expr operator<(const Z3Expr &lhs, const Z3Expr &rhs)
159
+ {
160
+ return lhs.getExpr() < rhs.getExpr();
161
+ }
138
162
 
139
- friend Z3Expr operator<=(const Z3Expr &lhs, const Z3Expr &rhs) {
140
- return lhs.getExpr() <= rhs.getExpr();
141
- }
163
+ friend Z3Expr operator<=(const Z3Expr &lhs, const Z3Expr &rhs)
164
+ {
165
+ return lhs.getExpr() <= rhs.getExpr();
166
+ }
142
167
 
143
- friend Z3Expr operator>=(const Z3Expr &lhs, const Z3Expr &rhs) {
144
- return lhs.getExpr() >= rhs.getExpr();
145
- }
168
+ friend Z3Expr operator>=(const Z3Expr &lhs, const Z3Expr &rhs)
169
+ {
170
+ return lhs.getExpr() >= rhs.getExpr();
171
+ }
146
172
 
147
- friend Z3Expr operator+(const Z3Expr &lhs, const Z3Expr &rhs) {
148
- return lhs.getExpr() + rhs.getExpr();
149
- }
173
+ friend Z3Expr operator+(const Z3Expr &lhs, const Z3Expr &rhs)
174
+ {
175
+ return lhs.getExpr() + rhs.getExpr();
176
+ }
150
177
 
151
- friend Z3Expr operator-(const Z3Expr &lhs, const Z3Expr &rhs) {
152
- return lhs.getExpr() - rhs.getExpr();
153
- }
178
+ friend Z3Expr operator-(const Z3Expr &lhs, const Z3Expr &rhs)
179
+ {
180
+ return lhs.getExpr() - rhs.getExpr();
181
+ }
154
182
 
155
- friend Z3Expr operator*(const Z3Expr &lhs, const Z3Expr &rhs) {
156
- return lhs.getExpr() * rhs.getExpr();
157
- }
183
+ friend Z3Expr operator*(const Z3Expr &lhs, const Z3Expr &rhs)
184
+ {
185
+ return lhs.getExpr() * rhs.getExpr();
186
+ }
158
187
 
159
- friend Z3Expr operator/(const Z3Expr &lhs, const Z3Expr &rhs) {
160
- return lhs.getExpr() / rhs.getExpr();
161
- }
188
+ friend Z3Expr operator/(const Z3Expr &lhs, const Z3Expr &rhs)
189
+ {
190
+ return lhs.getExpr() / rhs.getExpr();
191
+ }
162
192
 
163
- friend Z3Expr operator%(const Z3Expr &lhs, const Z3Expr &rhs) {
164
- return lhs.getExpr() % rhs.getExpr();
165
- }
193
+ friend Z3Expr operator%(const Z3Expr &lhs, const Z3Expr &rhs)
194
+ {
195
+ return lhs.getExpr() % rhs.getExpr();
196
+ }
166
197
 
167
- friend Z3Expr operator^(const Z3Expr &lhs, const Z3Expr &rhs) {
168
- return lhs.getExpr() ^ rhs.getExpr();
169
- }
198
+ friend Z3Expr operator^(const Z3Expr &lhs, const Z3Expr &rhs)
199
+ {
200
+ return lhs.getExpr() ^ rhs.getExpr();
201
+ }
170
202
 
171
- friend Z3Expr operator&(const Z3Expr &lhs, const Z3Expr &rhs) {
172
- return lhs.getExpr() & rhs.getExpr();
173
- }
203
+ friend Z3Expr operator&(const Z3Expr &lhs, const Z3Expr &rhs)
204
+ {
205
+ return lhs.getExpr() & rhs.getExpr();
206
+ }
174
207
 
175
- friend Z3Expr operator|(const Z3Expr &lhs, const Z3Expr &rhs) {
176
- return lhs.getExpr() | rhs.getExpr();
177
- }
208
+ friend Z3Expr operator|(const Z3Expr &lhs, const Z3Expr &rhs)
209
+ {
210
+ return lhs.getExpr() | rhs.getExpr();
211
+ }
178
212
 
179
- friend Z3Expr ashr(const Z3Expr &lhs, const Z3Expr &rhs) {
180
- return ashr(lhs.getExpr(), rhs.getExpr());
181
- }
213
+ friend Z3Expr ashr(const Z3Expr &lhs, const Z3Expr &rhs)
214
+ {
215
+ return ashr(lhs.getExpr(), rhs.getExpr());
216
+ }
182
217
 
183
- friend Z3Expr shl(const Z3Expr &lhs, const Z3Expr &rhs) {
184
- return shl(lhs.getExpr(), rhs.getExpr());
185
- }
218
+ friend Z3Expr shl(const Z3Expr &lhs, const Z3Expr &rhs)
219
+ {
220
+ return shl(lhs.getExpr(), rhs.getExpr());
221
+ }
186
222
 
187
- friend Z3Expr int2bv(u32_t n, const Z3Expr &e) {
188
- return int2bv(n, e.getExpr());
189
- }
223
+ friend Z3Expr int2bv(u32_t n, const Z3Expr &e)
224
+ {
225
+ return int2bv(n, e.getExpr());
226
+ }
190
227
 
191
- friend Z3Expr bv2int(const Z3Expr &e, bool isSigned) {
192
- return z3::bv2int(e.getExpr(), isSigned);
193
- }
228
+ friend Z3Expr bv2int(const Z3Expr &e, bool isSigned)
229
+ {
230
+ return z3::bv2int(e.getExpr(), isSigned);
231
+ }
194
232
 
195
- friend Z3Expr operator&&(const Z3Expr &lhs, const Z3Expr &rhs) {
196
- return lhs.getExpr() && rhs.getExpr();
197
- }
233
+ friend Z3Expr operator&&(const Z3Expr &lhs, const Z3Expr &rhs)
234
+ {
235
+ return lhs.getExpr() && rhs.getExpr();
236
+ }
198
237
 
199
- friend Z3Expr operator||(const Z3Expr &lhs, const Z3Expr &rhs) {
200
- return lhs.getExpr() || rhs.getExpr();
201
- }
238
+ friend Z3Expr operator||(const Z3Expr &lhs, const Z3Expr &rhs)
239
+ {
240
+ return lhs.getExpr() || rhs.getExpr();
241
+ }
202
242
 
203
- friend Z3Expr operator!(const Z3Expr &lhs) {
204
- return !lhs.getExpr();
205
- }
243
+ friend Z3Expr operator!(const Z3Expr &lhs)
244
+ {
245
+ return !lhs.getExpr();
246
+ }
206
247
 
207
- friend Z3Expr ite(const Z3Expr& cond, const Z3Expr& lhs, const Z3Expr& rhs) {
208
- return ite(cond.getExpr(), lhs.getExpr(), rhs.getExpr());
209
- }
248
+ friend Z3Expr ite(const Z3Expr& cond, const Z3Expr& lhs, const Z3Expr& rhs)
249
+ {
250
+ return ite(cond.getExpr(), lhs.getExpr(), rhs.getExpr());
251
+ }
210
252
 
211
- friend std::ostream &operator<<(std::ostream &out, const Z3Expr &expr) {
212
- out << expr.getExpr();
213
- return out;
214
- }
253
+ friend std::ostream &operator<<(std::ostream &out, const Z3Expr &expr)
254
+ {
255
+ out << expr.getExpr();
256
+ return out;
257
+ }
215
258
 
216
- friend bool eq(const Z3Expr &lhs, const Z3Expr &rhs) {
217
- return eq(lhs.getExpr(), rhs.getExpr());
218
- }
259
+ friend bool eq(const Z3Expr &lhs, const Z3Expr &rhs)
260
+ {
261
+ return eq(lhs.getExpr(), rhs.getExpr());
262
+ }
219
263
 
220
- z3::sort get_sort() const {
221
- return getExpr().get_sort();
222
- }
223
- //%}
224
- };
264
+ z3::sort get_sort() const
265
+ {
266
+ return getExpr().get_sort();
267
+ }
268
+ //%}
269
+ };
225
270
  }
226
271
 
227
272
  /// Specialise hash for AbsCxtDPItem.
228
273
  template<>
229
- struct std::hash<SVF::Z3Expr> {
230
- size_t operator()(const SVF::Z3Expr &z3Expr) const {
274
+ struct std::hash<SVF::Z3Expr>
275
+ {
276
+ size_t operator()(const SVF::Z3Expr &z3Expr) const
277
+ {
231
278
  return z3Expr.id();
232
279
  }
233
280
  };