[clangd] Fix warnings
[llvm-project.git] / llvm / test / tools / dsymutil / X86 / DWARFLinkerParallel / odr-fwd-declaration.test
blobd028194f7e83a817d5a607549de3dda082dcb64c
1 /* Compile with:
2    for FILE in `seq 3`; do
3      clang -g -c  X86/odr-fwd-declaration.cpp -DFILE$FILE -o
4        Inputs/odr-fwd-declaration/$FILE.o done
5 */
7 // RUN: dsymutil --linker=parallel -f \
8 // RUN: -oso-prepend-path=%p/../../Inputs/odr-fwd-declaration \
9 // RUN: -y %p/../dummy-debug-map.map -o %t1.out
10 // RUN: llvm-dwarfdump -v -debug-info %t1.out | FileCheck %s
12 #ifdef FILE1
13 # 1 "Header.h" 1
14 typedef struct S *Sptr;
15 typedef Sptr *Sptrptr;
16 # 3 "Source1.cpp" 2
17 void foo() { Sptrptr ptr1 = 0; }
19 // First we confirm that types are in type table.
21 // CHECK: DW_TAG_compile_unit
22 // CHECK: DW_AT_name{{.*}}"__artificial_type_unit"
24 // CHECK: DW_TAG_base_type
26 // CHECK: 0x[[PTR_S:[a-f0-9]*]]: DW_TAG_pointer_type
27 // CHECK-NEXT: DW_AT_type{{.*}}{0x[[STRUCT_S:[a-f0-9]*]]} "S"
29 // CHECK: 0x[[PTR_PTR_S:[a-f0-9]*]]: DW_TAG_pointer_type
30 // CHECK-NEXT: DW_AT_type{{.*}}{0x[[TYPEDEF_PTR_S:[a-f0-9]*]]} "Sptr"
32 // CHECK: 0x[[STRUCT_S]]: DW_TAG_structure_type
33 // CHECK-NEXT: DW_AT_name{{.*}}"S"
35 // CHECK: DW_TAG_member
36 // CHECK-NEXT: DW_AT_name{{.*}}"field"
38 // CHECK: 0x[[TYPEDEF_PTR_S]]: DW_TAG_typedef
39 // CHECK-NEXT: DW_AT_type{{.*}}{0x[[PTR_S]]} "S *"
40 // CHECK-NEXT: DW_AT_name{{.*}}"Sptr"
42 // CHECK: 0x[[TYPEDEF_PTR_PTR_S:[a-f0-9]*]]: DW_TAG_typedef
43 // CHECK-NEXT: DW_AT_type{{.*}}{0x[[PTR_PTR_S]]} "Sptr *"
44 // CHECK-NEXT: DW_AT_name{{.*}}"Sptrptr"
46 // First we confirm that first compile unit properly references type.
48 // CHECK: DW_TAG_compile_unit
49 // CHECK: DW_AT_name{{.*}}"X86/odr-fwd-declaration.cpp"
51 // CHECK: TAG_variable
52 // CHECK-NOT: {{DW_TAG|NULL}}
53 // CHECK: AT_name{{.*}} "ptr1"
54 // CHECK-NOT: {{DW_TAG|NULL}}
55 // CHECK: AT_type{{.*}}0x00000000[[TYPEDEF_PTR_PTR_S]]
57 #elif defined(FILE2)
58 # 1 "Header.h" 1
59 typedef struct S *Sptr;
60 typedef Sptr *Sptrptr;
61 # 3 "Source2.cpp" 2
62 struct S {
63   int field;
65 void bar() { Sptrptr ptr2 = 0; }
67 // Next we confirm that the second compile unit properly references types.
69 // CHECK: DW_TAG_compile_unit
70 // CHECK: DW_AT_name{{.*}}"X86/odr-fwd-declaration.cpp"
72 // CHECK: TAG_variable
73 // CHECK-NOT: {{DW_TAG|NULL}}
74 // CHECK: AT_name{{.*}} "ptr2"
75 // CHECK-NOT: {{DW_TAG|NULL}}
76 // CHECK: AT_type{{.*}}0x00000000[[TYPEDEF_PTR_PTR_S]]
78 #elif defined(FILE3)
79 # 1 "Header.h" 1
80 typedef struct S *Sptr;
81 typedef Sptr *Sptrptr;
82 # 3 "Source1.cpp" 2
83 void foo() { Sptrptr ptr1 = 0; }
85 // Finally we confirm that third compile unit references types correctly.
87 // CHECK: DW_TAG_compile_unit
88 // CHECK: DW_AT_name{{.*}}"X86/odr-fwd-declaration.cpp"
90 // CHECK: TAG_variable
91 // CHECK-NOT: {{DW_TAG|NULL}}
92 // CHECK: AT_name{{.*}} "ptr1"
93 // CHECK-NOT: {{DW_TAG|NULL}}
94 // CHECK: AT_type{{.*}}0x00000000[[TYPEDEF_PTR_PTR_S]]
95 // CHECK-NOT: TAG_typedef
96 // CHECK-NOT: TAG_pointer
97 // CHECK-NOT: TAG_structure_type
99 #else
100 #error "You must define which file you generate"
101 #endif