Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / pragma-weak.cpp
blob83d66bca3b5acbbe092d1afe05240fd6db3c77a9
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
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
10 #pragma weak foo
11 struct S { void foo(); };
12 void S::foo() {}
13 // CHECK-LABEL: define {{.*}}void @_ZN1S3fooEv(
15 #pragma weak zed
16 namespace bar { void zed() {} }
17 // CHECK-LABEL: define {{.*}}void @_ZN3bar3zedEv(
19 #pragma weak bah
20 void bah() {}
21 // CHECK-LABEL: define {{.*}}void @_Z3bahv(
23 #pragma weak baz
24 extern "C" void baz() {}
25 // CHECK-LABEL: define weak {{.*}}void @baz(
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(