// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s // Run again with -gline-tables-only and verify we don't crash. We won't output // type info at all. // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only %s -o - | FileCheck %s -check-prefix LINES-ONLY // LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type // "h" is at the top because it's in the compile unit's retainedTypes: list. // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "h" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} template struct a { }; extern template class a; // CHECK-NOT: DICompositeType(tag: DW_TAG_structure_type, name: "a" template struct b { }; extern template class b; b bi; template struct c { void f() {} }; extern template class c; c ci; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "c" // CHECK-SAME: DIFlagFwdDecl template struct d { void f(); }; extern template class d; d di; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "d" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} template struct e { void f(); }; template void e::f() { } extern template class e; e ei; // There's no guarantee that the out of line definition will appear before the // explicit template instantiation definition, so conservatively emit the type // definition here. // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "e" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} template struct f { void g(); }; extern template class f; template void f::g() { } f fi; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "f" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} template struct g { void f(); }; template <> void g::f(); extern template class g; g gi; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "g" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} template struct h { }; template class h; template struct i { void f() {} }; template<> void i::f(); extern template class i; i ii; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "i" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} template struct j { }; extern template class j; j jj; // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j" template struct k { }; template <> struct k; template struct k; // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "k" // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "b" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}}