aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-05 08:43:36 +0000
committerChris Lattner <sabre@nondot.org>2007-08-05 08:43:36 +0000
commit7b54452c84e478ab4d49ac08759ca4ec1badf2b2 (patch)
treea337f460adb4d558da55b5989cbbd4e8368d65bf /include/llvm
parent8c5287086c02cff4a905db2e9c7735a82ed9137f (diff)
downloadexternal_llvm-7b54452c84e478ab4d49ac08759ca4ec1badf2b2.zip
external_llvm-7b54452c84e478ab4d49ac08759ca4ec1badf2b2.tar.gz
external_llvm-7b54452c84e478ab4d49ac08759ca4ec1badf2b2.tar.bz2
Fix a bug in DenseMap::clear, where we never reset a tombstone
to EmptyKey. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/DenseMap.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index 8b25a82..fd3f346 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -100,10 +100,12 @@ public:
const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey();
for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) {
- if (P->first != EmptyKey && P->first != TombstoneKey) {
+ if (P->first != EmptyKey) {
+ if (P->first != TombstoneKey) {
+ P->second.~ValueT();
+ --NumEntries;
+ }
P->first = EmptyKey;
- P->second.~ValueT();
- --NumEntries;
}
}
assert(NumEntries == 0 && "Node count imbalance!");