From f6544aadeeba1525acd32cdc77a1c4c8a33ba1d1 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 15 Nov 2025 09:44:24 -0800 Subject: [PATCH] [ADT] Group public functions in DenseMap.h (NFC) This patch groups public functions, including the constructors, the destructor, and the copy/move assignment operators. --- llvm/include/llvm/ADT/DenseMap.h | 46 +++++++++++++++----------------- 1 file changed, 21 insertions(+), 25 deletions(-) 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) {