1*9880d681SAndroid Build Coastguard Worker; REQUIRES: object-emission 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; RUN: %llc_dwarf -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s 4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s 5*9880d681SAndroid Build Coastguard Worker; ModuleID = 'dwarf-public-names.cpp' 6*9880d681SAndroid Build Coastguard Worker; 7*9880d681SAndroid Build Coastguard Worker; Generated from: 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Worker; struct C { 10*9880d681SAndroid Build Coastguard Worker; void member_function(); 11*9880d681SAndroid Build Coastguard Worker; static int static_member_function(); 12*9880d681SAndroid Build Coastguard Worker; static int static_member_variable; 13*9880d681SAndroid Build Coastguard Worker; }; 14*9880d681SAndroid Build Coastguard Worker; 15*9880d681SAndroid Build Coastguard Worker; int C::static_member_variable = 0; 16*9880d681SAndroid Build Coastguard Worker; 17*9880d681SAndroid Build Coastguard Worker; void C::member_function() { 18*9880d681SAndroid Build Coastguard Worker; static_member_variable = 0; 19*9880d681SAndroid Build Coastguard Worker; } 20*9880d681SAndroid Build Coastguard Worker; 21*9880d681SAndroid Build Coastguard Worker; int C::static_member_function() { 22*9880d681SAndroid Build Coastguard Worker; return static_member_variable; 23*9880d681SAndroid Build Coastguard Worker; } 24*9880d681SAndroid Build Coastguard Worker; 25*9880d681SAndroid Build Coastguard Worker; C global_variable; 26*9880d681SAndroid Build Coastguard Worker; 27*9880d681SAndroid Build Coastguard Worker; int global_function() { 28*9880d681SAndroid Build Coastguard Worker; return -1; 29*9880d681SAndroid Build Coastguard Worker; } 30*9880d681SAndroid Build Coastguard Worker; 31*9880d681SAndroid Build Coastguard Worker; namespace ns { 32*9880d681SAndroid Build Coastguard Worker; void global_namespace_function() { 33*9880d681SAndroid Build Coastguard Worker; global_variable.member_function(); 34*9880d681SAndroid Build Coastguard Worker; } 35*9880d681SAndroid Build Coastguard Worker; int global_namespace_variable = 1; 36*9880d681SAndroid Build Coastguard Worker; } 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker; Skip the output to the header of the pubnames section. 39*9880d681SAndroid Build Coastguard Worker; CHECK: debug_pubnames 40*9880d681SAndroid Build Coastguard Worker; CHECK: version = 0x0002 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard Worker; Check for each name in the output. 43*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "ns" 44*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "C::static_member_function" 45*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "global_variable" 46*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "ns::global_namespace_variable" 47*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "ns::global_namespace_function" 48*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "global_function" 49*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "C::static_member_variable" 50*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: "C::member_function" 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker%struct.C = type { i8 } 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard Worker@_ZN1C22static_member_variableE = global i32 0, align 4 55*9880d681SAndroid Build Coastguard Worker@global_variable = global %struct.C zeroinitializer, align 1 56*9880d681SAndroid Build Coastguard Worker@_ZN2ns25global_namespace_variableE = global i32 1, align 4 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Workerdefine void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 !dbg !3 { 59*9880d681SAndroid Build Coastguard Workerentry: 60*9880d681SAndroid Build Coastguard Worker %this.addr = alloca %struct.C*, align 8 61*9880d681SAndroid Build Coastguard Worker store %struct.C* %this, %struct.C** %this.addr, align 8 62*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !DIExpression()), !dbg !30 63*9880d681SAndroid Build Coastguard Worker %this1 = load %struct.C*, %struct.C** %this.addr 64*9880d681SAndroid Build Coastguard Worker store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31 65*9880d681SAndroid Build Coastguard Worker ret void, !dbg !32 66*9880d681SAndroid Build Coastguard Worker} 67*9880d681SAndroid Build Coastguard Worker 68*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone 69*9880d681SAndroid Build Coastguard Worker 70*9880d681SAndroid Build Coastguard Workerdefine i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 !dbg !18 { 71*9880d681SAndroid Build Coastguard Workerentry: 72*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33 73*9880d681SAndroid Build Coastguard Worker ret i32 %0, !dbg !33 74*9880d681SAndroid Build Coastguard Worker} 75*9880d681SAndroid Build Coastguard Worker 76*9880d681SAndroid Build Coastguard Workerdefine i32 @_Z15global_functionv() nounwind uwtable !dbg !19 { 77*9880d681SAndroid Build Coastguard Workerentry: 78*9880d681SAndroid Build Coastguard Worker ret i32 -1, !dbg !34 79*9880d681SAndroid Build Coastguard Worker} 80*9880d681SAndroid Build Coastguard Worker 81*9880d681SAndroid Build Coastguard Workerdefine void @_ZN2ns25global_namespace_functionEv() nounwind uwtable !dbg !20 { 82*9880d681SAndroid Build Coastguard Workerentry: 83*9880d681SAndroid Build Coastguard Worker call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35 84*9880d681SAndroid Build Coastguard Worker ret void, !dbg !36 85*9880d681SAndroid Build Coastguard Worker} 86*9880d681SAndroid Build Coastguard Worker 87*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind uwtable } 88*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 89*9880d681SAndroid Build Coastguard Worker 90*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 91*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!38} 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Worker!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: FullDebug, file: !37, enums: !1, retainedTypes: !1, globals: !24, imports: !1) 94*9880d681SAndroid Build Coastguard Worker!1 = !{} 95*9880d681SAndroid Build Coastguard Worker!3 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 9, file: !4, scope: null, type: !5, declaration: !12, variables: !1) 96*9880d681SAndroid Build Coastguard Worker!4 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") 97*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6) 98*9880d681SAndroid Build Coastguard Worker!6 = !{null, !7} 99*9880d681SAndroid Build Coastguard Worker!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) 100*9880d681SAndroid Build Coastguard Worker!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9) 101*9880d681SAndroid Build Coastguard Worker!9 = !{!10, !12, !14} 102*9880d681SAndroid Build Coastguard Worker!10 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11) 103*9880d681SAndroid Build Coastguard Worker!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 104*9880d681SAndroid Build Coastguard Worker!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) 105*9880d681SAndroid Build Coastguard Worker!13 = !{} ; previously: invalid DW_TAG_base_type 106*9880d681SAndroid Build Coastguard Worker!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) 107*9880d681SAndroid Build Coastguard Worker!15 = !DISubroutineType(types: !16) 108*9880d681SAndroid Build Coastguard Worker!16 = !{!11} 109*9880d681SAndroid Build Coastguard Worker!17 = !{} ; previously: invalid DW_TAG_base_type 110*9880d681SAndroid Build Coastguard Worker!18 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 13, file: !4, scope: null, type: !15, declaration: !14, variables: !1) 111*9880d681SAndroid Build Coastguard Worker!19 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 19, file: !4, scope: !4, type: !15, variables: !1) 112*9880d681SAndroid Build Coastguard Worker!20 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", line: 24, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 24, file: !4, scope: !21, type: !22, variables: !1) 113*9880d681SAndroid Build Coastguard Worker!21 = !DINamespace(name: "ns", line: 23, file: !4, scope: null) 114*9880d681SAndroid Build Coastguard Worker!22 = !DISubroutineType(types: !23) 115*9880d681SAndroid Build Coastguard Worker!23 = !{null} 116*9880d681SAndroid Build Coastguard Worker!24 = !{!25, !26, !27} 117*9880d681SAndroid Build Coastguard Worker!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) 118*9880d681SAndroid Build Coastguard Worker!26 = !DIGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable) 119*9880d681SAndroid Build Coastguard Worker!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) 120*9880d681SAndroid Build Coastguard Worker!28 = !DILocalVariable(name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29) 121*9880d681SAndroid Build Coastguard Worker!29 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8) 122*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 9, scope: !3) 123*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 10, scope: !3) 124*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 11, scope: !3) 125*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 14, scope: !18) 126*9880d681SAndroid Build Coastguard Worker!34 = !DILocation(line: 20, scope: !19) 127*9880d681SAndroid Build Coastguard Worker!35 = !DILocation(line: 25, scope: !20) 128*9880d681SAndroid Build Coastguard Worker!36 = !DILocation(line: 26, scope: !20) 129*9880d681SAndroid Build Coastguard Worker!37 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") 130*9880d681SAndroid Build Coastguard Worker!38 = !{i32 1, !"Debug Info Version", i32 3} 131