From fe64c0137e69a7d4c7d9c451357b1216d5ff6bed Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 18 Apr 2017 22:10:18 +0000 Subject: Fix crash in AttributeList::addAttributes, add test llvm-svn: 300614 --- llvm/unittests/IR/AttributesTest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'llvm/unittests/IR/AttributesTest.cpp') diff --git a/llvm/unittests/IR/AttributesTest.cpp b/llvm/unittests/IR/AttributesTest.cpp index b5b221c63a1..c9c8cb75ebf 100644 --- a/llvm/unittests/IR/AttributesTest.cpp +++ b/llvm/unittests/IR/AttributesTest.cpp @@ -49,4 +49,13 @@ TEST(Attributes, Ordering) { EXPECT_NE(SetA, SetB); } +TEST(Attributes, AddAttributes) { + LLVMContext C; + AttributeList AL; + AttrBuilder B; + B.addAttribute(Attribute::NoReturn); + AL = AL.addAttributes(C, AttributeList::FunctionIndex, AttributeSet::get(C, B)); + EXPECT_TRUE(AL.hasFnAttribute(Attribute::NoReturn)); +} + } // end anonymous namespace -- cgit v1.2.3