svf-lib 1.0.1724 → 1.0.1726

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.
@@ -320,6 +320,7 @@ private:
320
320
  std::vector<const SVFBasicBlock*> allBBs; /// all BasicBlocks of this function
321
321
  std::vector<const SVFArgument*> allArgs; /// all formal arguments of this function
322
322
  std::vector<std::string> annotations; /// annotations of this function
323
+ SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
323
324
 
324
325
  protected:
325
326
  ///@{ attributes to be set only through Module builders e.g., LLVMModule
@@ -412,12 +413,17 @@ public:
412
413
  return allBBs.front();
413
414
  }
414
415
 
416
+ /// Carefully! when you call getExitBB, you need ensure the function has return instruction
417
+ /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
415
418
  inline const SVFBasicBlock* getExitBB() const
416
419
  {
417
420
  assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
418
- return allBBs.back();
421
+ assert((!isNotRet && exitBlock) && "ensure the function has a single basic block containing a return instruction!");
422
+ return exitBlock;
419
423
  }
420
424
 
425
+ void setExitBlock(SVFBasicBlock *bb);
426
+
421
427
  inline const SVFBasicBlock* front() const
422
428
  {
423
429
  return getEntryBlock();
@@ -425,7 +431,11 @@ public:
425
431
 
426
432
  inline const SVFBasicBlock* back() const
427
433
  {
428
- return getExitBB();
434
+ assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
435
+ /// Carefully! 'back' is just the last basic block of function,
436
+ /// but not necessarily a exit basic block
437
+ /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
438
+ return allBBs.back();
429
439
  }
430
440
 
431
441
  inline const_iterator begin() const
@@ -520,6 +530,7 @@ class SVFBasicBlock : public SVFValue
520
530
  friend class SVFIRWriter;
521
531
  friend class SVFIRReader;
522
532
  friend class SVFIRBuilder;
533
+ friend class SVFFunction;
523
534
 
524
535
  public:
525
536
  typedef std::vector<const SVFInstruction*>::const_iterator const_iterator;
@@ -205,6 +205,9 @@ inline bool isArgOfUncalledFunction (const Value* val)
205
205
  }
206
206
  //@}
207
207
 
208
+ /// Return true if the function has a return instruction
209
+ bool basicBlockHasRetInst(const BasicBlock* bb);
210
+
208
211
  /// Return true if the function has a return instruction reachable from function
209
212
  /// entry
210
213
  bool functionDoesNotRet(const Function* fun);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1724",
3
+ "version": "1.0.1726",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {