blob: 77efab95c191b913d257fbb6e47f23589312dfb1 [file] [log] [blame]
Eric Christopher7da24882013-08-19 21:07:38 +00001; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t.o < %s
2; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=LINUX %s
3; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -o %t.o < %s
4; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=DARWIN %s
5; ModuleID = 'dwarf-public-names.cpp'
6;
7; Generated from:
8;
9; struct C {
10; void member_function();
11; static int static_member_function();
12; static int static_member_variable;
13; };
14;
15; int C::static_member_variable = 0;
16;
17; void C::member_function() {
18; static_member_variable = 0;
19; }
20;
21; int C::static_member_function() {
22; return static_member_variable;
23; }
24;
25; C global_variable;
26;
27; int global_function() {
28; return -1;
29; }
30;
31; namespace ns {
32; void global_namespace_function() {
33; global_variable.member_function();
34; }
35; int global_namespace_variable = 1;
36; }
37
38; Darwin shouldn't be generating the section by default
39; DARWIN: debug_pubnames
David Blaikiea357aa02013-11-26 01:11:02 +000040; DARWIN: {{^$}}
Eric Christopher7da24882013-08-19 21:07:38 +000041
42; Skip the output to the header of the pubnames section.
43; LINUX: debug_pubnames
David Blaikie4729c782014-11-01 23:50:59 +000044; LINUX: unit_size = 0x00000128
Eric Christopher7da24882013-08-19 21:07:38 +000045
46; Check for each name in the output.
David Blaikie553eb4a2014-06-06 22:16:56 +000047; LINUX-DAG: "ns"
David Blaikie3dca5992014-06-06 22:29:05 +000048; LINUX-DAG: "C::static_member_function"
David Blaikie553eb4a2014-06-06 22:16:56 +000049; LINUX-DAG: "global_variable"
50; LINUX-DAG: "ns::global_namespace_variable"
51; LINUX-DAG: "ns::global_namespace_function"
52; LINUX-DAG: "global_function"
53; LINUX-DAG: "C::static_member_variable"
David Blaikie3dca5992014-06-06 22:29:05 +000054; LINUX-DAG: "C::member_function"
Eric Christopher7da24882013-08-19 21:07:38 +000055
56%struct.C = type { i8 }
57
58@_ZN1C22static_member_variableE = global i32 0, align 4
59@global_variable = global %struct.C zeroinitializer, align 1
60@_ZN2ns25global_namespace_variableE = global i32 1, align 4
61
62define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 {
63entry:
64 %this.addr = alloca %struct.C*, align 8
65 store %struct.C* %this, %struct.C** %this.addr, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000066 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !{!"0x102"}), !dbg !30
David Blaikiea79ac142015-02-27 21:17:42 +000067 %this1 = load %struct.C*, %struct.C** %this.addr
Eric Christopher7da24882013-08-19 21:07:38 +000068 store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
69 ret void, !dbg !32
70}
71
Adrian Prantl87b7eb92014-10-01 18:55:02 +000072declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Eric Christopher7da24882013-08-19 21:07:38 +000073
74define i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 {
75entry:
David Blaikiea79ac142015-02-27 21:17:42 +000076 %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33
Eric Christopher7da24882013-08-19 21:07:38 +000077 ret i32 %0, !dbg !33
78}
79
80define i32 @_Z15global_functionv() nounwind uwtable {
81entry:
82 ret i32 -1, !dbg !34
83}
84
85define void @_ZN2ns25global_namespace_functionEv() nounwind uwtable {
86entry:
87 call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35
88 ret void, !dbg !36
89}
90
91attributes #0 = { nounwind uwtable }
92attributes #1 = { nounwind readnone }
93
94!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +000095!llvm.module.flags = !{!38}
Eric Christopher7da24882013-08-19 21:07:38 +000096
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000097!0 = !{!"0x11\004\00clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)\000\00\000\00\000", !37, !1, !1, !2, !24, !1} ; [ DW_TAG_compile_unit ] [/usr2/kparzysz/s.hex/t/dwarf-public-names.cpp] [DW_LANG_C_plus_plus]
98!1 = !{}
99!2 = !{!3, !18, !19, !20}
100!3 = !{!"0x2e\00member_function\00member_function\00_ZN1C15member_functionEv\009\000\001\000\006\00256\000\009", !4, null, !5, null, void (%struct.C*)* @_ZN1C15member_functionEv, null, !12, !1} ; [ DW_TAG_subprogram ] [line 9] [def] [member_function]
101!4 = !{!"0x29", !37} ; [ DW_TAG_file_type ]
102!5 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !6, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
103!6 = !{null, !7}
104!7 = !{!"0xf\00\000\0064\0064\000\001088", i32 0, null, !8} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from C]
105!8 = !{!"0x13\00C\001\008\008\000\000\000", !37, null, null, !9, null, null, null} ; [ DW_TAG_structure_type ] [C] [line 1, size 8, align 8, offset 0] [def] [from ]
106!9 = !{!10, !12, !14}
107!10 = !{!"0xd\00static_member_variable\004\000\000\000\004096", !37, !8, !11, null} ; [ DW_TAG_member ] [static_member_variable] [line 4, size 0, align 0, offset 0] [static] [from int]
108!11 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
109!12 = !{!"0x2e\00member_function\00member_function\00_ZN1C15member_functionEv\002\000\000\000\006\00256\000\002", !4, !8, !5, null, null, null, i32 0, !13} ; [ DW_TAG_subprogram ] [line 2] [member_function]
110!13 = !{!"0x24"} ; [ DW_TAG_base_type ] [line 0, size 0, align 0, offset 0]
111!14 = !{!"0x2e\00static_member_function\00static_member_function\00_ZN1C22static_member_functionEv\003\000\000\000\006\00256\000\003", !4, !8, !15, null, null, null, i32 0, !17} ; [ DW_TAG_subprogram ] [line 3] [static_member_function]
112!15 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !16, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
113!16 = !{!11}
114!17 = !{!"0x24"} ; [ DW_TAG_base_type ] [line 0, size 0, align 0, offset 0]
115!18 = !{!"0x2e\00static_member_function\00static_member_function\00_ZN1C22static_member_functionEv\0013\000\001\000\006\00256\000\0013", !4, null, !15, null, i32 ()* @_ZN1C22static_member_functionEv, null, !14, !1} ; [ DW_TAG_subprogram ] [line 13] [def] [static_member_function]
116!19 = !{!"0x2e\00global_function\00global_function\00_Z15global_functionv\0019\000\001\000\006\00256\000\0019", !4, !4, !15, null, i32 ()* @_Z15global_functionv, null, null, !1} ; [ DW_TAG_subprogram ] [line 19] [def] [global_function]
117!20 = !{!"0x2e\00global_namespace_function\00global_namespace_function\00_ZN2ns25global_namespace_functionEv\0024\000\001\000\006\00256\000\0024", !4, !21, !22, null, void ()* @_ZN2ns25global_namespace_functionEv, null, null, !1} ; [ DW_TAG_subprogram ] [line 24] [def] [global_namespace_function]
118!21 = !{!"0x39\00ns\0023", !4, null} ; [ DW_TAG_namespace ] [/usr2/kparzysz/s.hex/t/dwarf-public-names.cpp]
119!22 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !23, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
120!23 = !{null}
121!24 = !{!25, !26, !27}
122!25 = !{!"0x34\00static_member_variable\00static_member_variable\00_ZN1C22static_member_variableE\007\000\001", !8, !4, !11, i32* @_ZN1C22static_member_variableE, !10} ; [ DW_TAG_variable ] [static_member_variable] [line 7] [def]
123!26 = !{!"0x34\00global_variable\00global_variable\00\0017\000\001", null, !4, !8, %struct.C* @global_variable, null} ; [ DW_TAG_variable ] [global_variable] [line 17] [def]
124!27 = !{!"0x34\00global_namespace_variable\00global_namespace_variable\00_ZN2ns25global_namespace_variableE\0027\000\001", !21, !4, !11, i32* @_ZN2ns25global_namespace_variableE, null} ; [ DW_TAG_variable ] [global_namespace_variable] [line 27] [def]
125!28 = !{!"0x101\00this\0016777225\001088", !3, !4, !29} ; [ DW_TAG_arg_variable ] [this] [line 9]
126!29 = !{!"0xf\00\000\0064\0064\000\000", null, null, !8} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from C]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000127!30 = !MDLocation(line: 9, scope: !3)
128!31 = !MDLocation(line: 10, scope: !3)
129!32 = !MDLocation(line: 11, scope: !3)
130!33 = !MDLocation(line: 14, scope: !18)
131!34 = !MDLocation(line: 20, scope: !19)
132!35 = !MDLocation(line: 25, scope: !20)
133!36 = !MDLocation(line: 26, scope: !20)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000134!37 = !{!"dwarf-public-names.cpp", !"/usr2/kparzysz/s.hex/t"}
135!38 = !{i32 1, !"Debug Info Version", i32 2}