1 ; RUN: llc -mtriple=x86_64-apple-macosx %s -o %t -filetype=obj 2 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s 3 ; 4 ; struct A { 5 ; A(int i); 6 ; ~A(); 7 ; }; 8 ; 9 ; A::~A() {} 10 ; 11 ; void foo() { 12 ; A a(1); 13 ; } 14 ; 15 ; rdar://problem/16362674 16 ; 17 ; Test that we do not emit a linkage name for the declaration of a destructor. 18 ; Test that we do emit a linkage name for a specific instance of it. 19 20 ; CHECK: DW_TAG_subprogram 21 ; CHECK: DW_TAG_subprogram 22 ; CHECK: DW_AT_name {{.*}} "~A" 23 ; CHECK-NOT: DW_AT_MIPS_linkage_name 24 ; CHECK: DW_TAG_subprogram 25 ; CHECK-NOT: DW_TAG 26 ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1AD2Ev" 27 ; CHECK-NOT: DW_TAG 28 ; CHECK: DW_AT_specification {{.*}} "~A" 29 30 31 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 32 target triple = "x86_64-apple-macosx10.9.0" 33 34 %struct.A = type { i8 } 35 36 ; Function Attrs: nounwind ssp uwtable 37 define void @_ZN1AD2Ev(%struct.A* %this) unnamed_addr #0 align 2 !dbg !17 { 38 entry: 39 %this.addr = alloca %struct.A*, align 8 40 store %struct.A* %this, %struct.A** %this.addr, align 8 41 call void @llvm.dbg.declare(metadata %struct.A** %this.addr, metadata !26, metadata !DIExpression()), !dbg !28 42 %this1 = load %struct.A*, %struct.A** %this.addr 43 ret void, !dbg !29 44 } 45 46 ; Function Attrs: nounwind readnone 47 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 48 49 ; Function Attrs: nounwind ssp uwtable 50 define void @_ZN1AD1Ev(%struct.A* %this) unnamed_addr #0 align 2 !dbg !18 { 51 entry: 52 %this.addr = alloca %struct.A*, align 8 53 store %struct.A* %this, %struct.A** %this.addr, align 8 54 call void @llvm.dbg.declare(metadata %struct.A** %this.addr, metadata !30, metadata !DIExpression()), !dbg !31 55 %this1 = load %struct.A*, %struct.A** %this.addr 56 call void @_ZN1AD2Ev(%struct.A* %this1), !dbg !32 57 ret void, !dbg !33 58 } 59 60 ; Function Attrs: ssp uwtable 61 define void @_Z3foov() #2 !dbg !19 { 62 entry: 63 %a = alloca %struct.A, align 1 64 call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !34, metadata !DIExpression()), !dbg !35 65 call void @_ZN1AC1Ei(%struct.A* %a, i32 1), !dbg !35 66 call void @_ZN1AD1Ev(%struct.A* %a), !dbg !36 67 ret void, !dbg !36 68 } 69 70 declare void @_ZN1AC1Ei(%struct.A*, i32) 71 72 attributes #0 = { nounwind ssp uwtable } 73 attributes #1 = { nounwind readnone } 74 attributes #2 = { ssp uwtable } 75 76 !llvm.dbg.cu = !{!0} 77 !llvm.module.flags = !{!23, !24} 78 !llvm.ident = !{!25} 79 80 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2) 81 !1 = !DIFile(filename: "linkage-name.cpp", directory: "") 82 !2 = !{} 83 !3 = !{!4} 84 !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1A") 85 !5 = !{!6, !12} 86 !6 = !DISubprogram(name: "A", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !4, type: !7) 87 !7 = !DISubroutineType(types: !8) 88 !8 = !{null, !9, !10} 89 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4) 90 !10 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 91 !12 = !DISubprogram(name: "~A", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !4, type: !13) 92 !13 = !DISubroutineType(types: !14) 93 !14 = !{null, !9} 94 !17 = distinct !DISubprogram(name: "~A", linkageName: "_ZN1AD2Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !4, type: !13, declaration: !12, variables: !2) 95 !18 = distinct !DISubprogram(name: "~A", linkageName: "_ZN1AD1Ev", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !4, type: !13, declaration: !12, variables: !2) 96 !19 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", line: 10, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 10, file: !1, scope: !20, type: !21, variables: !2) 97 !20 = !DIFile(filename: "linkage-name.cpp", directory: "") 98 !21 = !DISubroutineType(types: !22) 99 !22 = !{null} 100 !23 = !{i32 2, !"Dwarf Version", i32 2} 101 !24 = !{i32 1, !"Debug Info Version", i32 3} 102 !25 = !{!"clang version 3.5.0 "} 103 !26 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !17, type: !27) 104 !27 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4) 105 !28 = !DILocation(line: 0, scope: !17) 106 !29 = !DILocation(line: 8, scope: !17) 107 !30 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !18, type: !27) 108 !31 = !DILocation(line: 0, scope: !18) 109 !32 = !DILocation(line: 6, scope: !18) 110 !33 = !DILocation(line: 8, scope: !18) 111 !34 = !DILocalVariable(name: "a", line: 11, scope: !19, file: !20, type: !4) 112 !35 = !DILocation(line: 11, scope: !19) 113 !36 = !DILocation(line: 12, scope: !19) 114