svf-tools 1.0.803 → 1.0.804

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.803",
3
+ "version": "1.0.804",
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": {
@@ -577,74 +577,100 @@ inline IntervalValue operator%(const IntervalValue &lhs,
577
577
  }
578
578
  }
579
579
 
580
- /// Greater than IntervalValues
580
+ // Compare two IntervalValues for greater than
581
581
  inline IntervalValue operator>(const IntervalValue &lhs, const IntervalValue &rhs)
582
582
  {
583
+ // If either lhs or rhs is bottom, the result is bottom
583
584
  if (lhs.isBottom() || rhs.isBottom())
584
585
  {
585
586
  return IntervalValue::bottom();
586
587
  }
587
- else if (lhs.isTop() || lhs.isTop())
588
+ // If either lhs or rhs is top, the result is top
589
+ else if (lhs.isTop() || rhs.isTop())
588
590
  {
589
591
  return IntervalValue::top();
590
592
  }
591
593
  else
592
594
  {
595
+ // If both lhs and rhs are numerals (lb = ub), directly compare their values
593
596
  if (lhs.is_numeral() && rhs.is_numeral())
594
597
  {
598
+ // It means lhs.lb() > rhs.lb()? true: false
595
599
  return lhs.lb().leq(rhs.lb()) ? IntervalValue(0, 0) : IntervalValue(1, 1);
596
600
  }
597
601
  else
598
602
  {
599
- // lhs[3,4] rhs[1,2]
603
+ // Return [1,1] means lhs is totally greater than rhs
604
+ // When lhs.lb > rhs.ub, e.g., lhs:[3, 4] rhs:[1, 2]
605
+ // lhs.lb(3) > rhs.ub(2)
606
+ // It means lhs.lb() > rhs.ub()
600
607
  if (!lhs.lb().leq(rhs.ub()))
601
608
  {
602
609
  return IntervalValue(1, 1);
603
- // lhs[1,2] rhs[3,4]
604
610
  }
605
- else if (!lhs.ub().geq(rhs.lb()))
611
+ // Return [0,0] means lhs is totally impossible to be greater than rhs
612
+ // i.e., lhs is totally less than or equal to rhs
613
+ // When lhs.ub <= rhs.lb, e.g., lhs:[3, 4] rhs:[4,5]
614
+ // lhs.ub(4) <= rhs.lb(4)
615
+ else if (lhs.ub().leq(rhs.lb()))
606
616
  {
607
617
  return IntervalValue(0, 0);
608
618
  }
619
+ // For other cases, lhs can be greater than or not, depending on the values
620
+ // e.g., lhs: [2,4], rhs: [1,3],
621
+ // lhs can be greater than rhs if lhs is 4 and rhs is 1.
622
+ // lhs can also not be greater than rhs if lhs is 2 and rhs is 3
609
623
  else
610
624
  {
611
- // lhs[1,3] rhs[2,4]
612
625
  return IntervalValue(0, 1);
613
626
  }
614
627
  }
615
628
  }
616
629
  }
617
630
 
618
- /// Greater than IntervalValues
631
+ // Compare two IntervalValues for less than
619
632
  inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rhs)
620
633
  {
634
+ // If either lhs or rhs is bottom, the result is bottom
621
635
  if (lhs.isBottom() || rhs.isBottom())
622
636
  {
623
637
  return IntervalValue::bottom();
624
638
  }
625
- else if (lhs.isTop() || lhs.isTop())
639
+ // If either lhs or rhs is top, the result is top
640
+ else if (lhs.isTop() || rhs.isTop())
626
641
  {
627
642
  return IntervalValue::top();
628
643
  }
629
644
  else
630
645
  {
646
+ // If both lhs and rhs are numerals (lb = ub), directly compare their values
631
647
  if (lhs.is_numeral() && rhs.is_numeral())
632
648
  {
649
+ // It means lhs.lb() < rhs.lb()? true: false
633
650
  return lhs.lb().geq(rhs.lb()) ? IntervalValue(0, 0) : IntervalValue(1, 1);
634
651
  }
635
652
  else
636
653
  {
637
- // lhs [1,2] rhs [3,4]
654
+ // Return [1,1] means lhs is totally less than rhs
655
+ // When lhs.ub < rhs.lb, e.g., lhs:[1, 2] rhs:[3, 4]
656
+ // lhs.ub(2) < rhs.lb(3)
657
+ // It means lhs.ub() < rhs.lb()
638
658
  if (!lhs.ub().geq(rhs.lb()))
639
659
  {
640
660
  return IntervalValue(1, 1);
641
- // lhs [3,4] rhs [1,2]
642
661
  }
643
- else if (!lhs.lb().leq(rhs.ub()))
662
+ // Return [0,0] means lhs is totally impossible to be less than rhs
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()))
644
667
  {
645
668
  return IntervalValue(0, 0);
646
- // lhs [1,3] rhs [2,4]
647
669
  }
670
+ // For other cases, lhs can be less than rhs or not, depending on the values
671
+ // e.g., lhs: [2,4], rhs: [1,3],
672
+ // lhs can be less than rhs if lhs is 2, rhs is 3.
673
+ // lhs can also not be less than rhs if lhs is 4 and rhs is 1
648
674
  else
649
675
  {
650
676
  return IntervalValue(0, 1);
@@ -654,79 +680,101 @@ inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rh
654
680
  }
655
681
 
656
682
 
657
- /// Greater than IntervalValues
683
+ // Compare two IntervalValues for greater than or equal to
658
684
  inline IntervalValue operator>=(const IntervalValue &lhs, const IntervalValue &rhs)
659
685
  {
686
+ // If either lhs or rhs is bottom, the result is bottom
660
687
  if (lhs.isBottom() || rhs.isBottom())
661
688
  {
662
689
  return IntervalValue::bottom();
663
690
  }
664
- else if (lhs.isTop() || lhs.isTop())
691
+ // If either lhs or rhs is top, the result is top
692
+ else if (lhs.isTop() || rhs.isTop())
665
693
  {
666
694
  return IntervalValue::top();
667
695
  }
668
696
  else
669
697
  {
698
+ // If both lhs and rhs are numerals (lb = ub), directly compare their values
670
699
  if (lhs.is_numeral() && rhs.is_numeral())
671
700
  {
672
701
  return lhs.lb().geq(rhs.lb()) ? IntervalValue(1, 1) : IntervalValue(0, 0);
673
702
  }
674
703
  else
675
704
  {
676
- // lhs [2,3] rhs [1,2]
705
+ // Return [1,1] means lhs is totally greater than or equal to rhs
706
+ // When lhs.lb >= rhs.ub, e.g., lhs:[2, 3] rhs:[1, 2]
707
+ // lhs.lb(2) >= rhs.ub(2)
677
708
  if (lhs.lb().geq(rhs.ub()))
678
709
  {
679
710
  return IntervalValue(1, 1);
680
- // lhs [1,2] rhs[3,4]
681
711
  }
712
+ // Return [0,0] means lhs is totally impossible to be greater than or equal to rhs
713
+ // i.e., lhs is totally less than rhs
714
+ // When lhs.ub < rhs.lb, e.g., lhs:[1, 2] rhs:[3, 4]
715
+ // lhs.ub(2) < rhs.lb(3)
716
+ // It means lhs.ub() < rhs.lb()
682
717
  else if (!lhs.ub().geq(rhs.lb()))
683
718
  {
684
719
  return IntervalValue(0, 0);
685
- // lhs [1,3] rhs [2,4]
686
720
  }
721
+ // For other cases, lhs can be greater than or equal to rhs or not, depending on the values
722
+ // e.g., lhs: [2,4], rhs: [1,3],
723
+ // lhs can be greater than or equal to rhs if lhs is 3, rhs is 2.
724
+ // lhs can also not be greater than or equal to rhs if lhs is 2 and rhs is 3
687
725
  else
688
726
  {
689
- if (lhs.equals(rhs)) return IntervalValue(1, 1);
690
- else return IntervalValue(0, 1);
727
+ return IntervalValue(0, 1);
691
728
  }
692
729
  }
693
730
  }
694
731
  }
695
732
 
696
- /// Greater than IntervalValues
733
+ // Compare two IntervalValues for less than or equal to
697
734
  inline IntervalValue operator<=(const IntervalValue &lhs, const IntervalValue &rhs)
698
735
  {
736
+ // If either lhs or rhs is bottom, the result is bottom
699
737
  if (lhs.isBottom() || rhs.isBottom())
700
738
  {
701
739
  return IntervalValue::bottom();
702
740
  }
703
- else if (lhs.isTop() || lhs.isTop())
741
+ // If either lhs or rhs is top, the result is top
742
+ else if (lhs.isTop() || rhs.isTop())
704
743
  {
705
744
  return IntervalValue::top();
706
745
  }
707
746
  else
708
747
  {
748
+ // If both lhs and rhs are numerals (lb = ub), directly compare their values
709
749
  if (lhs.is_numeral() && rhs.is_numeral())
710
750
  {
711
751
  return lhs.lb().leq(rhs.lb()) ? IntervalValue(1, 1) : IntervalValue(0, 0);
712
752
  }
713
753
  else
714
754
  {
715
- // lhs [1,2] rhs [2,3]
755
+ // Return [1,1] means lhs is totally less than or equal to rhs
756
+ // When lhs.ub <= rhs.lb, e.g., lhs:[1, 2] rhs:[2, 3]
757
+ // lhs.ub(2) <= rhs.lb(2)
716
758
  if (lhs.ub().leq(rhs.lb()))
717
759
  {
718
760
  return IntervalValue(1, 1);
719
- // lhs [3,4] rhs[1,2]
720
761
  }
762
+ // Return [0,0] means lhs is totally impossible to be less than or equal to rhs
763
+ // i.e., lhs is totally greater than rhs
764
+ // When lhs.lb > rhs.ub, e.g., lhs:[3, 4] rhs:[1, 2]
765
+ // lhs.lb(3) > rhs.ub(2)
766
+ // It means lhs.lb() > rhs.ub()
721
767
  else if (!lhs.lb().leq(rhs.ub()))
722
768
  {
723
769
  return IntervalValue(0, 0);
724
- // lhs [1,3] rhs [2,4]
725
770
  }
771
+ // For other cases, lhs can be less than or equal to rhs or not, depending on the values
772
+ // e.g., lhs: [2,4], rhs: [1,3],
773
+ // lhs can be less than or equal to rhs if lhs is 3, rhs is 3.
774
+ // lhs can also not be less than or equal to rhs if lhs is 3 and rhs is 2
726
775
  else
727
776
  {
728
- if (lhs.equals(rhs)) return IntervalValue(1, 1);
729
- else return IntervalValue(0, 1);
777
+ return IntervalValue(0, 1);
730
778
  }
731
779
  }
732
780
  }