blob: c1cc03b668d999d95910c2f72c578b86671df106 [file] [log] [blame]
Rafael Espindola6a836702010-03-04 18:17:24 +00001// 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()
5void test1_f(void);
6static void test1_g(void) __attribute__((weakref("test1_f")));
7void test1_h(void) {
8 test1_g();
9}
10
11// CHECK: define void @test2_f()
12void test2_f(void) {}
13static void test2_g(void) __attribute__((weakref("test2_f")));
14void test2_h(void) {
15 test2_g();
16}
17
18// CHECK: declare void @test3_f()
19void test3_f(void);
20static void test3_g(void) __attribute__((weakref("test3_f")));
21void test3_foo(void) {
22 test3_f();
23}
24void test3_h(void) {
25 test3_g();
26}
27
28// CHECK: define void @test4_f()
29void test4_f(void);
30static void test4_g(void) __attribute__((weakref("test4_f")));
31void test4_h(void) {
32 test4_g();
33}
34void test4_f(void) {}
35
36// CHECK: declare void @test5_f()
37void test5_f(void);
38static void test5_g(void) __attribute__((weakref("test5_f")));
39void test5_h(void) {
40 test5_g();
41}
42void test5_foo(void) {
43 test5_f();
44}
45
46// CHECK: declare extern_weak void @test6_f()
47void test6_f(void) __attribute__((weak));
48static void test6_g(void) __attribute__((weakref("test6_f")));
49void test6_h(void) {
50 test6_g();
51}
52void test6_foo(void) {
53 test6_f();
54}
Rafael Espindolada182612010-03-04 21:26:03 +000055
56// CHECK: declare extern_weak void @test7_f()
57void test7_f(void);
58static void test7_g(void) __attribute__((weakref("test7_f")));
59static void *const test7_zed = (void *) &test7_g;
60void* test7_h(void) {
61 return test7_zed;
62}