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