Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.explicit / p9-linkage.cpp
blob9bdccc8e73246ce6620e291d386619215b05c4c6
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -O1 -disable-llvm-passes -emit-llvm -std=c++11 -o - %s | FileCheck %s
3 template<typename T>
4 struct X0 {
5 void f(T &t) {
6 t = 0;
9 void g(T &t);
11 void h(T &t);
13 static T static_var;
16 template<typename T>
17 inline void X0<T>::g(T & t) {
18 t = 0;
21 template<typename T>
22 void X0<T>::h(T & t) {
23 t = 0;
26 template<typename T>
27 T X0<T>::static_var = 0;
29 extern template struct X0<int*>;
31 int *&test(X0<int*> xi, int *ip) {
32 // CHECK: define available_externally void @_ZN2X0IPiE1fERS0_
33 xi.f(ip);
34 // CHECK: define available_externally void @_ZN2X0IPiE1gERS0_
35 xi.g(ip);
36 // CHECK: declare void @_ZN2X0IPiE1hERS0_
37 xi.h(ip);
38 return X0<int*>::static_var;
41 template<typename T>
42 void f0(T& t) {
43 t = 0;
46 template<typename T>
47 inline void f1(T& t) {
48 t = 0;
51 extern template void f0<>(int *&);
52 extern template void f1<>(int *&);
54 void test_f0(int *ip, float *fp) {
55 // CHECK: declare void @_Z2f0IPiEvRT_
56 f0(ip);
57 // CHECK: define linkonce_odr void @_Z2f0IPfEvRT_
58 f0(fp);
61 void test_f1(int *ip, float *fp) {
62 // CHECK: define available_externally void @_Z2f1IPiEvRT_
63 f1(ip);
64 // CHECK: define linkonce_odr void @_Z2f1IPfEvRT_
65 f1(fp);