1 | // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s |
2 | |
3 | #pragma weak zex |
4 | int zex; |
5 | // GCC produces a weak symbol for this because it matches mangled names. |
6 | // Different c++ ABIs may or may not mangle this, so we produce a strong |
7 | // symbol. |
8 | // CHECK: @zex = {{(dso_local )?}}global i32 |
9 | |
10 | #pragma weak foo |
11 | struct S { void foo(); }; |
12 | void S::foo() {} |
13 | // CHECK-LABEL: define {{.*}}void @_ZN1S3fooEv( |
14 | |
15 | #pragma weak zed |
16 | namespace bar { void zed() {} } |
17 | // CHECK-LABEL: define {{.*}}void @_ZN3bar3zedEv( |
18 | |
19 | #pragma weak bah |
20 | void bah() {} |
21 | // CHECK-LABEL: define {{.*}}void @_Z3bahv( |
22 | |
23 | #pragma weak baz |
24 | extern "C" void baz() {} |
25 | // CHECK-LABEL: define weak {{.*}}void @baz( |
26 | |
27 | #pragma weak _Z3baxv |
28 | void bax() {} |
29 | // GCC produces a weak symbol for this one, but it doesn't look like a good |
30 | // idea to expose the mangling to the pragma unless we really have to. |
31 | // CHECK-LABEL: define {{.*}}void @_Z3baxv( |
32 | |