diff options
author | Reid Kleckner <rnk@google.com> | 2017-04-12 22:22:01 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-04-12 22:22:01 +0000 |
commit | ec0fc037af27a882aec393e024b7a1f49339c3e8 (patch) | |
tree | 1dd403b976831bb1fcf2dbdc178eb19dd261cf1a /llvm/lib/IR/Attributes.cpp | |
parent | 0736066b0b512de9e026d0306b34fb9646d7d0ee (diff) | |
download | bcm5719-llvm-ec0fc037af27a882aec393e024b7a1f49339c3e8.tar.gz bcm5719-llvm-ec0fc037af27a882aec393e024b7a1f49339c3e8.zip |
[IR] Assert that we never create an empty AttributeListImpl, NFC
Delete following conditional that is always true as a result.
llvm-svn: 300117
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 4b840c36ccb..a62afe9dd2e 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -721,6 +721,7 @@ AttributeListImpl::AttributeListImpl( LLVMContext &C, ArrayRef<std::pair<unsigned, AttributeSet>> Slots) : Context(C), NumSlots(Slots.size()), AvailableFunctionAttrs(0) { #ifndef NDEBUG + assert(!Slots.empty() && "pointless AttributeListImpl"); if (Slots.size() >= 2) { auto &PrevPair = Slots.front(); for (auto &CurPair : Slots.drop_front()) { @@ -733,19 +734,17 @@ AttributeListImpl::AttributeListImpl( std::copy(Slots.begin(), Slots.end(), getTrailingObjects<IndexAttrPair>()); // Initialize AvailableFunctionAttrs summary bitset. - if (NumSlots > 0) { - static_assert(Attribute::EndAttrKinds <= - sizeof(AvailableFunctionAttrs) * CHAR_BIT, - "Too many attributes"); - static_assert(AttributeList::FunctionIndex == ~0u, - "FunctionIndex should be biggest possible index"); - const auto &Last = Slots.back(); - if (Last.first == AttributeList::FunctionIndex) { - AttributeSet Node = Last.second; - for (Attribute I : Node) { - if (!I.isStringAttribute()) - AvailableFunctionAttrs |= ((uint64_t)1) << I.getKindAsEnum(); - } + static_assert(Attribute::EndAttrKinds <= + sizeof(AvailableFunctionAttrs) * CHAR_BIT, + "Too many attributes"); + static_assert(AttributeList::FunctionIndex == ~0u, + "FunctionIndex should be biggest possible index"); + const auto &Last = Slots.back(); + if (Last.first == AttributeList::FunctionIndex) { + AttributeSet Node = Last.second; + for (Attribute I : Node) { + if (!I.isStringAttribute()) + AvailableFunctionAttrs |= ((uint64_t)1) << I.getKindAsEnum(); } } } |