2 cat >modules.modulemap <<EOF
12 clang -D BAR_H -E -o Bar.h modules.m
13 clang -D FOO_H -E -o Foo.h modules.m
14 clang -D ODR_VIOLATION_C -E -o odr_violation.c modules.m
15 clang -c -fmodules -fmodule-map-file=modules.modulemap \
16 -g -gmodules -fmodules-cache-path=. \
17 -Xclang -fdisable-module-hash modules.m -o 1.o
18 clang -c -g odr_violation.c -o 2.o
21 // RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/modules \
22 // RUN: -y %p/dummy-debug-map.map -o - \
23 // RUN: | llvm-dwarfdump -v --debug-info - | FileCheck %s
25 // RUN: dsymutil -f -oso-prepend-path=%p/../Inputs/modules -y \
26 // RUN: %p/dummy-debug-map.map -o %t 2>&1 | FileCheck --check-prefix=WARN %s
28 // WARN-NOT: warning: hash mismatch
30 // ---------------------------------------------------------------------
32 // ---------------------------------------------------------------------
33 // CHECK: DW_TAG_compile_unit
35 // CHECK: DW_TAG_module
36 // CHECK-NEXT: DW_AT_name{{.*}}"Bar"
37 // CHECK: 0x0[[BAR:.*]]: DW_TAG_structure_type
39 // CHECK: DW_AT_name {{.*}}"Bar"
41 // CHECK: DW_TAG_member
42 // CHECK: DW_AT_name {{.*}}"value"
43 // CHECK: DW_TAG_structure_type
45 // CHECK: DW_AT_name {{.*}}"PruneMeNot"
54 // ---------------------------------------------------------------------
56 // ---------------------------------------------------------------------
57 // CHECK: DW_TAG_compile_unit
59 // CHECK: 0x0[[FOO:.*]]: DW_TAG_module
60 // CHECK-NEXT: DW_AT_name{{.*}}"Foo"
62 // CHECK: 0x0[[BARTD:.*]]: DW_TAG_typedef
64 // CHECK: DW_AT_type [DW_FORM_ref_addr] (0x{{0*}}[[BAR]]
65 // CHECK: DW_TAG_structure_type
66 // CHECK-NEXT: DW_AT_name{{.*}}"S"
68 // CHECK: 0x0[[INTERFACE:.*]]: DW_TAG_structure_type
69 // CHECK-NEXT: DW_AT_name{{.*}}"Foo"
72 typedef struct Bar Bar;
81 // ---------------------------------------------------------------------
82 #ifdef ODR_VIOLATION_C
83 // ---------------------------------------------------------------------
88 typedef struct Bar Bar;
89 Bar odr_violation = { 42 };
91 // ---------------------------------------------------------------------
93 // ---------------------------------------------------------------------
95 // CHECK: DW_TAG_compile_unit
96 // CHECK: DW_AT_low_pc
97 // CHECK-NOT: DW_TAG_module
98 // CHECK-NOT: DW_TAG_typedef
100 // CHECK: DW_TAG_imported_declaration
102 // CHECK: DW_AT_import [DW_FORM_ref_addr] (0x{{0*}}[[FOO]]
104 // CHECK: DW_TAG_subprogram
105 // CHECK: DW_AT_name {{.*}}"main"
107 // CHECK: DW_TAG_variable
109 // CHECK: DW_AT_name{{.*}}"bar"
111 // CHECK: DW_AT_type [DW_FORM_ref_addr] (0x{{0*}}[[BARTD]]
112 // CHECK: DW_TAG_variable
114 // CHECK: DW_AT_name{{.*}}"foo"
116 // CHECK: DW_AT_type {{.*}}{0x{{0*}}[[PTR:.*]]}
118 // CHECK: 0x{{0*}}[[PTR]]: DW_TAG_pointer_type
119 // FIXME: The next line doesn't work.
120 // CHECK-NEXT DW_AT_type [DW_FORM_ref_addr] {0x{{0*}}[[INTERFACE]]
121 extern int odr_violation;
124 int main(int argc, char **argv) {
127 bar.value = odr_violation;
134 // CHECK: DW_TAG_compile_unit
135 // CHECK: DW_AT_name {{.*}}"odr_violation.c"
136 // CHECK: DW_TAG_variable
137 // CHECK: DW_AT_name {{.*}}"odr_violation"
138 // CHECK: DW_AT_type [DW_FORM_ref4] ({{.*}}{0x{{0*}}[[BAR2:.*]]}
139 // CHECK: 0x{{0*}}[[BAR2]]: DW_TAG_typedef
140 // CHECK: DW_AT_type [DW_FORM_ref4] ({{.*}}{0x{{0*}}[[BAR3:.*]]}
141 // CHECK: DW_AT_name {{.*}}"Bar"
142 // CHECK: 0x{{0*}}[[BAR3]]: DW_TAG_structure_type
143 // CHECK-NEXT: DW_AT_name {{.*}}"Bar"