diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:28 +0000 |
commit | b5630dbadf9a2a06754194387d6b0fd9962a67f1 (patch) | |
tree | 3fe1e2bc0dc2823ab21f06959fbb3eaca317ea29 /unittests/IR/AttributesTest.cpp | |
parent | 7af96fb3afd6725a2824a0a5ca5dad34e5e0b056 (diff) |
Diffstat (limited to 'unittests/IR/AttributesTest.cpp')
-rw-r--r-- | unittests/IR/AttributesTest.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/unittests/IR/AttributesTest.cpp b/unittests/IR/AttributesTest.cpp index 0df7a847f8a56..7af4aebd540a5 100644 --- a/unittests/IR/AttributesTest.cpp +++ b/unittests/IR/AttributesTest.cpp @@ -63,4 +63,23 @@ TEST(Attributes, AddAttributes) { EXPECT_TRUE(AL.hasFnAttribute(Attribute::NoReturn)); } +TEST(Attributes, AddMatchingAlignAttr) { + LLVMContext C; + AttributeList AL; + AL = AL.addAttribute(C, AttributeList::FirstArgIndex, + Attribute::getWithAlignment(C, 8)); + AL = AL.addAttribute(C, AttributeList::FirstArgIndex + 1, + Attribute::getWithAlignment(C, 32)); + EXPECT_EQ(8U, AL.getParamAlignment(0)); + EXPECT_EQ(32U, AL.getParamAlignment(1)); + + AttrBuilder B; + B.addAttribute(Attribute::NonNull); + B.addAlignmentAttr(8); + AL = AL.addAttributes(C, AttributeList::FirstArgIndex, B); + EXPECT_EQ(8U, AL.getParamAlignment(0)); + EXPECT_EQ(32U, AL.getParamAlignment(1)); + EXPECT_TRUE(AL.hasParamAttribute(0, Attribute::NonNull)); +} + } // end anonymous namespace |