blob: d850899ce85ab6e24c8ef8d541e369a90c17c97e [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
Paul Robinson49e38962015-03-05 00:08:27 +00004; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=NOPUB %s
5; RUN: llc -mtriple=x86_64-scei-ps4 -filetype=obj -o %t.o < %s
6; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck --check-prefix=NOPUB %s
Eric Christopher7da24882013-08-19 21:07:38 +00007; ModuleID = 'dwarf-public-names.cpp'
8;
9; Generated from:
10;
11; struct C {
12; void member_function();
13; static int static_member_function();
14; static int static_member_variable;
15; };
16;
17; int C::static_member_variable = 0;
18;
19; void C::member_function() {
20; static_member_variable = 0;
21; }
22;
23; int C::static_member_function() {
24; return static_member_variable;
25; }
26;
27; C global_variable;
28;
29; int global_function() {
30; return -1;
31; }
32;
33; namespace ns {
34; void global_namespace_function() {
35; global_variable.member_function();
36; }
37; int global_namespace_variable = 1;
38; }
39
Paul Robinson49e38962015-03-05 00:08:27 +000040; Darwin and PS4 shouldn't be generating the section by default
41; NOPUB: debug_pubnames
Paul Robinsone6c34b42015-06-25 19:37:13 +000042; NOPUB-NEXT: {{^$}}
Eric Christopher7da24882013-08-19 21:07:38 +000043
44; Skip the output to the header of the pubnames section.
45; LINUX: debug_pubnames
David Blaikiec9ad9192015-10-07 00:04:16 +000046; LINUX-NEXT: unit_size = 0x0000012a
Eric Christopher7da24882013-08-19 21:07:38 +000047
48; Check for each name in the output.
David Blaikie553eb4a2014-06-06 22:16:56 +000049; LINUX-DAG: "ns"
David Blaikie3dca5992014-06-06 22:29:05 +000050; LINUX-DAG: "C::static_member_function"
David Blaikie553eb4a2014-06-06 22:16:56 +000051; LINUX-DAG: "global_variable"
52; LINUX-DAG: "ns::global_namespace_variable"
53; LINUX-DAG: "ns::global_namespace_function"
54; LINUX-DAG: "global_function"
55; LINUX-DAG: "C::static_member_variable"
David Blaikie3dca5992014-06-06 22:29:05 +000056; LINUX-DAG: "C::member_function"
Eric Christopher7da24882013-08-19 21:07:38 +000057
58%struct.C = type { i8 }
59
60@_ZN1C22static_member_variableE = global i32 0, align 4
61@global_variable = global %struct.C zeroinitializer, align 1
62@_ZN2ns25global_namespace_variableE = global i32 1, align 4
63
Peter Collingbourned4bff302015-11-05 22:03:56 +000064define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 !dbg !3 {
Eric Christopher7da24882013-08-19 21:07:38 +000065entry:
66 %this.addr = alloca %struct.C*, align 8
67 store %struct.C* %this, %struct.C** %this.addr, align 8
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000068 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !DIExpression()), !dbg !30
David Blaikiea79ac142015-02-27 21:17:42 +000069 %this1 = load %struct.C*, %struct.C** %this.addr
Eric Christopher7da24882013-08-19 21:07:38 +000070 store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
71 ret void, !dbg !32
72}
73
Adrian Prantl87b7eb92014-10-01 18:55:02 +000074declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Eric Christopher7da24882013-08-19 21:07:38 +000075
Peter Collingbourned4bff302015-11-05 22:03:56 +000076define i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 !dbg !18 {
Eric Christopher7da24882013-08-19 21:07:38 +000077entry:
David Blaikiea79ac142015-02-27 21:17:42 +000078 %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33
Eric Christopher7da24882013-08-19 21:07:38 +000079 ret i32 %0, !dbg !33
80}
81
Peter Collingbourned4bff302015-11-05 22:03:56 +000082define i32 @_Z15global_functionv() nounwind uwtable !dbg !19 {
Eric Christopher7da24882013-08-19 21:07:38 +000083entry:
84 ret i32 -1, !dbg !34
85}
86
Peter Collingbourned4bff302015-11-05 22:03:56 +000087define void @_ZN2ns25global_namespace_functionEv() nounwind uwtable !dbg !20 {
Eric Christopher7da24882013-08-19 21:07:38 +000088entry:
89 call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35
90 ret void, !dbg !36
91}
92
93attributes #0 = { nounwind uwtable }
94attributes #1 = { nounwind readnone }
95
96!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +000097!llvm.module.flags = !{!38}
Eric Christopher7da24882013-08-19 21:07:38 +000098
Duncan P. N. Exon Smith55ca9642015-08-03 17:26:41 +000099!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, emissionKind: 0, file: !37, enums: !1, retainedTypes: !1, subprograms: !2, globals: !24, imports: !1)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000100!1 = !{}
101!2 = !{!3, !18, !19, !20}
Peter Collingbourned4bff302015-11-05 22:03:56 +0000102!3 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 9, file: !4, scope: null, type: !5, declaration: !12, variables: !1)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000103!4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
104!5 = !DISubroutineType(types: !6)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000105!6 = !{null, !7}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000106!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
107!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000108!9 = !{!10, !12, !14}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000109!10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11)
110!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
111!12 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !4, scope: !8, type: !5, variables: !13)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000112!13 = !{} ; previously: invalid DW_TAG_base_type
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000113!14 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !8, type: !15, variables: !17)
114!15 = !DISubroutineType(types: !16)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000115!16 = !{!11}
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000116!17 = !{} ; previously: invalid DW_TAG_base_type
Peter Collingbourned4bff302015-11-05 22:03:56 +0000117!18 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 13, file: !4, scope: null, type: !15, declaration: !14, variables: !1)
118!19 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 19, file: !4, scope: !4, type: !15, variables: !1)
119!20 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", line: 24, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 24, file: !4, scope: !21, type: !22, variables: !1)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000120!21 = !DINamespace(name: "ns", line: 23, file: !4, scope: null)
121!22 = !DISubroutineType(types: !23)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000122!23 = !{null}
123!24 = !{!25, !26, !27}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000124!25 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, variable: i32* @_ZN1C22static_member_variableE, declaration: !10)
125!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable)
126!27 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11, variable: i32* @_ZN2ns25global_namespace_variableE)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000127!28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000128!29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
129!30 = !DILocation(line: 9, scope: !3)
130!31 = !DILocation(line: 10, scope: !3)
131!32 = !DILocation(line: 11, scope: !3)
132!33 = !DILocation(line: 14, scope: !18)
133!34 = !DILocation(line: 20, scope: !19)
134!35 = !DILocation(line: 25, scope: !20)
135!36 = !DILocation(line: 26, scope: !20)
136!37 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +0000137!38 = !{i32 1, !"Debug Info Version", i32 3}