1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -g %s -o - -fno-standalone-debug | FileCheck %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc // Run again with -gline-tables-only and verify we don't crash. We won't output 4*0a6a1f1dSLionel Sambuc // type info at all. 5*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -g %s -o - -gline-tables-only | FileCheck %s -check-prefix LINES-ONLY 6*0a6a1f1dSLionel Sambuc 7*0a6a1f1dSLionel Sambuc // LINES-ONLY-NOT: DW_TAG_structure_type 8*0a6a1f1dSLionel Sambuc 9*0a6a1f1dSLionel Sambuc template <typename T> 10*0a6a1f1dSLionel Sambuc struct a { 11*0a6a1f1dSLionel Sambuc }; 12*0a6a1f1dSLionel Sambuc extern template class a<int>; 13*0a6a1f1dSLionel Sambuc // CHECK-NOT: ; [ DW_TAG_structure_type ] [a<int>] 14*0a6a1f1dSLionel Sambuc 15*0a6a1f1dSLionel Sambuc template <typename T> 16*0a6a1f1dSLionel Sambuc struct b { 17*0a6a1f1dSLionel Sambuc }; 18*0a6a1f1dSLionel Sambuc extern template class b<int>; 19*0a6a1f1dSLionel Sambuc b<int> bi; 20*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [b<int>] {{.*}} [def] 21*0a6a1f1dSLionel Sambuc 22*0a6a1f1dSLionel Sambuc template <typename T> 23*0a6a1f1dSLionel Sambuc struct c { fc24*0a6a1f1dSLionel Sambuc void f() {} 25*0a6a1f1dSLionel Sambuc }; 26*0a6a1f1dSLionel Sambuc extern template class c<int>; 27*0a6a1f1dSLionel Sambuc c<int> ci; 28*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [c<int>] {{.*}} [decl] 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc template <typename T> 31*0a6a1f1dSLionel Sambuc struct d { 32*0a6a1f1dSLionel Sambuc void f(); 33*0a6a1f1dSLionel Sambuc }; 34*0a6a1f1dSLionel Sambuc extern template class d<int>; 35*0a6a1f1dSLionel Sambuc d<int> di; 36*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [d<int>] {{.*}} [def] 37*0a6a1f1dSLionel Sambuc 38*0a6a1f1dSLionel Sambuc template <typename T> 39*0a6a1f1dSLionel Sambuc struct e { 40*0a6a1f1dSLionel Sambuc void f(); 41*0a6a1f1dSLionel Sambuc }; 42*0a6a1f1dSLionel Sambuc template <typename T> f()43*0a6a1f1dSLionel Sambucvoid e<T>::f() { 44*0a6a1f1dSLionel Sambuc } 45*0a6a1f1dSLionel Sambuc extern template class e<int>; 46*0a6a1f1dSLionel Sambuc e<int> ei; 47*0a6a1f1dSLionel Sambuc // There's no guarantee that the out of line definition will appear before the 48*0a6a1f1dSLionel Sambuc // explicit template instantiation definition, so conservatively emit the type 49*0a6a1f1dSLionel Sambuc // definition here. 50*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [e<int>] {{.*}} [def] 51*0a6a1f1dSLionel Sambuc 52*0a6a1f1dSLionel Sambuc template <typename T> 53*0a6a1f1dSLionel Sambuc struct f { 54*0a6a1f1dSLionel Sambuc void g(); 55*0a6a1f1dSLionel Sambuc }; 56*0a6a1f1dSLionel Sambuc extern template class f<int>; 57*0a6a1f1dSLionel Sambuc template <typename T> g()58*0a6a1f1dSLionel Sambucvoid f<T>::g() { 59*0a6a1f1dSLionel Sambuc } 60*0a6a1f1dSLionel Sambuc f<int> fi; 61*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [f<int>] {{.*}} [def] 62*0a6a1f1dSLionel Sambuc 63*0a6a1f1dSLionel Sambuc template <typename T> 64*0a6a1f1dSLionel Sambuc struct g { 65*0a6a1f1dSLionel Sambuc void f(); 66*0a6a1f1dSLionel Sambuc }; 67*0a6a1f1dSLionel Sambuc template <> 68*0a6a1f1dSLionel Sambuc void g<int>::f(); 69*0a6a1f1dSLionel Sambuc extern template class g<int>; 70*0a6a1f1dSLionel Sambuc g<int> gi; 71*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [g<int>] {{.*}} [def] 72*0a6a1f1dSLionel Sambuc 73*0a6a1f1dSLionel Sambuc template <typename T> 74*0a6a1f1dSLionel Sambuc struct h { 75*0a6a1f1dSLionel Sambuc }; 76*0a6a1f1dSLionel Sambuc template class h<int>; 77*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [h<int>] {{.*}} [def] 78*0a6a1f1dSLionel Sambuc 79*0a6a1f1dSLionel Sambuc template <typename T> 80*0a6a1f1dSLionel Sambuc struct i { fi81*0a6a1f1dSLionel Sambuc void f() {} 82*0a6a1f1dSLionel Sambuc }; 83*0a6a1f1dSLionel Sambuc template<> void i<int>::f(); 84*0a6a1f1dSLionel Sambuc extern template class i<int>; 85*0a6a1f1dSLionel Sambuc i<int> ii; 86*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [i<int>] {{.*}} [def] 87*0a6a1f1dSLionel Sambuc 88*0a6a1f1dSLionel Sambuc template <typename T1, typename T2 = T1> 89*0a6a1f1dSLionel Sambuc struct j { 90*0a6a1f1dSLionel Sambuc }; 91*0a6a1f1dSLionel Sambuc extern template class j<int>; 92*0a6a1f1dSLionel Sambuc j<int> jj; 93*0a6a1f1dSLionel Sambuc // CHECK: ; [ DW_TAG_structure_type ] [j<int, int>] 94*0a6a1f1dSLionel Sambuc 95*0a6a1f1dSLionel Sambuc template <typename T> 96*0a6a1f1dSLionel Sambuc struct k { 97*0a6a1f1dSLionel Sambuc }; 98*0a6a1f1dSLionel Sambuc template <> 99*0a6a1f1dSLionel Sambuc struct k<int>; 100*0a6a1f1dSLionel Sambuc template struct k<int>; 101*0a6a1f1dSLionel Sambuc // CHECK-NOT: ; [ DW_TAG_structure_type ] [k<int>] 102