blob: 2a6d99780587b4216c6aec709b1017ed6635d03f [file] [log] [blame]
David Blaikie404d3042013-09-19 23:01:29 +00001; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections < %s | FileCheck -check-prefix=ASM %s
2; RUN: llc -mtriple=x86_64-pc-linux-gnu -generate-gnu-dwarf-pub-sections -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
Eric Christopherdd1a0122013-09-13 00:35:05 +00003; ModuleID = 'dwarf-public-names.cpp'
4;
5; Generated from:
6;
7; struct C {
8; void member_function();
9; static int static_member_function();
10; static int static_member_variable;
11; };
12;
13; int C::static_member_variable = 0;
14;
15; void C::member_function() {
16; static_member_variable = 0;
17; }
18;
19; int C::static_member_function() {
20; return static_member_variable;
21; }
22;
23; C global_variable;
24;
25; int global_function() {
26; return -1;
27; }
28;
29; namespace ns {
30; void global_namespace_function() {
31; global_variable.member_function();
32; }
33; int global_namespace_variable = 1;
Eric Christopher2c8b7902013-10-17 02:06:06 +000034; struct D {
35; int A;
36; } d;
Eric Christopherdd1a0122013-09-13 00:35:05 +000037; }
38
Eric Christopher261d2342013-09-23 20:55:35 +000039; ASM: .section .debug_gnu_pubnames
David Blaikie404d3042013-09-19 23:01:29 +000040; ASM: .byte 32 # Kind: VARIABLE, EXTERNAL
Eric Christopher2c8b7902013-10-17 02:06:06 +000041; ASM-NEXT: .asciz "global_variable" # External Name
David Blaikie404d3042013-09-19 23:01:29 +000042
Eric Christopher261d2342013-09-23 20:55:35 +000043; ASM: .section .debug_gnu_pubtypes
44; ASM: .byte 16 # Kind: TYPE, EXTERNAL
David Blaikieecd21ff2013-09-24 19:50:00 +000045; ASM-NEXT: .asciz "C" # External Name
Eric Christopher261d2342013-09-23 20:55:35 +000046
David Blaikieac30f9e2013-09-19 23:43:46 +000047; CHECK: .debug_info contents:
Eric Christopher39eebfa2013-09-30 23:14:16 +000048; CHECK: DW_AT_GNU_pubnames [DW_FORM_sec_offset] (0x00000000)
49; CHECK: DW_AT_GNU_pubtypes [DW_FORM_sec_offset] (0x00000000)
Eric Christopherd2b497b2013-10-16 01:37:49 +000050
Eric Christopherd2b497b2013-10-16 01:37:49 +000051; CHECK: [[C:[0-9a-f]+]]: DW_TAG_structure_type
David Blaikieecd21ff2013-09-24 19:50:00 +000052; CHECK-NEXT: DW_AT_name {{.*}} "C"
Eric Christopherd2b497b2013-10-16 01:37:49 +000053
54; CHECK: [[STATIC_MEM_DECL:[0-9a-f]+]]: DW_TAG_member
55; CHECK-NEXT: DW_AT_name {{.*}} "static_member_variable"
56
57; CHECK: [[MEM_FUNC_DECL:[0-9a-f]+]]: DW_TAG_subprogram
David Blaikieac30f9e2013-09-19 23:43:46 +000058; CHECK-NEXT: DW_AT_MIPS_linkage_name
59; CHECK-NEXT: DW_AT_name {{.*}} "member_function"
Eric Christopherd2b497b2013-10-16 01:37:49 +000060
61; CHECK: [[STATIC_MEM_FUNC_DECL:[0-9a-f]+]]: DW_TAG_subprogram
David Blaikieac30f9e2013-09-19 23:43:46 +000062; CHECK-NEXT: DW_AT_MIPS_linkage_name
63; CHECK-NEXT: DW_AT_name {{.*}} "static_member_function"
Eric Christopherd2b497b2013-10-16 01:37:49 +000064
Manman Renf4c339e2013-10-29 22:49:29 +000065; CHECK: [[INT:[0-9a-f]+]]: DW_TAG_base_type
66; CHECK-NEXT: DW_AT_name {{.*}} "int"
67
Eric Christopherd2b497b2013-10-16 01:37:49 +000068; CHECK: [[STATIC_MEM_VAR:[0-9a-f]+]]: DW_TAG_variable
69; CHECK-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_DECL]]
70
71; CHECK: [[GLOB_VAR:[0-9a-f]+]]: DW_TAG_variable
David Blaikieac30f9e2013-09-19 23:43:46 +000072; CHECK-NEXT: DW_AT_name {{.*}} "global_variable"
Eric Christopherd2b497b2013-10-16 01:37:49 +000073
74; CHECK: [[NS:[0-9a-f]+]]: DW_TAG_namespace
75; CHECK-NEXT: DW_AT_name {{.*}} "ns"
76
77; CHECK: [[GLOB_NS_VAR_DECL:[0-9a-f]+]]: DW_TAG_variable
David Blaikieac30f9e2013-09-19 23:43:46 +000078; CHECK-NEXT: DW_AT_name {{.*}} "global_namespace_variable"
Eric Christopherd2b497b2013-10-16 01:37:49 +000079
Eric Christopher2c8b7902013-10-17 02:06:06 +000080; CHECK: [[D_VAR_DECL:[0-9a-f]+]]: DW_TAG_variable
81; CHECK-NEXT: DW_AT_name {{.*}} "d"
82
Manman Renf6b936b2013-10-29 05:49:41 +000083; CHECK: [[D:[0-9a-f]+]]: DW_TAG_structure_type
84; CHECK-NEXT: DW_AT_name {{.*}} "D"
85
Eric Christopherd2b497b2013-10-16 01:37:49 +000086; CHECK: [[GLOB_NS_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
David Blaikieac30f9e2013-09-19 23:43:46 +000087; CHECK-NEXT: DW_AT_MIPS_linkage_name
88; CHECK-NEXT: DW_AT_name {{.*}} "global_namespace_function"
Eric Christopherd2b497b2013-10-16 01:37:49 +000089
90; CHECK: [[GLOB_NS_VAR:[0-9a-f]+]]: DW_TAG_variable
91; CHECK-NEXT: DW_AT_specification {{.*}}[[GLOB_NS_VAR_DECL]]
92
Eric Christopher2c8b7902013-10-17 02:06:06 +000093; CHECK: [[D_VAR:[0-9a-f]+]]: DW_TAG_variable
94; CHECK-NEXT: DW_AT_specification {{.*}}[[D_VAR_DECL]]
95
Eric Christopherd2b497b2013-10-16 01:37:49 +000096; CHECK: [[MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
97; CHECK-NEXT: DW_AT_specification {{.*}}[[MEM_FUNC_DECL]]
98
99; CHECK: [[STATIC_MEM_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
100; CHECK-NEXT: DW_AT_specification {{.*}}[[STATIC_MEM_FUNC_DECL]]
101
102; CHECK: [[GLOBAL_FUNC:[0-9a-f]+]]: DW_TAG_subprogram
David Blaikieac30f9e2013-09-19 23:43:46 +0000103; CHECK-NEXT: DW_AT_MIPS_linkage_name
104; CHECK-NEXT: DW_AT_name {{.*}} "global_function"
105
106; CHECK-LABEL: .debug_gnu_pubnames contents:
Eric Christopher2c8b7902013-10-17 02:06:06 +0000107; CHECK-NEXT: Length: 231
David Blaikieac30f9e2013-09-19 23:43:46 +0000108; CHECK-NEXT: Version: 2
David Blaikie404d3042013-09-19 23:01:29 +0000109; CHECK-NEXT: Offset in .debug_info: 0
David Blaikie71d34a22013-11-01 00:25:45 +0000110; CHECK-NEXT: Size: 379
David Blaikie404d3042013-09-19 23:01:29 +0000111; CHECK-NEXT: Offset Linkage Kind Name
Eric Christopherd2b497b2013-10-16 01:37:49 +0000112; CHECK-DAG: [[GLOBAL_FUNC]] EXTERNAL FUNCTION "global_function"
Eric Christopher2c8b7902013-10-17 02:06:06 +0000113; CHECK-DAG: [[NS]] EXTERNAL TYPE "ns"
114; CHECK-DAG: [[MEM_FUNC]] EXTERNAL FUNCTION "C::member_function"
115; CHECK-DAG: [[GLOB_VAR]] EXTERNAL VARIABLE "global_variable"
116; CHECK-DAG: [[GLOB_NS_VAR]] EXTERNAL VARIABLE "ns::global_namespace_variable"
117; CHECK-DAG: [[GLOB_NS_FUNC]] EXTERNAL FUNCTION "ns::global_namespace_function"
118; CHECK-DAG: [[D_VAR]] EXTERNAL VARIABLE "ns::d"
119; CHECK-DAG: [[STATIC_MEM_VAR]] EXTERNAL VARIABLE "C::static_member_variable"
120; CHECK-DAG: [[STATIC_MEM_FUNC]] EXTERNAL FUNCTION "C::static_member_function"
121
Eric Christopherdd1a0122013-09-13 00:35:05 +0000122
David Blaikieecd21ff2013-09-24 19:50:00 +0000123; CHECK-LABEL: debug_gnu_pubtypes contents:
124; CHECK-NEXT: Length:
125; CHECK-NEXT: Version:
126; CHECK-NEXT: Offset in .debug_info:
127; CHECK-NEXT: Size:
128; CHECK-NEXT: Offset Linkage Kind Name
Eric Christopherd2b497b2013-10-16 01:37:49 +0000129; CHECK-DAG: [[C]] EXTERNAL TYPE "C"
Eric Christopher2c8b7902013-10-17 02:06:06 +0000130; CHECK-DAG: [[D]] EXTERNAL TYPE "ns::D"
Eric Christopherd2b497b2013-10-16 01:37:49 +0000131; CHECK-DAG: [[INT]] STATIC TYPE "int"
David Blaikieecd21ff2013-09-24 19:50:00 +0000132
Eric Christopherdd1a0122013-09-13 00:35:05 +0000133%struct.C = type { i8 }
Eric Christopher2c8b7902013-10-17 02:06:06 +0000134%"struct.ns::D" = type { i32 }
Eric Christopherdd1a0122013-09-13 00:35:05 +0000135
136@_ZN1C22static_member_variableE = global i32 0, align 4
137@global_variable = global %struct.C zeroinitializer, align 1
138@_ZN2ns25global_namespace_variableE = global i32 1, align 4
Eric Christopher2c8b7902013-10-17 02:06:06 +0000139@_ZN2ns1dE = global %"struct.ns::D" zeroinitializer, align 4
Eric Christopherdd1a0122013-09-13 00:35:05 +0000140
Eric Christopherfa986e72013-09-24 00:17:54 +0000141; Function Attrs: nounwind uwtable
142define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 {
Eric Christopherdd1a0122013-09-13 00:35:05 +0000143entry:
144 %this.addr = alloca %struct.C*, align 8
145 store %struct.C* %this, %struct.C** %this.addr, align 8
Eric Christopher2c8b7902013-10-17 02:06:06 +0000146 call void @llvm.dbg.declare(metadata !{%struct.C** %this.addr}, metadata !36), !dbg !38
Eric Christopherdd1a0122013-09-13 00:35:05 +0000147 %this1 = load %struct.C** %this.addr
Eric Christopher2c8b7902013-10-17 02:06:06 +0000148 store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !39
149 ret void, !dbg !39
Eric Christopherdd1a0122013-09-13 00:35:05 +0000150}
151
Eric Christopherfa986e72013-09-24 00:17:54 +0000152; Function Attrs: nounwind readnone
153declare void @llvm.dbg.declare(metadata, metadata) #1
Eric Christopherdd1a0122013-09-13 00:35:05 +0000154
Eric Christopherfa986e72013-09-24 00:17:54 +0000155; Function Attrs: nounwind uwtable
156define i32 @_ZN1C22static_member_functionEv() #0 align 2 {
Eric Christopherdd1a0122013-09-13 00:35:05 +0000157entry:
Eric Christopher2c8b7902013-10-17 02:06:06 +0000158 %0 = load i32* @_ZN1C22static_member_variableE, align 4, !dbg !40
159 ret i32 %0, !dbg !40
Eric Christopherdd1a0122013-09-13 00:35:05 +0000160}
161
Eric Christopherfa986e72013-09-24 00:17:54 +0000162; Function Attrs: nounwind uwtable
163define i32 @_Z15global_functionv() #0 {
Eric Christopherdd1a0122013-09-13 00:35:05 +0000164entry:
Eric Christopher2c8b7902013-10-17 02:06:06 +0000165 ret i32 -1, !dbg !41
Eric Christopherdd1a0122013-09-13 00:35:05 +0000166}
167
Eric Christopherfa986e72013-09-24 00:17:54 +0000168; Function Attrs: nounwind uwtable
169define void @_ZN2ns25global_namespace_functionEv() #0 {
Eric Christopherdd1a0122013-09-13 00:35:05 +0000170entry:
Eric Christopher2c8b7902013-10-17 02:06:06 +0000171 call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !42
172 ret void, !dbg !42
Eric Christopherdd1a0122013-09-13 00:35:05 +0000173}
174
Eric Christopherfa986e72013-09-24 00:17:54 +0000175attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
Eric Christopherdd1a0122013-09-13 00:35:05 +0000176attributes #1 = { nounwind readnone }
177
178!llvm.dbg.cu = !{!0}
Eric Christopher2c8b7902013-10-17 02:06:06 +0000179!llvm.module.flags = !{!34}
180!llvm.ident = !{!35}
Eric Christopherdd1a0122013-09-13 00:35:05 +0000181
Eric Christopher2c8b7902013-10-17 02:06:06 +0000182!0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.4 (trunk 192862) (llvm/trunk 192861)", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !21, metadata !29, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/echristo/tmp/pubnames.cpp] [DW_LANG_C_plus_plus]
Eric Christopherfa986e72013-09-24 00:17:54 +0000183!1 = metadata !{metadata !"pubnames.cpp", metadata !"/usr/local/google/home/echristo/tmp"}
184!2 = metadata !{i32 0}
Eric Christopher2c8b7902013-10-17 02:06:06 +0000185!3 = metadata !{metadata !4, metadata !17}
Eric Christopherfa986e72013-09-24 00:17:54 +0000186!4 = metadata !{i32 786451, metadata !1, null, metadata !"C", i32 1, i64 8, i64 8, i32 0, i32 0, null, metadata !5, i32 0, null, null, metadata !"_ZTS1C"} ; [ DW_TAG_structure_type ] [C] [line 1, size 8, align 8, offset 0] [def] [from ]
187!5 = metadata !{metadata !6, metadata !8, metadata !13}
Eric Christopher2c8b7902013-10-17 02:06:06 +0000188!6 = metadata !{i32 786445, metadata !1, metadata !"_ZTS1C", metadata !"static_member_variable", i32 4, i64 0, i64 0, i64 0, i32 4096, metadata !7, null} ; [ DW_TAG_member ] [static_member_variable] [line 4, size 0, align 0, offset 0] [static] [from int]
Eric Christopherfa986e72013-09-24 00:17:54 +0000189!7 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
Eric Christopher2c8b7902013-10-17 02:06:06 +0000190!8 = metadata !{i32 786478, metadata !1, metadata !"_ZTS1C", metadata !"member_function", metadata !"member_function", metadata !"_ZN1C15member_functionEv", i32 2, metadata !9, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !12, i32 2} ; [ DW_TAG_subprogram ] [line 2] [member_function]
Eric Christopherfa986e72013-09-24 00:17:54 +0000191!9 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !10, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
192!10 = metadata !{null, metadata !11}
Eric Christopher2c8b7902013-10-17 02:06:06 +0000193!11 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1C]
Eric Christopherfa986e72013-09-24 00:17:54 +0000194!12 = metadata !{i32 786468}
Eric Christopher2c8b7902013-10-17 02:06:06 +0000195!13 = metadata !{i32 786478, metadata !1, metadata !"_ZTS1C", metadata !"static_member_function", metadata !"static_member_function", metadata !"_ZN1C22static_member_functionEv", i32 3, metadata !14, i1 false, i1 false, i32 0, i32 0, null, i32 256, i1 false, null, null, i32 0, metadata !16, i32 3} ; [ DW_TAG_subprogram ] [line 3] [static_member_function]
Eric Christopherfa986e72013-09-24 00:17:54 +0000196!14 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !15, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
197!15 = metadata !{metadata !7}
198!16 = metadata !{i32 786468}
Eric Christopher2c8b7902013-10-17 02:06:06 +0000199!17 = metadata !{i32 786451, metadata !1, metadata !18, metadata !"D", i32 21, i64 32, i64 32, i32 0, i32 0, null, metadata !19, i32 0, null, null, metadata !"_ZTSN2ns1DE"} ; [ DW_TAG_structure_type ] [D] [line 21, size 32, align 32, offset 0] [def] [from ]
200!18 = metadata !{i32 786489, metadata !1, null, metadata !"ns", i32 17} ; [ DW_TAG_namespace ] [ns] [line 17]
201!19 = metadata !{metadata !20}
202!20 = metadata !{i32 786445, metadata !1, metadata !"_ZTSN2ns1DE", metadata !"A", i32 22, i64 32, i64 32, i64 0, i32 0, metadata !7} ; [ DW_TAG_member ] [A] [line 22, size 32, align 32, offset 0] [from int]
203!21 = metadata !{metadata !22, metadata !23, metadata !24, metadata !26}
204!22 = metadata !{i32 786478, metadata !1, metadata !"_ZTS1C", metadata !"member_function", metadata !"member_function", metadata !"_ZN1C15member_functionEv", i32 9, metadata !9, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (%struct.C*)* @_ZN1C15member_functionEv, null, metadata !8, metadata !2, i32 9} ; [ DW_TAG_subprogram ] [line 9] [def] [member_function]
205!23 = metadata !{i32 786478, metadata !1, metadata !"_ZTS1C", metadata !"static_member_function", metadata !"static_member_function", metadata !"_ZN1C22static_member_functionEv", i32 11, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @_ZN1C22static_member_functionEv, null, metadata !13, metadata !2, i32 11} ; [ DW_TAG_subprogram ] [line 11] [def] [static_member_function]
206!24 = metadata !{i32 786478, metadata !1, metadata !25, metadata !"global_function", metadata !"global_function", metadata !"_Z15global_functionv", i32 15, metadata !14, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @_Z15global_functionv, null, null, metadata !2, i32 15} ; [ DW_TAG_subprogram ] [line 15] [def] [global_function]
207!25 = metadata !{i32 786473, metadata !1} ; [ DW_TAG_file_type ] [/usr/local/google/home/echristo/tmp/pubnames.cpp]
208!26 = metadata !{i32 786478, metadata !1, metadata !18, metadata !"global_namespace_function", metadata !"global_namespace_function", metadata !"_ZN2ns25global_namespace_functionEv", i32 18, metadata !27, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, void ()* @_ZN2ns25global_namespace_functionEv, null, null, metadata !2, i32 18} ; [ DW_TAG_subprogram ] [line 18] [def] [global_namespace_function]
209!27 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !28, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
210!28 = metadata !{null}
211!29 = metadata !{metadata !30, metadata !31, metadata !32, metadata !33}
212!30 = metadata !{i32 786484, i32 0, metadata !4, metadata !"static_member_variable", metadata !"static_member_variable", metadata !"_ZN1C22static_member_variableE", metadata !25, i32 7, metadata !7, i32 0, i32 1, i32* @_ZN1C22static_member_variableE, metadata !6} ; [ DW_TAG_variable ] [static_member_variable] [line 7] [def]
213!31 = metadata !{i32 786484, i32 0, null, metadata !"global_variable", metadata !"global_variable", metadata !"", metadata !25, i32 13, metadata !4, i32 0, i32 1, %struct.C* @global_variable, null} ; [ DW_TAG_variable ] [global_variable] [line 13] [def]
214!32 = metadata !{i32 786484, i32 0, metadata !18, metadata !"global_namespace_variable", metadata !"global_namespace_variable", metadata !"_ZN2ns25global_namespace_variableE", metadata !25, i32 19, metadata !7, i32 0, i32 1, i32* @_ZN2ns25global_namespace_variableE, null} ; [ DW_TAG_variable ] [global_namespace_variable] [line 19] [def]
215!33 = metadata !{i32 786484, i32 0, metadata !18, metadata !"d", metadata !"d", metadata !"_ZN2ns1dE", metadata !25, i32 23, metadata !17, i32 0, i32 1, %"struct.ns::D"* @_ZN2ns1dE, null} ; [ DW_TAG_variable ] [d] [line 23] [def]
216!34 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
217!35 = metadata !{metadata !"clang version 3.4 (trunk 192862) (llvm/trunk 192861)"}
218!36 = metadata !{i32 786689, metadata !22, metadata !"this", null, i32 16777216, metadata !37, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0]
219!37 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1C]
220!38 = metadata !{i32 0, i32 0, metadata !22, null}
221!39 = metadata !{i32 9, i32 0, metadata !22, null}
222!40 = metadata !{i32 11, i32 0, metadata !23, null}
223!41 = metadata !{i32 15, i32 0, metadata !24, null}
224!42 = metadata !{i32 18, i32 0, metadata !26, null}
225