svf-lib 1.0.1726 → 1.0.1728

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.
@@ -341,13 +341,13 @@ public:
341
341
  return fun;
342
342
  }
343
343
 
344
- /// Return actual return parameter
344
+ /// Return formal return parameter
345
345
  inline const SVFVar *getFormalRet() const
346
346
  {
347
347
  return formalRet;
348
348
  }
349
349
 
350
- /// Add actual return parameter
350
+ /// Add formal return parameter
351
351
  inline void addFormalRet(const SVFVar *fr)
352
352
  {
353
353
  formalRet = fr;
@@ -418,7 +418,7 @@ public:
418
418
  inline const SVFBasicBlock* getExitBB() const
419
419
  {
420
420
  assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
421
- assert((!isNotRet && exitBlock) && "ensure the function has a single basic block containing a return instruction!");
421
+ assert((hasReturn() && exitBlock) && "ensure the function has a single basic block containing a return instruction!");
422
422
  return exitBlock;
423
423
  }
424
424
 
@@ -463,9 +463,9 @@ public:
463
463
  return isUncalled;
464
464
  }
465
465
 
466
- inline bool isNotRetFunction() const
466
+ inline bool hasReturn() const
467
467
  {
468
- return isNotRet;
468
+ return !isNotRet;
469
469
  }
470
470
 
471
471
  inline const std::vector<std::string>& getAnnotations() const
@@ -318,6 +318,7 @@ private:
318
318
  std::vector<const SVFBasicBlock*> allBBs; /// all BasicBlocks of this function
319
319
  std::vector<const SVFArgument*> allArgs; /// all formal arguments of this function
320
320
  std::vector<std::string> annotations; /// annotations of this function
321
+ SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
321
322
 
322
323
  protected:
323
324
  ///@{ attributes to be set only through Module builders e.g., LLVMModule
@@ -410,12 +411,17 @@ public:
410
411
  return allBBs.front();
411
412
  }
412
413
 
414
+ /// Carefully! when you call getExitBB, you need ensure the function has return instruction
415
+ /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
413
416
  inline const SVFBasicBlock* getExitBB() const
414
417
  {
415
418
  assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
416
- return allBBs.back();
419
+ assert((!isNotRet && exitBlock) && "ensure the function has a single basic block containing a return instruction!");
420
+ return exitBlock;
417
421
  }
418
422
 
423
+ void setExitBlock(SVFBasicBlock *bb);
424
+
419
425
  inline const SVFBasicBlock* front() const
420
426
  {
421
427
  return getEntryBlock();
@@ -423,7 +429,11 @@ public:
423
429
 
424
430
  inline const SVFBasicBlock* back() const
425
431
  {
426
- return getExitBB();
432
+ assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
433
+ /// Carefully! 'back' is just the last basic block of function,
434
+ /// but not necessarily a exit basic block
435
+ /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
436
+ return allBBs.back();
427
437
  }
428
438
 
429
439
  inline const_iterator begin() const
@@ -518,6 +528,7 @@ class SVFBasicBlock : public SVFValue
518
528
  friend class SVFIRWriter;
519
529
  friend class SVFIRReader;
520
530
  friend class SVFIRBuilder;
531
+ friend class SVFFunction;
521
532
 
522
533
  public:
523
534
  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.1726",
3
+ "version": "1.0.1728",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {