svf-tools 1.0.939 → 1.0.941

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-tools",
3
- "version": "1.0.939",
3
+ "version": "1.0.941",
4
4
  "description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -393,7 +393,7 @@ public:
393
393
  auto it = rhs.find(item.first);
394
394
  if (it == rhs.end()) return false;
395
395
  // judge from expr id
396
- if (item.second.getInterval().geq(it->second.getInterval())) return false;
396
+ if (item.second.getInterval().contain(it->second.getInterval())) return false;
397
397
  }
398
398
  return true;
399
399
  }
@@ -409,7 +409,8 @@ public:
409
409
  // judge from expr id
410
410
  if (it->second.isInterval() && item.second.isInterval())
411
411
  {
412
- if (!it->second.getInterval().geq(item.second.getInterval()))
412
+ if (!it->second.getInterval().contain(
413
+ item.second.getInterval()))
413
414
  return false;
414
415
  }
415
416
 
@@ -298,8 +298,11 @@ public:
298
298
  this->_ub = plus_infinity();
299
299
  }
300
300
 
301
- /// Check current IntervalValue is smaller than or equal to the other
302
- bool leq(const IntervalValue &other) const
301
+ /// Determines if the current IntervalValue is fully contained within another IntervalValue.
302
+ /// Example: this: [2, 3], other: [1, 4] -> returns true
303
+ /// Note: If the current interval is 'bottom', it is considered contained within any interval.
304
+ /// If the other interval is 'bottom', it cannot contain any interval.
305
+ bool containedWithin(const IntervalValue &other) const
303
306
  {
304
307
  if (this->isBottom())
305
308
  {
@@ -316,8 +319,11 @@ public:
316
319
 
317
320
  }
318
321
 
319
- /// Check current IntervalValue is greater than or equal to the other
320
- bool geq(const IntervalValue &other) const
322
+ /// Determines if the current IntervalValue fully contains another IntervalValue.
323
+ /// Example: this: [1, 4], other: [2, 3] -> returns true
324
+ /// Note: If the current interval is 'bottom', it is considered to contain any interval.
325
+ /// If the other interval is 'bottom', it cannot be contained by any interval.
326
+ bool contain(const IntervalValue &other) const
321
327
  {
322
328
  if (this->isBottom())
323
329
  {
@@ -333,6 +339,42 @@ public:
333
339
  }
334
340
  }
335
341
 
342
+ /// Check the upper bound of this Interval is less than or equal to the lower bound
343
+ /// e.g. [1, 3] < [3, 5] return true, lhs.ub <= rhs.lb
344
+ bool leq(const IntervalValue &other) const
345
+ {
346
+ if (this->isBottom())
347
+ {
348
+ return true;
349
+ }
350
+ else if (other.isBottom())
351
+ {
352
+ return false;
353
+ }
354
+ else
355
+ {
356
+ return this->_ub.leq(other._lb);
357
+ }
358
+ }
359
+
360
+ /// Check the lower bound of this Interval is greater than or equal to the upper bound
361
+ /// e.g. [3, 5] > [1, 3] return true, lhs.lb >= rhs.ub
362
+ bool geq(const IntervalValue &other) const
363
+ {
364
+ if (this->isBottom())
365
+ {
366
+ return true;
367
+ }
368
+ else if (other.isBottom())
369
+ {
370
+ return false;
371
+ }
372
+ else
373
+ {
374
+ return this->_lb.geq(other._ub);
375
+ }
376
+ }
377
+
336
378
 
337
379
  /// Equality comparison
338
380
  bool equals(const IntervalValue &other) const
@@ -383,7 +383,16 @@ public:
383
383
  }
384
384
  //@}
385
385
 
386
+ virtual const std::string toString() const;
386
387
 
388
+ /// Overloading operator << for dumping node
389
+ //@{
390
+ friend OutStream &operator<<(OutStream &o, const ConstraintNode &node)
391
+ {
392
+ o << node.toString();
393
+ return o;
394
+ }
395
+ //@}
387
396
  };
388
397
 
389
398
  } // End namespace SVF
@@ -717,6 +717,11 @@ ConstraintNode::const_iterator ConstraintNode::directInEdgeEnd() const
717
717
  }
718
718
  //@}
719
719
 
720
+ const std::string ConstraintNode::toString() const
721
+ {
722
+ return SVFIR::getPAG()->getGNode(getId())->toString();
723
+ }
724
+
720
725
  /*!
721
726
  * GraphTraits specialization for constraint graph
722
727
  */