svf-lib 1.0.1728 → 1.0.1730

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
@@ -339,13 +339,13 @@ public:
339
339
  return fun;
340
340
  }
341
341
 
342
- /// Return actual return parameter
342
+ /// Return formal return parameter
343
343
  inline const SVFVar *getFormalRet() const
344
344
  {
345
345
  return formalRet;
346
346
  }
347
347
 
348
- /// Add actual return parameter
348
+ /// Add formal return parameter
349
349
  inline void addFormalRet(const SVFVar *fr)
350
350
  {
351
351
  formalRet = fr;
@@ -416,7 +416,7 @@ public:
416
416
  inline const SVFBasicBlock* getExitBB() const
417
417
  {
418
418
  assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
419
- assert((!isNotRet && exitBlock) && "ensure the function has a single basic block containing a return instruction!");
419
+ assert((hasReturn() && exitBlock) && "ensure the function has a single basic block containing a return instruction!");
420
420
  return exitBlock;
421
421
  }
422
422
 
@@ -461,9 +461,9 @@ public:
461
461
  return isUncalled;
462
462
  }
463
463
 
464
- inline bool isNotRetFunction() const
464
+ inline bool hasReturn() const
465
465
  {
466
- return isNotRet;
466
+ return !isNotRet;
467
467
  }
468
468
 
469
469
  inline const std::vector<std::string>& getAnnotations() const
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1728",
3
+ "version": "1.0.1730",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {