|
| 1 | +; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck %s |
| 2 | + |
| 3 | +; Make sure we attach DW_AT_linkage_name on function declarations but only |
| 4 | +; attach it on definitions if the value is different than on the declaration. |
| 5 | + |
| 6 | +target triple = "arm64-apple-macosx" |
| 7 | + |
| 8 | +define void @_Z11SameLinkagev() !dbg !4 { |
| 9 | +entry: |
| 10 | + ret void |
| 11 | +} |
| 12 | + |
| 13 | +; CHECK: DW_AT_linkage_name ("_Z11SameLinkagev") |
| 14 | +; CHECK: DW_AT_declaration (true) |
| 15 | +; CHECK-NOT: DW_AT_linkage_name ("_Z11SameLinkagev") |
| 16 | + |
| 17 | +define void @_Z11DiffLinkagev() !dbg !8 { |
| 18 | +entry: |
| 19 | + ret void |
| 20 | +} |
| 21 | + |
| 22 | +; CHECK: DW_AT_linkage_name ("SomeName") |
| 23 | +; CHECK: DW_AT_declaration (true) |
| 24 | +; CHECK: DW_AT_linkage_name ("_Z11DiffLinkagev") |
| 25 | + |
| 26 | +define void @_Z15EmptyDefLinkagev() !dbg !10 { |
| 27 | +entry: |
| 28 | + ret void |
| 29 | +} |
| 30 | + |
| 31 | +; CHECK: DW_AT_linkage_name ("_Z15EmptyDefLinkagev") |
| 32 | +; CHECK: DW_AT_declaration (true) |
| 33 | +; CHECK-NOT: DW_AT_linkage_name |
| 34 | + |
| 35 | +define void @_Z16EmptyDeclLinkagev() !dbg !12 { |
| 36 | +entry: |
| 37 | + ret void |
| 38 | +} |
| 39 | + |
| 40 | +; CHECK: DW_AT_declaration (true) |
| 41 | +; CHECK: DW_AT_linkage_name ("_Z16EmptyDeclLinkagev") |
| 42 | + |
| 43 | +define void @_Z13EmptyLinkagesv() !dbg !14 { |
| 44 | +entry: |
| 45 | + ret void |
| 46 | +} |
| 47 | + |
| 48 | +; CHECK-NOT: DW_AT_linkage_name |
| 49 | + |
| 50 | +!llvm.dbg.cu = !{!0} |
| 51 | +!llvm.module.flags = !{!2, !3} |
| 52 | + |
| 53 | +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") |
| 54 | +!1 = !DIFile(filename: "foo.cpp", directory: "/tmp") |
| 55 | +!2 = !{i32 7, !"Dwarf Version", i32 5} |
| 56 | +!3 = !{i32 2, !"Debug Info Version", i32 3} |
| 57 | +!4 = distinct !DISubprogram(name: "SameLinkage", linkageName: "_Z11SameLinkagev", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !7) |
| 58 | +!5 = !DISubroutineType(types: !6) |
| 59 | +!6 = !{null} |
| 60 | +!7 = !DISubprogram(name: "SameLinkage", linkageName: "_Z11SameLinkagev", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0) |
| 61 | +!8 = distinct !DISubprogram(name: "DiffLinkage", linkageName: "_Z11DiffLinkagev", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !9) |
| 62 | +!9 = !DISubprogram(name: "DiffLinkage", linkageName: "SomeName", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0) |
| 63 | +!10 = distinct !DISubprogram(name: "EmptyDefLinkage", linkageName: "", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !11) |
| 64 | +!11 = !DISubprogram(name: "EmptyDefLinkage", linkageName: "_Z15EmptyDefLinkagev", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0) |
| 65 | +!12 = distinct !DISubprogram(name: "EmptyDeclLinkage", linkageName: "_Z16EmptyDeclLinkagev", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !13) |
| 66 | +!13 = !DISubprogram(name: "EmptyDeclLinkage", linkageName: "", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0) |
| 67 | +!14 = distinct !DISubprogram(name: "EmptyLinkages", linkageName: "", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !15) |
| 68 | +!15 = !DISubprogram(name: "EmptyLinkages", linkageName: "", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0) |
0 commit comments