svf-lib 1.0.1275 → 1.0.1276

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.
Binary file
@@ -259,56 +259,68 @@ public:
259
259
  storeInEdges.insert(inEdge);
260
260
  addIncomingEdge(inEdge);
261
261
  }
262
- inline void addIncomingDirectEdge(ConstraintEdge* inEdge)
262
+ inline bool addIncomingDirectEdge(ConstraintEdge* inEdge)
263
263
  {
264
264
  assert(inEdge->getDstID() == this->getId());
265
265
  bool added1 = directInEdges.insert(inEdge).second;
266
266
  bool added2 = addIncomingEdge(inEdge);
267
- assert(added1 && added2 && "edge not added, duplicated adding!!");
267
+ bool both_added = added1 & added2;
268
+ assert(both_added && "edge not added, duplicated adding!!");
269
+ return both_added;
268
270
  }
269
271
  inline void addOutgoingAddrEdge(AddrCGEdge* outEdge)
270
272
  {
271
273
  addressOutEdges.insert(outEdge);
272
274
  addOutgoingEdge(outEdge);
273
275
  }
274
- inline void addOutgoingLoadEdge(LoadCGEdge* outEdge)
276
+ inline bool addOutgoingLoadEdge(LoadCGEdge* outEdge)
275
277
  {
276
278
  bool added1 = loadOutEdges.insert(outEdge).second;
277
279
  bool added2 = addOutgoingEdge(outEdge);
278
- assert(added1 && added2 && "edge not added, duplicated adding!!");
280
+ bool both_added = added1 & added2;
281
+ assert(both_added && "edge not added, duplicated adding!!");
282
+ return both_added;
279
283
  }
280
- inline void addOutgoingStoreEdge(StoreCGEdge* outEdge)
284
+ inline bool addOutgoingStoreEdge(StoreCGEdge* outEdge)
281
285
  {
282
286
  bool added1 = storeOutEdges.insert(outEdge).second;
283
287
  bool added2 = addOutgoingEdge(outEdge);
284
- assert(added1 && added2 && "edge not added, duplicated adding!!");
288
+ bool both_added = added1 & added2;
289
+ assert(both_added && "edge not added, duplicated adding!!");
290
+ return both_added;
285
291
  }
286
- inline void addOutgoingDirectEdge(ConstraintEdge* outEdge)
292
+ inline bool addOutgoingDirectEdge(ConstraintEdge* outEdge)
287
293
  {
288
294
  assert(outEdge->getSrcID() == this->getId());
289
295
  bool added1 = directOutEdges.insert(outEdge).second;
290
296
  bool added2 = addOutgoingEdge(outEdge);
291
- assert(added1 && added2 && "edge not added, duplicated adding!!");
297
+ bool both_added = added1 & added2;
298
+ assert(both_added && "edge not added, duplicated adding!!");
299
+ return both_added;
292
300
  }
293
301
  //@}
294
302
 
295
303
  /// Remove constraint graph edges
296
304
  //{@
297
- inline void removeOutgoingAddrEdge(AddrCGEdge* outEdge)
305
+ inline bool removeOutgoingAddrEdge(AddrCGEdge* outEdge)
298
306
  {
299
307
  u32_t num1 = addressOutEdges.erase(outEdge);
300
308
  u32_t num2 = removeOutgoingEdge(outEdge);
301
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
309
+ bool removed = (num1 > 0) & (num2 > 0);
310
+ assert(removed && "edge not in the set, can not remove!!!");
311
+ return removed;
302
312
  }
303
313
 
304
- inline void removeIncomingAddrEdge(AddrCGEdge* inEdge)
314
+ inline bool removeIncomingAddrEdge(AddrCGEdge* inEdge)
305
315
  {
306
316
  u32_t num1 = addressInEdges.erase(inEdge);
307
317
  u32_t num2 = removeIncomingEdge(inEdge);
308
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
318
+ bool removed = (num1 > 0) & (num2 > 0);
319
+ assert(removed && "edge not in the set, can not remove!!!");
320
+ return removed;
309
321
  }
310
322
 
311
- inline void removeOutgoingDirectEdge(ConstraintEdge* outEdge)
323
+ inline bool removeOutgoingDirectEdge(ConstraintEdge* outEdge)
312
324
  {
313
325
  if (SVFUtil::isa<GepCGEdge>(outEdge))
314
326
  gepOutEdges.erase(outEdge);
@@ -316,10 +328,12 @@ public:
316
328
  copyOutEdges.erase(outEdge);
317
329
  u32_t num1 = directOutEdges.erase(outEdge);
318
330
  u32_t num2 = removeOutgoingEdge(outEdge);
319
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
331
+ bool removed = (num1 > 0) & (num2 > 0);
332
+ assert(removed && "edge not in the set, can not remove!!!");
333
+ return removed;
320
334
  }
321
335
 
322
- inline void removeIncomingDirectEdge(ConstraintEdge* inEdge)
336
+ inline bool removeIncomingDirectEdge(ConstraintEdge* inEdge)
323
337
  {
324
338
  if (SVFUtil::isa<GepCGEdge>(inEdge))
325
339
  gepInEdges.erase(inEdge);
@@ -327,35 +341,45 @@ public:
327
341
  copyInEdges.erase(inEdge);
328
342
  u32_t num1 = directInEdges.erase(inEdge);
329
343
  u32_t num2 = removeIncomingEdge(inEdge);
330
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
344
+ bool removed = (num1 > 0) & (num2 > 0);
345
+ assert(removed && "edge not in the set, can not remove!!!");
346
+ return removed;
331
347
  }
332
348
 
333
- inline void removeOutgoingLoadEdge(LoadCGEdge* outEdge)
349
+ inline bool removeOutgoingLoadEdge(LoadCGEdge* outEdge)
334
350
  {
335
351
  u32_t num1 = loadOutEdges.erase(outEdge);
336
352
  u32_t num2 = removeOutgoingEdge(outEdge);
337
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
353
+ bool removed = (num1 > 0) & (num2 > 0);
354
+ assert(removed && "edge not in the set, can not remove!!!");
355
+ return removed;
338
356
  }
339
357
 
340
- inline void removeIncomingLoadEdge(LoadCGEdge* inEdge)
358
+ inline bool removeIncomingLoadEdge(LoadCGEdge* inEdge)
341
359
  {
342
360
  u32_t num1 = loadInEdges.erase(inEdge);
343
361
  u32_t num2 = removeIncomingEdge(inEdge);
344
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
362
+ bool removed = (num1 > 0) & (num2 > 0);
363
+ assert(removed && "edge not in the set, can not remove!!!");
364
+ return removed;
345
365
  }
346
366
 
347
- inline void removeOutgoingStoreEdge(StoreCGEdge* outEdge)
367
+ inline bool removeOutgoingStoreEdge(StoreCGEdge* outEdge)
348
368
  {
349
369
  u32_t num1 = storeOutEdges.erase(outEdge);
350
370
  u32_t num2 = removeOutgoingEdge(outEdge);
351
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
371
+ bool removed = (num1 > 0) & (num2 > 0);
372
+ assert(removed && "edge not in the set, can not remove!!!");
373
+ return removed;
352
374
  }
353
375
 
354
- inline void removeIncomingStoreEdge(StoreCGEdge* inEdge)
376
+ inline bool removeIncomingStoreEdge(StoreCGEdge* inEdge)
355
377
  {
356
378
  u32_t num1 = storeInEdges.erase(inEdge);
357
379
  u32_t num2 = removeIncomingEdge(inEdge);
358
- assert((num1 && num2) && "edge not in the set, can not remove!!!");
380
+ bool removed = (num1 > 0) & (num2 > 0);
381
+ assert(removed && "edge not in the set, can not remove!!!");
382
+ return removed;
359
383
  }
360
384
  //@}
361
385
 
@@ -292,13 +292,15 @@ public:
292
292
  {
293
293
  iterator it = InEdges.find(edge);
294
294
  assert(it != InEdges.end() && "can not find in edge in SVFG node");
295
- return InEdges.erase(edge);
295
+ InEdges.erase(it);
296
+ return 1;
296
297
  }
297
298
  inline u32_t removeOutgoingEdge(EdgeType* edge)
298
299
  {
299
300
  iterator it = OutEdges.find(edge);
300
301
  assert(it != OutEdges.end() && "can not find out edge in SVFG node");
301
- return OutEdges.erase(edge);
302
+ OutEdges.erase(it);
303
+ return 1;
302
304
  }
303
305
  ///@}
304
306
 
@@ -179,8 +179,9 @@ protected:
179
179
  {
180
180
  bool added1 = edge->getDstNode()->addIncomingEdge(edge);
181
181
  bool added2 = edge->getSrcNode()->addOutgoingEdge(edge);
182
- assert(added1 && added2 && "edge not added??");
183
- return true;
182
+ bool all_added = added1 && added2;
183
+ assert(all_added && "ICFGEdge not added?");
184
+ return all_added;
184
185
  }
185
186
 
186
187
  /// Add a ICFG node
@@ -261,23 +261,23 @@ private:
261
261
  {
262
262
  PAGNodeToDefMapTy::iterator it = PAGNodeToDefMap.find(pagNode);
263
263
  assert(it != PAGNodeToDefMap.end() && "a SVFIR node doesn't have definition before");
264
- PAGNodeToDefMap[pagNode] = node->getId();
264
+ it->second = node->getId();
265
265
  }
266
266
 
267
267
  /// Set def-site of actual-in/formal-out.
268
268
  ///@{
269
269
  inline void setActualINDef(NodeID ai, NodeID def)
270
270
  {
271
- NodeIDToNodeIDMap::const_iterator it = actualInToDefMap.find(ai);
272
- assert(it == actualInToDefMap.end() && "can not set actual-in's def twice");
273
- actualInToDefMap[ai] = def;
271
+ bool inserted = actualInToDefMap.emplace(ai, def).second;
272
+ (void)inserted; // Suppress warning of unused variable under release build
273
+ assert(inserted && "can not set actual-in's def twice");
274
274
  defNodes.set(def);
275
275
  }
276
276
  inline void setFormalOUTDef(NodeID fo, NodeID def)
277
277
  {
278
- NodeIDToNodeIDMap::const_iterator it = formalOutToDefMap.find(fo);
279
- assert(it == formalOutToDefMap.end() && "can not set formal-out's def twice");
280
- formalOutToDefMap[fo] = def;
278
+ bool inserted = formalOutToDefMap.emplace(fo, def).second;
279
+ (void) inserted;
280
+ assert(inserted && "can not set formal-out's def twice");
281
281
  defNodes.set(def);
282
282
  }
283
283
  ///@}
@@ -340,8 +340,9 @@ public:
340
340
  {
341
341
  bool added1 = edge->getDstNode()->addIncomingEdge(edge);
342
342
  bool added2 = edge->getSrcNode()->addOutgoingEdge(edge);
343
- assert(added1 && added2 && "edge not added??");
344
- return true;
343
+ bool both_added = added1 & added2;
344
+ assert(both_added && "VFGEdge not added??");
345
+ return both_added;
345
346
  }
346
347
 
347
348
  protected:
@@ -324,9 +324,9 @@ public:
324
324
  {
325
325
  if (const LoadStmt* load = SVFUtil::dyn_cast<LoadStmt>(inst))
326
326
  {
327
- assert(0 != load2MuSetMap.count(load)
328
- && "not associated with mem region!");
329
- return true;
327
+ bool hasMu = load2MuSetMap.count(load) != 0;
328
+ assert(hasMu && "not associated with mem region!");
329
+ return hasMu;
330
330
  }
331
331
  else
332
332
  return false;
@@ -336,9 +336,9 @@ public:
336
336
  if (const StoreStmt* store = SVFUtil::dyn_cast<StoreStmt>(
337
337
  inst))
338
338
  {
339
- assert(0 != store2ChiSetMap.count(store)
340
- && "not associated with mem region!");
341
- return true;
339
+ bool has_store = store2ChiSetMap.count(store) != 0;
340
+ assert(has_store && "not associated with mem region!");
341
+ return has_store;
342
342
  }
343
343
  else
344
344
  return false;
@@ -363,7 +363,7 @@ public:
363
363
  virtual inline const KeySet& getRevPts(const Data&) override
364
364
  {
365
365
  assert(false && "PersistentDFPTData::getRevPts: not supported yet!");
366
- return *(KeySet*)nullptr; // suppress -Werror=return-type
366
+ abort();
367
367
  }
368
368
 
369
369
  virtual inline bool unionPts(const Key& dstKey, const Key& srcKey) override
@@ -456,6 +456,7 @@ private:
456
456
  inline void addToStmt2TypeMap(SVFStmt* edge)
457
457
  {
458
458
  bool added = KindToSVFStmtSetMap[edge->getEdgeKind()].insert(edge).second;
459
+ (void)added; // Suppress warning of unused variable under release build
459
460
  assert(added && "duplicated edge, not added!!!");
460
461
  if (edge->isPTAEdge())
461
462
  {
@@ -494,7 +495,8 @@ private:
494
495
  /// Add indirect callsites
495
496
  inline void addIndirectCallsites(const CallICFGNode* cs,NodeID funPtr)
496
497
  {
497
- bool added = indCallSiteToFunPtrMap.insert(std::make_pair(cs,funPtr)).second;
498
+ bool added = indCallSiteToFunPtrMap.emplace(cs, funPtr).second;
499
+ (void) added;
498
500
  funPtrToCallSitesMap[funPtr].insert(cs);
499
501
  assert(added && "adding the same indirect callsite twice?");
500
502
  }
@@ -148,7 +148,9 @@ public:
148
148
  {
149
149
  const SVFFunction* keyFunc = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(bbKey->getParent());
150
150
  const SVFFunction* valueFunc = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(bbValue->getParent());
151
- assert((keyFunc == valueFunc) && "two basicblocks should be in the same function!");
151
+ bool funcEq = (keyFunc == valueFunc);
152
+ (void)funcEq; // Suppress warning of unused variable under release build
153
+ assert(funcEq && "two basicblocks should be in the same function!");
152
154
 
153
155
  return keyFunc->postDominate(bbKey,bbValue);
154
156
  }
@@ -157,7 +159,10 @@ public:
157
159
  {
158
160
  const SVFFunction* keyFunc = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(bbKey->getParent());
159
161
  const SVFFunction* valueFunc = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(bbValue->getParent());
160
- assert((keyFunc == valueFunc) && "two basicblocks should be in the same function!");
162
+ bool funcEq = (keyFunc == valueFunc);
163
+ (void)funcEq; // Suppress warning of unused variable under release build
164
+
165
+ assert(funcEq && "two basicblocks should be in the same function!");
161
166
 
162
167
  return keyFunc->dominate(bbKey,bbValue);
163
168
  }
@@ -101,7 +101,9 @@ private:
101
101
  LocationSet locationSet = LocationSet(locationSetOffset);
102
102
  SVF::NodeID gepnodeId = pag->getGepObjVar(baseNodeId, locationSet);
103
103
 
104
- assert(nodeId == gepnodeId && "nodeId != gepnodeId");
104
+ bool idEq = (nodeId == gepnodeId);
105
+ (void)idEq; // Suppress warning of unused variable under release build
106
+ assert(idEq && "nodeId is not equal to gepnodeId?");
105
107
  }
106
108
  }
107
109
 
@@ -321,6 +321,7 @@ public:
321
321
  if (Bits[i] != 0)
322
322
  return i * BITWORD_SIZE + countTrailingZeros(Bits[i]);
323
323
  assert(false && "SBV: find_first: SBV cannot be empty");
324
+ abort();
324
325
  }
325
326
 
326
327
  /// find_last - Returns the index of the last set bit.
@@ -334,6 +335,7 @@ public:
334
335
  countLeadingZeros(Bits[Idx]) - 1;
335
336
  }
336
337
  assert(false && "SBV: find_last: SBV cannot be empty");
338
+ abort();
337
339
  }
338
340
 
339
341
  /// find_next - Returns the index of the next set bit starting from the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1275",
3
+ "version": "1.0.1276",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {