svf-lib 1.0.2126 → 1.0.2128

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
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -172,6 +172,49 @@ protected:
172
172
  }
173
173
  }
174
174
 
175
+ virtual inline IntraICFGNode* addIntraICFGNode(const SVFBasicBlock* bb, bool isRet)
176
+ {
177
+ IntraICFGNode* intraIcfgNode =
178
+ new IntraICFGNode(totalICFGNode++, bb, isRet);
179
+ addICFGNode(intraIcfgNode);
180
+ return intraIcfgNode;
181
+ }
182
+
183
+ virtual inline CallICFGNode* addCallICFGNode(
184
+ const SVFBasicBlock* bb, const SVFType* ty,
185
+ const SVFFunction* calledFunc, bool isVararg, bool isvcall,
186
+ s32_t vcallIdx, const std::string& funNameOfVcall)
187
+ {
188
+
189
+ CallICFGNode* callICFGNode =
190
+ new CallICFGNode(totalICFGNode++, bb, ty, calledFunc, isVararg,
191
+ isvcall, vcallIdx, funNameOfVcall);
192
+ addICFGNode(callICFGNode);
193
+ return callICFGNode;
194
+ }
195
+
196
+ virtual inline RetICFGNode* addRetICFGNode(CallICFGNode* call)
197
+ {
198
+ RetICFGNode* retICFGNode = new RetICFGNode(totalICFGNode++, call);
199
+ call->setRetICFGNode(retICFGNode);
200
+ addICFGNode(retICFGNode);
201
+ return retICFGNode;
202
+ }
203
+
204
+ virtual inline FunEntryICFGNode* addFunEntryICFGNode(const SVFFunction* svfFunc)
205
+ {
206
+ FunEntryICFGNode* sNode = new FunEntryICFGNode(totalICFGNode++,svfFunc);
207
+ addICFGNode(sNode);
208
+ return FunToFunEntryNodeMap[svfFunc] = sNode;
209
+ }
210
+
211
+ virtual inline FunExitICFGNode* addFunExitICFGNode(const SVFFunction* svfFunc)
212
+ {
213
+ FunExitICFGNode* sNode = new FunExitICFGNode(totalICFGNode++, svfFunc);
214
+ addICFGNode(sNode);
215
+ return FunToFunExitNodeMap[svfFunc] = sNode;
216
+ }
217
+
175
218
  /// Add a ICFG node
176
219
  virtual inline void addICFGNode(ICFGNode* node)
177
220
  {
@@ -428,19 +428,28 @@ public:
428
428
  typedef std::vector<const SVFVar *> ActualParmNodeVec;
429
429
 
430
430
  protected:
431
- const SVFInstruction* cs;
432
431
  const RetICFGNode* ret;
433
- ActualParmNodeVec APNodes;
432
+ ActualParmNodeVec APNodes; /// arguments
433
+ const SVFFunction* calledFunc; /// called function
434
+ bool isvararg; /// is variable argument
435
+ bool isVirCallInst; /// is virtual call inst
436
+ SVFVar* vtabPtr; /// virtual table pointer
437
+ s32_t virtualFunIdx; /// virtual function index of the virtual table(s) at a virtual call
438
+ std::string funNameOfVcall; /// the function name of this virtual call
434
439
 
435
440
  /// Constructor to create empty CallICFGNode (for SVFIRReader/deserialization)
436
- CallICFGNode(NodeID id) : InterICFGNode(id, FunCallBlock), cs{}, ret{} {}
441
+ CallICFGNode(NodeID id) : InterICFGNode(id, FunCallBlock), ret{} {}
437
442
 
438
443
  public:
439
- CallICFGNode(NodeID id, const SVFInstruction* c, const SVFType* ty)
440
- : InterICFGNode(id, FunCallBlock), cs(c), ret(nullptr)
444
+ CallICFGNode(NodeID id, const SVFBasicBlock* b, const SVFType* ty,
445
+ const SVFFunction* cf, bool iv, bool ivc, s32_t vfi,
446
+ const std::string& fnv)
447
+ : InterICFGNode(id, FunCallBlock), ret(nullptr), calledFunc(cf),
448
+ isvararg(iv), isVirCallInst(ivc), vtabPtr(nullptr),
449
+ virtualFunIdx(vfi), funNameOfVcall(fnv)
441
450
  {
442
- fun = cs->getFunction();
443
- bb = cs->getParent();
451
+ fun = b->getFunction();
452
+ bb = b;
444
453
  type = ty;
445
454
  }
446
455
 
@@ -472,7 +481,7 @@ public:
472
481
  /// Return true if this is an indirect call
473
482
  inline bool isIndirectCall() const
474
483
  {
475
- return nullptr == SVFUtil::cast<SVFCallInst>(cs)->getCalledFunction();
484
+ return nullptr == calledFunc;
476
485
  }
477
486
 
478
487
  /// Return the set of actual parameters
@@ -488,54 +497,61 @@ public:
488
497
  }
489
498
  /// Parameter operations
490
499
  //@{
491
- const SVFVar* getArgument(u32_t ArgNo) const
500
+ inline const SVFVar* getArgument(u32_t ArgNo) const
492
501
  {
493
502
  return getActualParms()[ArgNo];
494
503
  }
495
504
 
496
- u32_t arg_size() const
505
+ inline u32_t arg_size() const
497
506
  {
498
507
  return APNodes.size();
499
508
  }
500
- bool arg_empty() const
509
+ inline bool arg_empty() const
501
510
  {
502
511
  return APNodes.empty();
503
512
  }
504
513
 
505
- u32_t getNumArgOperands() const
514
+ inline u32_t getNumArgOperands() const
506
515
  {
507
516
  return arg_size();
508
517
  }
509
- const SVFFunction* getCalledFunction() const
518
+ inline const SVFFunction* getCalledFunction() const
510
519
  {
511
- return SVFUtil::cast<SVFCallInst>(cs)->getCalledFunction();
520
+ return calledFunc;
512
521
  }
513
- const SVFValue* getCalledValue() const
522
+
523
+ inline bool isVarArg() const
514
524
  {
515
- return SVFUtil::cast<SVFCallInst>(cs)->getCalledOperand();
525
+ return isvararg;
516
526
  }
517
- bool isVarArg() const
527
+ inline bool isVirtualCall() const
518
528
  {
519
- return SVFUtil::cast<SVFCallInst>(cs)->isVarArg();
529
+ return isVirCallInst;
520
530
  }
521
- bool isVirtualCall() const
531
+
532
+ inline void setVtablePtr(SVFVar* v)
522
533
  {
523
- return SVFUtil::isa<SVFVirtualCallInst>(cs);
534
+ vtabPtr = v;
524
535
  }
525
- const SVFValue* getVtablePtr() const
536
+
537
+ inline const SVFVar* getVtablePtr() const
526
538
  {
527
539
  assert(isVirtualCall() && "not a virtual call?");
528
- return SVFUtil::cast<SVFVirtualCallInst>(cs)->getVtablePtr();
540
+ return vtabPtr;
529
541
  }
530
- s32_t getFunIdxInVtable() const
542
+
543
+
544
+ inline s32_t getFunIdxInVtable() const
531
545
  {
532
546
  assert(isVirtualCall() && "not a virtual call?");
533
- return SVFUtil::cast<SVFVirtualCallInst>(cs)->getFunIdxInVtable();
547
+ assert(virtualFunIdx >=0 && "virtual function idx is less than 0? not set yet?");
548
+ return virtualFunIdx;
534
549
  }
535
- const std::string& getFunNameOfVirtualCall() const
550
+
551
+ inline const std::string& getFunNameOfVirtualCall() const
536
552
  {
537
553
  assert(isVirtualCall() && "not a virtual call?");
538
- return SVFUtil::cast<SVFVirtualCallInst>(cs)->getFunNameOfVirtualCall();
554
+ return funNameOfVcall;
539
555
  }
540
556
  //@}
541
557
 
@@ -585,23 +601,22 @@ class RetICFGNode : public InterICFGNode
585
601
  friend class SVFIRReader;
586
602
 
587
603
  private:
588
- const SVFInstruction* cs;
589
604
  const SVFVar *actualRet;
590
605
  const CallICFGNode* callBlockNode;
591
606
 
592
607
  /// Constructor to create empty RetICFGNode (for SVFIRReader/deserialization)
593
608
  RetICFGNode(NodeID id)
594
- : InterICFGNode(id, FunRetBlock), cs{}, actualRet{}, callBlockNode{}
609
+ : InterICFGNode(id, FunRetBlock), actualRet{}, callBlockNode{}
595
610
  {
596
611
  }
597
612
 
598
613
  public:
599
- RetICFGNode(NodeID id, const SVFInstruction* c, CallICFGNode* cb) :
600
- InterICFGNode(id, FunRetBlock), cs(c), actualRet(nullptr), callBlockNode(cb)
614
+ RetICFGNode(NodeID id, CallICFGNode* cb) :
615
+ InterICFGNode(id, FunRetBlock), actualRet(nullptr), callBlockNode(cb)
601
616
  {
602
- fun = cs->getFunction();
603
- bb = cs->getParent();
604
- type = callBlockNode->getType();
617
+ fun = cb->getFun();
618
+ bb = cb->getBB();
619
+ type = cb->getType();
605
620
  }
606
621
 
607
622
  inline const CallICFGNode* getCallICFGNode() const
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -58,11 +58,11 @@ private:
58
58
  public:
59
59
  typedef FIFOWorkList<const Instruction*> WorkList;
60
60
 
61
- ICFGBuilder(ICFG* i): icfg(i)
61
+ ICFGBuilder(): icfg(new ICFG())
62
62
  {
63
63
 
64
64
  }
65
- void build();
65
+ ICFG* build();
66
66
 
67
67
  private:
68
68
 
@@ -76,6 +76,7 @@ private:
76
76
  static bool preProcessed;
77
77
  SymbolTableInfo* symInfo;
78
78
  SVFModule* svfModule; ///< Borrowed from singleton SVFModule::svfModule
79
+ ICFG* icfg;
79
80
  std::unique_ptr<LLVMContext> owned_ctx;
80
81
  std::vector<std::unique_ptr<Module>> owned_modules;
81
82
  std::vector<std::reference_wrapper<Module>> modules;
@@ -362,6 +363,11 @@ public:
362
363
 
363
364
  ObjTypeInference* getTypeInference();
364
365
 
366
+ inline ICFG* getICFG()
367
+ {
368
+ return icfg;
369
+ }
370
+
365
371
  private:
366
372
  /// Create SVFTypes
367
373
  SVFType* addSVFTypeInfo(const Type* t);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2126",
3
+ "version": "1.0.2128",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {