Add a new (simple) StringMap::clear method, patch by Pratik
[oota-llvm.git] / include / llvm / ADT / DenseMap.h
index fdfb3294ea3d2553524aafca9e51b893228029e3..2caec63ee4126b5465171f0f35a90e4b5f3b9775 100644 (file)
@@ -218,7 +218,7 @@ private:
       memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT));
     else
       for (size_t i = 0; i < other.NumBuckets; ++i) {
-        new (Buckets[i].first) KeyT(other.Buckets[i].first);
+        new (&Buckets[i].first) KeyT(other.Buckets[i].first);
         if (!KeyInfoT::isEqual(Buckets[i].first, getEmptyKey()) &&
             !KeyInfoT::isEqual(Buckets[i].first, getTombstoneKey()))
           new (&Buckets[i].second) ValueT(other.Buckets[i].second);
@@ -313,7 +313,7 @@ private:
     NumEntries = 0;
     NumTombstones = 0;
     NumBuckets = InitBuckets;
-    assert(InitBuckets && (InitBuckets & InitBuckets-1) == 0 &&
+    assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
            "# initial buckets must be a power of two!");
     Buckets = reinterpret_cast<BucketT*>(new char[sizeof(BucketT)*InitBuckets]);
     // Initialize all the keys to EmptyKey.