Index: llvm/include/llvm/ADT/BitVector.h =================================================================== --- llvm/include/llvm/ADT/BitVector.h +++ llvm/include/llvm/ADT/BitVector.h @@ -85,7 +85,7 @@ unsigned Size; // Size of bitvector in bits. public: - typedef unsigned size_type; + using size_type = unsigned; // Encapsulation of a single bit. class reference { @@ -536,7 +536,7 @@ [&Arg](auto const &BV) { return Arg.size() == BV; }) && "consistent sizes"); Out.resize(Arg.size()); - for (size_t i = 0, e = Arg.Bits.size(); i != e; ++i) + for (size_type i = 0, e = Arg.Bits.size(); i != e; ++i) Out.Bits[i] = f(Arg.Bits[i], Args.Bits[i]...); Out.clear_unused_bits(); return Out; @@ -545,7 +545,7 @@ BitVector &operator|=(const BitVector &RHS) { if (size() < RHS.size()) resize(RHS.size()); - for (size_t i = 0, e = RHS.Bits.size(); i != e; ++i) + for (size_type i = 0, e = RHS.Bits.size(); i != e; ++i) Bits[i] |= RHS.Bits[i]; return *this; } @@ -553,7 +553,7 @@ BitVector &operator^=(const BitVector &RHS) { if (size() < RHS.size()) resize(RHS.size()); - for (size_t i = 0, e = RHS.Bits.size(); i != e; ++i) + for (size_type i = 0, e = RHS.Bits.size(); i != e; ++i) Bits[i] ^= RHS.Bits[i]; return *this; } @@ -808,11 +808,11 @@ public: /// Return the size (in bytes) of the bit vector. - size_t getMemorySize() const { return Bits.size() * sizeof(BitWord); } - size_t getBitCapacity() const { return Bits.size() * BITWORD_SIZE; } + size_type getMemorySize() const { return Bits.size() * sizeof(BitWord); } + size_type getBitCapacity() const { return Bits.size() * BITWORD_SIZE; } }; -inline size_t capacity_in_bytes(const BitVector &X) { +inline BitVector::size_type capacity_in_bytes(const BitVector &X) { return X.getMemorySize(); } @@ -824,8 +824,8 @@ return V; } static unsigned getHashValue(const BitVector &V) { - return DenseMapInfo>>::getHashValue( - std::make_pair(V.size(), V.getData())); + return DenseMapInfo>>:: + getHashValue(std::make_pair(V.size(), V.getData())); } static bool isEqual(const BitVector &LHS, const BitVector &RHS) { if (LHS.isInvalid() || RHS.isInvalid()) Index: llvm/include/llvm/ADT/SmallBitVector.h =================================================================== --- llvm/include/llvm/ADT/SmallBitVector.h +++ llvm/include/llvm/ADT/SmallBitVector.h @@ -60,7 +60,7 @@ "Unsupported word size"); public: - using size_type = unsigned; + using size_type = uintptr_t; // Encapsulation of a single bit. class reference { @@ -96,7 +96,7 @@ return reinterpret_cast(X); } - void switchToSmall(uintptr_t NewSmallBits, size_t NewSize) { + void switchToSmall(uintptr_t NewSmallBits, size_type NewSize) { X = 1; setSmallSize(NewSize); setSmallBits(NewSmallBits); @@ -120,9 +120,9 @@ } // Return the size. - size_t getSmallSize() const { return getSmallRawBits() >> SmallNumDataBits; } + size_type getSmallSize() const { return getSmallRawBits() >> SmallNumDataBits; } - void setSmallSize(size_t Size) { + void setSmallSize(size_type Size) { setSmallRawBits(getSmallBits() | (Size << SmallNumDataBits)); } @@ -189,7 +189,7 @@ } /// Returns the number of bits in this bitvector. - size_t size() const { + size_type size() const { return isSmall() ? getSmallSize() : getPointer()->size(); } @@ -336,7 +336,7 @@ } else { BitVector *BV = new BitVector(N, t); uintptr_t OldBits = getSmallBits(); - for (size_t i = 0, e = getSmallSize(); i != e; ++i) + for (size_type i = 0, e = getSmallSize(); i != e; ++i) (*BV)[i] = (OldBits >> i) & 1; switchToLarge(BV); } @@ -346,9 +346,9 @@ if (isSmall()) { if (N > SmallNumDataBits) { uintptr_t OldBits = getSmallRawBits(); - size_t SmallSize = getSmallSize(); + size_type SmallSize = getSmallSize(); BitVector *BV = new BitVector(SmallSize); - for (size_t i = 0; i < SmallSize; ++i) + for (size_type i = 0; i < SmallSize; ++i) if ((OldBits >> i) & 1) BV->set(i); BV->reserve(N); @@ -491,7 +491,7 @@ else if (!isSmall() && !RHS.isSmall()) return *getPointer() == *RHS.getPointer(); else { - for (size_t i = 0, e = size(); i != e; ++i) { + for (size_type i = 0, e = size(); i != e; ++i) { if ((*this)[i] != RHS[i]) return false; } @@ -512,7 +512,7 @@ else if (!isSmall() && !RHS.isSmall()) getPointer()->operator&=(*RHS.getPointer()); else { - size_t i, e; + size_type i, e; for (i = 0, e = std::min(size(), RHS.size()); i != e; ++i) (*this)[i] = test(i) && RHS.test(i); for (e = size(); i != e; ++i) @@ -561,7 +561,7 @@ else if (!isSmall() && !RHS.isSmall()) getPointer()->operator|=(*RHS.getPointer()); else { - for (size_t i = 0, e = RHS.size(); i != e; ++i) + for (size_type i = 0, e = RHS.size(); i != e; ++i) (*this)[i] = test(i) || RHS.test(i); } return *this; @@ -574,7 +574,7 @@ else if (!isSmall() && !RHS.isSmall()) getPointer()->operator^=(*RHS.getPointer()); else { - for (size_t i = 0, e = RHS.size(); i != e; ++i) + for (size_type i = 0, e = RHS.size(); i != e; ++i) (*this)[i] = test(i) != RHS.test(i); } return *this; @@ -721,8 +721,9 @@ } static unsigned getHashValue(const SmallBitVector &V) { uintptr_t Store; - return DenseMapInfo>>::getHashValue( - std::make_pair(V.size(), V.getData(Store))); + return DenseMapInfo< + std::pair>>:: + getHashValue(std::make_pair(V.size(), V.getData(Store))); } static bool isEqual(const SmallBitVector &LHS, const SmallBitVector &RHS) { if (LHS.isInvalid() || RHS.isInvalid())