1// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -g %s -o - -fno-standalone-debug | 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 -g %s -o - -gline-tables-only | FileCheck %s -check-prefix LINES-ONLY
6
7// LINES-ONLY-NOT: DW_TAG_structure_type
8
9template <typename T>
10struct a {
11};
12extern template class a<int>;
13// CHECK-NOT: ; [ DW_TAG_structure_type ] [a<int>]
14
15template <typename T>
16struct b {
17};
18extern template class b<int>;
19b<int> bi;
20// CHECK: ; [ DW_TAG_structure_type ] [b<int>] {{.*}} [def]
21
22template <typename T>
23struct c {
24  void f() {}
25};
26extern template class c<int>;
27c<int> ci;
28// CHECK: ; [ DW_TAG_structure_type ] [c<int>] {{.*}} [decl]
29
30template <typename T>
31struct d {
32  void f();
33};
34extern template class d<int>;
35d<int> di;
36// CHECK: ; [ DW_TAG_structure_type ] [d<int>] {{.*}} [def]
37
38template <typename T>
39struct e {
40  void f();
41};
42template <typename T>
43void e<T>::f() {
44}
45extern template class e<int>;
46e<int> ei;
47// There's no guarantee that the out of line definition will appear before the
48// explicit template instantiation definition, so conservatively emit the type
49// definition here.
50// CHECK: ; [ DW_TAG_structure_type ] [e<int>] {{.*}} [def]
51
52template <typename T>
53struct f {
54  void g();
55};
56extern template class f<int>;
57template <typename T>
58void f<T>::g() {
59}
60f<int> fi;
61// CHECK: ; [ DW_TAG_structure_type ] [f<int>] {{.*}} [def]
62
63template <typename T>
64struct g {
65  void f();
66};
67template <>
68void g<int>::f();
69extern template class g<int>;
70g<int> gi;
71// CHECK: ; [ DW_TAG_structure_type ] [g<int>] {{.*}} [def]
72
73template <typename T>
74struct h {
75};
76template class h<int>;
77// CHECK: ; [ DW_TAG_structure_type ] [h<int>] {{.*}} [def]
78
79template <typename T>
80struct i {
81  void f() {}
82};
83template<> void i<int>::f();
84extern template class i<int>;
85i<int> ii;
86// CHECK: ; [ DW_TAG_structure_type ] [i<int>] {{.*}} [def]
87
88template <typename T1, typename T2 = T1>
89struct j {
90};
91extern template class j<int>;
92j<int> jj;
93// CHECK: ; [ DW_TAG_structure_type ] [j<int, int>]
94