Skip to content

Commit 019e90f

Browse files
[ADT] Group public functions in DenseMap.h (NFC) (#168239)
This patch groups public functions, including the constructors, the destructor, and the copy/move assignment operators.
1 parent 6cedafb commit 019e90f

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -772,15 +772,6 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
772772
deallocateBuckets();
773773
}
774774

775-
private:
776-
void swapImpl(DenseMap &RHS) {
777-
std::swap(Buckets, RHS.Buckets);
778-
std::swap(NumEntries, RHS.NumEntries);
779-
std::swap(NumTombstones, RHS.NumTombstones);
780-
std::swap(NumBuckets, RHS.NumBuckets);
781-
}
782-
783-
public:
784775
DenseMap &operator=(const DenseMap &other) {
785776
if (&other != this)
786777
this->copyFrom(other);
@@ -796,6 +787,13 @@ class DenseMap : public DenseMapBase<DenseMap<KeyT, ValueT, KeyInfoT, BucketT>,
796787
}
797788

798789
private:
790+
void swapImpl(DenseMap &RHS) {
791+
std::swap(Buckets, RHS.Buckets);
792+
std::swap(NumEntries, RHS.NumEntries);
793+
std::swap(NumTombstones, RHS.NumTombstones);
794+
std::swap(NumBuckets, RHS.NumBuckets);
795+
}
796+
799797
unsigned getNumEntries() const { return NumEntries; }
800798

801799
void setNumEntries(unsigned Num) { NumEntries = Num; }
@@ -945,6 +943,20 @@ class SmallDenseMap
945943
deallocateBuckets();
946944
}
947945

946+
SmallDenseMap &operator=(const SmallDenseMap &other) {
947+
if (&other != this)
948+
this->copyFrom(other);
949+
return *this;
950+
}
951+
952+
SmallDenseMap &operator=(SmallDenseMap &&other) {
953+
this->destroyAll();
954+
deallocateBuckets();
955+
init(0);
956+
this->swap(other);
957+
return *this;
958+
}
959+
948960
private:
949961
void swapImpl(SmallDenseMap &RHS) {
950962
unsigned TmpNumEntries = RHS.NumEntries;
@@ -1017,22 +1029,6 @@ class SmallDenseMap
10171029
new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep));
10181030
}
10191031

1020-
public:
1021-
SmallDenseMap &operator=(const SmallDenseMap &other) {
1022-
if (&other != this)
1023-
this->copyFrom(other);
1024-
return *this;
1025-
}
1026-
1027-
SmallDenseMap &operator=(SmallDenseMap &&other) {
1028-
this->destroyAll();
1029-
deallocateBuckets();
1030-
init(0);
1031-
this->swap(other);
1032-
return *this;
1033-
}
1034-
1035-
private:
10361032
unsigned getNumEntries() const { return NumEntries; }
10371033

10381034
void setNumEntries(unsigned Num) {

0 commit comments

Comments
 (0)