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

Dan Gohman gohman at apple.com
Wed Jul 2 17:59:36 PDT 2008


Author: djg
Date: Wed Jul  2 19:59:36 2008
New Revision: 53067

URL: http://llvm.org/viewvc/llvm-project?rev=53067&view=rev
Log:
Use operator new instead of new char[].

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=53067&r1=53066&r2=53067&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Wed Jul  2 19:59:36 2008
@@ -82,7 +82,7 @@
         P->second.~ValueT();
       P->first.~KeyT();
     }
-    delete[] reinterpret_cast<char*>(Buckets);
+    operator delete(Buckets);
   }
   
   typedef DenseMapIterator<KeyT, ValueT, KeyInfoT> iterator;
@@ -210,9 +210,9 @@
     NumTombstones = other.NumTombstones;
     
     if (NumBuckets)
-      delete[] reinterpret_cast<char*>(Buckets);
-    Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT) *
-                                                  other.NumBuckets]);
+      operator delete(Buckets);
+    Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT) *
+                                                 other.NumBuckets));
     
     if (KeyInfoT::isPod() && ValueInfoT::isPod())
       memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT));
@@ -315,7 +315,7 @@
     NumBuckets = InitBuckets;
     assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
            "# initial buckets must be a power of two!");
-    Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT)*InitBuckets]);
+    Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT)*InitBuckets));
     // Initialize all the keys to EmptyKey.
     const KeyT EmptyKey = getEmptyKey();
     for (unsigned i = 0; i != InitBuckets; ++i)
@@ -330,7 +330,7 @@
     while (NumBuckets <= AtLeast)
       NumBuckets <<= 1;
     NumTombstones = 0;
-    Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT)*NumBuckets]);
+    Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT)*NumBuckets));
 
     // Initialize all the keys to EmptyKey.
     const KeyT EmptyKey = getEmptyKey();
@@ -357,7 +357,7 @@
     }
     
     // Free the old table.
-    delete[] reinterpret_cast<char*>(OldBuckets);
+    operator delete(OldBuckets);
   }
   
   void shrink_and_clear() {
@@ -368,7 +368,7 @@
     NumBuckets = NumEntries > 32 ? 1 << (Log2_32_Ceil(NumEntries) + 1)
                                  : 64;
     NumTombstones = 0;
-    Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT)*NumBuckets]);
+    Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT)*NumBuckets));
 
     // Initialize all the keys to EmptyKey.
     const KeyT EmptyKey = getEmptyKey();
@@ -387,7 +387,7 @@
     }
     
     // Free the old table.
-    delete[] reinterpret_cast<char*>(OldBuckets);
+    operator delete(OldBuckets);
     
     NumEntries = 0;
   }





More information about the llvm-commits mailing list