114 lines · plain
1; RUN: llc -mtriple=x86_64-apple-macosx %s -o %t -filetype=obj2; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s3;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/1636267416;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_subprogram21; CHECK: DW_TAG_subprogram22; CHECK: DW_AT_name {{.*}} "~A"23; CHECK-NOT: DW_AT_MIPS_linkage_name24; CHECK: DW_TAG_subprogram25; CHECK-NOT: DW_TAG26; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1AD2Ev"27; CHECK-NOT: DW_TAG28; CHECK: DW_AT_specification {{.*}} "~A"29 30 31target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"32target triple = "x86_64-apple-macosx10.9.0"33 34%struct.A = type { i8 }35 36; Function Attrs: nounwind ssp uwtable37define void @_ZN1AD2Ev(ptr %this) unnamed_addr #0 align 2 !dbg !17 {38entry:39 %this.addr = alloca ptr, align 840 store ptr %this, ptr %this.addr, align 841 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !26, metadata !DIExpression()), !dbg !2842 %this1 = load ptr, ptr %this.addr43 ret void, !dbg !2944}45 46; Function Attrs: nounwind readnone47declare void @llvm.dbg.declare(metadata, metadata, metadata) #148 49; Function Attrs: nounwind ssp uwtable50define void @_ZN1AD1Ev(ptr %this) unnamed_addr #0 align 2 !dbg !18 {51entry:52 %this.addr = alloca ptr, align 853 store ptr %this, ptr %this.addr, align 854 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !30, metadata !DIExpression()), !dbg !3155 %this1 = load ptr, ptr %this.addr56 call void @_ZN1AD2Ev(ptr %this1), !dbg !3257 ret void, !dbg !3358}59 60; Function Attrs: ssp uwtable61define void @_Z3foov() #2 !dbg !19 {62entry:63 %a = alloca %struct.A, align 164 call void @llvm.dbg.declare(metadata ptr %a, metadata !34, metadata !DIExpression()), !dbg !3565 call void @_ZN1AC1Ei(ptr %a, i32 1), !dbg !3566 call void @_ZN1AD1Ev(ptr %a), !dbg !3667 ret void, !dbg !3668}69 70declare void @_ZN1AC1Ei(ptr, i32)71 72attributes #0 = { nounwind ssp uwtable }73attributes #1 = { nounwind readnone }74attributes #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, retainedNodes: !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, retainedNodes: !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, retainedNodes: !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