[clangd] Fix warnings
[llvm-project.git] / llvm / test / tools / dsymutil / X86 / DWARFLinkerParallel / odr-member-functions.cpp
blob480cef1bf26480d1bd1fec4b8dc7413e5991ab8a
1 /* Compile with:
2 for FILE in `seq 3`; do
3 clang -g -c odr-member-functions.cpp -DFILE$FILE -o
4 odr-member-functions/$FILE.o done
5 */
7 // RUN: dsymutil --linker=parallel -f \
8 // RUN: -oso-prepend-path=%p/../../Inputs/odr-member-functions \
9 // RUN: -y %p/../dummy-debug-map.map -o %t1.out
10 // RUN: llvm-dwarfdump -debug-info %t1.out | FileCheck %s
12 struct S {
13 __attribute__((always_inline)) void foo() { bar(); }
14 __attribute__((always_inline)) void foo(int i) {
15 if (i)
16 bar();
18 void bar();
20 template <typename T> void baz(T t) {}
23 #ifdef FILE1
24 void foo() { S s; }
26 // First chack that types are moved into the type table unit.
28 // CHECK: TAG_compile_unit
29 // CHECK: AT_name{{.*}}"__artificial_type_unit"
31 // CHECK: 0x[[INT_BASE:[0-9a-f]*]]: DW_TAG_base_type
32 // CHECK-NEXT: DW_AT_name{{.*}}"int"
34 // CHECK: 0x[[PTR_S:[0-9a-f]*]]:{{.*}}DW_TAG_pointer_type
35 // CHECK-NEXT: DW_AT_type{{.*}}0x[[STRUCT_S:[0-9a-f]*]] "S")
37 // CHECK: 0x[[STRUCT_S]]:{{.*}}DW_TAG_structure_type
38 // CHECK-NEXT: DW_AT_name{{.*}}"S"
40 // CHECK: DW_TAG_subprogram
41 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3barEv"
42 // CHECK: DW_AT_name{{.*}}"bar"
44 // CHECK: DW_TAG_formal_parameter
45 // CHECK-NEXT: DW_AT_type{{.*}}0x[[PTR_S]] "S *"
47 // CHECK: 0x[[BAZ_SUBPROGRAM:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
48 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3bazIiEEvT_"
49 // CHECK: DW_AT_name{{.*}}"baz<int>"
51 // CHECK: DW_TAG_formal_parameter
52 // CHECK-NEXT: DW_AT_type{{.*}}0x[[PTR_S]] "S *"
54 // CHECK: DW_TAG_formal_parameter
55 // CHECK-NEXT: DW_AT_type{{.*}}0x[[INT_BASE]] "int"
57 // CHECK: DW_TAG_template_type_parameter
58 // CHECK-NEXT: DW_AT_type{{.*}}0x[[INT_BASE]] "int"
59 // CHECK-NEXT: DW_AT_name{{.*}}"T"
61 // CHECK: 0x[[FOO_Ei:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
62 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEi"
63 // CHECK: DW_AT_name{{.*}}"foo"
65 // CHECK: DW_TAG_formal_parameter
66 // CHECK-NEXT: DW_AT_type{{.*}}0x[[PTR_S]] "S *"
68 // CHECK: DW_TAG_formal_parameter
69 // CHECK-NEXT: DW_AT_type{{.*}}0x[[INT_BASE]] "int"
71 // CHECK: 0x[[FOO_Ev:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
72 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEv"
73 // CHECK: DW_AT_name{{.*}}"foo"
75 // CHECK: DW_TAG_formal_parameter
76 // CHECK-NEXT: DW_AT_type{{.*}}0x[[PTR_S]] "S *"
78 // For the second unit check that it references structure "S"
80 // CHECK: TAG_compile_unit
81 // CHECK-NOT: {{DW_TAG|NULL}}
82 // CHECK: AT_name{{.*}}"odr-member-functions.cpp"
84 // CHECK: DW_TAG_subprogram
85 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z3foov"
86 // CHECK-NEXT: AT_name{{.*}}"foo"
88 // CHECK: DW_TAG_variable
89 // CHECK: DW_AT_name{{.*}}"s"
90 // CHECK: DW_AT_type{{.*}}(0x00000000[[STRUCT_S]] "S"
92 #elif defined(FILE2)
93 void foo() {
94 S s;
95 // Check that the overloaded member functions are resolved correctly
96 s.foo();
97 s.foo(1);
100 // For the third unit check that it references member functions of structure S.
101 // CHECK: TAG_compile_unit
102 // CHECK-NOT: DW_TAG
103 // CHECK: AT_name{{.*}}"odr-member-functions.cpp"
105 // CHECK: 0x[[ABASE_FOO_Ev:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
106 // CHECK-NEXT: DW_AT_specification {{.*}}(0x00000000[[FOO_Ev]] "_ZN1S3fooEv"
107 // CHECK-NEXT: DW_AT_inline (DW_INL_inlined)
108 // CHECK-NEXT: DW_AT_object_pointer {{.*}}(0x[[ABASE_FOO_Ev_PARAM1:[0-9a-f]*]]
110 // CHECK: 0x[[ABASE_FOO_Ev_PARAM1]]:{{.*}}DW_TAG_formal_parameter
111 // CHECK-NEXT: DW_AT_name{{.*}}"this"
112 // CHECK-NEXT: DW_AT_type{{.*}}(0x00000000[[PTR_S]] "S *"
114 // CHECK: 0x[[ABASE_FOO_Ei:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
115 // CHECK-NEXT: DW_AT_specification {{.*}}(0x00000000[[FOO_Ei]] "_ZN1S3fooEi"
116 // CHECK-NEXT: DW_AT_inline (DW_INL_inlined)
117 // CHECK-NEXT: DW_AT_object_pointer {{.*}}(0x[[ABASE_FOO_Ei_PARAM1:[0-9a-f]*]]
119 // CHECK: 0x[[ABASE_FOO_Ei_PARAM1]]:{{.*}}DW_TAG_formal_parameter
120 // CHECK-NEXT: DW_AT_name{{.*}}"this"
121 // CHECK-NEXT: DW_AT_type{{.*}}(0x00000000[[PTR_S]] "S *"
123 // CHECK: 0x[[ABASE_FOO_Ei_PARAM2:[0-9a-f]*]]:{{.*}}DW_TAG_formal_parameter
124 // CHECK-NEXT: DW_AT_name{{.*}}"i"
125 // CHECK: DW_AT_type (0x00000000[[INT_BASE]] "int"
127 // CHECK: DW_TAG_subprogram
128 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z3foov"
129 // CHECK: DW_AT_name{{.*}}"foo"
131 // CHECK: DW_TAG_variable
132 // CHECK: DW_AT_name{{.*}}"s"
133 // CHECK: DW_AT_type{{.*}}(0x00000000[[STRUCT_S]] "S"
135 // CHECK: DW_TAG_inlined_subroutine
136 // CHECK: DW_AT_abstract_origin{{.*}}(0x[[ABASE_FOO_Ev]] "_ZN1S3fooEv"
137 // CHECK: DW_AT_low_pc
138 // CHECK: DW_AT_high_pc
140 // CHECK: DW_TAG_formal_parameter
141 // CHECK: DW_AT_abstract_origin{{.*}}(0x[[ABASE_FOO_Ev_PARAM1]] "this"
143 // CHECK: DW_TAG_inlined_subroutine
144 // CHECK: DW_AT_abstract_origin{{.*}}(0x[[ABASE_FOO_Ei]] "_ZN1S3fooEi"
145 // CHECK: DW_AT_low_pc
146 // CHECK: DW_AT_high_pc
148 // CHECK: DW_TAG_formal_parameter
149 // CHECK: DW_AT_abstract_origin{{.*}}(0x[[ABASE_FOO_Ei_PARAM1]] "this"
151 // CHECK: DW_TAG_formal_parameter
152 // CHECK: DW_AT_abstract_origin{{.*}}(0x[[ABASE_FOO_Ei_PARAM2]] "i"
154 #elif defined(FILE3)
155 void foo() {
156 S s;
157 s.baz<int>(42);
160 // For the fourth unit check that it references member functions of structure S.
162 // CHECK: TAG_compile_unit
163 // CHECK-NOT: DW_TAG
164 // CHECK: AT_name{{.*}}"odr-member-functions.cpp"
166 // CHECK: DW_TAG_subprogram
167 // CHECK: DW_AT_MIPS_linkage_name{{.*}}"_Z3foov"
168 // CHECK: DW_AT_name{{.*}}"foo"
170 // CHECK: DW_TAG_variable
171 // CHECK: DW_AT_name{{.*}}"s"
172 // CHECK: DW_AT_type{{.*}}(0x00000000[[STRUCT_S]] "S"
174 // CHECK: DW_TAG_subprogram
175 // CHECK: DW_AT_object_pointer{{.*}}(0x[[INST_PARAM2:[0-9a-f]*]]
176 // CHECK: DW_AT_specification{{.*}}(0x00000000[[BAZ_SUBPROGRAM]] "_ZN1S3bazIiEEvT_"
178 // CHECK: 0x[[INST_PARAM2]]:{{.*}}DW_TAG_formal_parameter
179 // CHECK: DW_AT_name{{.*}}"this"
180 // CHECK: DW_AT_type{{.*}}(0x00000000[[PTR_S]] "S *"
182 // CHECK: DW_TAG_formal_parameter
183 // CHECK: DW_AT_name{{.*}}"t"
184 // CHECK: DW_AT_type{{.*}}(0x00000000[[INT_BASE]] "int"
186 // CHECK: DW_TAG_template_type_parameter
187 // CHECK: DW_AT_type{{.*}}(0x00000000[[INT_BASE]] "int"
188 // CHECK: DW_AT_name{{.*}}"T"
190 #else
191 #error "You must define which file you generate"
192 #endif