blob: caab2662a9f5b413aac3ddf5e4b14d64b3da6401 [file] [log] [blame]
Hans Wennborgc9bd88e2014-01-14 19:35:09 +00001// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
Rafael Espindoladb77c4a2013-02-26 19:13:56 +00002
3#pragma weak zex
4int 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 = global i32
9
10#pragma weak foo
11struct S { void foo(); };
12void S::foo() {}
Rafael Espindola34970692013-12-12 16:07:11 +000013// CHECK-LABEL: define {{.*}}void @_ZN1S3fooEv(
Rafael Espindoladb77c4a2013-02-26 19:13:56 +000014
15#pragma weak zed
16namespace bar { void zed() {} }
David Blaikieea3e51d2015-06-29 17:29:50 +000017// CHECK-LABEL: define {{.*}}void @_ZN3bar3zedEv(
Rafael Espindoladb77c4a2013-02-26 19:13:56 +000018
19#pragma weak bah
20void bah() {}
David Blaikieea3e51d2015-06-29 17:29:50 +000021// CHECK-LABEL: define {{.*}}void @_Z3bahv(
Rafael Espindoladb77c4a2013-02-26 19:13:56 +000022
23#pragma weak baz
24extern "C" void baz() {}
David Blaikieea3e51d2015-06-29 17:29:50 +000025// CHECK-LABEL: define weak {{.*}}void @baz(
Rafael Espindoladb77c4a2013-02-26 19:13:56 +000026
27#pragma weak _Z3baxv
28void 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.
David Blaikieea3e51d2015-06-29 17:29:50 +000031// CHECK-LABEL: define {{.*}}void @_Z3baxv(