Skip to content

Commit 2f38ced

Browse files
authored
StringMap: Remove redundant member init in constructor (#149491)
These are already zeroinitialized in the field definitions.
1 parent a5d6fa6 commit 2f38ced

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

llvm/lib/Support/StringMap.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,15 @@ static inline unsigned *getHashTable(StringMapEntryBase **TheTable,
4545

4646
uint32_t StringMapImpl::hash(StringRef Key) { return xxh3_64bits(Key); }
4747

48-
StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) {
49-
ItemSize = itemSize;
50-
48+
StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize)
49+
: ItemSize(itemSize) {
5150
// If a size is specified, initialize the table with that many buckets.
5251
if (InitSize) {
5352
// The table will grow when the number of entries reach 3/4 of the number of
5453
// buckets. To guarantee that "InitSize" number of entries can be inserted
5554
// in the table without growing, we allocate just what is needed here.
5655
init(getMinBucketToReserveForEntries(InitSize));
57-
return;
5856
}
59-
60-
// Otherwise, initialize it with zero buckets to avoid the allocation.
61-
TheTable = nullptr;
62-
NumBuckets = 0;
63-
NumItems = 0;
64-
NumTombstones = 0;
6557
}
6658

6759
void StringMapImpl::init(unsigned InitSize) {

0 commit comments

Comments
 (0)