Jyotsna Verma | 9dea095 | 2013-04-10 19:53:26 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
Timur Iskhodzhanov | f166f6c | 2014-01-30 01:39:17 +0000 | [diff] [blame] | 3 | ; RUN: %llc_dwarf -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 4 | ; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 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 | ; Skip the output to the header of the pubnames section. |
| 39 | ; CHECK: debug_pubnames |
David Blaikie | eed309d | 2014-11-01 23:42:30 +0000 | [diff] [blame] | 40 | ; CHECK: version = 0x0002 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 41 | |
| 42 | ; Check for each name in the output. |
David Blaikie | 553eb4a | 2014-06-06 22:16:56 +0000 | [diff] [blame] | 43 | ; CHECK-DAG: "ns" |
David Blaikie | 3dca599 | 2014-06-06 22:29:05 +0000 | [diff] [blame] | 44 | ; CHECK-DAG: "C::static_member_function" |
David Blaikie | 553eb4a | 2014-06-06 22:16:56 +0000 | [diff] [blame] | 45 | ; CHECK-DAG: "global_variable" |
| 46 | ; CHECK-DAG: "ns::global_namespace_variable" |
| 47 | ; CHECK-DAG: "ns::global_namespace_function" |
| 48 | ; CHECK-DAG: "global_function" |
| 49 | ; CHECK-DAG: "C::static_member_variable" |
David Blaikie | 3dca599 | 2014-06-06 22:29:05 +0000 | [diff] [blame] | 50 | ; CHECK-DAG: "C::member_function" |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 51 | |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 52 | %struct.C = type { i8 } |
| 53 | |
| 54 | @_ZN1C22static_member_variableE = global i32 0, align 4 |
| 55 | @global_variable = global %struct.C zeroinitializer, align 1 |
| 56 | @_ZN2ns25global_namespace_variableE = global i32 1, align 4 |
| 57 | |
| 58 | define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 { |
| 59 | entry: |
| 60 | %this.addr = alloca %struct.C*, align 8 |
| 61 | store %struct.C* %this, %struct.C** %this.addr, align 8 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 62 | call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !DIExpression()), !dbg !30 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 63 | %this1 = load %struct.C*, %struct.C** %this.addr |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 64 | store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31 |
| 65 | ret void, !dbg !32 |
| 66 | } |
| 67 | |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 68 | declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 69 | |
| 70 | define i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 { |
| 71 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 72 | %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33 |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 73 | ret i32 %0, !dbg !33 |
| 74 | } |
| 75 | |
| 76 | define i32 @_Z15global_functionv() nounwind uwtable { |
| 77 | entry: |
| 78 | ret i32 -1, !dbg !34 |
| 79 | } |
| 80 | |
| 81 | define void @_ZN2ns25global_namespace_functionEv() nounwind uwtable { |
| 82 | entry: |
| 83 | call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35 |
| 84 | ret void, !dbg !36 |
| 85 | } |
| 86 | |
| 87 | attributes #0 = { nounwind uwtable } |
| 88 | attributes #1 = { nounwind readnone } |
| 89 | |
| 90 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 91 | !llvm.module.flags = !{!38} |
Krzysztof Parzyszek | 228daa6 | 2013-02-12 18:00:14 +0000 | [diff] [blame] | 92 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 93 | !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 Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 94 | !1 = !{} |
| 95 | !2 = !{!3, !18, !19, !20} |
Duncan P. N. Exon Smith | 814b8e9 | 2015-08-28 20:26:49 +0000 | [diff] [blame] | 96 | !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, function: void (%struct.C*)* @_ZN1C15member_functionEv, declaration: !12, variables: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 97 | !4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") |
| 98 | !5 = !DISubroutineType(types: !6) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 99 | !6 = !{null, !7} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 100 | !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) |
| 101 | !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 102 | !9 = !{!10, !12, !14} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 103 | !10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11) |
| 104 | !11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 105 | !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 Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 106 | !13 = !{} ; previously: invalid DW_TAG_base_type |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 107 | !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) |
| 108 | !15 = !DISubroutineType(types: !16) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 109 | !16 = !{!11} |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 110 | !17 = !{} ; previously: invalid DW_TAG_base_type |
Duncan P. N. Exon Smith | 814b8e9 | 2015-08-28 20:26:49 +0000 | [diff] [blame] | 111 | !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, function: i32 ()* @_ZN1C22static_member_functionEv, declaration: !14, variables: !1) |
| 112 | !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, function: i32 ()* @_Z15global_functionv, variables: !1) |
| 113 | !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, function: void ()* @_ZN2ns25global_namespace_functionEv, variables: !1) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 114 | !21 = !DINamespace(name: "ns", line: 23, file: !4, scope: null) |
| 115 | !22 = !DISubroutineType(types: !23) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 116 | !23 = !{null} |
| 117 | !24 = !{!25, !26, !27} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 118 | !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) |
| 119 | !26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable) |
| 120 | !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 Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 121 | !28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 122 | !29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8) |
| 123 | !30 = !DILocation(line: 9, scope: !3) |
| 124 | !31 = !DILocation(line: 10, scope: !3) |
| 125 | !32 = !DILocation(line: 11, scope: !3) |
| 126 | !33 = !DILocation(line: 14, scope: !18) |
| 127 | !34 = !DILocation(line: 20, scope: !19) |
| 128 | !35 = !DILocation(line: 25, scope: !20) |
| 129 | !36 = !DILocation(line: 26, scope: !20) |
| 130 | !37 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 131 | !38 = !{i32 1, !"Debug Info Version", i32 3} |