svf-lib 1.0.1721 → 1.0.1722

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.
@@ -661,9 +661,9 @@ inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rh
661
661
  }
662
662
  // Return [0,0] means lhs is totally impossible to be less than rhs
663
663
  // i.e., lhs is totally greater than or equal to rhs
664
- // When lhs.ub >= rhs.lb, e.g., lhs:[3, 4] rhs:[4,5]
665
- // lhs.ub(4) >= rhs.lb(4)
666
- else if (rhs.ub().geq(lhs.lb()))
664
+ // When lhs.lb >= rhs.ub, e.g., lhs:[4,5] rhs:[3,4]
665
+ // lhs.lb(4) >= rhs.ub(4)
666
+ else if (lhs.lb().geq(rhs.ub()))
667
667
  {
668
668
  return IntervalValue(0, 0);
669
669
  }
@@ -74,20 +74,20 @@ public:
74
74
  VAddrs getGepObjAddress(u32_t pointer, APOffset offset);
75
75
 
76
76
  /// Return the byte offset from one gep param offset
77
- std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
77
+ IntervalValue getByteOffsetfromGepTypePair(const AccessPath::IdxVarAndGepTypePair& gep_pair, const GepStmt *gep);
78
78
 
79
79
  /// Return the Index offset from one gep param offset
80
- std::pair<APOffset, APOffset> getIndexfromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
80
+ IntervalValue getItvOfFlattenedElemIndexFromGepTypePair(const AccessPath::IdxVarAndGepTypePair& gep_pair, const GepStmt *gep);
81
81
 
82
82
  /// Return the byte offset expression of a GepStmt
83
83
  /// elemBytesize is the element byte size of an static alloc or heap alloc array
84
84
  /// e.g. GepStmt* gep = [i32*10], x, and x is [0,3]
85
- /// std::pair<s32_t, s32_t> byteOffset = getGepByteOffset(gep);
85
+ /// std::pair<s32_t, s32_t> byteOffset = getByteOffset(gep);
86
86
  /// byteOffset should be [0, 12] since i32 is 4 bytes.
87
- std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep);
87
+ IntervalValue getByteOffset(const GepStmt *gep);
88
88
 
89
89
  /// Return the offset expression of a GepStmt
90
- std::pair<APOffset, APOffset> getGepOffset(const GepStmt *gep);
90
+ IntervalValue getItvOfFlattenedElemIndex(const GepStmt *gep);
91
91
 
92
92
 
93
93
  static z3::context &getContext()
@@ -61,8 +61,8 @@ public:
61
61
  NonOverlap, Overlap, Subset, Superset, Same
62
62
  };
63
63
 
64
- typedef std::pair<const SVFVar*, const SVFType*> VarAndGepTypePair;
65
- typedef std::vector<VarAndGepTypePair> OffsetVarAndGepTypePairs;
64
+ typedef std::pair<const SVFVar*, const SVFType*> IdxVarAndGepTypePair;
65
+ typedef std::vector<IdxVarAndGepTypePair> IdxVarAndGepTypePairs;
66
66
 
67
67
  /// Constructor
68
68
  AccessPath(APOffset o = 0) : fldIdx(o) {}
@@ -103,7 +103,7 @@ public:
103
103
  {
104
104
  fldIdx = idx;
105
105
  }
106
- inline const OffsetVarAndGepTypePairs& getOffsetVarAndGepTypePairVec() const
106
+ inline const IdxVarAndGepTypePairs& getOffsetVarAndGepTypePairVec() const
107
107
  {
108
108
  return offsetVarAndGepTypePairs;
109
109
  }
@@ -163,7 +163,8 @@ private:
163
163
  NodeBS computeAllLocations() const;
164
164
 
165
165
  APOffset fldIdx; ///< Accumulated Constant Offsets
166
- OffsetVarAndGepTypePairs offsetVarAndGepTypePairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>s
166
+ IdxVarAndGepTypePairs
167
+ offsetVarAndGepTypePairs; ///< a vector of actual offset in the form of <SVF Var, iterator type>s
167
168
  };
168
169
 
169
170
  } // End namespace SVF
@@ -173,7 +174,7 @@ template <> struct std::hash<SVF::AccessPath>
173
174
  size_t operator()(const SVF::AccessPath &ap) const
174
175
  {
175
176
  SVF::Hash<std::pair<SVF::NodeID, SVF::NodeID>> h;
176
- std::hash<SVF::AccessPath::OffsetVarAndGepTypePairs> v;
177
+ std::hash<SVF::AccessPath::IdxVarAndGepTypePairs> v;
177
178
  return h(std::make_pair(ap.getConstantFieldIdx(),
178
179
  v(ap.getOffsetVarAndGepTypePairVec())));
179
180
  }
@@ -342,6 +342,7 @@ public:
342
342
  AddrStmt(SVFVar* s, SVFVar* d) : AssignStmt(s, d, SVFStmt::Addr) {}
343
343
 
344
344
  virtual const std::string toString() const override;
345
+
345
346
  };
346
347
 
347
348
  /*!
@@ -491,7 +492,8 @@ public:
491
492
  {
492
493
  return ap;
493
494
  }
494
- inline const AccessPath::OffsetVarAndGepTypePairs getOffsetVarAndGepTypePairVec() const
495
+ inline const AccessPath::IdxVarAndGepTypePairs
496
+ getOffsetVarAndGepTypePairVec() const
495
497
  {
496
498
  return getAccessPath().getOffsetVarAndGepTypePairVec();
497
499
  }
@@ -264,12 +264,13 @@ private:
264
264
  getPointerToTy; /// Return a pointer to the current type
265
265
  StInfo* typeinfo; ///< SVF's TypeInfo
266
266
  bool isSingleValTy; ///< The type represents a single value, not struct or
267
+ u32_t byteSize; ///< LLVM Byte Size
267
268
  ///< array
268
269
 
269
270
  protected:
270
- SVFType(bool svt, SVFTyKind k)
271
+ SVFType(bool svt, SVFTyKind k, u32_t Sz)
271
272
  : kind(k), getPointerToTy(nullptr), typeinfo(nullptr),
272
- isSingleValTy(svt)
273
+ isSingleValTy(svt), byteSize(Sz)
273
274
  {
274
275
  }
275
276
 
@@ -299,7 +300,6 @@ public:
299
300
  return getPointerToTy;
300
301
  }
301
302
 
302
- u32_t getLLVMByteSize() const;
303
303
 
304
304
  inline void setTypeInfo(StInfo* ti)
305
305
  {
@@ -318,6 +318,13 @@ public:
318
318
  return typeinfo;
319
319
  }
320
320
 
321
+ /// if Type is not sized, byteSize is 0
322
+ /// if Type is sized, byteSize is the LLVM Byte Size.
323
+ inline u32_t getByteSize() const
324
+ {
325
+ return byteSize;
326
+ }
327
+
321
328
  inline bool isPointerTy() const
322
329
  {
323
330
  return kind == SVFPointerTy;
@@ -350,8 +357,8 @@ private:
350
357
  const SVFType* ptrElementType;
351
358
 
352
359
  public:
353
- SVFPointerType()
354
- : SVFType(true, SVFPointerTy), ptrElementType(nullptr)
360
+ SVFPointerType(u32_t byteSize)
361
+ : SVFType(true, SVFPointerTy, byteSize), ptrElementType(nullptr)
355
362
  {
356
363
  }
357
364
 
@@ -382,7 +389,7 @@ private:
382
389
  short signAndWidth; ///< For printing
383
390
 
384
391
  public:
385
- SVFIntegerType() : SVFType(true, SVFIntegerTy) {}
392
+ SVFIntegerType(u32_t byteSize) : SVFType(true, SVFIntegerTy, byteSize) {}
386
393
  static inline bool classof(const SVFType* node)
387
394
  {
388
395
  return node->getKind() == SVFIntegerTy;
@@ -411,7 +418,7 @@ private:
411
418
 
412
419
  public:
413
420
  SVFFunctionType(const SVFType* rt)
414
- : SVFType(false, SVFFunctionTy), retTy(rt)
421
+ : SVFType(false, SVFFunctionTy, 0), retTy(rt)
415
422
  {
416
423
  }
417
424
  static inline bool classof(const SVFType* node)
@@ -436,7 +443,7 @@ private:
436
443
  std::string name;
437
444
 
438
445
  public:
439
- SVFStructType() : SVFType(false, SVFStructTy) {}
446
+ SVFStructType(u32_t byteSize) : SVFType(false, SVFStructTy, byteSize) {}
440
447
 
441
448
  static inline bool classof(const SVFType* node)
442
449
  {
@@ -469,8 +476,8 @@ private:
469
476
  const SVFType* typeOfElement; /// For printing & debugging
470
477
 
471
478
  public:
472
- SVFArrayType()
473
- : SVFType(false, SVFArrayTy), numOfElement(0), typeOfElement(nullptr)
479
+ SVFArrayType(u32_t byteSize)
480
+ : SVFType(false, SVFArrayTy, byteSize), numOfElement(0), typeOfElement(nullptr)
474
481
  {
475
482
  }
476
483
 
@@ -508,7 +515,7 @@ private:
508
515
  std::string repr; /// Field representation for printing
509
516
 
510
517
  public:
511
- SVFOtherType(bool isSingleValueTy) : SVFType(isSingleValueTy, SVFOtherTy) {}
518
+ SVFOtherType(u32_t byteSize, bool isSingleValueTy) : SVFType(isSingleValueTy, SVFOtherTy, byteSize) {}
512
519
 
513
520
  static inline bool classof(const SVFType* node)
514
521
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.1721",
3
+ "version": "1.0.1722",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {