| 1 |
; REQUIRES: object-emission |
| 2 |
|
| 3 |
; RUN: llvm-as < %s -o %t.bc |
| 4 |
; RUN: llvm-spirv %t.bc -o %t.spv |
| 5 |
; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll |
| 6 |
|
| 7 |
; RUN: llc -mtriple=%triple -debugger-tune=gdb -filetype=obj -o %t.o < %t.ll |
| 8 |
; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck %s |
| 9 |
|
| 10 |
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64" |
| 11 |
target triple = "spir64-unknown-unknown" |
| 12 |
; ModuleID = 'dwarf-public-names.cpp' |
| 13 |
; |
| 14 |
; Generated from: |
| 15 |
; |
| 16 |
; struct C { |
| 17 |
; void member_function(); |
| 18 |
; static int static_member_function(); |
| 19 |
; static int static_member_variable; |
| 20 |
; }; |
| 21 |
; |
| 22 |
; int C::static_member_variable = 0; |
| 23 |
; |
| 24 |
; void C::member_function() { |
| 25 |
; static_member_variable = 0; |
| 26 |
; } |
| 27 |
; |
| 28 |
; int C::static_member_function() { |
| 29 |
; return static_member_variable; |
| 30 |
; } |
| 31 |
; |
| 32 |
; C global_variable; |
| 33 |
; |
| 34 |
; int global_function() { |
| 35 |
; return -1; |
| 36 |
; } |
| 37 |
; |
| 38 |
; namespace ns { |
| 39 |
; void global_namespace_function() { |
| 40 |
; global_variable.member_function(); |
| 41 |
; } |
| 42 |
; int global_namespace_variable = 1; |
| 43 |
; } |
| 44 |
|
| 45 |
; Skip the output to the header of the pubnames section. |
| 46 |
; CHECK: debug_pubnames |
| 47 |
; CHECK: version = 0x0002 |
| 48 |
|
| 49 |
; Check for each name in the output. |
| 50 |
; CHECK-DAG: "ns" |
| 51 |
; CHECK-DAG: "C::static_member_function" |
| 52 |
; CHECK-DAG: "global_variable" |
| 53 |
; CHECK-DAG: "ns::global_namespace_variable" |
| 54 |
; CHECK-DAG: "ns::global_namespace_function" |
| 55 |
; CHECK-DAG: "global_function" |
| 56 |
; CHECK-DAG: "C::static_member_variable" |
| 57 |
; CHECK-DAG: "C::member_function" |
| 58 |
|
| 59 |
source_filename = "test/DebugInfo/Generic/dwarf-public-names.ll" |
| 60 |
|
| 61 |
%struct.C = type { i8 } |
| 62 |
|
| 63 |
@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0 |
| 64 |
@global_variable = global %struct.C zeroinitializer, align 1, !dbg !15 |
| 65 |
@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17 |
| 66 |
|
| 67 |
; Function Attrs: nounwind uwtable |
| 68 |
define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 !dbg !23 { |
| 69 |
entry: |
| 70 |
%this.addr = alloca %struct.C*, align 8 |
| 71 |
store %struct.C* %this, %struct.C** %this.addr, align 8 |
| 72 |
call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !24, metadata !26), !dbg !27 |
| 73 |
%this1 = load %struct.C*, %struct.C** %this.addr |
| 74 |
store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !28 |
| 75 |
ret void, !dbg !29 |
| 76 |
} |
| 77 |
|
| 78 |
; Function Attrs: nounwind readnone |
| 79 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
| 80 |
|
| 81 |
; Function Attrs: nounwind uwtable |
| 82 |
define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 { |
| 83 |
entry: |
| 84 |
%0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31 |
| 85 |
ret i32 %0, !dbg !31 |
| 86 |
} |
| 87 |
|
| 88 |
; Function Attrs: nounwind uwtable |
| 89 |
define i32 @_Z15global_functionv() #0 !dbg !32 { |
| 90 |
entry: |
| 91 |
ret i32 -1, !dbg !33 |
| 92 |
} |
| 93 |
|
| 94 |
; Function Attrs: nounwind uwtable |
| 95 |
define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 { |
| 96 |
entry: |
| 97 |
call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !37 |
| 98 |
ret void, !dbg !38 |
| 99 |
} |
| 100 |
|
| 101 |
attributes #0 = { nounwind uwtable } |
| 102 |
attributes #1 = { nounwind readnone } |
| 103 |
|
| 104 |
!llvm.dbg.cu = !{!20} |
| 105 |
!llvm.module.flags = !{!22} |
| 106 |
|
| 107 |
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
| 108 |
!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5) |
| 109 |
!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, align: 8, elements: !4) |
| 110 |
!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") |
| 111 |
!4 = !{!5, !7, !12} |
| 112 |
!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember) |
| 113 |
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 114 |
!7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11) |
| 115 |
!8 = !DISubroutineType(types: !9) |
| 116 |
!9 = !{null, !10} |
| 117 |
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 118 |
!11 = !{} |
| 119 |
!12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11) |
| 120 |
!13 = !DISubroutineType(types: !14) |
| 121 |
!14 = !{!6} |
| 122 |
!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) |
| 123 |
!16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type |
| 124 |
!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) |
| 125 |
!18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true) |
| 126 |
!19 = !DINamespace(name: "ns", scope: null) |
| 127 |
!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type |
| 128 |
!21 = !{!0, !15, !17} |
| 129 |
!22 = !{i32 1, !"Debug Info Version", i32 3} |
| 130 |
!23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, retainedNodes: !11) |
| 131 |
!24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 132 |
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64) |
| 133 |
!26 = !DIExpression() |
| 134 |
!27 = !DILocation(line: 9, scope: !23) |
| 135 |
!28 = !DILocation(line: 10, scope: !23) |
| 136 |
!29 = !DILocation(line: 11, scope: !23) |
| 137 |
!30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, retainedNodes: !11) |
| 138 |
!31 = !DILocation(line: 14, scope: !30) |
| 139 |
!32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11) |
| 140 |
!33 = !DILocation(line: 20, scope: !32) |
| 141 |
!34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11) |
| 142 |
!35 = !DISubroutineType(types: !36) |
| 143 |
!36 = !{null} |
| 144 |
!37 = !DILocation(line: 25, scope: !34) |
| 145 |
!38 = !DILocation(line: 26, scope: !34) |
| 146 |
|