mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
DenseMap: Use an early exit when there is nothing to do in DestroyAll().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157550 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -273,6 +273,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void DestroyAll() {
|
void DestroyAll() {
|
||||||
|
if (NumBuckets == 0) // Nothing to do.
|
||||||
|
return;
|
||||||
|
|
||||||
const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
|
const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
|
||||||
for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) {
|
for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) {
|
||||||
if (!KeyInfoT::isEqual(P->first, EmptyKey) &&
|
if (!KeyInfoT::isEqual(P->first, EmptyKey) &&
|
||||||
@@ -281,12 +284,10 @@ private:
|
|||||||
P->first.~KeyT();
|
P->first.~KeyT();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumBuckets) {
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
memset((void*)Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
|
memset((void*)Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
|
||||||
#endif
|
#endif
|
||||||
operator delete(Buckets);
|
operator delete(Buckets);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyFrom(const DenseMap& other) {
|
void CopyFrom(const DenseMap& other) {
|
||||||
|
Reference in New Issue
Block a user