Make some assertions on constant expressions static.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-03-15 18:47:07 +00:00
parent 80d3b1e708
commit 571832b930
6 changed files with 20 additions and 15 deletions

View File

@@ -35,6 +35,9 @@ class ArrayRecycler {
FreeList *Next;
};
static_assert(Align >= AlignOf<FreeList>::Alignment, "Object underaligned");
static_assert(sizeof(T) >= sizeof(FreeList), "Objects are too small");
// Keep a free list for each array size.
SmallVector<FreeList*, 8> Bucket;
@@ -53,8 +56,6 @@ class ArrayRecycler {
// Add an entry to the free list at Bucket[Idx].
void push(unsigned Idx, T *Ptr) {
assert(Ptr && "Cannot recycle NULL pointer");
assert(sizeof(T) >= sizeof(FreeList) && "Objects are too small");
assert(Align >= AlignOf<FreeList>::Alignment && "Object underaligned");
FreeList *Entry = reinterpret_cast<FreeList*>(Ptr);
if (Idx >= Bucket.size())
Bucket.resize(size_t(Idx) + 1);