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