Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 21 additions & 25 deletions llvm/include/llvm/ADT/DenseMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -772,15 +772,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
deallocateBuckets();
}

private:
void swapImpl(DenseMap &RHS) {
std::swap(Buckets, RHS.Buckets);
std::swap(NumEntries, RHS.NumEntries);
std::swap(NumTombstones, RHS.NumTombstones);
std::swap(NumBuckets, RHS.NumBuckets);
}

public:
DenseMap &operator=(const DenseMap &other) {
if (&other != this)
this->copyFrom(other);
Expand All @@ -796,6 +787,13 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
}

private:
void swapImpl(DenseMap &RHS) {
std::swap(Buckets, RHS.Buckets);
std::swap(NumEntries, RHS.NumEntries);
std::swap(NumTombstones, RHS.NumTombstones);
std::swap(NumBuckets, RHS.NumBuckets);
}

unsigned getNumEntries() const { return NumEntries; }

void setNumEntries(unsigned Num) { NumEntries = Num; }
Expand Down Expand Up @@ -945,6 +943,20 @@ class SmallDenseMap
deallocateBuckets();
}

SmallDenseMap &operator=(const SmallDenseMap &other) {
if (&other != this)
this->copyFrom(other);
return *this;
}

SmallDenseMap &operator=(SmallDenseMap &&other) {
this->destroyAll();
deallocateBuckets();
init(0);
this->swap(other);
return *this;
}

private:
void swapImpl(SmallDenseMap &RHS) {
unsigned TmpNumEntries = RHS.NumEntries;
Expand Down Expand Up @@ -1017,22 +1029,6 @@ class SmallDenseMap
new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep));
}

public:
SmallDenseMap &operator=(const SmallDenseMap &other) {
if (&other != this)
this->copyFrom(other);
return *this;
}

SmallDenseMap &operator=(SmallDenseMap &&other) {
this->destroyAll();
deallocateBuckets();
init(0);
this->swap(other);
return *this;
}

private:
unsigned getNumEntries() const { return NumEntries; }

void setNumEntries(unsigned Num) {
Expand Down
Loading