Reid Kleckner | dfb1887 | 2014-03-04 21:33:26 +0000 | [diff] [blame] | 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 |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 8 | |
| 9 | template <typename T> |
| 10 | struct a { |
| 11 | }; |
| 12 | extern template class a<int>; |
| 13 | // CHECK-NOT: ; [ DW_TAG_structure_type ] [a<int>] |
| 14 | |
| 15 | template <typename T> |
| 16 | struct b { |
| 17 | }; |
| 18 | extern template class b<int>; |
| 19 | b<int> bi; |
| 20 | // CHECK: ; [ DW_TAG_structure_type ] [b<int>] {{.*}} [def] |
| 21 | |
| 22 | template <typename T> |
| 23 | struct c { |
| 24 | void f() {} |
| 25 | }; |
| 26 | extern template class c<int>; |
| 27 | c<int> ci; |
| 28 | // CHECK: ; [ DW_TAG_structure_type ] [c<int>] {{.*}} [decl] |
| 29 | |
| 30 | template <typename T> |
| 31 | struct d { |
| 32 | void f(); |
| 33 | }; |
| 34 | extern template class d<int>; |
| 35 | d<int> di; |
| 36 | // CHECK: ; [ DW_TAG_structure_type ] [d<int>] {{.*}} [def] |
| 37 | |
| 38 | template <typename T> |
| 39 | struct e { |
| 40 | void f(); |
| 41 | }; |
| 42 | template <typename T> |
| 43 | void e<T>::f() { |
| 44 | } |
| 45 | extern template class e<int>; |
| 46 | e<int> ei; |
David Blaikie | f7f2185 | 2014-03-04 03:08:14 +0000 | [diff] [blame] | 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] |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 51 | |
| 52 | template <typename T> |
| 53 | struct f { |
| 54 | void g(); |
| 55 | }; |
| 56 | extern template class f<int>; |
| 57 | template <typename T> |
| 58 | void f<T>::g() { |
| 59 | } |
| 60 | f<int> fi; |
David Blaikie | f7f2185 | 2014-03-04 03:08:14 +0000 | [diff] [blame] | 61 | // CHECK: ; [ DW_TAG_structure_type ] [f<int>] {{.*}} [def] |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 62 | |
| 63 | template <typename T> |
| 64 | struct g { |
| 65 | void f(); |
| 66 | }; |
| 67 | template <> |
| 68 | void g<int>::f(); |
| 69 | extern template class g<int>; |
| 70 | g<int> gi; |
| 71 | // CHECK: ; [ DW_TAG_structure_type ] [g<int>] {{.*}} [def] |
| 72 | |
| 73 | template <typename T> |
| 74 | struct h { |
| 75 | }; |
| 76 | template class h<int>; |
| 77 | // CHECK: ; [ DW_TAG_structure_type ] [h<int>] {{.*}} [def] |
David Blaikie | f7f2185 | 2014-03-04 03:08:14 +0000 | [diff] [blame] | 78 | |
| 79 | template <typename T> |
| 80 | struct i { |
| 81 | void f() {} |
| 82 | }; |
| 83 | template<> void i<int>::f(); |
| 84 | extern template class i<int>; |
| 85 | i<int> ii; |
| 86 | // CHECK: ; [ DW_TAG_structure_type ] [i<int>] {{.*}} [def] |
David Blaikie | 65813a3 | 2014-04-02 18:21:09 +0000 | [diff] [blame^] | 87 | |
| 88 | template <typename T1, typename T2 = T1> |
| 89 | struct j { |
| 90 | }; |
| 91 | extern template class j<int>; |
| 92 | j<int> jj; |
| 93 | // CHECK: ; [ DW_TAG_structure_type ] [j<int, int>] |