mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-06 04:09:04 +00:00
DenseMap: Use an early exit when there is nothing to do in DestroyAll().
llvm-svn: 157550
This commit is contained in:
parent
1e46062a2b
commit
fb377a947e
@ -273,6 +273,9 @@ public:
|
||||
|
||||
private:
|
||||
void DestroyAll() {
|
||||
if (NumBuckets == 0) // Nothing to do.
|
||||
return;
|
||||
|
||||
const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
|
||||
for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) {
|
||||
if (!KeyInfoT::isEqual(P->first, EmptyKey) &&
|
||||
@ -281,12 +284,10 @@ private:
|
||||
P->first.~KeyT();
|
||||
}
|
||||
|
||||
if (NumBuckets) {
|
||||
#ifndef NDEBUG
|
||||
memset((void*)Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
|
||||
memset((void*)Buckets, 0x5a, sizeof(BucketT)*NumBuckets);
|
||||
#endif
|
||||
operator delete(Buckets);
|
||||
}
|
||||
operator delete(Buckets);
|
||||
}
|
||||
|
||||
void CopyFrom(const DenseMap& other) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user