Pete Cooper | a8290ac | 2014-03-04 02:56:59 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -S -emit-llvm -g %s -o - -triple=x86_64-unknown-unknown | FileCheck %s |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 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 | // CHECK: ; [ DW_TAG_structure_type ] [e<int>] {{.*}} [decl] |
| 42 | |
| 43 | template <typename T> |
| 44 | struct f { |
| 45 | void g(); |
| 46 | }; |
| 47 | extern template class f<int>; |
| 48 | template <typename T> |
| 49 | void f<T>::g() { |
| 50 | } |
| 51 | f<int> fi; |
| 52 | // Is this right? We don't seem to emit a def for 'f<int>::g' (even if it is |
| 53 | // called in this translation unit) so I guess if we're relying on its |
| 54 | // definition to be wherever the explicit instantiation definition is, we can do |
| 55 | // the same for the debug info. |
| 56 | // CHECK: ; [ DW_TAG_structure_type ] [f<int>] {{.*}} [decl] |
| 57 | |
| 58 | template <typename T> |
| 59 | struct g { |
| 60 | void f(); |
| 61 | }; |
| 62 | template <> |
| 63 | void g<int>::f(); |
| 64 | extern template class g<int>; |
| 65 | g<int> gi; |
| 66 | // CHECK: ; [ DW_TAG_structure_type ] [g<int>] {{.*}} [def] |
| 67 | |
| 68 | template <typename T> |
| 69 | struct h { |
| 70 | }; |
| 71 | template class h<int>; |
| 72 | // CHECK: ; [ DW_TAG_structure_type ] [h<int>] {{.*}} [def] |