1 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s 2 3 // Run again with -gline-tables-only and verify we don't crash. We won't output 4 // type info at all. 5 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only %s -o - | FileCheck %s -check-prefix LINES-ONLY 6 7 // LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type 8 9 // "h" is at the top because it's in the compile unit's retainedTypes: list. 10 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "h<int>" 11 // CHECK-NOT: DIFlagFwdDecl 12 // CHECK-SAME: ){{$}} 13 14 template <typename T> 15 struct a { 16 }; 17 extern template class a<int>; 18 // CHECK-NOT: DICompositeType(tag: DW_TAG_structure_type, name: "a<int>" 19 20 template <typename T> 21 struct b { 22 }; 23 extern template class b<int>; 24 b<int> bi; 25 26 template <typename T> 27 struct c { 28 void f() {} 29 }; 30 extern template class c<int>; 31 c<int> ci; 32 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "c<int>" 33 // CHECK-SAME: DIFlagFwdDecl 34 35 template <typename T> 36 struct d { 37 void f(); 38 }; 39 extern template class d<int>; 40 d<int> di; 41 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "d<int>" 42 // CHECK-NOT: DIFlagFwdDecl 43 // CHECK-SAME: ){{$}} 44 45 template <typename T> 46 struct e { 47 void f(); 48 }; 49 template <typename T> 50 void e<T>::f() { 51 } 52 extern template class e<int>; 53 e<int> ei; 54 // There's no guarantee that the out of line definition will appear before the 55 // explicit template instantiation definition, so conservatively emit the type 56 // definition here. 57 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "e<int>" 58 // CHECK-NOT: DIFlagFwdDecl 59 // CHECK-SAME: ){{$}} 60 61 template <typename T> 62 struct f { 63 void g(); 64 }; 65 extern template class f<int>; 66 template <typename T> 67 void f<T>::g() { 68 } 69 f<int> fi; 70 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "f<int>" 71 // CHECK-NOT: DIFlagFwdDecl 72 // CHECK-SAME: ){{$}} 73 74 template <typename T> 75 struct g { 76 void f(); 77 }; 78 template <> 79 void g<int>::f(); 80 extern template class g<int>; 81 g<int> gi; 82 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "g<int>" 83 // CHECK-NOT: DIFlagFwdDecl 84 // CHECK-SAME: ){{$}} 85 86 template <typename T> 87 struct h { 88 }; 89 template class h<int>; 90 91 template <typename T> 92 struct i { 93 void f() {} 94 }; 95 template<> void i<int>::f(); 96 extern template class i<int>; 97 i<int> ii; 98 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "i<int>" 99 // CHECK-NOT: DIFlagFwdDecl 100 // CHECK-SAME: ){{$}} 101 102 template <typename T1, typename T2 = T1> 103 struct j { 104 }; 105 extern template class j<int>; 106 j<int> jj; 107 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j<int, int>" 108 109 template <typename T> 110 struct k { 111 }; 112 template <> 113 struct k<int>; 114 template struct k<int>; 115 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "k<int>" 116 117 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "b<int>" 118 // CHECK-NOT: DIFlagFwdDecl 119 // CHECK-SAME: ){{$}} 120