svf-lib 1.0.1729 → 1.0.1731

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.
@@ -73,11 +73,8 @@ public:
73
73
  /// Return the field address given a pointer points to a struct object and an offset
74
74
  VAddrs getGepObjAddress(u32_t pointer, APOffset offset);
75
75
 
76
- /// Return the byte offset from one gep param offset
77
- IntervalValue getByteOffsetfromGepTypePair(const AccessPath::IdxVarAndGepTypePair& gep_pair, const GepStmt *gep);
78
-
79
- /// Return the Index offset from one gep param offset
80
- IntervalValue getItvOfFlattenedElemIndexFromGepTypePair(const AccessPath::IdxVarAndGepTypePair& gep_pair, const GepStmt *gep);
76
+ /// Return the value range of Integer SVF Type, e.g. unsigned i8 Type->[0, 255], signed i8 Type->[-128, 127]
77
+ IntervalValue getRangeLimitFromType(const SVFType* type);
81
78
 
82
79
  /// Return the byte offset expression of a GepStmt
83
80
  /// elemBytesize is the element byte size of an static alloc or heap alloc array
@@ -61,8 +61,8 @@ public:
61
61
  NonOverlap, Overlap, Subset, Superset, Same
62
62
  };
63
63
 
64
- typedef std::pair<const SVFVar*, const SVFType*> IdxVarAndGepTypePair;
65
- typedef std::vector<IdxVarAndGepTypePair> IdxVarAndGepTypePairs;
64
+ typedef std::pair<const SVFVar*, const SVFType*> IdxOperandPair;
65
+ typedef std::vector<IdxOperandPair> IdxOperandPairs;
66
66
 
67
67
  /// Constructor
68
68
  AccessPath(APOffset o = 0) : fldIdx(o) {}
@@ -70,7 +70,7 @@ public:
70
70
  /// Copy Constructor
71
71
  AccessPath(const AccessPath& ap)
72
72
  : fldIdx(ap.fldIdx),
73
- offsetVarAndGepTypePairs(ap.getOffsetVarAndGepTypePairVec())
73
+ idxOperandPairs(ap.getIdxOperandPairVec())
74
74
  {
75
75
  }
76
76
 
@@ -83,13 +83,13 @@ public:
83
83
  inline const AccessPath& operator=(const AccessPath& rhs)
84
84
  {
85
85
  fldIdx = rhs.fldIdx;
86
- offsetVarAndGepTypePairs = rhs.getOffsetVarAndGepTypePairVec();
86
+ idxOperandPairs = rhs.getIdxOperandPairVec();
87
87
  return *this;
88
88
  }
89
89
  inline bool operator==(const AccessPath& rhs) const
90
90
  {
91
91
  return this->fldIdx == rhs.fldIdx &&
92
- this->offsetVarAndGepTypePairs == rhs.offsetVarAndGepTypePairs;
92
+ this->idxOperandPairs == rhs.idxOperandPairs;
93
93
  }
94
94
  //@}
95
95
 
@@ -103,9 +103,9 @@ public:
103
103
  {
104
104
  fldIdx = idx;
105
105
  }
106
- inline const IdxVarAndGepTypePairs& getOffsetVarAndGepTypePairVec() const
106
+ inline const IdxOperandPairs& getIdxOperandPairVec() const
107
107
  {
108
- return offsetVarAndGepTypePairs;
108
+ return idxOperandPairs;
109
109
  }
110
110
  //@}
111
111
 
@@ -151,6 +151,9 @@ public:
151
151
  return computeAllLocations().intersects(RHS.computeAllLocations());
152
152
  }
153
153
 
154
+ /// Return byte offset from the beginning of the structure to the field where it is located for struct type
155
+ u32_t getStructFieldOffset(const SVFVar* idxOperandVar, const SVFStructType* idxOperandType) const;
156
+
154
157
  /// Dump location set
155
158
  std::string dump() const;
156
159
 
@@ -163,8 +166,7 @@ private:
163
166
  NodeBS computeAllLocations() const;
164
167
 
165
168
  APOffset fldIdx; ///< Accumulated Constant Offsets
166
- IdxVarAndGepTypePairs
167
- offsetVarAndGepTypePairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>s
169
+ IdxOperandPairs idxOperandPairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>
168
170
  };
169
171
 
170
172
  } // End namespace SVF
@@ -174,9 +176,9 @@ template <> struct std::hash<SVF::AccessPath>
174
176
  size_t operator()(const SVF::AccessPath &ap) const
175
177
  {
176
178
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
177
- std::hash<SVF::AccessPath::IdxVarAndGepTypePairs> v;
179
+ std::hash<SVF::AccessPath::IdxOperandPairs> v;
178
180
  return h(std::make_pair(ap.getConstantFieldIdx(),
179
- v(ap.getOffsetVarAndGepTypePairVec())));
181
+ v(ap.getIdxOperandPairVec())));
180
182
  }
181
183
  };
182
184
 
@@ -492,10 +492,9 @@ public:
492
492
  {
493
493
  return ap;
494
494
  }
495
- inline const AccessPath::IdxVarAndGepTypePairs
496
- getOffsetVarAndGepTypePairVec() const
495
+ inline const AccessPath::IdxOperandPairs getOffsetVarAndGepTypePairVec() const
497
496
  {
498
- return getAccessPath().getOffsetVarAndGepTypePairVec();
497
+ return getAccessPath().getIdxOperandPairVec();
499
498
  }
500
499
  /// Return TRUE if this is a constant location set.
501
500
  inline bool isConstantOffset() const
@@ -73,11 +73,8 @@ public:
73
73
  /// Return the field address given a pointer points to a struct object and an offset
74
74
  VAddrs getGepObjAddress(u32_t pointer, APOffset offset);
75
75
 
76
- /// Return the byte offset from one gep param offset
77
- IntervalValue getByteOffsetfromGepTypePair(const AccessPath::IdxVarAndGepTypePair& gep_pair, const GepStmt *gep);
78
-
79
- /// Return the Index offset from one gep param offset
80
- IntervalValue getItvOfFlattenedElemIndexFromGepTypePair(const AccessPath::IdxVarAndGepTypePair& gep_pair, const GepStmt *gep);
76
+ /// Return the value range of Integer SVF Type, e.g. unsigned i8 Type->[0, 255], signed i8 Type->[-128, 127]
77
+ IntervalValue getRangeLimitFromType(const SVFType* type);
81
78
 
82
79
  /// Return the byte offset expression of a GepStmt
83
80
  /// elemBytesize is the element byte size of an static alloc or heap alloc array
@@ -57,8 +57,8 @@ public:
57
57
  NonOverlap, Overlap, Subset, Superset, Same
58
58
  };
59
59
 
60
- typedef std::pair<const SVFVar*, const SVFType*> IdxVarAndGepTypePair;
61
- typedef std::vector<IdxVarAndGepTypePair> IdxVarAndGepTypePairs;
60
+ typedef std::pair<const SVFVar*, const SVFType*> IdxOperandPair;
61
+ typedef std::vector<IdxOperandPair> IdxOperandPairs;
62
62
 
63
63
  /// Constructor
64
64
  AccessPath(APOffset o = 0) : fldIdx(o) {}
@@ -66,7 +66,7 @@ public:
66
66
  /// Copy Constructor
67
67
  AccessPath(const AccessPath& ap)
68
68
  : fldIdx(ap.fldIdx),
69
- offsetVarAndGepTypePairs(ap.getOffsetVarAndGepTypePairVec())
69
+ idxOperandPairs(ap.getIdxOperandPairVec())
70
70
  {
71
71
  }
72
72
 
@@ -79,13 +79,13 @@ public:
79
79
  inline const AccessPath& operator=(const AccessPath& rhs)
80
80
  {
81
81
  fldIdx = rhs.fldIdx;
82
- offsetVarAndGepTypePairs = rhs.getOffsetVarAndGepTypePairVec();
82
+ idxOperandPairs = rhs.getIdxOperandPairVec();
83
83
  return *this;
84
84
  }
85
85
  inline bool operator==(const AccessPath& rhs) const
86
86
  {
87
87
  return this->fldIdx == rhs.fldIdx &&
88
- this->offsetVarAndGepTypePairs == rhs.offsetVarAndGepTypePairs;
88
+ this->idxOperandPairs == rhs.idxOperandPairs;
89
89
  }
90
90
  //@}
91
91
 
@@ -99,9 +99,9 @@ public:
99
99
  {
100
100
  fldIdx = idx;
101
101
  }
102
- inline const IdxVarAndGepTypePairs& getOffsetVarAndGepTypePairVec() const
102
+ inline const IdxOperandPairs& getIdxOperandPairVec() const
103
103
  {
104
- return offsetVarAndGepTypePairs;
104
+ return idxOperandPairs;
105
105
  }
106
106
  //@}
107
107
 
@@ -146,6 +146,9 @@ public:
146
146
  return computeAllLocations().intersects(RHS.computeAllLocations());
147
147
  }
148
148
 
149
+ /// Return byte offset from the beginning of the structure to the field where it is located for struct type
150
+ u32_t getStructFieldOffset(const SVFVar* idxOperandVar, const SVFStructType* idxOperandType) const;
151
+
149
152
  /// Dump location set
150
153
  std::string dump() const;
151
154
 
@@ -158,8 +161,7 @@ private:
158
161
  NodeBS computeAllLocations() const;
159
162
 
160
163
  APOffset fldIdx; ///< Accumulated Constant Offsets
161
- IdxVarAndGepTypePairs
162
- offsetVarAndGepTypePairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>s
164
+ IdxOperandPairs idxOperandPairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>
163
165
  };
164
166
 
165
167
  } // End namespace SVF
@@ -169,9 +171,9 @@ template <> struct std::hash<SVF::AccessPath>
169
171
  size_t operator()(const SVF::AccessPath &ap) const
170
172
  {
171
173
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
172
- std::hash<SVF::AccessPath::IdxVarAndGepTypePairs> v;
174
+ std::hash<SVF::AccessPath::IdxOperandPairs> v;
173
175
  return h(std::make_pair(ap.getConstantFieldIdx(),
174
- v(ap.getOffsetVarAndGepTypePairVec())));
176
+ v(ap.getIdxOperandPairVec())));
175
177
  }
176
178
  };
177
179
 
@@ -491,10 +491,9 @@ public:
491
491
  {
492
492
  return ap;
493
493
  }
494
- inline const AccessPath::IdxVarAndGepTypePairs
495
- getOffsetVarAndGepTypePairVec() const
494
+ inline const AccessPath::IdxOperandPairs getOffsetVarAndGepTypePairVec() const
496
495
  {
497
- return getAccessPath().getOffsetVarAndGepTypePairVec();
496
+ return getAccessPath().getIdxOperandPairVec();
498
497
  }
499
498
  /// Return TRUE if this is a constant location set.
500
499
  inline bool isConstantOffset() const
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1729",
3
+ "version": "1.0.1731",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {