[llvm-readelf] - Report a warning when .hash section contains a chain with a cycle.
[llvm-complete.git] / test / tools / dsymutil / X86 / odr-member-functions.cpp
blob99fecd0b4ad2338ad753fba2b5935a7f0dfc169f
1 /* Compile with:
2 for FILE in `seq 3`; do
3 clang -g -c odr-member-functions.cpp -DFILE$FILE -o odr-member-functions/$FILE.o
4 done
5 */
7 // RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/odr-member-functions -y %p/dummy-debug-map.map -o - | llvm-dwarfdump -debug-info - | FileCheck %s
9 struct S {
10 __attribute__((always_inline)) void foo() { bar(); }
11 __attribute__((always_inline)) void foo(int i) { if (i) bar(); }
12 void bar();
14 template<typename T> void baz(T t) {}
17 #ifdef FILE1
18 void foo() {
19 S s;
22 // CHECK: TAG_compile_unit
23 // CHECK-NOT: {{DW_TAG|NULL}}
24 // CHECK: AT_name{{.*}}"odr-member-functions.cpp"
26 // CHECK: 0x[[S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type
27 // CHECK-NOT: {{DW_TAG|NULL}}
28 // CHECK: DW_AT_name{{.*}}"S"
29 // CHECK-NOT: NULL
30 // CHECK: 0x[[FOO:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
31 // CHECK-NEXT: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEv"
32 // CHECK: NULL
33 // CHECK: 0x[[FOOI:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
34 // CHECK-NEXT: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEi"
36 #elif defined(FILE2)
37 void foo() {
38 S s;
39 // Check that the overloaded member functions are resolved correctly
40 s.foo();
41 s.foo(1);
44 // CHECK: TAG_compile_unit
45 // CHECK-NOT: DW_TAG
46 // CHECK: AT_name{{.*}}"odr-member-functions.cpp"
48 // Normal member functions should be desribed by the type in the first
49 // CU, thus we should be able to reuse its definition and avoid
50 // reemiting it.
51 // CHECK-NOT: DW_TAG_structure_type
53 // CHECK: 0x[[FOO_SUB:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
54 // CHECK-NEXT: DW_AT_specification{{.*}}[[FOO]]
55 // CHECK-NOT: DW_TAG_structure_type
56 // CHECK: 0x[[FOOI_SUB:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram
57 // CHECK-NEXT: DW_AT_specification{{.*}}[[FOOI]]
58 // CHECK-NOT: DW_TAG_structure_type
60 // CHECK: DW_TAG_variable
61 // CHECK-NOT: DW_TAG
62 // CHECK: DW_AT_name {{.*}}"s"
63 // CHECK-NOT: DW_TAG
64 // CHECK: DW_AT_type {{.*}}[[S]]
65 // CHECK: DW_TAG_inlined_subroutine
66 // CHECK-NEXT: DW_AT_abstract_origin{{.*}}[[FOO_SUB]]
67 // CHECK-NOT: DW_TAG
68 // CHECK: DW_AT_call_line{{.*}}40
69 // CHECK: DW_TAG_inlined_subroutine
70 // CHECK-NEXT: DW_AT_abstract_origin{{.*}}[[FOOI_SUB]]
71 // CHECK-NOT: DW_TAG
72 // CHECK: DW_AT_call_line{{.*}}41
74 #elif defined(FILE3)
75 void foo() {
76 S s;
77 s.baz<int>(42);
80 // CHECK: TAG_compile_unit
81 // CHECK-NOT: DW_TAG
82 // CHECK: AT_name{{.*}}"odr-member-functions.cpp"
84 // Template or other implicit members will be included in the type
85 // only if they are generated. Thus actually creating a new type.
86 // CHECK: DW_TAG_structure_type
88 // Skip 'normal' member functions
89 // CHECK: DW_TAG_subprogram
90 // CHECK: DW_TAG_subprogram
91 // CHECK: DW_TAG_subprogram
93 // This is the 'baz' member
94 // CHECK: 0x[[BAZ:[0-9a-f]*]]: DW_TAG_subprogram
95 // CHECK-NOT: DW_TAG
96 // CHECK: DW_AT_MIPS_linkage_name {{.*}}"_ZN1S3bazIiEEvT_"
97 // CHECK-NOT: DW_TAG
98 // CHECK: DW_AT_name {{.*}}"baz<int>"
100 // Skip foo3
101 // CHECK: DW_TAG_subprogram
103 // baz instanciation:
104 // CHECK: DW_TAG_subprogram
105 // CHECK-NOT: DW_TAG
106 // CHECK: DW_AT_specification {{.*}}[[BAZ]] "_ZN1S3bazIiEEvT_"
107 #else
108 #error "You must define which file you generate"
109 #endif