1; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t.o < %s 2; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=LINUX %s 3; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -o %t.o < %s 4; RUN: llvm-dwarfdump -debug-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-pubnames %t.o | FileCheck --check-prefix=NOPUB %s 7 8; RUN: rm -rf %t 9; RUN: mkdir %t 10; RUN: sed -e "s/C_plus_plus/C_plus_plus_03/" %s > %t/test.ll 11; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll 12; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s 13; RUN: sed -e "s/C_plus_plus/C_plus_plus_11/" %s > %t/test.ll 14; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll 15; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s 16; RUN: sed -e "s/C_plus_plus/C_plus_plus_14/" %s > %t/test.ll 17; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll 18; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s 19; RUN: sed -e "s/C_plus_plus/C_plus_plus_17/" %s > %t/test.ll 20; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll 21; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s 22; RUN: sed -e "s/C_plus_plus/C_plus_plus_20/" %s > %t/test.ll 23; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t/test.o < %t/test.ll 24; RUN: llvm-dwarfdump -debug-pubnames %t/test.o | FileCheck --check-prefix=LINUX %s 25; ModuleID = 'dwarf-public-names.cpp' 26; 27; Generated from: 28; 29; struct C { 30; void member_function(); 31; static int static_member_function(); 32; static int static_member_variable; 33; }; 34; 35; int C::static_member_variable = 0; 36; 37; void C::member_function() { 38; static_member_variable = 0; 39; } 40; 41; int C::static_member_function() { 42; return static_member_variable; 43; } 44; 45; C global_variable; 46; 47; int global_function() { 48; return -1; 49; } 50; 51; namespace ns { 52; void global_namespace_function() { 53; global_variable.member_function(); 54; } 55; int global_namespace_variable = 1; 56; } 57 58; Darwin and PS4 shouldn't be generating the section by default 59; NOPUB: debug_pubnames 60; NOPUB-NEXT: {{^$}} 61 62; Skip the output to the header of the pubnames section. 63; LINUX: debug_pubnames 64; LINUX-NEXT: unit_size = 0x00000128 65 66; Check for each name in the output. 67; LINUX-DAG: "ns" 68; LINUX-DAG: "C::static_member_function" 69; LINUX-DAG: "global_variable" 70; LINUX-DAG: "ns::global_namespace_variable" 71; LINUX-DAG: "ns::global_namespace_function" 72; LINUX-DAG: "global_function" 73; LINUX-DAG: "C::static_member_variable" 74; LINUX-DAG: "C::member_function" 75 76source_filename = "test/DebugInfo/X86/dwarf-public-names.ll" 77 78%struct.C = type { i8 } 79 80@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0 81@global_variable = global %struct.C zeroinitializer, align 1, !dbg !15 82@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17 83 84; Function Attrs: nounwind uwtable 85define void @_ZN1C15member_functionEv(ptr %this) #0 align 2 !dbg !23 { 86entry: 87 %this.addr = alloca ptr, align 8 88 store ptr %this, ptr %this.addr, align 8 89 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !24, metadata !26), !dbg !27 90 %this1 = load ptr, ptr %this.addr 91 store i32 0, ptr @_ZN1C22static_member_variableE, align 4, !dbg !28 92 ret void, !dbg !29 93} 94 95; Function Attrs: nounwind readnone 96declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 97 98; Function Attrs: nounwind uwtable 99define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 { 100entry: 101 %0 = load i32, ptr @_ZN1C22static_member_variableE, align 4, !dbg !31 102 ret i32 %0, !dbg !31 103} 104 105; Function Attrs: nounwind uwtable 106define i32 @_Z15global_functionv() #0 !dbg !32 { 107entry: 108 ret i32 -1, !dbg !33 109} 110 111; Function Attrs: nounwind uwtable 112define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 { 113entry: 114 call void @_ZN1C15member_functionEv(ptr @global_variable), !dbg !37 115 ret void, !dbg !38 116} 117 118attributes #0 = { nounwind uwtable } 119attributes #1 = { nounwind readnone } 120 121!llvm.dbg.cu = !{!20} 122!llvm.module.flags = !{!22} 123 124!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 125!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5) 126!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, elements: !4) 127!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t") 128!4 = !{!5, !7, !12} 129!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember) 130!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 131!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) 132!8 = !DISubroutineType(types: !9) 133!9 = !{null, !10} 134!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 135!11 = !{} 136!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) 137!13 = !DISubroutineType(types: !14) 138!14 = !{!6} 139!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression()) 140!16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type 141!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression()) 142!18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true) 143!19 = !DINamespace(name: "ns", scope: null) 144!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type 145!21 = !{!0, !15, !17} 146!22 = !{i32 1, !"Debug Info Version", i32 3} 147!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) 148!24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer) 149!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64) 150!26 = !DIExpression() 151!27 = !DILocation(line: 9, scope: !23) 152!28 = !DILocation(line: 10, scope: !23) 153!29 = !DILocation(line: 11, scope: !23) 154!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) 155!31 = !DILocation(line: 14, scope: !30) 156!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) 157!33 = !DILocation(line: 20, scope: !32) 158!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) 159!35 = !DISubroutineType(types: !36) 160!36 = !{null} 161!37 = !DILocation(line: 25, scope: !34) 162!38 = !DILocation(line: 26, scope: !34) 163 164