aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/DenseMap.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index 1fc0eed706..0ceca926c6 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -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) {