svf-lib 1.0.718 → 1.0.722

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.
@@ -157,7 +157,8 @@ public:
157
157
  /// Destructor
158
158
  virtual ~GenericNode()
159
159
  {
160
-
160
+ for (auto * edge : OutEdges)
161
+ delete edge;
161
162
  }
162
163
 
163
164
  /// Get ID
@@ -352,13 +353,8 @@ public:
352
353
  /// Release memory
353
354
  void destroy()
354
355
  {
355
- for (iterator I = IDToNodeMap.begin(), E = IDToNodeMap.end(); I != E; ++I){
356
- // NodeType* node = I->second;
357
- // for(typename NodeType::iterator it = node->InEdgeBegin(), eit = node->InEdgeEnd(); it!=eit; ++it)
358
- // delete *it;
359
- }
360
- for (iterator I = IDToNodeMap.begin(), E = IDToNodeMap.end(); I != E; ++I)
361
- delete I->second;
356
+ for (auto &entry : IDToNodeMap)
357
+ delete entry.second;
362
358
  }
363
359
  /// Iterators
364
360
  //@{
@@ -411,6 +407,7 @@ public:
411
407
  iterator it = IDToNodeMap.find(node->getId());
412
408
  assert(it != IDToNodeMap.end() && "can not find the node");
413
409
  IDToNodeMap.erase(it);
410
+ delete node;
414
411
  }
415
412
 
416
413
  /// Get total number of node/edge
@@ -45,21 +45,27 @@ public:
45
45
  initStats();
46
46
  }
47
47
 
48
+ /// Clear the cache.
49
+ void clear()
50
+ {
51
+ for (const Data *d : idToPts) delete d;
52
+ idToPts.clear();
53
+ ptsToId.clear();
54
+
55
+ unionCache.clear();
56
+ complementCache.clear();
57
+ intersectionCache.clear();
58
+ }
59
+
48
60
  /// Resets the cache removing everything except the emptyData it was initialised with.
49
61
  void reset(void)
50
62
  {
51
- for (const Data *d : idToPts) delete d;
52
- idToPts.clear();
53
- ptsToId.clear();
63
+ clear();
54
64
 
55
65
  // Put the empty data back in.
56
66
  ptsToId[Data()] = emptyPointsToId();
57
67
  idToPts.push_back(new Data());
58
68
 
59
- unionCache.clear();
60
- complementCache.clear();
61
- intersectionCache.clear();
62
-
63
69
  idCounter = 1;
64
70
  // Cache is empty...
65
71
  initStats();
@@ -91,6 +91,7 @@ public:
91
91
  {
92
92
  delete ptD;
93
93
  ptD = nullptr;
94
+ ptCache.clear();
94
95
  }
95
96
 
96
97
  /// Get points-to and reverse points-to
@@ -138,7 +138,9 @@ template <> struct Hash<NodePair>
138
138
  // and u64_t. If NodeID is not actually u32_t or size_t
139
139
  // is not u64_t we should be fine since we get a
140
140
  // consistent result.
141
- return ((uint64_t)(p.first) << 32) | (uint64_t)(p.second);
141
+ uint32_t first = (uint32_t)(p.first);
142
+ uint32_t second = (uint32_t)(p.second);
143
+ return ((uint64_t)(first) << 32) | (uint64_t)(second);
142
144
  }
143
145
  };
144
146
 
@@ -266,7 +268,7 @@ template <> struct std::hash<SVF::NodePair> {
266
268
  // consistent result.
267
269
  uint32_t first = (uint32_t)(p.first);
268
270
  uint32_t second = (uint32_t)(p.second);
269
- return ((uint64_t)(p.first) << 32) | (uint64_t)(p.second);
271
+ return ((uint64_t)(first) << 32) | (uint64_t)(second);
270
272
  }
271
273
  };
272
274
 
@@ -31,6 +31,9 @@
31
31
  #define SVFMODULE_H_
32
32
 
33
33
  #include "Util/BasicTypes.h"
34
+ #include "Util/ExtAPI.h"
35
+ #include "Util/NodeIDAllocator.h"
36
+ #include "Util/ThreadAPI.h"
34
37
 
35
38
  namespace SVF
36
39
  {
@@ -68,6 +71,19 @@ public:
68
71
  {
69
72
  }
70
73
 
74
+ ~SVFModule()
75
+ {
76
+ for (auto * f : FunctionSet)
77
+ delete f;
78
+
79
+ auto * extAPI = ExtAPI::getExtAPI();
80
+ delete extAPI;
81
+ extAPI = nullptr;
82
+ NodeIDAllocator::unset();
83
+ auto * threadAPI = SVF::ThreadAPI::getThreadAPI();
84
+ delete threadAPI;
85
+ threadAPI = nullptr;
86
+ }
71
87
 
72
88
  static inline void setPagFromTXT(std::string txt)
73
89
  {
Binary file
@@ -157,7 +157,8 @@ public:
157
157
  /// Destructor
158
158
  virtual ~GenericNode()
159
159
  {
160
-
160
+ for (auto * edge : OutEdges)
161
+ delete edge;
161
162
  }
162
163
 
163
164
  /// Get ID
@@ -352,13 +353,8 @@ public:
352
353
  /// Release memory
353
354
  void destroy()
354
355
  {
355
- for (iterator I = IDToNodeMap.begin(), E = IDToNodeMap.end(); I != E; ++I){
356
- // NodeType* node = I->second;
357
- // for(typename NodeType::iterator it = node->InEdgeBegin(), eit = node->InEdgeEnd(); it!=eit; ++it)
358
- // delete *it;
359
- }
360
- for (iterator I = IDToNodeMap.begin(), E = IDToNodeMap.end(); I != E; ++I)
361
- delete I->second;
356
+ for (auto &entry : IDToNodeMap)
357
+ delete entry.second;
362
358
  }
363
359
  /// Iterators
364
360
  //@{
@@ -411,6 +407,7 @@ public:
411
407
  iterator it = IDToNodeMap.find(node->getId());
412
408
  assert(it != IDToNodeMap.end() && "can not find the node");
413
409
  IDToNodeMap.erase(it);
410
+ delete node;
414
411
  }
415
412
 
416
413
  /// Get total number of node/edge
@@ -45,21 +45,27 @@ public:
45
45
  initStats();
46
46
  }
47
47
 
48
+ /// Clear the cache.
49
+ void clear()
50
+ {
51
+ for (const Data *d : idToPts) delete d;
52
+ idToPts.clear();
53
+ ptsToId.clear();
54
+
55
+ unionCache.clear();
56
+ complementCache.clear();
57
+ intersectionCache.clear();
58
+ }
59
+
48
60
  /// Resets the cache removing everything except the emptyData it was initialised with.
49
61
  void reset(void)
50
62
  {
51
- for (const Data *d : idToPts) delete d;
52
- idToPts.clear();
53
- ptsToId.clear();
63
+ clear();
54
64
 
55
65
  // Put the empty data back in.
56
66
  ptsToId[Data()] = emptyPointsToId();
57
67
  idToPts.push_back(new Data());
58
68
 
59
- unionCache.clear();
60
- complementCache.clear();
61
- intersectionCache.clear();
62
-
63
69
  idCounter = 1;
64
70
  // Cache is empty...
65
71
  initStats();
@@ -91,6 +91,7 @@ public:
91
91
  {
92
92
  delete ptD;
93
93
  ptD = nullptr;
94
+ ptCache.clear();
94
95
  }
95
96
 
96
97
  /// Get points-to and reverse points-to
@@ -138,7 +138,9 @@ template <> struct Hash<NodePair>
138
138
  // and u64_t. If NodeID is not actually u32_t or size_t
139
139
  // is not u64_t we should be fine since we get a
140
140
  // consistent result.
141
- return ((uint64_t)(p.first) << 32) | (uint64_t)(p.second);
141
+ uint32_t first = (uint32_t)(p.first);
142
+ uint32_t second = (uint32_t)(p.second);
143
+ return ((uint64_t)(first) << 32) | (uint64_t)(second);
142
144
  }
143
145
  };
144
146
 
@@ -266,7 +268,7 @@ template <> struct std::hash<SVF::NodePair> {
266
268
  // consistent result.
267
269
  uint32_t first = (uint32_t)(p.first);
268
270
  uint32_t second = (uint32_t)(p.second);
269
- return ((uint64_t)(p.first) << 32) | (uint64_t)(p.second);
271
+ return ((uint64_t)(first) << 32) | (uint64_t)(second);
270
272
  }
271
273
  };
272
274
 
@@ -31,6 +31,9 @@
31
31
  #define SVFMODULE_H_
32
32
 
33
33
  #include "Util/BasicTypes.h"
34
+ #include "Util/ExtAPI.h"
35
+ #include "Util/NodeIDAllocator.h"
36
+ #include "Util/ThreadAPI.h"
34
37
 
35
38
  namespace SVF
36
39
  {
@@ -68,6 +71,19 @@ public:
68
71
  {
69
72
  }
70
73
 
74
+ ~SVFModule()
75
+ {
76
+ for (auto * f : FunctionSet)
77
+ delete f;
78
+
79
+ auto * extAPI = ExtAPI::getExtAPI();
80
+ delete extAPI;
81
+ extAPI = nullptr;
82
+ NodeIDAllocator::unset();
83
+ auto * threadAPI = SVF::ThreadAPI::getThreadAPI();
84
+ delete threadAPI;
85
+ threadAPI = nullptr;
86
+ }
71
87
 
72
88
  static inline void setPagFromTXT(std::string txt)
73
89
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.718",
3
+ "version": "1.0.722",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {