mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-18 07:52:35 +00:00
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:
parent
80d3b1e708
commit
571832b930
@ -76,6 +76,10 @@ template<typename ValueT,
|
||||
typename KeyFunctorT = llvm::identity<unsigned>,
|
||||
typename SparseT = uint8_t>
|
||||
class SparseMultiSet {
|
||||
static_assert(std::numeric_limits<SparseT>::is_integer &&
|
||||
!std::numeric_limits<SparseT>::is_signed,
|
||||
"SparseT must be an unsigned integer type");
|
||||
|
||||
/// The actual data that's stored, as a doubly-linked list implemented via
|
||||
/// indices into the DenseVector. The doubly linked list is implemented
|
||||
/// circular in Prev indices, and INVALID-terminated in Next indices. This
|
||||
@ -344,9 +348,6 @@ public:
|
||||
///
|
||||
iterator findIndex(unsigned Idx) {
|
||||
assert(Idx < Universe && "Key out of range");
|
||||
assert(std::numeric_limits<SparseT>::is_integer &&
|
||||
!std::numeric_limits<SparseT>::is_signed &&
|
||||
"SparseT must be an unsigned integer type");
|
||||
const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
|
||||
for (unsigned i = Sparse[Idx], e = Dense.size(); i < e; i += Stride) {
|
||||
const unsigned FoundIdx = sparseIndex(Dense[i]);
|
||||
|
@ -118,6 +118,10 @@ template<typename ValueT,
|
||||
typename KeyFunctorT = llvm::identity<unsigned>,
|
||||
typename SparseT = uint8_t>
|
||||
class SparseSet {
|
||||
static_assert(std::numeric_limits<SparseT>::is_integer &&
|
||||
!std::numeric_limits<SparseT>::is_signed,
|
||||
"SparseT must be an unsigned integer type");
|
||||
|
||||
typedef typename KeyFunctorT::argument_type KeyT;
|
||||
typedef SmallVector<ValueT, 8> DenseT;
|
||||
DenseT Dense;
|
||||
@ -198,9 +202,6 @@ public:
|
||||
///
|
||||
iterator findIndex(unsigned Idx) {
|
||||
assert(Idx < Universe && "Key out of range");
|
||||
assert(std::numeric_limits<SparseT>::is_integer &&
|
||||
!std::numeric_limits<SparseT>::is_signed &&
|
||||
"SparseT must be an unsigned integer type");
|
||||
const unsigned Stride = std::numeric_limits<SparseT>::max() + 1u;
|
||||
for (unsigned i = Sparse[Idx], e = size(); i < e; i += Stride) {
|
||||
const unsigned FoundIdx = ValIndexOf(Dense[i]);
|
||||
|
@ -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);
|
||||
|
@ -100,10 +100,10 @@ public:
|
||||
|
||||
template<class SubClass, class AllocatorType>
|
||||
SubClass *Allocate(AllocatorType &Allocator) {
|
||||
assert(sizeof(SubClass) <= Size &&
|
||||
"Recycler allocation size is less than object size!");
|
||||
assert(AlignOf<SubClass>::Alignment <= Align &&
|
||||
"Recycler allocation alignment is less than object alignment!");
|
||||
static_assert(AlignOf<SubClass>::Alignment <= Align,
|
||||
"Recycler allocation alignment is less than object align!");
|
||||
static_assert(sizeof(SubClass) <= Size,
|
||||
"Recycler allocation size is less than object size!");
|
||||
return !FreeList.empty() ?
|
||||
reinterpret_cast<SubClass *>(FreeList.remove(FreeList.begin())) :
|
||||
static_cast<SubClass *>(Allocator.Allocate(Size, Align));
|
||||
|
@ -67,7 +67,9 @@ DWARFDebugArangeSet::extract(DataExtractor data, uint32_t *offset_ptr) {
|
||||
|
||||
Descriptor arangeDescriptor;
|
||||
|
||||
assert(sizeof(arangeDescriptor.Address) == sizeof(arangeDescriptor.Length));
|
||||
static_assert(sizeof(arangeDescriptor.Address) ==
|
||||
sizeof(arangeDescriptor.Length),
|
||||
"Different datatypes for addresses and sizes!");
|
||||
assert(sizeof(arangeDescriptor.Address) >= HeaderData.AddrSize);
|
||||
|
||||
while (data.isValidOffset(*offset_ptr)) {
|
||||
|
@ -811,8 +811,8 @@ static void WriteConstantInternal(raw_ostream &Out, const Constant *CV,
|
||||
// output the string in hexadecimal format! Note that loading and storing
|
||||
// floating point types changes the bits of NaNs on some hosts, notably
|
||||
// x86, so we must not use these types.
|
||||
assert(sizeof(double) == sizeof(uint64_t) &&
|
||||
"assuming that double is 64 bits!");
|
||||
static_assert(sizeof(double) == sizeof(uint64_t),
|
||||
"assuming that double is 64 bits!");
|
||||
char Buffer[40];
|
||||
APFloat apf = CFP->getValueAPF();
|
||||
// Halves and floats are represented in ASCII IR as double, convert.
|
||||
|
Loading…
x
Reference in New Issue
Block a user