• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* Compile with:
2   cat >modules.modulemap <<EOF
3     module Foo {
4       header "Foo.h"
5       export *
6     }
7     module Bar {
8       header "Bar.h"
9       export *
10     }
11EOF
12   clang -D BAR_H -E -o Bar.h modules.m
13   clang -D FOO_H -E -o Foo.h modules.m
14   clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
15     -fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \
16     -fdisable-module-hash modules.m -o 1.o
17*/
18
19// RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs/modules \
20// RUN:   -y %p/dummy-debug-map.map -o - \
21// RUN:     | llvm-dwarfdump --debug-dump=info - | FileCheck %s
22
23// RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs/modules -y \
24// RUN:   %p/dummy-debug-map.map -o %t 2>&1 | FileCheck --check-prefix=WARN %s
25
26// WARN-NOT: warning: hash mismatch
27
28// ---------------------------------------------------------------------
29#ifdef BAR_H
30// ---------------------------------------------------------------------
31// CHECK:            DW_TAG_compile_unit
32// CHECK-NOT:        DW_TAG
33// CHECK:              DW_TAG_module
34// CHECK-NEXT:           DW_AT_name{{.*}}"Bar"
35// CHECK: 0x0[[BAR:.*]]: DW_TAG_structure_type
36// CHECK-NOT:              DW_TAG
37// CHECK:                  DW_AT_name {{.*}}"Bar"
38// CHECK-NOT:              DW_TAG
39// CHECK:                  DW_TAG_member
40// CHECK:                    DW_AT_name {{.*}}"value"
41// CHECK:                DW_TAG_structure_type
42// CHECK-NOT:              DW_TAG
43// CHECK:                  DW_AT_name {{.*}}"PruneMeNot"
44
45struct Bar {
46  int value;
47};
48
49struct PruneMeNot;
50
51#else
52// ---------------------------------------------------------------------
53#ifdef FOO_H
54// ---------------------------------------------------------------------
55// CHECK:               DW_TAG_compile_unit
56// CHECK-NOT:             DW_TAG
57// CHECK: 0x0[[FOO:.*]]:  DW_TAG_module
58// CHECK-NEXT:              DW_AT_name{{.*}}"Foo"
59// CHECK-NOT:               DW_TAG
60// CHECK:                   DW_TAG_typedef
61// CHECK-NOT:                 DW_TAG
62// CHECK:                     DW_AT_type [DW_FORM_ref_addr] (0x{{0*}}[[BAR]])
63// CHECK:                   DW_TAG_structure_type
64// CHECK-NEXT:                DW_AT_name{{.*}}"S"
65// CHECK-NOT:                 DW_TAG
66// CHECK: 0x0[[INTERFACE:.*]]: DW_TAG_structure_type
67// CHECK-NEXT:                DW_AT_name{{.*}}"Foo"
68
69@import Bar;
70typedef struct Bar Bar;
71struct S {};
72
73@interface Foo {
74  int ivar;
75}
76@end
77
78// ---------------------------------------------------------------------
79#else
80// ---------------------------------------------------------------------
81
82// CHECK:  DW_TAG_compile_unit
83// CHECK:    DW_AT_low_pc
84// CHECK-NOT:DW_TAG
85// CHECK:     DW_TAG_module
86// CHECK-NEXT:  DW_AT_name{{.*}}"Foo"
87// CHECK-NOT:   DW_TAG
88// CHECK:       DW_TAG_typedef
89// CHECK-NOT:     DW_TAG
90// CHECK:       NULL
91//
92// CHECK:   DW_TAG_imported_declaration
93// CHECK-NOT: DW_TAG
94// CHECK:     DW_AT_import [DW_FORM_ref_addr] (0x{{0*}}[[FOO]]
95//
96// CHECK:   DW_TAG_subprogram
97// CHECK:     DW_AT_name {{.*}}"main"
98//
99// CHECK:     DW_TAG_variable
100// CHECK:     DW_TAG_variable
101// CHECK-NOT:   DW_TAG
102// CHECK:       DW_AT_name{{.*}}"foo"
103// CHECK-NOT:   DW_TAG
104// CHECK:       DW_AT_type {{.*}}{0x{{0*}}[[PTR:.*]]}
105//
106// CHECK: 0x{{0*}}[[PTR]]: DW_TAG_pointer_type
107// CHECK-NEXT   DW_AT_type [DW_FORM_ref_addr] {0x{{0*}}[[INTERFACE]])
108
109@import Foo;
110int main(int argc, char **argv) {
111  Bar bar;
112  Foo *foo = 0;
113  bar.value = 42;
114  return bar.value;
115}
116#endif
117#endif
118