diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index db59bd595bca7..094dc5730a8d9 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -772,15 +772,6 @@ class DenseMap : public DenseMapBase, 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); @@ -796,6 +787,13 @@ class DenseMap : public DenseMapBase, } 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; } @@ -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; @@ -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) {