blob: 04c63ae2ff242574f01f5a5e96082b609d49b49a [file] [log] [blame]
Douglas Katzman3459ce22015-10-08 04:24:12 +00001// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=limited %s -o - | FileCheck %s
Reid Klecknerdfb18872014-03-04 21:33:26 +00002
3// Run again with -gline-tables-only and verify we don't crash. We won't output
4// type info at all.
Douglas Katzman3459ce22015-10-08 04:24:12 +00005// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -debug-info-kind=line-tables-only %s -o - | FileCheck %s -check-prefix LINES-ONLY
Reid Klecknerdfb18872014-03-04 21:33:26 +00006
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +00007// LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type
David Blaikie0e716b42014-03-03 23:48:23 +00008
9template <typename T>
10struct a {
11};
12extern template class a<int>;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000013// CHECK-NOT: DICompositeType(tag: DW_TAG_structure_type, name: "a<int>"
David Blaikie0e716b42014-03-03 23:48:23 +000014
15template <typename T>
16struct b {
17};
18extern template class b<int>;
19b<int> bi;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000020// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "b<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000021// CHECK-NOT: DIFlagFwdDecl
22// CHECK-SAME: ){{$}}
David Blaikie0e716b42014-03-03 23:48:23 +000023
24template <typename T>
25struct c {
26 void f() {}
27};
28extern template class c<int>;
29c<int> ci;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000030// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "c<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000031// CHECK-SAME: DIFlagFwdDecl
David Blaikie0e716b42014-03-03 23:48:23 +000032
33template <typename T>
34struct d {
35 void f();
36};
37extern template class d<int>;
38d<int> di;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000039// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "d<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000040// CHECK-NOT: DIFlagFwdDecl
41// CHECK-SAME: ){{$}}
David Blaikie0e716b42014-03-03 23:48:23 +000042
43template <typename T>
44struct e {
45 void f();
46};
47template <typename T>
48void e<T>::f() {
49}
50extern template class e<int>;
51e<int> ei;
David Blaikief7f21852014-03-04 03:08:14 +000052// 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 Smith9dd4e4e2015-04-29 16:40:08 +000055// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "e<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000056// CHECK-NOT: DIFlagFwdDecl
57// CHECK-SAME: ){{$}}
David Blaikie0e716b42014-03-03 23:48:23 +000058
59template <typename T>
60struct f {
61 void g();
62};
63extern template class f<int>;
64template <typename T>
65void f<T>::g() {
66}
67f<int> fi;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000068// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "f<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000069// CHECK-NOT: DIFlagFwdDecl
70// CHECK-SAME: ){{$}}
David Blaikie0e716b42014-03-03 23:48:23 +000071
72template <typename T>
73struct g {
74 void f();
75};
76template <>
77void g<int>::f();
78extern template class g<int>;
79g<int> gi;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000080// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "g<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000081// CHECK-NOT: DIFlagFwdDecl
82// CHECK-SAME: ){{$}}
David Blaikie0e716b42014-03-03 23:48:23 +000083
84template <typename T>
85struct h {
86};
87template class h<int>;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000088// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "h<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +000089// CHECK-NOT: DIFlagFwdDecl
90// CHECK-SAME: ){{$}}
David Blaikief7f21852014-03-04 03:08:14 +000091
92template <typename T>
93struct i {
94 void f() {}
95};
96template<> void i<int>::f();
97extern template class i<int>;
98i<int> ii;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +000099// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "i<int>"
Duncan P. N. Exon Smithf04be1f2015-03-03 17:25:55 +0000100// CHECK-NOT: DIFlagFwdDecl
101// CHECK-SAME: ){{$}}
David Blaikie65813a32014-04-02 18:21:09 +0000102
103template <typename T1, typename T2 = T1>
104struct j {
105};
106extern template class j<int>;
107j<int> jj;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +0000108// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "j<int, int>"
David Blaikie0317bc92014-12-16 23:49:18 +0000109
110template <typename T>
111struct k {
112};
113template <>
114struct k<int>;
115template struct k<int>;
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +0000116// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "k<int>"