xref: /llvm-project/llvm/test/DebugInfo/Generic/split-dwarf-local-import3.ll (revision b6f922fbf5e983122271aa12acb33f6172046d4d)
1; REQUIRES: x86_64-linux
2; RUN: %llc_dwarf -O1 -filetype=obj -split-dwarf-file=%t.dwo < %s \
3; RUN:   | llvm-dwarfdump -debug-info -                           \
4; RUN:   | FileCheck %s --implicit-check-not "{{DW_TAG|NULL}}"
5
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7target triple = "x86_64-unknown-linux-gnu"
8
9; Ensure that the imported entity 'nn::A' gets emitted in 'foo()'s abstract tree
10; in the destination (where 'foo()' was inlined) compile unit.
11
12; CHECK-LABEL: .debug_info contents
13; CHECK: DW_TAG_skeleton_unit
14; CHECK:   DW_AT_dwo_name
15
16; CHECK-LABEL: .debug_info.dwo contents:
17; CHECK: DW_TAG_compile_unit
18; CHECK:   DW_AT_name ("test.cpp")
19; CHECK:   DW_AT_dwo_name
20
21; CHECK:   [[ABSTRACT_FOO:0x[0-9a-f]+]]: DW_TAG_subprogram
22; CHECK:     DW_AT_name	("foo")
23; CHECK:     DW_TAG_imported_declaration
24; CHECK:       DW_AT_import  ([[A:0x[0-9a-f]+]])
25; CHECK:     NULL
26
27; CHECK:   DW_TAG_base_type
28; CHECK:     DW_AT_name	("int")
29
30; CHECK:   DW_TAG_subprogram
31; CHECK:     DW_AT_name	("main")
32; CHECK:     DW_TAG_inlined_subroutine
33; CHECK:       DW_AT_abstract_origin ([[ABSTRACT_FOO]] "_Z3foov")
34; CHECK:     NULL
35
36; CHECK:   DW_TAG_namespace
37; CHECK:     DW_AT_name	("nn")
38; CHECK:     [[A]]: DW_TAG_variable
39; CHECK:       DW_AT_name	("A")
40; CHECK:     NULL
41; CHECK:   NULL
42
43define dso_local noundef i32 @main() local_unnamed_addr !dbg !20 {
44entry:
45  ret i32 42, !dbg !21
46}
47
48!llvm.dbg.cu = !{!0, !2}
49!llvm.module.flags = !{!13, !14}
50!llvm.ident = !{!19, !19}
51
52!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "test.dwo", emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: GNU)
53!1 = !DIFile(filename: "test.cpp", directory: "/", checksumkind: CSK_MD5, checksum: "e7c2808ee27614e496499d55e4b37962")
54!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 15.0.0", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "cu1.dwo", emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: GNU)
55!3 = !DIFile(filename: "cu1.cpp", directory: "/", checksumkind: CSK_MD5, checksum: "c0b84240ef5682b87083b33cf9038171")
56!4 = !{!5}
57!5 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !6, entity: !11, file: !3, line: 5)
58!6 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !3, file: !3, line: 5, type: !7, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !4)
59!7 = !DISubroutineType(types: !8)
60!8 = !{!9}
61!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
62!10 = !{}
63!11 = distinct !DIGlobalVariable(name: "A", linkageName: "_ZN2nn1AE", scope: !12, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true)
64!12 = !DINamespace(name: "nn", scope: null)
65!13 = !{i32 7, !"Dwarf Version", i32 5}
66!14 = !{i32 2, !"Debug Info Version", i32 3}
67!19 = !{!"clang version 15.0.0"}
68!20 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !7, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
69!21 = !DILocation(line: 4, column: 3, scope: !6, inlinedAt: !22)
70!22 = !DILocation(line: 4, column: 3, scope: !20)
71