brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 47dd387 Raw
66 lines · plain
1Test binaries created with the following commands:2 3$ cat container.cpp4#include "container.h"5#include <stdlib.h>6 7struct Container_ivars {8  // real definition here9};10 11ContainerPtr allocateContainer() {12  Container *c = (Container *)malloc(sizeof(Container));13  c->ivars = (Container_ivars *)malloc(sizeof(Container_ivars));14  return c;15}16 17extern void doSomething(ContainerPtr);18 19int main() {20  ContainerPtr c = allocateContainer();21  doSomething(c);22  return 0;23}24 25$ cat container.h26struct Container_ivars;27 28struct Container {29  union {30    struct Container_ivars *ivars;31  };32};33 34typedef Container *ContainerPtr;35 36$ cat use.cpp37#include "container.h"38 39void doSomething(ContainerPtr c) {}40 41 42$ clang++ -O0 -g container.cpp -c -o container.o43$ clang++ -O0 -g use.cpp -c -o use.o44$ clang++ use.o container.o -o a.out45 46Note that the link order in the last command matters for this test.47 48RUN: dsymutil --linker parallel -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/union/a.out -o %t.dSYM49RUN: llvm-dwarfdump --debug-info %t.dSYM | FileCheck %s50 51CHECK:       DW_TAG_compile_unit52CHECK-NEXT:    DW_AT_producer    ("llvm DWARFLinkerParallel library53CHECK-NEXT:    DW_AT_language    (DW_LANG_C_plus_plus_14)54CHECK-NEXT:    DW_AT_name        ("__artificial_type_unit")55CHECK-NEXT:    DW_AT_stmt_list   (0x00000000)56 57CHECK:       DW_TAG_structure_type58CHECK:         DW_AT_calling_convention        (DW_CC_pass_by_value)59CHECK:         DW_AT_name      ("Container_ivars")60CHECK-NEXT:    DW_AT_byte_size (0x01)61CHECK-NEXT:    DW_AT_decl_line (4)62CHECK-NEXT:    DW_AT_decl_file ("{{.*}}container.cpp")63 64CHECK:       DW_TAG_compile_unit65CHECK-NOT:   DW_AT_declaration66