xref: /llvm-project/llvm/test/DebugInfo/Generic/debug-names-one-cu.ll (revision 380ac53dfa05792c6f9fd0a4aba542f8c7e5e17c)
1; XFAIL: target={{.*}}-aix{{.*}}
2; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
3; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
4; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
5
6; Check the header
7; CHECK: CU count: 1
8; CHECK: Local TU count: 0
9; CHECK: Foreign TU count: 0
10; CHECK: Name count: 3
11; CHECK: CU[0]: 0x{{[0-9a-f]*}}
12
13; CHECK: Abbreviation [[ABBREV_STRUCT:0x[0-9a-f]*]] {
14; CHECK-NEXT:   Tag: DW_TAG_structure_type
15; CHECK-NEXT:   DW_IDX_die_offset: DW_FORM_ref4
16; CHECK-NEXT: }
17
18; CHECK: Abbreviation [[ABBREV:0x[0-9a-f]*]]
19; CHECK-NEXT: Tag: DW_TAG_variable
20; CHECK-NEXT: DW_IDX_die_offset: DW_FORM_ref4
21; CHECK-NEXT: DW_IDX_parent: DW_FORM_flag_present
22; CHECK-NEXT: }
23
24; The entry for A::B must not have an IDX_Parent, since A is only a forward
25; declaration.
26; CHECK: String: 0x{{[0-9a-f]*}} "B"
27; CHECK-NEXT: Entry
28; CHECK-NEXT: Abbrev: [[ABBREV_STRUCT]]
29; CHECK-NEXT: Tag: DW_TAG_structure_type
30; CHECK-NEXT: DW_IDX_die_offset: 0x{{[0-9a-f]*}}
31; CHECK-NEXT: }
32
33; CHECK: String: 0x{{[0-9a-f]*}} "someA_B"
34; CHECK-NEXT: Entry
35; CHECK-NEXT: Abbrev: [[ABBREV]]
36; CHECK-NEXT: Tag: DW_TAG_variable
37; CHECK-NEXT: DW_IDX_die_offset: 0x{{[0-9a-f]*}}
38; CHECK-NEXT: DW_IDX_parent: <parent not indexed>
39; CHECK-NEXT: }
40
41; CHECK: String: 0x{{[0-9a-f]*}} "foobar"
42; CHECK-NEXT: Entry
43; CHECK-NEXT: Abbrev: [[ABBREV]]
44; CHECK-NEXT: Tag: DW_TAG_variable
45; CHECK-NEXT: DW_IDX_die_offset: 0x{{[0-9a-f]*}}
46; CHECK-NEXT: DW_IDX_parent: <parent not indexed>
47; CHECK-NEXT: }
48
49; VERIFY: No errors.
50
51@foobar = common dso_local global ptr null, align 8, !dbg !0
52@someA_B = common dso_local global ptr null, align 8, !dbg !18
53
54!llvm.dbg.cu = !{!2}
55!llvm.module.flags = !{!7, !8, !9}
56!llvm.ident = !{!10}
57
58!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
59!1 = distinct !DIGlobalVariable(name: "foobar", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
60!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (trunk 325496) (llvm/trunk 325732)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
61!3 = !DIFile(filename: "/tmp/cu1.c", directory: "/tmp")
62!4 = !{}
63!5 = !{!0, !18}
64!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
65!7 = !{i32 2, !"Dwarf Version", i32 4}
66!8 = !{i32 2, !"Debug Info Version", i32 3}
67!9 = !{i32 1, !"wchar_size", i32 4}
68!10 = !{!"clang version 7.0.0 (trunk 325496) (llvm/trunk 325732)"}
69
70!13 = !{}
71!15 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", scope: !16, file: !3, line: 3, size: 8, elements: !13, identifier: "type_A::B")
72!16 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 8, flags: DIFlagFwdDecl, identifier: "type_A")
73!17 = distinct !DIGlobalVariable(name: "someA_B", scope: !2, file: !3, line: 1, type: !15, isLocal: false, isDefinition: true)
74!18 = !DIGlobalVariableExpression(var: !17, expr: !DIExpression())
75