svf-lib 1.0.1276 → 1.0.1278

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 (60) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/Graphs/ConsGNode.h +48 -24
  3. package/SVF-linux/include/Graphs/GenericGraph.h +4 -2
  4. package/SVF-linux/include/Graphs/ICFG.h +3 -2
  5. package/SVF-linux/include/Graphs/SVFGOPT.h +7 -7
  6. package/SVF-linux/include/Graphs/VFG.h +3 -2
  7. package/SVF-linux/include/MSSA/MemSSA.h +6 -6
  8. package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +1 -1
  9. package/SVF-linux/include/MemoryModel/SVFIR.h +3 -1
  10. package/SVF-linux/include/SABER/SaberCondAllocator.h +7 -2
  11. package/SVF-linux/include/SVF-FE/IRAnnotator.h +3 -1
  12. package/SVF-linux/include/Util/SparseBitVector.h +2 -0
  13. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  14. package/SVF-osx/include/DDA/DDAVFSolver.h +1 -2
  15. package/SVF-osx/include/Graphs/ICFG.h +16 -16
  16. package/SVF-osx/include/Graphs/ICFGEdge.h +6 -6
  17. package/SVF-osx/include/Graphs/ICFGNode.h +16 -16
  18. package/SVF-osx/include/Graphs/IRGraph.h +6 -6
  19. package/SVF-osx/include/Graphs/ThreadCallGraph.h +2 -2
  20. package/SVF-osx/include/Graphs/VFGNode.h +1 -1
  21. package/SVF-osx/include/MSSA/MSSAMuChi.h +11 -11
  22. package/SVF-osx/include/MSSA/MemRegion.h +2 -2
  23. package/SVF-osx/include/MSSA/MemSSA.h +13 -13
  24. package/SVF-osx/include/MTA/FSMPTA.h +1 -1
  25. package/SVF-osx/include/MTA/LockAnalysis.h +33 -33
  26. package/SVF-osx/include/MTA/LockResultValidator.h +7 -6
  27. package/SVF-osx/include/MTA/MHP.h +46 -46
  28. package/SVF-osx/include/MTA/MTA.h +4 -4
  29. package/SVF-osx/include/MTA/MTAAnnotator.h +6 -4
  30. package/SVF-osx/include/MTA/MTAResultValidator.h +51 -44
  31. package/SVF-osx/include/MTA/PCG.h +22 -27
  32. package/SVF-osx/include/MTA/TCT.h +28 -37
  33. package/SVF-osx/include/MemoryModel/SVFStatements.h +11 -6
  34. package/SVF-osx/include/MemoryModel/SVFVariables.h +4 -4
  35. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +13 -19
  36. package/SVF-osx/include/SABER/ProgSlice.h +5 -5
  37. package/SVF-osx/include/SABER/SaberCheckerAPI.h +4 -4
  38. package/SVF-osx/include/SABER/SaberCondAllocator.h +32 -35
  39. package/SVF-osx/include/SVF-FE/BasicTypes.h +10 -0
  40. package/SVF-osx/include/SVF-FE/CPPUtil.h +9 -8
  41. package/SVF-osx/include/SVF-FE/DCHG.h +4 -4
  42. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +1 -1
  43. package/SVF-osx/include/SVF-FE/GEPTypeBridgeIterator.h +1 -1
  44. package/SVF-osx/include/SVF-FE/ICFGBuilder.h +9 -9
  45. package/SVF-osx/include/SVF-FE/IRAnnotator.h +9 -9
  46. package/SVF-osx/include/SVF-FE/LLVMModule.h +119 -22
  47. package/SVF-osx/include/SVF-FE/LLVMUtil.h +31 -52
  48. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +14 -20
  49. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +8 -8
  50. package/SVF-osx/include/Util/Annotator.h +22 -22
  51. package/SVF-osx/include/Util/BasicTypes.h +476 -72
  52. package/SVF-osx/include/Util/Casting.h +1 -1
  53. package/SVF-osx/include/Util/CxtStmt.h +13 -12
  54. package/SVF-osx/include/Util/SVFBasicTypes.h +0 -78
  55. package/SVF-osx/include/Util/SVFInstruction.h +40 -0
  56. package/SVF-osx/include/Util/SVFModule.h +58 -124
  57. package/SVF-osx/include/Util/SVFUtil.h +48 -39
  58. package/SVF-osx/include/Util/ThreadAPI.h +17 -28
  59. package/SVF-osx/include/WPA/WPAPass.h +4 -4
  60. package/package.json +1 -1
@@ -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
Binary file
@@ -470,9 +470,8 @@ protected:
470
470
  assert(obj && "object not found!!");
471
471
  if(obj->isStack())
472
472
  {
473
- if(const Function* fun = _pag->getGNode(id)->getFunction())
473
+ if(const SVFFunction* svffun = _pag->getGNode(id)->getFunction())
474
474
  {
475
- const SVFFunction* svffun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
476
475
  return _callGraphSCC->isInCycle(_callGraph->getCallGraphNode(svffun)->getId());
477
476
  }
478
477
  }
@@ -58,9 +58,9 @@ public:
58
58
 
59
59
  typedef Map<const SVFFunction*, FunEntryICFGNode *> FunToFunEntryNodeMapTy;
60
60
  typedef Map<const SVFFunction*, FunExitICFGNode *> FunToFunExitNodeMapTy;
61
- typedef Map<const Instruction*, CallICFGNode *> CSToCallNodeMapTy;
62
- typedef Map<const Instruction*, RetICFGNode *> CSToRetNodeMapTy;
63
- typedef Map<const Instruction*, IntraICFGNode *> InstToBlockNodeMapTy;
61
+ typedef Map<const SVFInstruction*, CallICFGNode *> CSToCallNodeMapTy;
62
+ typedef Map<const SVFInstruction*, RetICFGNode *> CSToRetNodeMapTy;
63
+ typedef Map<const SVFInstruction*, IntraICFGNode *> InstToBlockNodeMapTy;
64
64
  typedef std::vector<const SVFLoop *> SVFLoopVec;
65
65
  typedef Map<const ICFGNode *, SVFLoopVec> ICFGNodeToSVFLoopVec;
66
66
 
@@ -122,7 +122,7 @@ public:
122
122
  }
123
123
 
124
124
  /// Whether node is in a loop
125
- inline bool isInLoop(const Instruction *inst)
125
+ inline bool isInLoop(const SVFInstruction* inst)
126
126
  {
127
127
  return isInLoop(getICFGNode(inst));
128
128
  }
@@ -159,8 +159,8 @@ protected:
159
159
  //@{
160
160
  ICFGEdge* addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode);
161
161
  ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Value* condition, s32_t branchCondVal);
162
- ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Instruction* cs);
163
- ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode, const Instruction* cs);
162
+ ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode, const SVFInstruction* cs);
163
+ ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode, const SVFInstruction* cs);
164
164
  //@}
165
165
 
166
166
  /// sanitize Intra edges, verify that both nodes belong to the same function.
@@ -194,13 +194,13 @@ public:
194
194
  /// Get a basic block ICFGNode
195
195
  /// TODO:: need to fix the assertions
196
196
  //@{
197
- ICFGNode* getICFGNode(const Instruction* inst);
197
+ ICFGNode* getICFGNode(const SVFInstruction* inst);
198
198
 
199
- CallICFGNode* getCallICFGNode(const Instruction* inst);
199
+ CallICFGNode* getCallICFGNode(const SVFInstruction* inst);
200
200
 
201
- RetICFGNode* getRetICFGNode(const Instruction* inst);
201
+ RetICFGNode* getRetICFGNode(const SVFInstruction* inst);
202
202
 
203
- IntraICFGNode* getIntraICFGNode(const Instruction* inst);
203
+ IntraICFGNode* getIntraICFGNode(const SVFInstruction* inst);
204
204
 
205
205
  FunEntryICFGNode* getFunEntryICFGNode(const SVFFunction* fun);
206
206
 
@@ -220,14 +220,14 @@ public:
220
220
  private:
221
221
 
222
222
  /// Get/Add IntraBlock ICFGNode
223
- inline IntraICFGNode* getIntraBlock(const Instruction* inst)
223
+ inline IntraICFGNode* getIntraBlock(const SVFInstruction* inst)
224
224
  {
225
225
  InstToBlockNodeMapTy::const_iterator it = InstToBlockNodeMap.find(inst);
226
226
  if (it == InstToBlockNodeMap.end())
227
227
  return nullptr;
228
228
  return it->second;
229
229
  }
230
- inline IntraICFGNode* addIntraBlock(const Instruction* inst)
230
+ inline IntraICFGNode* addIntraBlock(const SVFInstruction* inst)
231
231
  {
232
232
  IntraICFGNode* sNode = new IntraICFGNode(totalICFGNode++,inst);
233
233
  addICFGNode(sNode);
@@ -268,14 +268,14 @@ private:
268
268
  }
269
269
 
270
270
  /// Get/Add a call node
271
- inline CallICFGNode* addCallBlock(const Instruction* cs)
271
+ inline CallICFGNode* addCallBlock(const SVFInstruction* cs)
272
272
  {
273
273
  CallICFGNode* sNode = new CallICFGNode(totalICFGNode++, cs);
274
274
  addICFGNode(sNode);
275
275
  CSToCallNodeMap[cs] = sNode;
276
276
  return sNode;
277
277
  }
278
- inline CallICFGNode* getCallBlock(const Instruction* cs)
278
+ inline CallICFGNode* getCallBlock(const SVFInstruction* cs)
279
279
  {
280
280
  CSToCallNodeMapTy::const_iterator it = CSToCallNodeMap.find(cs);
281
281
  if (it == CSToCallNodeMap.end())
@@ -284,14 +284,14 @@ private:
284
284
  }
285
285
 
286
286
  /// Get/Add a return node
287
- inline RetICFGNode* getRetBlock(const Instruction* cs)
287
+ inline RetICFGNode* getRetBlock(const SVFInstruction* cs)
288
288
  {
289
289
  CSToRetNodeMapTy::const_iterator it = CSToRetNodeMap.find(cs);
290
290
  if (it == CSToRetNodeMap.end())
291
291
  return nullptr;
292
292
  return it->second;
293
293
  }
294
- inline RetICFGNode* addRetBlock(const Instruction* cs)
294
+ inline RetICFGNode* addRetBlock(const SVFInstruction* cs)
295
295
  {
296
296
  CallICFGNode* callBlockNode = getCallICFGNode(cs);
297
297
  RetICFGNode* sNode = new RetICFGNode(totalICFGNode++, cs, callBlockNode);
@@ -169,16 +169,16 @@ class CallCFGEdge : public ICFGEdge
169
169
  {
170
170
 
171
171
  private:
172
- const Instruction* cs;
172
+ const SVFInstruction* cs;
173
173
  std::vector<const CallPE*> callPEs;
174
174
  public:
175
175
  /// Constructor
176
- CallCFGEdge(ICFGNode* s, ICFGNode* d, const Instruction* c):
176
+ CallCFGEdge(ICFGNode* s, ICFGNode* d, const SVFInstruction* c):
177
177
  ICFGEdge(s,d,CallCF),cs(c)
178
178
  {
179
179
  }
180
180
  /// Return callsite ID
181
- inline const Instruction* getCallSite() const
181
+ inline const SVFInstruction* getCallSite() const
182
182
  {
183
183
  return cs;
184
184
  }
@@ -217,16 +217,16 @@ class RetCFGEdge : public ICFGEdge
217
217
  {
218
218
 
219
219
  private:
220
- const Instruction* cs;
220
+ const SVFInstruction* cs;
221
221
  const RetPE* retPE;
222
222
  public:
223
223
  /// Constructor
224
- RetCFGEdge(ICFGNode* s, ICFGNode* d, const Instruction* c):
224
+ RetCFGEdge(ICFGNode* s, ICFGNode* d, const SVFInstruction* c):
225
225
  ICFGEdge(s,d,RetCF),cs(c),retPE(nullptr)
226
226
  {
227
227
  }
228
228
  /// Return callsite ID
229
- inline const Instruction* getCallSite() const
229
+ inline const SVFInstruction* getCallSite() const
230
230
  {
231
231
  return cs;
232
232
  }
@@ -83,7 +83,7 @@ public:
83
83
  }
84
84
 
85
85
  /// Return the function of this ICFGNode
86
- virtual const BasicBlock* getBB() const
86
+ virtual const SVFBasicBlock* getBB() const
87
87
  {
88
88
  return bb;
89
89
  }
@@ -130,7 +130,7 @@ public:
130
130
 
131
131
  protected:
132
132
  const SVFFunction* fun;
133
- const BasicBlock* bb;
133
+ const SVFBasicBlock* bb;
134
134
  VFGNodeList VFGNodes; //< a list of VFGNodes
135
135
  SVFStmtList pagEdges; //< a list of PAGEdges
136
136
 
@@ -175,16 +175,16 @@ public:
175
175
  class IntraICFGNode : public ICFGNode
176
176
  {
177
177
  private:
178
- const Instruction *inst;
178
+ const SVFInstruction *inst;
179
179
 
180
180
  public:
181
- IntraICFGNode(NodeID id, const Instruction *i) : ICFGNode(id, IntraBlock), inst(i)
181
+ IntraICFGNode(NodeID id, const SVFInstruction *i) : ICFGNode(id, IntraBlock), inst(i)
182
182
  {
183
- fun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(inst->getFunction());
183
+ fun = inst->getFunction();
184
184
  bb = inst->getParent();
185
185
  }
186
186
 
187
- inline const Instruction *getInst() const
187
+ inline const SVFInstruction *getInst() const
188
188
  {
189
189
  return inst;
190
190
  }
@@ -366,18 +366,18 @@ class CallICFGNode : public InterICFGNode
366
366
  public:
367
367
  typedef std::vector<const SVFVar *> ActualParmNodeVec;
368
368
  private:
369
- const Instruction* cs;
369
+ const SVFInstruction* cs;
370
370
  const RetICFGNode* ret;
371
371
  ActualParmNodeVec APNodes;
372
372
  public:
373
- CallICFGNode(NodeID id, const Instruction* c) : InterICFGNode(id, FunCallBlock), cs(c), ret(nullptr)
373
+ CallICFGNode(NodeID id, const SVFInstruction* c) : InterICFGNode(id, FunCallBlock), cs(c), ret(nullptr)
374
374
  {
375
- fun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(cs->getFunction());
375
+ fun = cs->getFunction();
376
376
  bb = cs->getParent();
377
377
  }
378
378
 
379
379
  /// Return callsite
380
- inline const Instruction* getCallSite() const
380
+ inline const SVFInstruction* getCallSite() const
381
381
  {
382
382
  return cs;
383
383
  }
@@ -398,11 +398,11 @@ public:
398
398
  /// Return callsite
399
399
  inline const SVFFunction* getCaller() const
400
400
  {
401
- return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(cs->getFunction());
401
+ return cs->getFunction();
402
402
  }
403
403
 
404
404
  /// Return Basic Block
405
- inline const BasicBlock* getParent() const
405
+ inline const SVFBasicBlock* getParent() const
406
406
  {
407
407
  return cs->getParent();
408
408
  }
@@ -459,19 +459,19 @@ class RetICFGNode : public InterICFGNode
459
459
  {
460
460
 
461
461
  private:
462
- const Instruction* cs;
462
+ const SVFInstruction* cs;
463
463
  const SVFVar *actualRet;
464
464
  const CallICFGNode* callBlockNode;
465
465
  public:
466
- RetICFGNode(NodeID id, const Instruction* c, CallICFGNode* cb) :
466
+ RetICFGNode(NodeID id, const SVFInstruction* c, CallICFGNode* cb) :
467
467
  InterICFGNode(id, FunRetBlock), cs(c), actualRet(nullptr), callBlockNode(cb)
468
468
  {
469
- fun = LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(cs->getFunction());
469
+ fun = cs->getFunction();
470
470
  bb = cs->getParent();
471
471
  }
472
472
 
473
473
  /// Return callsite
474
- inline const Instruction* getCallSite() const
474
+ inline const SVFInstruction* getCallSite() const
475
475
  {
476
476
  return cs;
477
477
  }
@@ -78,7 +78,7 @@ protected:
78
78
  SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind, const SVFVar* op2);
79
79
 
80
80
  /// Map a value to a set of edges
81
- inline void mapValueToEdge(const Value *V, SVFStmt *edge)
81
+ inline void mapValueToEdge(const Value* V, SVFStmt *edge)
82
82
  {
83
83
  auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
84
84
  if (!inserted.second)
@@ -108,7 +108,7 @@ public:
108
108
  return fromFile;
109
109
  }
110
110
  /// Get all SVFIR Edges that corresponds to an LLVM value
111
- inline const SVFStmtSet& getValueEdges(const Value *V)
111
+ inline const SVFStmtSet& getValueEdges(const Value* V)
112
112
  {
113
113
  auto it = valueToEdgeMap.find(V);
114
114
  if (it == valueToEdgeMap.end())
@@ -121,7 +121,7 @@ public:
121
121
 
122
122
  /// Get SVFIR Node according to LLVM value
123
123
  ///getNode - Return the node corresponding to the specified pointer.
124
- inline NodeID getValueNode(const Value *V)
124
+ inline NodeID getValueNode(const Value* V)
125
125
  {
126
126
  return symInfo->getValSym(V);
127
127
  }
@@ -131,19 +131,19 @@ public:
131
131
  }
132
132
  /// getObject - Return the obj node id refer to the memory object for the
133
133
  /// specified global, heap or alloca instruction according to llvm value.
134
- inline NodeID getObjectNode(const Value *V)
134
+ inline NodeID getObjectNode(const Value* V)
135
135
  {
136
136
  return symInfo->getObjSym(V);
137
137
  }
138
138
  /// GetReturnNode - Return the unique node representing the return value of a function
139
139
  inline NodeID getReturnNode(const SVFFunction* func) const
140
140
  {
141
- return symInfo->getRetSym(func->getLLVMFun());
141
+ return symInfo->getRetSym(func);
142
142
  }
143
143
  /// getVarargNode - Return the unique node representing the variadic argument of a variadic function.
144
144
  inline NodeID getVarargNode(const SVFFunction* func) const
145
145
  {
146
- return symInfo->getVarargSym(func->getLLVMFun());
146
+ return symInfo->getVarargSym(func);
147
147
  }
148
148
  inline NodeID getBlackHoleNode() const
149
149
  {
@@ -163,8 +163,8 @@ class ThreadCallGraph: public PTACallGraph
163
163
  public:
164
164
  typedef Set<const CallICFGNode*> InstSet;
165
165
  typedef InstSet CallSiteSet;
166
- typedef std::vector<const Instruction*> InstVector;
167
- typedef Map<const Instruction*, InstSet> CallToInstMap;
166
+ typedef std::vector<const SVFInstruction*> InstVector;
167
+ typedef Map<const SVFInstruction*, InstSet> CallToInstMap;
168
168
  typedef Set<CallSiteSet*> CtxSet;
169
169
  typedef ThreadForkEdge::ForkEdgeSet ForkEdgeSet;
170
170
  typedef Map<const CallICFGNode*, ForkEdgeSet> CallInstToForkEdgesMap;