1; REQUIRES: object-emission
2
3; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck --implicit-check-not "{{DW_TAG|NULL}}" %s
4
5; Generated from the following source:
6; namespace ns {
7; void f();
8; }
9; inline __attribute__((always_inline)) void f1() {
10;   using ns::f;
11;   f();
12; }
13; void f2() { f1(); }
14
15; Ensure that top level imported declarations don't produce an extra degenerate
16; concrete subprogram definition.
17
18; FIXME: imported entities should only be emitted to the abstract origin if one is present
19
20; CHECK: DW_TAG_compile_unit
21; CHECK:   DW_TAG_subprogram
22; CHECK:     DW_AT_name {{.*}} "f1"
23; CHECK:     DW_TAG_imported_declaration
24; CHECK:     NULL
25; CHECK:   DW_TAG_namespace
26; CHECK:     DW_TAG_subprogram
27; CHECK:     NULL
28; CHECK:   DW_TAG_subprogram
29; CHECK:     DW_AT_name {{.*}} "f2"
30; CHECK:     DW_TAG_inlined_subroutine
31; CHECK:       DW_TAG_imported_declaration
32; CHECK:       NULL
33; CHECK:     NULL
34; CHECK:   NULL
35
36; Function Attrs: noinline
37define void @_Z2f2v() noinline !dbg !14 {
38entry:
39  call void @_ZN2ns1fEv(), !dbg !15
40  ret void, !dbg !17
41}
42
43declare void @_ZN2ns1fEv()
44
45!llvm.dbg.cu = !{!0}
46!llvm.module.flags = !{!10, !11, !12}
47!llvm.ident = !{!13}
48
49!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 309061) (llvm/trunk 309076)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, imports: !3)
50!1 = !DIFile(filename: "imported-name-inlined.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
51!2 = !{}
52!3 = !{!4}
53!4 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !8, file: !1, line: 5)
54!5 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 4, type: !6, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
55!6 = !DISubroutineType(types: !7)
56!7 = !{null}
57!8 = !DISubprogram(name: "f", linkageName: "_ZN2ns1fEv", scope: !9, file: !1, line: 2, type: !6, isLocal: false, isDefinition: false, flags: DIFlagPrototyped, isOptimized: false)
58!9 = !DINamespace(name: "ns", scope: null)
59!10 = !{i32 2, !"Dwarf Version", i32 4}
60!11 = !{i32 2, !"Debug Info Version", i32 3}
61!12 = !{i32 1, !"wchar_size", i32 4}
62!13 = !{!"clang version 6.0.0 (trunk 309061) (llvm/trunk 309076)"}
63!14 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 8, type: !6, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
64!15 = !DILocation(line: 6, column: 3, scope: !5, inlinedAt: !16)
65!16 = distinct !DILocation(line: 8, column: 13, scope: !14)
66!17 = !DILocation(line: 8, column: 19, scope: !14)
67