• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Generate one file with all linkage names, and another with only abstract ones.
2; Then test both.
3; RUN: %llc_dwarf -accel-tables=Dwarf -dwarf-linkage-names=All -filetype=obj -o %t.All < %s
4; RUN: %llc_dwarf -accel-tables=Dwarf -dwarf-linkage-names=Abstract -filetype=obj -o %t.Abstract < %s
5; RUN: llvm-dwarfdump -debug-info -debug-names %t.All | FileCheck %s --check-prefix=ALL
6; RUN: llvm-dwarfdump -debug-info -debug-names %t.Abstract \
7; RUN:   | FileCheck %s --check-prefix=ABSTRACT --implicit-check-not=_Z1gi --implicit-check-not=_ZN1n1vE
8; RUN: llvm-dwarfdump -debug-names -verify %t.All | FileCheck --check-prefix=VERIFY %s
9; RUN: llvm-dwarfdump -debug-names -verify %t.Abstract | FileCheck --check-prefix=VERIFY %s
10
11; We should have all three linkage names in the .debug_info and .debug_names
12; ALL: .debug_info contents:
13; ALL: DW_AT_linkage_name	("_ZN1n1vE")
14; ALL: DW_AT_linkage_name	("_Z1fi")
15; ALL: DW_AT_linkage_name	("_Z1gi")
16; ALL: .debug_names contents:
17; ALL: String: {{.*}} "_Z1fi"
18; ALL: String: {{.*}} "_Z1gi"
19; ALL: String: {{.*}} "_ZN1n1vE"
20
21; Only _Z1fi should be present in both sections
22; ABSTRACT: .debug_info contents:
23; ABSTRACT: DW_AT_linkage_name	("_Z1fi")
24; ABSTRACT: .debug_names contents:
25; ABSTRACT: String: {{.*}} "_Z1fi"
26
27; There should be no verification errors for both files.
28; VERIFY: No errors.
29
30; Input generated from the following C code using
31; clang -g -O2 -S -emit-llvm
32
33; int e(int);
34; inline int f(int a) { return e(a); }
35; int g(int a) { return f(a); }
36;
37; namespace n {
38; int v;
39; }
40
41@_ZN1n1vE = dso_local local_unnamed_addr global i32 0, align 4, !dbg !0
42
43define dso_local i32 @_Z1gi(i32 %a) local_unnamed_addr !dbg !12 {
44entry:
45  call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !17
46  call void @llvm.dbg.value(metadata i32 %a, metadata !18, metadata !DIExpression()), !dbg !21
47  %call.i = tail call i32 @_Z1ei(i32 %a), !dbg !23
48  ret i32 %call.i, !dbg !24
49}
50
51declare dso_local i32 @_Z1ei(i32) local_unnamed_addr
52
53; Function Attrs: nounwind readnone speculatable
54declare void @llvm.dbg.value(metadata, metadata, metadata) #0
55
56attributes #2 = { nounwind readnone speculatable }
57
58!llvm.dbg.cu = !{!5}
59!llvm.module.flags = !{!8, !9, !10}
60!llvm.ident = !{!11}
61
62!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
63!1 = distinct !DIGlobalVariable(name: "v", linkageName: "_ZN1n1vE", scope: !2, file: !3, line: 6, type: !4, isLocal: false, isDefinition: true)
64!2 = !DINamespace(name: "n", scope: null)
65!3 = !DIFile(filename: "/tmp/linkage-name.cc", directory: "/usr/local/google/home/labath/ll/build/dbg")
66!4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
67!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 (trunk 331861) (llvm/trunk 331884)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, globals: !7)
68!6 = !{}
69!7 = !{!0}
70!8 = !{i32 2, !"Dwarf Version", i32 4}
71!9 = !{i32 2, !"Debug Info Version", i32 3}
72!10 = !{i32 1, !"wchar_size", i32 4}
73!11 = !{!"clang version 7.0.0 (trunk 331861) (llvm/trunk 331884)"}
74!12 = distinct !DISubprogram(name: "g", linkageName: "_Z1gi", scope: !3, file: !3, line: 3, type: !13, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !5, retainedNodes: !15)
75!13 = !DISubroutineType(types: !14)
76!14 = !{!4, !4}
77!15 = !{!16}
78!16 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !3, line: 3, type: !4)
79!17 = !DILocation(line: 3, column: 11, scope: !12)
80!18 = !DILocalVariable(name: "a", arg: 1, scope: !19, file: !3, line: 2, type: !4)
81!19 = distinct !DISubprogram(name: "f", linkageName: "_Z1fi", scope: !3, file: !3, line: 2, type: !13, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !5, retainedNodes: !20)
82!20 = !{!18}
83!21 = !DILocation(line: 2, column: 18, scope: !19, inlinedAt: !22)
84!22 = distinct !DILocation(line: 3, column: 23, scope: !12)
85!23 = !DILocation(line: 2, column: 30, scope: !19, inlinedAt: !22)
86!24 = !DILocation(line: 3, column: 16, scope: !12)
87