svf-lib 1.0.1451 → 1.0.1453

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.
@@ -58,7 +58,8 @@ public:
58
58
  NonOverlap, Overlap, Subset, Superset, Same
59
59
  };
60
60
 
61
- typedef std::vector<const SVFVar*> OffsetVarVec;
61
+ typedef std::pair<const SVFVar*, const SVFType*> VarAndGepTypePair;
62
+ typedef std::vector<VarAndGepTypePair> OffsetVarAndGepTypePairs;
62
63
 
63
64
  /// Constructor
64
65
  LocationSet(s32_t o = 0) : fldIdx(o)
@@ -66,7 +67,7 @@ public:
66
67
 
67
68
  /// Copy Constructor
68
69
  LocationSet(const LocationSet& ls)
69
- : fldIdx(ls.fldIdx), offsetVars(ls.getOffsetVarVec())
70
+ : fldIdx(ls.fldIdx), offsetVarAndGepTypePairs(ls.getOffsetVarAndGepTypePairVec())
70
71
  {
71
72
  }
72
73
 
@@ -79,13 +80,13 @@ public:
79
80
  inline const LocationSet& operator= (const LocationSet& rhs)
80
81
  {
81
82
  fldIdx = rhs.fldIdx;
82
- offsetVars = rhs.getOffsetVarVec();
83
+ offsetVarAndGepTypePairs = rhs.getOffsetVarAndGepTypePairVec();
83
84
  return *this;
84
85
  }
85
86
  inline bool operator==(const LocationSet& rhs) const
86
87
  {
87
88
  return this->fldIdx == rhs.fldIdx
88
- && this->offsetVars == rhs.offsetVars;
89
+ && this->offsetVarAndGepTypePairs == rhs.offsetVarAndGepTypePairs;
89
90
  }
90
91
  //@}
91
92
 
@@ -99,9 +100,9 @@ public:
99
100
  {
100
101
  fldIdx = idx;
101
102
  }
102
- inline const OffsetVarVec& getOffsetVarVec() const
103
+ inline const OffsetVarAndGepTypePairs& getOffsetVarAndGepTypePairVec() const
103
104
  {
104
- return offsetVars;
105
+ return offsetVarAndGepTypePairs;
105
106
  }
106
107
  //@}
107
108
 
@@ -112,7 +113,7 @@ public:
112
113
  u32_t getElementNum(const SVFType* type) const;
113
114
 
114
115
 
115
- bool addOffsetVar(const SVFVar* var);
116
+ bool addOffsetVarAndGepTypePair(const SVFVar* var, const SVFType* gepIterType);
116
117
 
117
118
  /// Return TRUE if this is a constant location set.
118
119
  bool isConstantOffset() const;
@@ -135,7 +136,7 @@ private:
135
136
  NodeBS computeAllLocations() const;
136
137
 
137
138
  s32_t fldIdx; ///< Accumulated Constant Offsets
138
- OffsetVarVec offsetVars; ///< a vector of actual offset in the form of SVF Vars
139
+ OffsetVarAndGepTypePairs offsetVarAndGepTypePairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>s
139
140
  };
140
141
 
141
142
  } // End namespace SVF
@@ -145,8 +146,8 @@ template <> struct std::hash<SVF::LocationSet>
145
146
  size_t operator()(const SVF::LocationSet &ls) const
146
147
  {
147
148
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
148
- std::hash<SVF::LocationSet::OffsetVarVec> v;
149
- return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetVarVec())));
149
+ std::hash<SVF::LocationSet::OffsetVarAndGepTypePairs> v;
150
+ return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetVarAndGepTypePairVec())));
150
151
  }
151
152
  };
152
153
 
@@ -444,9 +444,9 @@ public:
444
444
  {
445
445
  return ls;
446
446
  }
447
- inline const LocationSet::OffsetVarVec getOffsetVarVec() const
447
+ inline const LocationSet::OffsetVarAndGepTypePairs getOffsetVarAndGepTypePairVec() const
448
448
  {
449
- return getLocationSet().getOffsetVarVec();
449
+ return getLocationSet().getOffsetVarAndGepTypePairVec();
450
450
  }
451
451
  /// Return TRUE if this is a constant location set.
452
452
  inline bool isConstantOffset() const
@@ -306,7 +306,7 @@ public:
306
306
  /// Get location set of the gep edge
307
307
  inline s32_t getConstantFieldIdx() const
308
308
  {
309
- return ls.accumulateConstantFieldIdx();
309
+ return ls.getConstantFieldIdx();
310
310
  }
311
311
 
312
312
  };
@@ -92,7 +92,7 @@ public:
92
92
 
93
93
  /// Get methods
94
94
  //@{
95
- inline s32_t accumulateConstantFieldIdx() const
95
+ inline s32_t getConstantFieldIdx() const
96
96
  {
97
97
  return fldIdx;
98
98
  }
@@ -107,7 +107,7 @@ public:
107
107
  //@}
108
108
 
109
109
  /// Return accumulated constant offset given OffsetVarVec
110
- s32_t accumulateConstantOffset() const;
110
+ s32_t computeConstantOffset() const;
111
111
 
112
112
  /// Return element number of a type.
113
113
  u32_t getElementNum(const SVFType* type) const;
@@ -147,7 +147,7 @@ template <> struct std::hash<SVF::LocationSet>
147
147
  {
148
148
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
149
149
  std::hash<SVF::LocationSet::OffsetVarAndGepTypePairs> v;
150
- return h(std::make_pair(ls.accumulateConstantFieldIdx(), v(ls.getOffsetVarAndGepTypePairVec())));
150
+ return h(std::make_pair(ls.getConstantFieldIdx(), v(ls.getOffsetVarAndGepTypePairVec())));
151
151
  }
152
152
  };
153
153
 
@@ -456,13 +456,13 @@ public:
456
456
  /// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
457
457
  inline s32_t accumulateConstantOffset() const
458
458
  {
459
- return getLocationSet().accumulateConstantOffset();
459
+ return getLocationSet().computeConstantOffset();
460
460
  }
461
461
  /// Field index of the gep statement if it access the field of a struct
462
462
  inline s32_t getConstantFieldIdx() const
463
463
  {
464
464
  assert(isVariantFieldGep()==false && "Can't retrieve the LocationSet if using a variable field index (pointer arithmetic) for struct field access ");
465
- return getLocationSet().accumulateConstantFieldIdx();
465
+ return getLocationSet().getConstantFieldIdx();
466
466
  }
467
467
  /// Gep statement with a variant field index (pointer arithmetic) for struct field access
468
468
  inline bool isVariantFieldGep() const
@@ -399,7 +399,7 @@ public:
399
399
  /// offset of the base value variable
400
400
  inline s32_t getConstantFieldIdx() const
401
401
  {
402
- return ls.accumulateConstantFieldIdx();
402
+ return ls.getConstantFieldIdx();
403
403
  }
404
404
 
405
405
  /// Return name of a LLVM value
@@ -466,7 +466,7 @@ public:
466
466
  /// offset of the mem object
467
467
  inline s32_t getConstantFieldIdx() const
468
468
  {
469
- return ls.accumulateConstantFieldIdx();
469
+ return ls.getConstantFieldIdx();
470
470
  }
471
471
 
472
472
  /// Set the base object from which this GEP node came from.
@@ -484,15 +484,15 @@ public:
484
484
  /// Return the type of this gep object
485
485
  inline virtual const SVFType* getType() const
486
486
  {
487
- return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(mem->getType(), ls.accumulateConstantFieldIdx());
487
+ return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(mem->getType(), ls.getConstantFieldIdx());
488
488
  }
489
489
 
490
490
  /// Return name of a LLVM value
491
491
  inline const std::string getValueName() const
492
492
  {
493
493
  if (value)
494
- return value->getName() + "_" + std::to_string(ls.accumulateConstantFieldIdx());
495
- return "offset_" + std::to_string(ls.accumulateConstantFieldIdx());
494
+ return value->getName() + "_" + std::to_string(ls.getConstantFieldIdx());
495
+ return "offset_" + std::to_string(ls.getConstantFieldIdx());
496
496
  }
497
497
 
498
498
  virtual const std::string toString() const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1451",
3
+ "version": "1.0.1453",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {