xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/visibility-hidden-extern-templates.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -O1 -triple %itanium_abi_triple -emit-llvm -o - -fvisibility hidden %s | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc template<typename T>
4f4a2713aSLionel Sambuc struct X {
5f4a2713aSLionel Sambuc   void f();
gX6f4a2713aSLionel Sambuc   void g() { }
7f4a2713aSLionel Sambuc };
8f4a2713aSLionel Sambuc 
f()9f4a2713aSLionel Sambuc template<typename T> void X<T>::f() { }
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc extern template struct X<int>;
12f4a2713aSLionel Sambuc template struct X<int>;
13f4a2713aSLionel Sambuc extern template struct X<char>;
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc // <rdar://problem/8109763>
test_X(X<int> xi,X<char> xc)16f4a2713aSLionel Sambuc void test_X(X<int> xi, X<char> xc) {
17*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: define weak_odr hidden {{.*}}void @_ZN1XIiE1fEv
18f4a2713aSLionel Sambuc   xi.f();
19*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: define weak_odr hidden {{.*}}void @_ZN1XIiE1gEv
20f4a2713aSLionel Sambuc   xi.g();
21*0a6a1f1dSLionel Sambuc   // CHECK: declare {{.*}}void @_ZN1XIcE1fEv
22f4a2713aSLionel Sambuc   xc.f();
23*0a6a1f1dSLionel Sambuc   // CHECK-LABEL: define available_externally {{.*}}void @_ZN1XIcE1gEv
24f4a2713aSLionel Sambuc   xc.g();
25f4a2713aSLionel Sambuc }
26f4a2713aSLionel Sambuc 
27