132 lines · plain
1/* Compile with:2 for FILE in `seq 3`; do3 clang -g -c X86/odr-fwd-declaration2.cpp -DFILE$FILE -o4 Inputs/odr-fwd-declaration2/$FILE.o done5*/6 7// RUN: dsymutil --linker=parallel -f \8// RUN: -oso-prepend-path=%p/../../Inputs/odr-fwd-declaration2 \9// RUN: -y %p/../dummy-debug-map.map -o %t1.out10// RUN: llvm-dwarfdump -v %t1.out -debug-info | FileCheck %s11 12#ifdef FILE113# 1 "Header.h" 114struct A {15 struct B;16 B *bPtr;17 B &bRef;18 int B::*bPtrToField;19};20# 3 "Source1.cpp" 221void foo() { A *ptr1 = 0; }22 23// First we check that types are in type table unit.24 25// CHECK: DW_TAG_compile_unit26// CHECK: AT_name{{.*}}"__artificial_type_unit"27 28// CHECK: 0x[[INT_BASE:[a-f0-9]*]]: DW_TAG_base_type29// CHECK: AT_name{{.*}}"int"30 31// CHECK: 0x[[PTR_A:[a-f0-9]*]]: DW_TAG_pointer_type32// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}0x[[STRUCT_A:[a-f0-9]*]]} "A")33 34// CHECK: 0x[[PTR_B:[a-f0-9]*]]: DW_TAG_pointer_type35// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}0x[[STRUCT_B:[a-f0-9]*]]} "A::B")36 37// CHECK: 0x[[REF_B:[a-f0-9]*]]: DW_TAG_reference_type38// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}0x[[STRUCT_B]]} "A::B")39 40// CHECK: 0x[[STRUCT_A]]: DW_TAG_structure_type41// CHECK: AT_name{{.*}}"A"42 43// CHECK: DW_TAG_member44// CHECK-NEXT: AT_name{{.*}}"bPtr"45// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}{0x[[PTR_B]]} "A::B *")46 47// CHECK: DW_TAG_member48// CHECK-NEXT: AT_name{{.*}}"bRef"49// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}{0x[[REF_B]]} "A::B &"50 51// CHECK: DW_TAG_member52// CHECK-NEXT: AT_name{{.*}}"bPtrToField"53// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}{0x[[PTR_TO_FIELD:[a-f0-9]*]]} "int A::B::*"54 55// CHECK: 0x[[STRUCT_B]]: DW_TAG_structure_type56// CHECK: AT_name{{.*}}"B"57 58// CHECK: DW_TAG_member59// CHECK: AT_name{{.*}}"x"60 61// CHECK: 0x[[PTR_TO_FIELD]]: DW_TAG_ptr_to_member_type62// CHECK-NEXT: DW_AT_type [DW_FORM_ref4] {{.*}}{0x[[INT_BASE]]} "int"63// CHECK-NEXT: DW_AT_containing_type [DW_FORM_ref4] {{.*}}{0x[[STRUCT_B]]} "A::B")64 65// Next we check that second compile unit references type from type table unit.66//67 68// CHECK: DW_TAG_compile_unit69// CHECK: AT_name{{.*}}"X86/odr-fwd-declaration2.cpp"70 71// CHECK: DW_TAG_subprogram72 73// CHECK: DW_TAG_variable74// CHECK: DW_AT_name{{.*}}"ptr1"75// CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000[[PTR_A]] "A *"76 77#elif defined(FILE2)78# 1 "Header.h" 179struct A {80 struct B;81 B *bPtr;82 B &bRef;83 int B::*bPtrToField;84};85# 3 "Source2.cpp" 286struct A::B {87 int x;88};89void bar() { A *ptr2 = 0; }90 91// Next we check that thrid compile unit references type from type table unit.92//93 94// CHECK: DW_TAG_compile_unit95// CHECK: AT_name{{.*}}"X86/odr-fwd-declaration2.cpp"96 97// CHECK: DW_TAG_subprogram98 99// CHECK: DW_TAG_variable100// CHECK: DW_AT_name{{.*}}"ptr2"101// CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000[[PTR_A]] "A *"102 103#elif defined(FILE3)104# 1 "Header.h" 1105struct A {106 struct B;107 B *bPtr;108 B &bRef;109 int B::*bPtrToField;110};111# 3 "Source2.cpp" 2112struct A::B {113 int x;114};115void bar() { A *ptr2 = 0; }116 117// Next we check that fourth compile unit references type from type table unit.118//119 120// CHECK: DW_TAG_compile_unit121// CHECK: AT_name{{.*}}"X86/odr-fwd-declaration2.cpp"122 123// CHECK: DW_TAG_subprogram124 125// CHECK: DW_TAG_variable126// CHECK: DW_AT_name{{.*}}"ptr2"127// CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000[[PTR_A]] "A *"128 129#else130#error "You must define which file you generate"131#endif132