Reverting size_type for the containers from size_type to unsigned.

Various places in LLVM assume that container size and count are unsigned
and do not use the container size_type. Therefore they break compilation
(or possibly executation) for LP64 systems where size_t is 64 bit while
unsigned is still 32 bit.

If we'll ever that many items in the container size_type could be made
size_t for a specific containers after reviweing its other uses.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Yaron Keren 2014-06-20 12:20:56 +00:00
parent 7d5bff0d5a
commit 212e2b9c8d
9 changed files with 9 additions and 9 deletions

View File

@ -43,7 +43,7 @@ protected:
typedef std::pair<KeyT, ValueT> BucketT; typedef std::pair<KeyT, ValueT> BucketT;
public: public:
typedef size_t size_type; typedef unsigned size_type;
typedef KeyT key_type; typedef KeyT key_type;
typedef ValueT mapped_type; typedef ValueT mapped_type;
typedef BucketT value_type; typedef BucketT value_type;

View File

@ -29,7 +29,7 @@ class DenseSet {
public: public:
typedef ValueT key_type; typedef ValueT key_type;
typedef ValueT value_type; typedef ValueT value_type;
typedef size_t size_type; typedef unsigned size_type;
explicit DenseSet(unsigned NumInitBuckets = 0) : TheMap(NumInitBuckets) {} explicit DenseSet(unsigned NumInitBuckets = 0) : TheMap(NumInitBuckets) {}

View File

@ -148,7 +148,7 @@ public:
/// ScopeTy - This is a helpful typedef that allows clients to get easy access /// ScopeTy - This is a helpful typedef that allows clients to get easy access
/// to the name of the scope for this hash table. /// to the name of the scope for this hash table.
typedef ScopedHashTableScope<K, V, KInfo, AllocatorTy> ScopeTy; typedef ScopedHashTableScope<K, V, KInfo, AllocatorTy> ScopeTy;
typedef size_t size_type; typedef unsigned size_type;
private: private:
typedef ScopedHashTableVal<K, V> ValTy; typedef ScopedHashTableVal<K, V> ValTy;
DenseMap<K, ValTy*, KInfo> TopLevelMap; DenseMap<K, ValTy*, KInfo> TopLevelMap;

View File

@ -54,7 +54,7 @@ class SmallBitVector {
}; };
public: public:
typedef size_t size_type; typedef unsigned size_type;
// Encapsulation of a single bit. // Encapsulation of a single bit.
class reference { class reference {
SmallBitVector &TheVector; SmallBitVector &TheVector;

View File

@ -73,7 +73,7 @@ protected:
~SmallPtrSetImplBase(); ~SmallPtrSetImplBase();
public: public:
typedef size_t size_type; typedef unsigned size_type;
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; } bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; }
size_type size() const { return NumElements; } size_type size() const { return NumElements; }

View File

@ -45,7 +45,7 @@ struct SparseBitVectorElement
: public ilist_node<SparseBitVectorElement<ElementSize> > { : public ilist_node<SparseBitVectorElement<ElementSize> > {
public: public:
typedef unsigned long BitWord; typedef unsigned long BitWord;
typedef size_t size_type; typedef unsigned size_type;
enum { enum {
BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT, BITWORD_SIZE = sizeof(BitWord) * CHAR_BIT,
BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE, BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE,

View File

@ -185,7 +185,7 @@ public:
typedef const ValueT &const_reference; typedef const ValueT &const_reference;
typedef ValueT *pointer; typedef ValueT *pointer;
typedef const ValueT *const_pointer; typedef const ValueT *const_pointer;
typedef size_t size_type; typedef unsigned size_type;
SparseMultiSet() SparseMultiSet()
: Sparse(nullptr), Universe(0), FreelistIdx(SMSNode::INVALID), NumFree(0) {} : Sparse(nullptr), Universe(0), FreelistIdx(SMSNode::INVALID), NumFree(0) {}

View File

@ -124,7 +124,7 @@ class SparseSet {
typedef typename KeyFunctorT::argument_type KeyT; typedef typename KeyFunctorT::argument_type KeyT;
typedef SmallVector<ValueT, 8> DenseT; typedef SmallVector<ValueT, 8> DenseT;
typedef size_t size_type; typedef unsigned size_type;
DenseT Dense; DenseT Dense;
SparseT *Sparse; SparseT *Sparse;
unsigned Universe; unsigned Universe;

View File

@ -87,7 +87,7 @@ public:
typedef KeyT key_type; typedef KeyT key_type;
typedef ValueT mapped_type; typedef ValueT mapped_type;
typedef std::pair<KeyT, ValueT> value_type; typedef std::pair<KeyT, ValueT> value_type;
typedef size_t size_type; typedef unsigned size_type;
explicit ValueMap(unsigned NumInitBuckets = 64) explicit ValueMap(unsigned NumInitBuckets = 64)
: Map(NumInitBuckets), Data() {} : Map(NumInitBuckets), Data() {}