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 | |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 7 | // LINES-ONLY-NOT: !MDCompositeType(tag: 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>; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 13 | // CHECK-NOT: MDCompositeType(tag: DW_TAG_structure_type, name: "a<int>" |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 14 | |
| 15 | template <typename T> |
| 16 | struct b { |
| 17 | }; |
| 18 | extern template class b<int>; |
| 19 | b<int> bi; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 20 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "b<int>" |
| 21 | // CHECK-NOT: DIFlagFwdDecl |
| 22 | // CHECK-SAME: ){{$}} |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 23 | |
| 24 | template <typename T> |
| 25 | struct c { |
| 26 | void f() {} |
| 27 | }; |
| 28 | extern template class c<int>; |
| 29 | c<int> ci; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 30 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "c<int>" |
| 31 | // CHECK-SAME: DIFlagFwdDecl |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 32 | |
| 33 | template <typename T> |
| 34 | struct d { |
| 35 | void f(); |
| 36 | }; |
| 37 | extern template class d<int>; |
| 38 | d<int> di; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 39 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "d<int>" |
| 40 | // CHECK-NOT: DIFlagFwdDecl |
| 41 | // CHECK-SAME: ){{$}} |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 42 | |
| 43 | template <typename T> |
| 44 | struct e { |
| 45 | void f(); |
| 46 | }; |
| 47 | template <typename T> |
| 48 | void e<T>::f() { |
| 49 | } |
| 50 | extern template class e<int>; |
| 51 | e<int> ei; |
David Blaikie | f7f2185 | 2014-03-04 03:08:14 +0000 | [diff] [blame] | 52 | // There's no guarantee that the out of line definition will appear before the |
| 53 | // explicit template instantiation definition, so conservatively emit the type |
| 54 | // definition here. |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 55 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "e<int>" |
| 56 | // CHECK-NOT: DIFlagFwdDecl |
| 57 | // CHECK-SAME: ){{$}} |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 58 | |
| 59 | template <typename T> |
| 60 | struct f { |
| 61 | void g(); |
| 62 | }; |
| 63 | extern template class f<int>; |
| 64 | template <typename T> |
| 65 | void f<T>::g() { |
| 66 | } |
| 67 | f<int> fi; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 68 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "f<int>" |
| 69 | // CHECK-NOT: DIFlagFwdDecl |
| 70 | // CHECK-SAME: ){{$}} |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 71 | |
| 72 | template <typename T> |
| 73 | struct g { |
| 74 | void f(); |
| 75 | }; |
| 76 | template <> |
| 77 | void g<int>::f(); |
| 78 | extern template class g<int>; |
| 79 | g<int> gi; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 80 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "g<int>" |
| 81 | // CHECK-NOT: DIFlagFwdDecl |
| 82 | // CHECK-SAME: ){{$}} |
David Blaikie | 0e716b4 | 2014-03-03 23:48:23 +0000 | [diff] [blame] | 83 | |
| 84 | template <typename T> |
| 85 | struct h { |
| 86 | }; |
| 87 | template class h<int>; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 88 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "h<int>" |
| 89 | // CHECK-NOT: DIFlagFwdDecl |
| 90 | // CHECK-SAME: ){{$}} |
David Blaikie | f7f2185 | 2014-03-04 03:08:14 +0000 | [diff] [blame] | 91 | |
| 92 | template <typename T> |
| 93 | struct i { |
| 94 | void f() {} |
| 95 | }; |
| 96 | template<> void i<int>::f(); |
| 97 | extern template class i<int>; |
| 98 | i<int> ii; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 99 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "i<int>" |
| 100 | // CHECK-NOT: DIFlagFwdDecl |
| 101 | // CHECK-SAME: ){{$}} |
David Blaikie | 65813a3 | 2014-04-02 18:21:09 +0000 | [diff] [blame] | 102 | |
| 103 | template <typename T1, typename T2 = T1> |
| 104 | struct j { |
| 105 | }; |
| 106 | extern template class j<int>; |
| 107 | j<int> jj; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 108 | // CHECK: MDCompositeType(tag: DW_TAG_structure_type, name: "j<int, int>" |
David Blaikie | 0317bc9 | 2014-12-16 23:49:18 +0000 | [diff] [blame] | 109 | |
| 110 | template <typename T> |
| 111 | struct k { |
| 112 | }; |
| 113 | template <> |
| 114 | struct k<int>; |
| 115 | template struct k<int>; |
Duncan P. N. Exon Smith | f04be1f | 2015-03-03 17:25:55 +0000 | [diff] [blame^] | 116 | // CHECK-NOT: !MDCompositeType(tag: DW_TAG_structure_type, name: "k<int>" |