1 //===- llvm/unittest/IR/AttributesTest.cpp - Attributes unit tests --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/IR/Attributes.h"
11 #include "llvm/IR/LLVMContext.h"
12 #include "gtest/gtest.h"
17 TEST(Attributes, Uniquing) {
20 Attribute AttrA = Attribute::get(C, Attribute::AlwaysInline);
21 Attribute AttrB = Attribute::get(C, Attribute::AlwaysInline);
22 EXPECT_EQ(AttrA, AttrB);
24 AttributeSet ASs[] = {
25 AttributeSet::get(C, 1, Attribute::ZExt),
26 AttributeSet::get(C, 2, Attribute::SExt)
29 AttributeSet SetA = AttributeSet::get(C, ASs);
30 AttributeSet SetB = AttributeSet::get(C, ASs);
31 EXPECT_EQ(SetA, SetB);
34 TEST(Attributes, Ordering) {
37 AttributeSet ASs[] = {
38 AttributeSet::get(C, 2, Attribute::ZExt),
39 AttributeSet::get(C, 1, Attribute::SExt)
42 AttributeSet SetA = AttributeSet::get(C, ASs);
43 AttributeSet SetB = SetA.removeAttributes(C, 1, ASs[1]);
44 EXPECT_NE(SetA, SetB);
47 } // end anonymous namespace