xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/attr.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // CHECK: @test2 = alias i32 ()* @_Z5test1v
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // CHECK: define i32 @_Z3foov() [[NUW:#[0-9]+]] align 1024
6*f4a2713aSLionel Sambuc int foo() __attribute__((aligned(1024)));
foo()7*f4a2713aSLionel Sambuc int foo() { }
8*f4a2713aSLionel Sambuc 
9*f4a2713aSLionel Sambuc class C {
10*f4a2713aSLionel Sambuc   virtual void bar1() __attribute__((aligned(1)));
11*f4a2713aSLionel Sambuc   virtual void bar2() __attribute__((aligned(2)));
12*f4a2713aSLionel Sambuc   virtual void bar3() __attribute__((aligned(1024)));
13*f4a2713aSLionel Sambuc   void bar4() __attribute__((aligned(1024)));
14*f4a2713aSLionel Sambuc } c;
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // CHECK: define void @_ZN1C4bar1Ev(%class.C* %this) unnamed_addr [[NUW]] align 2
bar1()17*f4a2713aSLionel Sambuc void C::bar1() { }
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // CHECK: define void @_ZN1C4bar2Ev(%class.C* %this) unnamed_addr [[NUW]] align 2
bar2()20*f4a2713aSLionel Sambuc void C::bar2() { }
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc // CHECK: define void @_ZN1C4bar3Ev(%class.C* %this) unnamed_addr [[NUW]] align 1024
bar3()23*f4a2713aSLionel Sambuc void C::bar3() { }
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc // CHECK: define void @_ZN1C4bar4Ev(%class.C* %this) [[NUW]] align 1024
bar4()26*f4a2713aSLionel Sambuc void C::bar4() { }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc // PR6635
29*f4a2713aSLionel Sambuc // CHECK-LABEL: define i32 @_Z5test1v()
test1()30*f4a2713aSLionel Sambuc int test1() { return 10; }
31*f4a2713aSLionel Sambuc // CHECK at top of file
32*f4a2713aSLionel Sambuc extern "C" int test2() __attribute__((alias("_Z5test1v")));
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc // CHECK: attributes [[NUW]] = { nounwind{{.*}} }
35