[llvm] b926e35 - precommit APSInt format for D140059

Peter Rong via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 17 13:07:25 PST 2022


Author: Peter Rong
Date: 2022-12-17T13:07:12-08:00
New Revision: b926e35724e68b18326396eac614ae62c14d3d47

URL: https://github.com/llvm/llvm-project/commit/b926e35724e68b18326396eac614ae62c14d3d47
DIFF: https://github.com/llvm/llvm-project/commit/b926e35724e68b18326396eac614ae62c14d3d47.diff

LOG: precommit APSInt format for D140059

Signed-off-by: Peter Rong <PeterRong96 at gmail.com>

Added: 
    

Modified: 
    llvm/include/llvm/ADT/APSInt.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/APSInt.h b/llvm/include/llvm/ADT/APSInt.h
index c9c2118716fb1..c64cf303d4c04 100644
--- a/llvm/include/llvm/ADT/APSInt.h
+++ b/llvm/include/llvm/ADT/APSInt.h
@@ -29,10 +29,10 @@ class [[nodiscard]] APSInt : public APInt {
 
   /// Create an APSInt with the specified width, default to unsigned.
   explicit APSInt(uint32_t BitWidth, bool isUnsigned = true)
-   : APInt(BitWidth, 0), IsUnsigned(isUnsigned) {}
+      : APInt(BitWidth, 0), IsUnsigned(isUnsigned) {}
 
   explicit APSInt(APInt I, bool isUnsigned = true)
-   : APInt(std::move(I)), IsUnsigned(isUnsigned) {}
+      : APInt(std::move(I)), IsUnsigned(isUnsigned) {}
 
   /// Construct an APSInt from a string representation.
   ///
@@ -137,7 +137,7 @@ class [[nodiscard]] APSInt : public APInt {
   APSInt operator>>(unsigned Amt) const {
     return IsUnsigned ? APSInt(lshr(Amt), true) : APSInt(ashr(Amt), false);
   }
-  APSInt& operator>>=(unsigned Amt) {
+  APSInt &operator>>=(unsigned Amt) {
     if (IsUnsigned)
       lshrInPlace(Amt);
     else
@@ -149,29 +149,27 @@ class [[nodiscard]] APSInt : public APInt {
                       : APSInt(relativeAShr(Amt), false);
   }
 
-  inline bool operator<(const APSInt& RHS) const {
+  inline bool operator<(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
     return IsUnsigned ? ult(RHS) : slt(RHS);
   }
-  inline bool operator>(const APSInt& RHS) const {
+  inline bool operator>(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
     return IsUnsigned ? ugt(RHS) : sgt(RHS);
   }
-  inline bool operator<=(const APSInt& RHS) const {
+  inline bool operator<=(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
     return IsUnsigned ? ule(RHS) : sle(RHS);
   }
-  inline bool operator>=(const APSInt& RHS) const {
+  inline bool operator>=(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
     return IsUnsigned ? uge(RHS) : sge(RHS);
   }
-  inline bool operator==(const APSInt& RHS) const {
+  inline bool operator==(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
     return eq(RHS);
   }
-  inline bool operator!=(const APSInt& RHS) const {
-    return !((*this) == RHS);
-  }
+  inline bool operator!=(const APSInt &RHS) const { return !((*this) == RHS); }
 
   bool operator==(int64_t RHS) const {
     return compareValues(*this, get(RHS)) == 0;
@@ -196,10 +194,10 @@ class [[nodiscard]] APSInt : public APInt {
   // signedness information.
 
   APSInt operator<<(unsigned Bits) const {
-    return APSInt(static_cast<const APInt&>(*this) << Bits, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) << Bits, IsUnsigned);
   }
-  APSInt& operator<<=(unsigned Amt) {
-    static_cast<APInt&>(*this) <<= Amt;
+  APSInt &operator<<=(unsigned Amt) {
+    static_cast<APInt &>(*this) <<= Amt;
     return *this;
   }
   APSInt relativeShl(unsigned Amt) const {
@@ -207,97 +205,99 @@ class [[nodiscard]] APSInt : public APInt {
                       : APSInt(relativeAShl(Amt), false);
   }
 
-  APSInt& operator++() {
-    ++(static_cast<APInt&>(*this));
+  APSInt &operator++() {
+    ++(static_cast<APInt &>(*this));
     return *this;
   }
-  APSInt& operator--() {
-    --(static_cast<APInt&>(*this));
+  APSInt &operator--() {
+    --(static_cast<APInt &>(*this));
     return *this;
   }
   APSInt operator++(int) {
-    return APSInt(++static_cast<APInt&>(*this), IsUnsigned);
+    return APSInt(++static_cast<APInt &>(*this), IsUnsigned);
   }
   APSInt operator--(int) {
-    return APSInt(--static_cast<APInt&>(*this), IsUnsigned);
+    return APSInt(--static_cast<APInt &>(*this), IsUnsigned);
   }
   APSInt operator-() const {
-    return APSInt(-static_cast<const APInt&>(*this), IsUnsigned);
+    return APSInt(-static_cast<const APInt &>(*this), IsUnsigned);
   }
-  APSInt& operator+=(const APSInt& RHS) {
+  APSInt &operator+=(const APSInt &RHS) {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    static_cast<APInt&>(*this) += RHS;
+    static_cast<APInt &>(*this) += RHS;
     return *this;
   }
-  APSInt& operator-=(const APSInt& RHS) {
+  APSInt &operator-=(const APSInt &RHS) {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    static_cast<APInt&>(*this) -= RHS;
+    static_cast<APInt &>(*this) -= RHS;
     return *this;
   }
-  APSInt& operator*=(const APSInt& RHS) {
+  APSInt &operator*=(const APSInt &RHS) {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    static_cast<APInt&>(*this) *= RHS;
+    static_cast<APInt &>(*this) *= RHS;
     return *this;
   }
-  APSInt& operator&=(const APSInt& RHS) {
+  APSInt &operator&=(const APSInt &RHS) {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    static_cast<APInt&>(*this) &= RHS;
+    static_cast<APInt &>(*this) &= RHS;
     return *this;
   }
-  APSInt& operator|=(const APSInt& RHS) {
+  APSInt &operator|=(const APSInt &RHS) {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    static_cast<APInt&>(*this) |= RHS;
+    static_cast<APInt &>(*this) |= RHS;
     return *this;
   }
-  APSInt& operator^=(const APSInt& RHS) {
+  APSInt &operator^=(const APSInt &RHS) {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    static_cast<APInt&>(*this) ^= RHS;
+    static_cast<APInt &>(*this) ^= RHS;
     return *this;
   }
 
-  APSInt operator&(const APSInt& RHS) const {
+  APSInt operator&(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    return APSInt(static_cast<const APInt&>(*this) & RHS, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) & RHS, IsUnsigned);
   }
 
-  APSInt operator|(const APSInt& RHS) const {
+  APSInt operator|(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    return APSInt(static_cast<const APInt&>(*this) | RHS, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) | RHS, IsUnsigned);
   }
 
   APSInt operator^(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    return APSInt(static_cast<const APInt&>(*this) ^ RHS, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) ^ RHS, IsUnsigned);
   }
 
-  APSInt operator*(const APSInt& RHS) const {
+  APSInt operator*(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    return APSInt(static_cast<const APInt&>(*this) * RHS, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) * RHS, IsUnsigned);
   }
-  APSInt operator+(const APSInt& RHS) const {
+  APSInt operator+(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    return APSInt(static_cast<const APInt&>(*this) + RHS, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) + RHS, IsUnsigned);
   }
-  APSInt operator-(const APSInt& RHS) const {
+  APSInt operator-(const APSInt &RHS) const {
     assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-    return APSInt(static_cast<const APInt&>(*this) - RHS, IsUnsigned);
+    return APSInt(static_cast<const APInt &>(*this) - RHS, IsUnsigned);
   }
   APSInt operator~() const {
-    return APSInt(~static_cast<const APInt&>(*this), IsUnsigned);
+    return APSInt(~static_cast<const APInt &>(*this), IsUnsigned);
   }
 
   /// Return the APSInt representing the maximum integer value with the given
   /// bit width and signedness.
   static APSInt getMaxValue(uint32_t numBits, bool Unsigned) {
     return APSInt(Unsigned ? APInt::getMaxValue(numBits)
-                           : APInt::getSignedMaxValue(numBits), Unsigned);
+                           : APInt::getSignedMaxValue(numBits),
+                  Unsigned);
   }
 
   /// Return the APSInt representing the minimum integer value with the given
   /// bit width and signedness.
   static APSInt getMinValue(uint32_t numBits, bool Unsigned) {
     return APSInt(Unsigned ? APInt::getMinValue(numBits)
-                           : APInt::getSignedMinValue(numBits), Unsigned);
+                           : APInt::getSignedMinValue(numBits),
+                  Unsigned);
   }
 
   /// Determine if two APSInts have the same value, zero- or
@@ -337,7 +337,7 @@ class [[nodiscard]] APSInt : public APInt {
 
   /// Used to insert APSInt objects, or objects that contain APSInt objects,
   /// into FoldingSets.
-  void Profile(FoldingSetNodeID& ID) const;
+  void Profile(FoldingSetNodeID &ID) const;
 };
 
 inline bool operator==(int64_t V1, const APSInt &V2) { return V2 == V1; }


        


More information about the llvm-commits mailing list