Rafael Espindola | 6a83670 | 2010-03-04 18:17:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s |
| 2 | // RUN: FileCheck --input-file=%t %s |
| 3 | |
| 4 | // CHECK: declare extern_weak void @test1_f() |
| 5 | void test1_f(void); |
| 6 | static void test1_g(void) __attribute__((weakref("test1_f"))); |
| 7 | void test1_h(void) { |
| 8 | test1_g(); |
| 9 | } |
| 10 | |
| 11 | // CHECK: define void @test2_f() |
| 12 | void test2_f(void) {} |
| 13 | static void test2_g(void) __attribute__((weakref("test2_f"))); |
| 14 | void test2_h(void) { |
| 15 | test2_g(); |
| 16 | } |
| 17 | |
| 18 | // CHECK: declare void @test3_f() |
| 19 | void test3_f(void); |
| 20 | static void test3_g(void) __attribute__((weakref("test3_f"))); |
| 21 | void test3_foo(void) { |
| 22 | test3_f(); |
| 23 | } |
| 24 | void test3_h(void) { |
| 25 | test3_g(); |
| 26 | } |
| 27 | |
| 28 | // CHECK: define void @test4_f() |
| 29 | void test4_f(void); |
| 30 | static void test4_g(void) __attribute__((weakref("test4_f"))); |
| 31 | void test4_h(void) { |
| 32 | test4_g(); |
| 33 | } |
| 34 | void test4_f(void) {} |
| 35 | |
| 36 | // CHECK: declare void @test5_f() |
| 37 | void test5_f(void); |
| 38 | static void test5_g(void) __attribute__((weakref("test5_f"))); |
| 39 | void test5_h(void) { |
| 40 | test5_g(); |
| 41 | } |
| 42 | void test5_foo(void) { |
| 43 | test5_f(); |
| 44 | } |
| 45 | |
| 46 | // CHECK: declare extern_weak void @test6_f() |
| 47 | void test6_f(void) __attribute__((weak)); |
| 48 | static void test6_g(void) __attribute__((weakref("test6_f"))); |
| 49 | void test6_h(void) { |
| 50 | test6_g(); |
| 51 | } |
| 52 | void test6_foo(void) { |
| 53 | test6_f(); |
| 54 | } |
Rafael Espindola | da18261 | 2010-03-04 21:26:03 +0000 | [diff] [blame] | 55 | |
| 56 | // CHECK: declare extern_weak void @test7_f() |
| 57 | void test7_f(void); |
| 58 | static void test7_g(void) __attribute__((weakref("test7_f"))); |
| 59 | static void *const test7_zed = (void *) &test7_g; |
| 60 | void* test7_h(void) { |
| 61 | return test7_zed; |
| 62 | } |