1 // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
3 #pragma GCC visibility push(hidden)
7 #pragma GCC visibility pop
9 // CHECK: @_ZN1x1yE = hidden global
11 #pragma GCC visibility push(hidden)
12 struct __attribute((visibility("default"))) x2
{
16 // CHECK: @_ZN2x21yE ={{.*}} global
17 #pragma GCC visibility pop
19 #pragma GCC visibility push(hidden)
20 template<class T
> struct x4
{
23 #pragma GCC visibility pop
24 template<> int x4
<int>::y
= 10;
25 // CHECK: @_ZN2x4IiE1yE = hidden global i32
27 #pragma GCC visibility push(hidden)
28 template<int x
> int f() { return x
; }
29 extern "C" int g() { return f
<3>(); }
30 #pragma GCC visibility pop
31 // CHECK-LABEL: define hidden i32 @g()
32 // CHECK-LABEL: define linkonce_odr hidden noundef i32 @_Z1fILi3EEiv()
34 #pragma GCC visibility push(hidden)
35 template<class T
> struct x5
{
38 #pragma GCC visibility pop
39 template<> void x5
<int>::y() {}
40 // CHECK-LABEL: define hidden void @_ZN2x5IiE1yEv
42 #pragma GCC visibility push(hidden)
43 namespace n
__attribute((visibility("default"))) {
45 // CHECK-LABEL: define{{.*}} void @_ZN1n1fEv
47 #pragma GCC visibility pop
49 namespace n
__attribute((visibility("default"))) {
50 #pragma GCC visibility push(hidden)
52 // CHECK-LABEL: define hidden void @_ZN1n1gEv
53 #pragma GCC visibility pop
57 #pragma GCC visibility push(default)
58 #pragma GCC visibility push(hidden)
59 struct foo
{ // foo is hidden
61 #pragma GCC visibility pop
62 struct foo
; // declaration is ok, we ignore the default in the stack
64 struct bar
{ // bar is default
67 #pragma GCC visibility pop
72 // CHECK-LABEL: define linkonce_odr hidden void @_ZN5test23barINS_3fooEE1fEv
73 // CHECK-LABEL: define linkonce_odr void @_ZN5test23barIiE1fEv