129 lines · cpp
1// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s2 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 %s5 6// Run again with -gline-tables-only or -gline-directives-only and verify we don't crash. We won't output7// 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-ONLY9// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-directives-only %s -o - | FileCheck %s -check-prefix LINES-ONLY10 11// LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type12 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: DIFlagFwdDecl16// CHECK-SAME: ){{$}}17 18template <typename T>19struct a {20};21extern template class a<int>;22// CHECK-NOT: DICompositeType(tag: DW_TAG_structure_type, name: "a<int>"23 24template <typename T>25struct b {26};27extern template class b<int>;28b<int> bi;29 30template <typename T>31struct c {32 void f() {}33};34extern template class c<int>;35c<int> ci;36// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "c<int>"37// CHECK-SAME: DIFlagFwdDecl38 39template <typename T>40struct d {41 void f();42};43extern template class d<int>;44d<int> di;45// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "d<int>"46// CHECK-NOT: DIFlagFwdDecl47// CHECK-SAME: ){{$}}48 49template <typename T>50struct e {51 void f();52};53template <typename T>54void e<T>::f() {55}56extern template class e<int>;57e<int> ei;58// There's no guarantee that the out of line definition will appear before the59// explicit template instantiation definition, so conservatively emit the type60// definition here.61// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "e<int>"62// CHECK-NOT: DIFlagFwdDecl63// CHECK-SAME: ){{$}}64 65template <typename T>66struct f {67 void g();68};69extern template class f<int>;70template <typename T>71void f<T>::g() {72}73f<int> fi;74// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "f<int>"75// CHECK-NOT: DIFlagFwdDecl76// CHECK-SAME: ){{$}}77 78template <typename T>79struct g {80 void f();81};82template <>83void g<int>::f();84extern template class g<int>;85g<int> gi;86// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "g<int>"87// CHECK-NOT: DIFlagFwdDecl88// CHECK-SAME: ){{$}}89 90template <typename T>91struct h {92};93template class h<int>;94 95template <typename T>96struct i {97 void f() {}98};99template<> void i<int>::f();100extern template class i<int>;101i<int> ii;102// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "i<int>"103// CHECK-NOT: DIFlagFwdDecl104// CHECK-SAME: ){{$}}105 106template <typename T1, typename T2 = T1>107struct j {108};109extern template class j<int>;110j<int> jj;111template <typename T>112struct j_wrap {113};114j_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 118template <typename T>119struct k {120};121template <>122struct k<int>;123template 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: DIFlagFwdDecl128// CHECK-SAME: ){{$}}129