blob: ed90a7c491e3cafb31ac83f5ba0bf2a203cf2705 [file] [log] [blame]
Alex Rosenberg26994a12012-10-05 23:12:48 +00001// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
2
3int g0;
4// CHECK: @g0 = common global i32 0
5static int bar1 = 42;
6// CHECK: @bar1 = internal global i32 42
7
8extern int g1;
9extern int g1 __attribute((alias("g0")));
10// CHECK: @g1 = alias i32* @g0
Daniel Dunbar5e1e1f92009-03-19 08:27:24 +000011
12void f0(void) { }
13extern void f1(void);
14extern void f1(void) __attribute((alias("f0")));
Alex Rosenberg26994a12012-10-05 23:12:48 +000015// CHECK: @f1 = alias void ()* @f0
16// CHECK: define void @f0() nounwind {
Chris Lattner82227ff2009-03-22 21:21:57 +000017
18// Make sure that aliases cause referenced values to be emitted.
19// PR3200
Chris Lattner82227ff2009-03-22 21:21:57 +000020static inline int foo1() { return 0; }
Alex Rosenberg26994a12012-10-05 23:12:48 +000021// CHECK: define internal i32 @foo1()
Chris Lattner82227ff2009-03-22 21:21:57 +000022int foo() __attribute__((alias("foo1")));
Chris Lattner82227ff2009-03-22 21:21:57 +000023int bar() __attribute__((alias("bar1")));
24
Chris Lattner35f6c132009-03-22 21:39:12 +000025extern int test6();
26void test7() { test6(); } // test6 is emitted as extern.
27
28// test6 changes to alias.
29int test6() __attribute__((alias("test7")));
30