Benjamin Kramer | 8591fa3 | 2013-01-12 14:13:45 +0000 | [diff] [blame^] | 1 | //===- llvm/unittest/IR/AttributesTest.cpp - Attributes unit tests --------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "llvm/IR/Attributes.h" |
| 11 | #include "llvm/IR/LLVMContext.h" |
| 12 | #include "gtest/gtest.h" |
| 13 | using namespace llvm; |
| 14 | |
| 15 | namespace { |
| 16 | |
| 17 | TEST(Attributes, Uniquing) { |
| 18 | LLVMContext C; |
| 19 | |
| 20 | Attribute AttrA = Attribute::get(C, Attribute::AlwaysInline); |
| 21 | Attribute AttrB = Attribute::get(C, Attribute::AlwaysInline); |
| 22 | EXPECT_EQ(AttrA, AttrB); |
| 23 | |
| 24 | AttributeWithIndex AWIs[] = { |
| 25 | AttributeWithIndex::get(C, 1, Attribute::ZExt), |
| 26 | AttributeWithIndex::get(C, 2, Attribute::SExt) |
| 27 | }; |
| 28 | |
| 29 | AttributeSet SetA = AttributeSet::get(C, AWIs); |
| 30 | AttributeSet SetB = AttributeSet::get(C, AWIs); |
| 31 | EXPECT_EQ(SetA, SetB); |
| 32 | } |
| 33 | |
| 34 | } // end anonymous namespace |