[llvm-commits] [llvm] r40839 - /llvm/trunk/include/llvm/ADT/DenseMap.h

Chris Lattner sabre at nondot.org
Sun Aug 5 01:43:36 PDT 2007


Author: lattner
Date: Sun Aug  5 03:43:36 2007
New Revision: 40839

URL: http://llvm.org/viewvc/llvm-project?rev=40839&view=rev
Log:
Fix a bug in DenseMap::clear, where we never reset a tombstone
to EmptyKey.

Modified:
    llvm/trunk/include/llvm/ADT/DenseMap.h

Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=40839&r1=40838&r2=40839&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Sun Aug  5 03:43:36 2007
@@ -100,10 +100,12 @@
     
     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!");





More information about the llvm-commits mailing list