Skip to content

Commit b147644

Browse files
[ADT] Simplify SmallDenseMap::swap (NFC) (llvm#155067)
This patch simplifies the swapping of *getLargeRep(). In other places, we treat the two member variables together like: new (getLargeRep()) LargeRep(allocateBuckets(InitBuckets)); This patch makes the code a little more consistent with other places copying/moving LargeRep.
1 parent 66eaa80 commit b147644

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,7 @@ class SmallDenseMap
10381038
return;
10391039
}
10401040
if (!Small && !RHS.Small) {
1041-
std::swap(getLargeRep()->Buckets, RHS.getLargeRep()->Buckets);
1042-
std::swap(getLargeRep()->NumBuckets, RHS.getLargeRep()->NumBuckets);
1041+
std::swap(*getLargeRep(), *RHS.getLargeRep());
10431042
return;
10441043
}
10451044

0 commit comments

Comments
 (0)