Index: include/llvm/ADT/StringMap.h =================================================================== --- include/llvm/ADT/StringMap.h +++ include/llvm/ADT/StringMap.h @@ -37,12 +37,12 @@ /// StringMapEntryBase - Shared base class of StringMapEntry instances. class StringMapEntryBase { - unsigned StrLen; + size_t StrLen; public: - explicit StringMapEntryBase(unsigned Len) : StrLen(Len) {} + explicit StringMapEntryBase(size_t Len) : StrLen(Len) {} - unsigned getKeyLength() const { return StrLen; } + size_t getKeyLength() const { return StrLen; } }; /// StringMapImpl - This is the base class of StringMap that is shared among @@ -130,7 +130,7 @@ explicit StringMapEntry(unsigned strLen) : StringMapEntryBase(strLen), second() {} template - StringMapEntry(unsigned strLen, InitTy &&... InitVals) + StringMapEntry(size_t strLen, InitTy &&... InitVals) : StringMapEntryBase(strLen), second(std::forward(InitVals)...) {} StringMapEntry(StringMapEntry &E) = delete; @@ -155,13 +155,12 @@ template static StringMapEntry *Create(StringRef Key, AllocatorTy &Allocator, InitTy &&... InitVals) { - unsigned KeyLength = Key.size(); + size_t KeyLength = Key.size(); // Allocate a new item with space for the string at the end and a null // terminator. - unsigned AllocSize = static_cast(sizeof(StringMapEntry))+ - KeyLength+1; - unsigned Alignment = alignof(StringMapEntry); + size_t AllocSize = sizeof(StringMapEntry) + KeyLength + 1; + size_t Alignment = alignof(StringMapEntry); StringMapEntry *NewItem = static_cast(Allocator.Allocate(AllocSize,Alignment)); @@ -203,8 +202,7 @@ template void Destroy(AllocatorTy &Allocator) { // Free memory referenced by the item. - unsigned AllocSize = - static_cast(sizeof(StringMapEntry)) + getKeyLength() + 1; + size_t AllocSize = sizeof(StringMapEntry) + getKeyLength() + 1; this->~StringMapEntry(); Allocator.Deallocate(static_cast(this), AllocSize); }