@@ -1109,17 +1109,17 @@ class SmallDenseMap
1109
1109
// temporary storage. Have the loop move the TmpEnd forward as it goes.
1110
1110
const KeyT EmptyKey = this ->getEmptyKey ();
1111
1111
const KeyT TombstoneKey = this ->getTombstoneKey ();
1112
- for (BucketT *P = getBuckets (), *E = P + InlineBuckets; P != E; ++P ) {
1113
- if (!KeyInfoT::isEqual (P-> getFirst (), EmptyKey) &&
1114
- !KeyInfoT::isEqual (P-> getFirst (), TombstoneKey)) {
1112
+ for (BucketT &B : inlineBuckets () ) {
1113
+ if (!KeyInfoT::isEqual (B. getFirst (), EmptyKey) &&
1114
+ !KeyInfoT::isEqual (B. getFirst (), TombstoneKey)) {
1115
1115
assert (size_t (TmpEnd - TmpBegin) < InlineBuckets &&
1116
1116
" Too many inline buckets!" );
1117
- ::new (&TmpEnd->getFirst ()) KeyT (std::move (P-> getFirst ()));
1118
- ::new (&TmpEnd->getSecond ()) ValueT (std::move (P-> getSecond ()));
1117
+ ::new (&TmpEnd->getFirst ()) KeyT (std::move (B. getFirst ()));
1118
+ ::new (&TmpEnd->getSecond ()) ValueT (std::move (B. getSecond ()));
1119
1119
++TmpEnd;
1120
- P-> getSecond ().~ValueT ();
1120
+ B. getSecond ().~ValueT ();
1121
1121
}
1122
- P-> getFirst ().~KeyT ();
1122
+ B. getFirst ().~KeyT ();
1123
1123
}
1124
1124
1125
1125
// AtLeast == InlineBuckets can happen if there are many tombstones,
@@ -1220,6 +1220,11 @@ class SmallDenseMap
1220
1220
return Small ? InlineBuckets : getLargeRep ()->NumBuckets ;
1221
1221
}
1222
1222
1223
+ iterator_range<BucketT *> inlineBuckets () {
1224
+ BucketT *Begin = getInlineBuckets ();
1225
+ return llvm::make_range (Begin, Begin + InlineBuckets);
1226
+ }
1227
+
1223
1228
void deallocateBuckets () {
1224
1229
if (Small)
1225
1230
return ;
0 commit comments