68 lines · c
1// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o - %s | FileCheck %s2 3// CHECK: declare extern_weak void @test1_f()4void test1_f(void);5static void test1_g(void) __attribute__((weakref("test1_f")));6void test1_h(void) {7 test1_g();8}9 10// CHECK-LABEL: define dso_local void @test2_f()11void test2_f(void) {}12static void test2_g(void) __attribute__((weakref("test2_f")));13void test2_h(void) {14 test2_g();15}16 17// CHECK: declare void @test3_f()18void test3_f(void);19static void test3_g(void) __attribute__((weakref("test3_f")));20void test3_foo(void) {21 test3_f();22}23void test3_h(void) {24 test3_g();25}26 27// CHECK-LABEL: define dso_local void @test4_f()28void test4_f(void);29static void test4_g(void) __attribute__((weakref("test4_f")));30void test4_h(void) {31 test4_g();32}33void test4_f(void) {}34 35// CHECK: declare void @test5_f()36void test5_f(void);37static void test5_g(void) __attribute__((weakref("test5_f")));38void test5_h(void) {39 test5_g();40}41void test5_foo(void) {42 test5_f();43}44 45// CHECK: declare extern_weak void @test6_f()46void test6_f(void) __attribute__((weak));47static void test6_g(void) __attribute__((weakref("test6_f")));48void test6_h(void) {49 test6_g();50}51void test6_foo(void) {52 test6_f();53}54 55// CHECK: declare extern_weak void @test8_f()56static void test8_g(void) __attribute__((weakref("test8_f")));57void test8_h(void) {58 if (test8_g)59 test8_g();60}61// CHECK: declare extern_weak void @test7_f()62void test7_f(void);63static void test7_g(void) __attribute__((weakref("test7_f")));64static void *const test7_zed = (void *) &test7_g;65void* test7_h(void) {66 return test7_zed;67}68