mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-05-13 10:36:07 +00:00
Fix assertion when merging multiple empty AttributeLists
Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D33627 llvm-svn: 304300
This commit is contained in:
parent
11fda41d0b
commit
ee913d8457
@ -1006,6 +1006,10 @@ AttributeList AttributeList::get(LLVMContext &C,
|
||||
for (AttributeList List : Attrs)
|
||||
MaxSize = std::max(MaxSize, List.getNumAttrSets());
|
||||
|
||||
// If every list was empty, there is no point in merging the lists.
|
||||
if (MaxSize == 0)
|
||||
return AttributeList();
|
||||
|
||||
SmallVector<AttributeSet, 8> NewAttrSets(MaxSize);
|
||||
for (unsigned I = 0; I < MaxSize; ++I) {
|
||||
AttrBuilder CurBuilder;
|
||||
|
@ -82,4 +82,11 @@ TEST(Attributes, AddMatchingAlignAttr) {
|
||||
EXPECT_TRUE(AL.hasParamAttribute(0, Attribute::NonNull));
|
||||
}
|
||||
|
||||
TEST(Attributes, EmptyGet) {
|
||||
LLVMContext C;
|
||||
AttributeList EmptyLists[] = {AttributeList(), AttributeList()};
|
||||
AttributeList AL = AttributeList::get(C, EmptyLists);
|
||||
EXPECT_TRUE(AL.isEmpty());
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user