svf-lib 1.0.764 → 1.0.765

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.
@@ -291,7 +291,7 @@ public:
291
291
  inline bool isZeroOffsettedGepCGEdge(ConstraintEdge *edge) const
292
292
  {
293
293
  if (NormalGepCGEdge *normalGepCGEdge = SVFUtil::dyn_cast<NormalGepCGEdge>(edge))
294
- if (0 == normalGepCGEdge->getOffset())
294
+ if (0 == normalGepCGEdge->getFieldOffset())
295
295
  return true;
296
296
  return false;
297
297
  }
@@ -304,9 +304,9 @@ public:
304
304
  }
305
305
 
306
306
  /// Get location set of the gep edge
307
- inline Size_t getOffset() const
307
+ inline Size_t getFieldOffset() const
308
308
  {
309
- return ls.accumulateConstantOffset();
309
+ return ls.accumulateConstantFieldIdx();
310
310
  }
311
311
  };
312
312
 
@@ -104,7 +104,7 @@ public:
104
104
  inline LocationSet operator+ (const LocationSet& rhs) const
105
105
  {
106
106
  LocationSet ls(rhs);
107
- ls.fldIdx += accumulateConstantOffset();
107
+ ls.fldIdx += accumulateConstantFieldIdx();
108
108
  OffsetValueVec::const_iterator it = getOffsetValueVec().begin();
109
109
  OffsetValueVec::const_iterator eit = getOffsetValueVec().end();
110
110
  for (; it != eit; ++it)
@@ -151,7 +151,7 @@ public:
151
151
 
152
152
  /// Get methods
153
153
  //@{
154
- inline Size_t accumulateConstantOffset() const
154
+ inline Size_t accumulateConstantFieldIdx() const
155
155
  {
156
156
  return fldIdx;
157
157
  }
@@ -203,7 +203,7 @@ template <> struct std::hash<SVF::LocationSet> {
203
203
  size_t operator()(const SVF::LocationSet &ls) const {
204
204
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
205
205
  std::hash<SVF::LocationSet::OffsetValueVec> v;
206
- return h(std::make_pair(ls.accumulateConstantOffset(), v(ls.getOffsetValueVec())));
206
+ return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetValueVec())));
207
207
  }
208
208
  };
209
209
 
@@ -651,7 +651,7 @@ private:
651
651
  /// Add Offset(Gep) edge
652
652
  NormalGepStmt* addNormalGepStmt(NodeID src, NodeID dst, const LocationSet& ls);
653
653
  /// Add Variant(Gep) edge
654
- VariantGepStmt* addVariantGepStmt(NodeID src, NodeID dst);
654
+ VariantGepStmt* addVariantGepStmt(NodeID src, NodeID dst, const LocationSet& ls);
655
655
  /// Add Thread fork edge for parameter passing
656
656
  TDForkPE* addThreadForkPE(NodeID src, NodeID dst, const CallBlockNode* cs);
657
657
  /// Add Thread join edge for parameter passing
@@ -664,7 +664,7 @@ public:
664
664
 
665
665
 
666
666
  /*!
667
- * Gep statement for field access and pointer arithmetic
667
+ * Gep statement for struct field access, array access and pointer arithmetic
668
668
  */
669
669
  class GepStmt: public SVFStmt
670
670
  {
@@ -673,6 +673,8 @@ private:
673
673
  GepStmt(const GepStmt &); ///< place holder
674
674
  void operator=(const GepStmt &); ///< place holder
675
675
 
676
+ LocationSet ls; ///< location set of the gep edge
677
+
676
678
  public:
677
679
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
678
680
  //@{
@@ -692,19 +694,24 @@ public:
692
694
  }
693
695
  //@}
694
696
 
697
+ inline const LocationSet& getLocationSet() const
698
+ {
699
+ return ls;
700
+ }
701
+
695
702
  protected:
696
703
  /// constructor
697
- GepStmt(SVFVar* s, SVFVar* d, PEDGEK k) : SVFStmt(s,d,k)
704
+ GepStmt(SVFVar* s, SVFVar* d, const LocationSet& l, PEDGEK k) : SVFStmt(s,d,k), ls(l)
698
705
  {
699
-
700
706
  }
701
707
 
702
708
  virtual const std::string toString() const;
709
+
703
710
  };
704
711
 
705
712
 
706
713
  /*!
707
- * Gep statement with a fixed offset
714
+ * Gep statement with a fixed field index for struct field access
708
715
  */
709
716
  class NormalGepStmt : public GepStmt
710
717
  {
@@ -713,8 +720,6 @@ private:
713
720
  NormalGepStmt(const NormalGepStmt&); ///< place holder
714
721
  void operator=(const NormalGepStmt&); ///< place holder
715
722
 
716
- LocationSet ls; ///< location set of the gep edge
717
-
718
723
  public:
719
724
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
720
725
  //@{
@@ -737,24 +742,20 @@ public:
737
742
  //@}
738
743
 
739
744
  /// constructor
740
- NormalGepStmt(SVFVar* s, SVFVar* d, const LocationSet& l) : GepStmt(s,d,SVFStmt::NormalGep), ls(l)
745
+ NormalGepStmt(SVFVar* s, SVFVar* d, const LocationSet& l) : GepStmt(s,d,l, SVFStmt::NormalGep)
741
746
  {}
742
747
 
743
748
  /// offset of the gep edge
744
- inline u32_t getOffset() const
749
+ inline u32_t getFieldOffset() const
745
750
  {
746
- return ls.accumulateConstantOffset();
747
- }
748
- inline const LocationSet& getLocationSet() const
749
- {
750
- return ls;
751
+ return getLocationSet().accumulateConstantFieldIdx();
751
752
  }
752
753
 
753
754
  virtual const std::string toString() const override;
754
755
  };
755
756
 
756
757
  /*!
757
- * Gep statement with a variant offset
758
+ * Gep statement with a variant field index for struct field access
758
759
  */
759
760
  class VariantGepStmt : public GepStmt
760
761
  {
@@ -785,7 +786,7 @@ public:
785
786
  //@}
786
787
 
787
788
  /// constructor
788
- VariantGepStmt(SVFVar* s, SVFVar* d) : GepStmt(s,d,SVFStmt::VariantGep) {}
789
+ VariantGepStmt(SVFVar* s, SVFVar* d, const LocationSet& l) : GepStmt(s,d,l, SVFStmt::VariantGep) {}
789
790
 
790
791
  virtual const std::string toString() const override;
791
792
 
@@ -417,17 +417,17 @@ public:
417
417
  }
418
418
 
419
419
  /// offset of the base value variable
420
- inline u32_t getOffset() const
420
+ inline u32_t getFieldOffset() const
421
421
  {
422
- return ls.accumulateConstantOffset();
422
+ return ls.accumulateConstantFieldIdx();
423
423
  }
424
424
 
425
425
  /// Return name of a LLVM value
426
426
  inline const std::string getValueName() const
427
427
  {
428
428
  if (value && value->hasName())
429
- return value->getName().str() + "_" + llvm::utostr(getOffset());
430
- return "offset_" + llvm::utostr(getOffset());
429
+ return value->getName().str() + "_" + llvm::utostr(getFieldOffset());
430
+ return "offset_" + llvm::utostr(getFieldOffset());
431
431
  }
432
432
 
433
433
  inline const Type* getType() const
@@ -492,9 +492,9 @@ public:
492
492
  }
493
493
 
494
494
  /// offset of the mem object
495
- inline u32_t getOffset() const
495
+ inline u32_t getFieldOffset() const
496
496
  {
497
- return ls.accumulateConstantOffset();
497
+ return ls.accumulateConstantFieldIdx();
498
498
  }
499
499
 
500
500
  /// Set the base object from which this GEP node came from.
@@ -512,15 +512,15 @@ public:
512
512
  /// Return the type of this gep object
513
513
  inline virtual const Type* getType() const
514
514
  {
515
- return SymbolTableInfo::SymbolInfo()->getOriginalFieldType(mem->getType(), ls.accumulateConstantOffset());
515
+ return SymbolTableInfo::SymbolInfo()->getOriginalFieldType(mem->getType(), ls.accumulateConstantFieldIdx());
516
516
  }
517
517
 
518
518
  /// Return name of a LLVM value
519
519
  inline const std::string getValueName() const
520
520
  {
521
521
  if (value && value->hasName())
522
- return value->getName().str() + "_" + llvm::itostr(ls.accumulateConstantOffset());
523
- return "offset_" + llvm::itostr(ls.accumulateConstantOffset());
522
+ return value->getName().str() + "_" + llvm::itostr(ls.accumulateConstantFieldIdx());
523
+ return "offset_" + llvm::itostr(ls.accumulateConstantFieldIdx());
524
524
  }
525
525
 
526
526
  virtual const std::string toString() const;
@@ -46,18 +46,18 @@ public:
46
46
  {
47
47
  }
48
48
 
49
- unsigned int getOffset(void) const
49
+ u32_t getFieldOffset(void) const
50
50
  {
51
51
  return offset;
52
52
  }
53
53
 
54
- void setOffset(unsigned int offset)
54
+ void setOffset(u32_t offset)
55
55
  {
56
56
  this->offset = offset;
57
57
  }
58
58
 
59
59
  private:
60
- unsigned int offset;
60
+ u32_t offset;
61
61
  };
62
62
 
63
63
  class DCHNode : public GenericNode<DCHNode, DCHEdge>
@@ -381,9 +381,9 @@ public:
381
381
  return edge;
382
382
  }
383
383
  /// Add Variant(Gep) edge
384
- inline VariantGepStmt* addVariantGepEdge(NodeID src, NodeID dst)
384
+ inline VariantGepStmt* addVariantGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
385
385
  {
386
- VariantGepStmt *edge = pag->addVariantGepStmt(src, dst);
386
+ VariantGepStmt *edge = pag->addVariantGepStmt(src, dst, ls);
387
387
  setCurrentBBAndValueForPAGEdge(edge);
388
388
  return edge;
389
389
  }
@@ -64,7 +64,7 @@ private:
64
64
  void writePAGgepNode(SVF::NodeID nodeId, GepObjVar* gepNode)
65
65
  {
66
66
  auto baseNodeId = gepNode->getBaseNode();
67
- auto locationSetOffset = gepNode->getOffset();
67
+ auto locationSetOffset = gepNode->getFieldOffset();
68
68
 
69
69
  LLVMContext &context = mainModule->getContext();
70
70
  llvm::SmallVector<llvm::Metadata *, 32> operands;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.764",
3
+ "version": "1.0.765",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {