blob: 4748cda8cc47a660c23729de64a46d96350f0b35 [file] [log] [blame]
Rafael Espindola0017c5f2010-12-07 15:23:23 +00001// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
Mike Stumpf6ab1f02009-10-05 22:24:47 +00002
John McCall7ec50432010-03-19 23:29:14 +00003// CHECK: @test2 = alias i32 ()* @_Z5test1v
4
Bill Wendling2386bb12013-02-27 00:06:04 +00005// CHECK: define i32 @_Z3foov() [[NUW:#[0-9]+]] align 1024
Mike Stumpf6ab1f02009-10-05 22:24:47 +00006int foo() __attribute__((aligned(1024)));
7int foo() { }
8
Mike Stumpf6ab1f02009-10-05 22:24:47 +00009class C {
Mike Stump3472ae52009-10-05 22:49:20 +000010 virtual void bar1() __attribute__((aligned(1)));
11 virtual void bar2() __attribute__((aligned(2)));
12 virtual void bar3() __attribute__((aligned(1024)));
Richard Smithb555a762012-09-28 22:46:07 +000013 void bar4() __attribute__((aligned(1024)));
Mike Stumpf6ab1f02009-10-05 22:24:47 +000014} c;
15
Bill Wendling2386bb12013-02-27 00:06:04 +000016// CHECK: define void @_ZN1C4bar1Ev(%class.C* %this) unnamed_addr [[NUW]] align 2
Mike Stumpf6ab1f02009-10-05 22:24:47 +000017void C::bar1() { }
18
Bill Wendling2386bb12013-02-27 00:06:04 +000019// CHECK: define void @_ZN1C4bar2Ev(%class.C* %this) unnamed_addr [[NUW]] align 2
Mike Stumpf6ab1f02009-10-05 22:24:47 +000020void C::bar2() { }
21
Bill Wendling2386bb12013-02-27 00:06:04 +000022// CHECK: define void @_ZN1C4bar3Ev(%class.C* %this) unnamed_addr [[NUW]] align 1024
Mike Stump3472ae52009-10-05 22:49:20 +000023void C::bar3() { }
John McCall7ec50432010-03-19 23:29:14 +000024
Bill Wendling2386bb12013-02-27 00:06:04 +000025// CHECK: define void @_ZN1C4bar4Ev(%class.C* %this) [[NUW]] align 1024
Richard Smithb555a762012-09-28 22:46:07 +000026void C::bar4() { }
27
John McCall7ec50432010-03-19 23:29:14 +000028// PR6635
29// CHECK: define i32 @_Z5test1v()
30int test1() { return 10; }
31// CHECK at top of file
32extern "C" int test2() __attribute__((alias("_Z5test1v")));
Bill Wendlingc33fc4c2013-02-20 07:22:19 +000033
Bill Wendling706469b2013-02-28 22:49:57 +000034// CHECK: attributes [[NUW]] = { nounwind{{.*}} }