[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-template-explicit-specialization.cpp
blobb756674f54c4053133004af7e4cca6006b3a0e33
1 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s
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
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
11 // LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type
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: ){{$}}
18 template <typename T>
19 struct a {
21 extern template class a<int>;
22 // CHECK-NOT: DICompositeType(tag: DW_TAG_structure_type, name: "a<int>"
24 template <typename T>
25 struct b {
27 extern template class b<int>;
28 b<int> bi;
30 template <typename T>
31 struct c {
32 void f() {}
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
39 template <typename T>
40 struct d {
41 void f();
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: ){{$}}
49 template <typename T>
50 struct e {
51 void f();
53 template <typename T>
54 void e<T>::f() {
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: ){{$}}
65 template <typename T>
66 struct f {
67 void g();
69 extern template class f<int>;
70 template <typename T>
71 void f<T>::g() {
73 f<int> fi;
74 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "f<int>"
75 // CHECK-NOT: DIFlagFwdDecl
76 // CHECK-SAME: ){{$}}
78 template <typename T>
79 struct g {
80 void f();
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: ){{$}}
90 template <typename T>
91 struct h {
93 template class h<int>;
95 template <typename T>
96 struct i {
97 void f() {}
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: ){{$}}
106 template <typename T1, typename T2 = T1>
107 struct j {
109 extern template class j<int>;
110 j<int> jj;
111 template <typename T>
112 struct j_wrap {
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> >"
118 template <typename T>
119 struct k {
121 template <>
122 struct k<int>;
123 template struct k<int>;
124 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "k<int>"
126 // CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "b<int>"
127 // CHECK-NOT: DIFlagFwdDecl
128 // CHECK-SAME: ){{$}}