blob: 9d7d489499a4b6947c82b40c3d34513c7d61dcc2 [file] [log] [blame]
Hans Wennborg442e4f72013-12-13 22:43:52 +00001// RUN: %clang_cc1 -cxx-abi itanium -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() {} }
Stephen Lin43622612013-08-15 06:47:53 +000017// CHECK-LABEL: define void @_ZN3bar3zedEv(
Rafael Espindoladb77c4a2013-02-26 19:13:56 +000018
19#pragma weak bah
20void bah() {}
Stephen Lin43622612013-08-15 06:47:53 +000021// CHECK-LABEL: define void @_Z3bahv(
Rafael Espindoladb77c4a2013-02-26 19:13:56 +000022
23#pragma weak baz
24extern "C" void baz() {}
Stephen Lin43622612013-08-15 06:47:53 +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.
Stephen Lin43622612013-08-15 06:47:53 +000031// CHECK-LABEL: define void @_Z3baxv(