Alex Rosenberg | 26994a1 | 2012-10-05 23:12:48 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s |
| 2 | |
| 3 | int g0; |
| 4 | // CHECK: @g0 = common global i32 0 |
| 5 | static int bar1 = 42; |
| 6 | // CHECK: @bar1 = internal global i32 42 |
| 7 | |
| 8 | extern int g1; |
| 9 | extern int g1 __attribute((alias("g0"))); |
| 10 | // CHECK: @g1 = alias i32* @g0 |
Daniel Dunbar | 5e1e1f9 | 2009-03-19 08:27:24 +0000 | [diff] [blame] | 11 | |
| 12 | void f0(void) { } |
| 13 | extern void f1(void); |
| 14 | extern void f1(void) __attribute((alias("f0"))); |
Alex Rosenberg | 26994a1 | 2012-10-05 23:12:48 +0000 | [diff] [blame^] | 15 | // CHECK: @f1 = alias void ()* @f0 |
| 16 | // CHECK: define void @f0() nounwind { |
Chris Lattner | 82227ff | 2009-03-22 21:21:57 +0000 | [diff] [blame] | 17 | |
| 18 | // Make sure that aliases cause referenced values to be emitted. |
| 19 | // PR3200 |
Chris Lattner | 82227ff | 2009-03-22 21:21:57 +0000 | [diff] [blame] | 20 | static inline int foo1() { return 0; } |
Alex Rosenberg | 26994a1 | 2012-10-05 23:12:48 +0000 | [diff] [blame^] | 21 | // CHECK: define internal i32 @foo1() |
Chris Lattner | 82227ff | 2009-03-22 21:21:57 +0000 | [diff] [blame] | 22 | int foo() __attribute__((alias("foo1"))); |
Chris Lattner | 82227ff | 2009-03-22 21:21:57 +0000 | [diff] [blame] | 23 | int bar() __attribute__((alias("bar1"))); |
| 24 | |
Chris Lattner | 35f6c13 | 2009-03-22 21:39:12 +0000 | [diff] [blame] | 25 | extern int test6(); |
| 26 | void test7() { test6(); } // test6 is emitted as extern. |
| 27 | |
| 28 | // test6 changes to alias. |
| 29 | int test6() __attribute__((alias("test7"))); |
| 30 | |