llvm.org GIT mirror llvm / 08c0949
Use operator new instead of new char[]. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53067 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 11 years ago
1 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
8181 P->second.~ValueT();
8282 P->first.~KeyT();
8383 }
84 delete[] reinterpret_cast(Buckets);
84 operator delete(Buckets);
8585 }
8686
8787 typedef DenseMapIterator iterator;
209209 NumTombstones = other.NumTombstones;
210210
211211 if (NumBuckets)
212 delete[] reinterpret_cast(Buckets);
213 Buckets = reinterpret_cast(new char[sizeof(BucketT) *
214 other.NumBuckets]);
212 operator delete(Buckets);
213 Buckets = static_cast(operator new(sizeof(BucketT) *
214 other.NumBuckets));
215215
216216 if (KeyInfoT::isPod() && ValueInfoT::isPod())
217217 memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT));
314314 NumBuckets = InitBuckets;
315315 assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
316316 "# initial buckets must be a power of two!");
317 Buckets = reinterpret_cast(new char[sizeof(BucketT)*InitBuckets]);
317 Buckets = static_cast(operator new(sizeof(BucketT)*InitBuckets));
318318 // Initialize all the keys to EmptyKey.
319319 const KeyT EmptyKey = getEmptyKey();
320320 for (unsigned i = 0; i != InitBuckets; ++i)
329329 while (NumBuckets <= AtLeast)
330330 NumBuckets <<= 1;
331331 NumTombstones = 0;
332 Buckets = reinterpret_cast(new char[sizeof(BucketT)*NumBuckets]);
332 Buckets = static_cast(operator new(sizeof(BucketT)*NumBuckets));
333333
334334 // Initialize all the keys to EmptyKey.
335335 const KeyT EmptyKey = getEmptyKey();
356356 }
357357
358358 // Free the old table.
359 delete[] reinterpret_cast(OldBuckets);
359 operator delete(OldBuckets);
360360 }
361361
362362 void shrink_and_clear() {
367367 NumBuckets = NumEntries > 32 ? 1 << (Log2_32_Ceil(NumEntries) + 1)
368368 : 64;
369369 NumTombstones = 0;
370 Buckets = reinterpret_cast(new char[sizeof(BucketT)*NumBuckets]);
370 Buckets = static_cast(operator new(sizeof(BucketT)*NumBuckets));
371371
372372 // Initialize all the keys to EmptyKey.
373373 const KeyT EmptyKey = getEmptyKey();
386386 }
387387
388388 // Free the old table.
389 delete[] reinterpret_cast(OldBuckets);
389 operator delete(OldBuckets);
390390
391391 NumEntries = 0;
392392 }