llvm.org GIT mirror llvm / 3db1299
Fix assertion when merging multiple empty AttributeLists Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D33627 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304300 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 2 years ago
2 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
10051005 for (AttributeList List : Attrs)
10061006 MaxSize = std::max(MaxSize, List.getNumAttrSets());
10071007
1008 // If every list was empty, there is no point in merging the lists.
1009 if (MaxSize == 0)
1010 return AttributeList();
1011
10081012 SmallVector NewAttrSets(MaxSize);
10091013 for (unsigned I = 0; I < MaxSize; ++I) {
10101014 AttrBuilder CurBuilder;
8181 EXPECT_TRUE(AL.hasParamAttribute(0, Attribute::NonNull));
8282 }
8383
84 TEST(Attributes, EmptyGet) {
85 LLVMContext C;
86 AttributeList EmptyLists[] = {AttributeList(), AttributeList()};
87 AttributeList AL = AttributeList::get(C, EmptyLists);
88 EXPECT_TRUE(AL.isEmpty());
89 }
90
8491 } // end anonymous namespace