xref: /aosp_15_r20/external/llvm/test/tools/dsymutil/X86/submodules.m (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker/* Compile with:
2*9880d681SAndroid Build Coastguard Worker   cat >modules.modulemap <<EOF
3*9880d681SAndroid Build Coastguard Worker   module Parent {
4*9880d681SAndroid Build Coastguard Worker     module Child {
5*9880d681SAndroid Build Coastguard Worker       header "Child.h"
6*9880d681SAndroid Build Coastguard Worker     }
7*9880d681SAndroid Build Coastguard Worker     module Empty {
8*9880d681SAndroid Build Coastguard Worker       header "Empty.h"
9*9880d681SAndroid Build Coastguard Worker     }
10*9880d681SAndroid Build Coastguard Worker   }
11*9880d681SAndroid Build Coastguard WorkerEOF
12*9880d681SAndroid Build Coastguard Worker   clang -D CHILD_H -E -o Child.h submodules.m
13*9880d681SAndroid Build Coastguard Worker   touch empty.h
14*9880d681SAndroid Build Coastguard Worker   clang -cc1 -emit-obj -fmodules -fmodule-map-file=modules.modulemap \
15*9880d681SAndroid Build Coastguard Worker     -fmodule-format=obj -g -dwarf-ext-refs -fmodules-cache-path=. \
16*9880d681SAndroid Build Coastguard Worker     -fdisable-module-hash submodules.m -o 1.o
17*9880d681SAndroid Build Coastguard Worker*/
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker// RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs/submodules \
20*9880d681SAndroid Build Coastguard Worker// RUN:   -y %p/dummy-debug-map.map -o - \
21*9880d681SAndroid Build Coastguard Worker// RUN:     | llvm-dwarfdump --debug-dump=info - | FileCheck %s
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker// ---------------------------------------------------------------------
24*9880d681SAndroid Build Coastguard Worker#ifdef CHILD_H
25*9880d681SAndroid Build Coastguard Worker// ---------------------------------------------------------------------
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker// CHECK:            DW_TAG_compile_unit
28*9880d681SAndroid Build Coastguard Worker// CHECK-NOT:        DW_TAG
29*9880d681SAndroid Build Coastguard Worker// CHECK:              DW_TAG_module
30*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:           DW_AT_name{{.*}}"Parent"
31*9880d681SAndroid Build Coastguard Worker// CHECK:                DW_TAG_module
32*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:             DW_AT_name{{.*}}"Child"
33*9880d681SAndroid Build Coastguard Worker// CHECK:                  DW_TAG_structure_type
34*9880d681SAndroid Build Coastguard Worker// CHECK-NOT:                DW_TAG
35*9880d681SAndroid Build Coastguard Worker// CHECK:                    DW_AT_name {{.*}}"PruneMeNot"
36*9880d681SAndroid Build Coastguard Workerstruct PruneMeNot;
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker// ---------------------------------------------------------------------
39*9880d681SAndroid Build Coastguard Worker#else
40*9880d681SAndroid Build Coastguard Worker// ---------------------------------------------------------------------
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker// CHECK:            DW_TAG_compile_unit
43*9880d681SAndroid Build Coastguard Worker// CHECK:              DW_TAG_module
44*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:           DW_AT_name{{.*}}"Parent"
45*9880d681SAndroid Build Coastguard Worker// CHECK: 0x0[[EMPTY:.*]]: DW_TAG_module
46*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:             DW_AT_name{{.*}}"Empty"
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker// CHECK:     DW_AT_import  {{.*}}0x{{0*}}[[EMPTY]]
49*9880d681SAndroid Build Coastguard Worker@import Parent.Child;
50*9880d681SAndroid Build Coastguard Worker@import Parent.Empty;
51*9880d681SAndroid Build Coastguard Workerint main(int argc, char **argv) { return 0; }
52*9880d681SAndroid Build Coastguard Worker#endif
53