brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.0 KiB · 99fecd0 Raw
110 lines · cpp
1/* Compile with:2   for FILE in `seq 3`; do3     clang -g -c  odr-member-functions.cpp -DFILE$FILE -o odr-member-functions/$FILE.o4   done5 */6 7// RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/odr-member-functions -y %p/dummy-debug-map.map -o - | llvm-dwarfdump -debug-info - | FileCheck %s8 9struct S {10  __attribute__((always_inline)) void foo() { bar(); }11  __attribute__((always_inline)) void foo(int i) { if (i) bar(); }12  void bar();13 14  template<typename T> void baz(T t) {}15};16 17#ifdef FILE118void foo() {19  S s;20}21 22// CHECK: TAG_compile_unit23// CHECK-NOT: {{DW_TAG|NULL}}24// CHECK: AT_name{{.*}}"odr-member-functions.cpp"25 26// CHECK: 0x[[S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type27// CHECK-NOT: {{DW_TAG|NULL}}28// CHECK: DW_AT_name{{.*}}"S"29// CHECK-NOT: NULL30// CHECK: 0x[[FOO:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram31// CHECK-NEXT: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEv"32// CHECK: NULL33// CHECK: 0x[[FOOI:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram34// CHECK-NEXT: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEi"35 36#elif defined(FILE2)37void foo() {38  S s;39  // Check that the overloaded member functions are resolved correctly40  s.foo();41  s.foo(1);42}43 44// CHECK: TAG_compile_unit45// CHECK-NOT: DW_TAG46// CHECK: AT_name{{.*}}"odr-member-functions.cpp"47 48// Normal member functions should be desribed by the type in the first49// CU, thus we should be able to reuse its definition and avoid50// reemiting it.51// CHECK-NOT: DW_TAG_structure_type52 53// CHECK: 0x[[FOO_SUB:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram54// CHECK-NEXT: DW_AT_specification{{.*}}[[FOO]]55// CHECK-NOT: DW_TAG_structure_type56// CHECK: 0x[[FOOI_SUB:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram57// CHECK-NEXT: DW_AT_specification{{.*}}[[FOOI]]58// CHECK-NOT: DW_TAG_structure_type59 60// CHECK: DW_TAG_variable61// CHECK-NOT: DW_TAG62// CHECK: DW_AT_name {{.*}}"s"63// CHECK-NOT: DW_TAG64// CHECK: DW_AT_type {{.*}}[[S]]65// CHECK: DW_TAG_inlined_subroutine66// CHECK-NEXT: DW_AT_abstract_origin{{.*}}[[FOO_SUB]]67// CHECK-NOT: DW_TAG68// CHECK: DW_AT_call_line{{.*}}4069// CHECK: DW_TAG_inlined_subroutine70// CHECK-NEXT: DW_AT_abstract_origin{{.*}}[[FOOI_SUB]]71// CHECK-NOT: DW_TAG72// CHECK: DW_AT_call_line{{.*}}4173 74#elif defined(FILE3)75void foo() {76  S s;77  s.baz<int>(42);78}79 80// CHECK: TAG_compile_unit81// CHECK-NOT: DW_TAG82// CHECK: AT_name{{.*}}"odr-member-functions.cpp"83 84// Template or other implicit members will be included in the type85// only if they are generated. Thus actually creating a new type.86// CHECK: DW_TAG_structure_type87 88// Skip 'normal' member functions89// CHECK: DW_TAG_subprogram90// CHECK: DW_TAG_subprogram91// CHECK: DW_TAG_subprogram92 93// This is the 'baz' member94// CHECK: 0x[[BAZ:[0-9a-f]*]]: DW_TAG_subprogram95// CHECK-NOT: DW_TAG96// CHECK: DW_AT_MIPS_linkage_name {{.*}}"_ZN1S3bazIiEEvT_"97// CHECK-NOT: DW_TAG98// CHECK: DW_AT_name {{.*}}"baz<int>"99 100// Skip foo3101// CHECK: DW_TAG_subprogram102 103// baz instanciation:104// CHECK: DW_TAG_subprogram105// CHECK-NOT: DW_TAG106// CHECK: DW_AT_specification {{.*}}[[BAZ]] "_ZN1S3bazIiEEvT_"107#else108#error "You must define which file you generate"109#endif110