OSDN Git Service

Merge "Take HOST_PREFER_32_BIT into account"
[android-x86/external-llvm.git] / test / DebugInfo / X86 / DW_AT_linkage_name.ll
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 {
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 !{!"0x102"}), !dbg !28
42   %this1 = load %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 {
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 !{!"0x102"}), !dbg !31
55   %this1 = load %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 {
62 entry:
63   %a = alloca %struct.A, align 1
64   call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !34, metadata !{!"0x102"}), !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 = !{!"0x11\004\00clang version 3.5.0 \000\00\000\00\001", !1, !2, !3, !16, !2, !2} ; [ DW_TAG_compile_unit ] [linkage-name.cpp] [DW_LANG_C_plus_plus]
81 !1 = !{!"linkage-name.cpp", !""}
82 !2 = !{}
83 !3 = !{!4}
84 !4 = !{!"0x13\00A\001\008\008\000\000\000", !1, null, null, !5, null, null, !"_ZTS1A"} ; [ DW_TAG_structure_type ] [A] [line 1, size 8, align 8, offset 0] [def] [from ]
85 !5 = !{!6, !12}
86 !6 = !{!"0x2e\00A\00A\00\002\000\000\000\006\00256\000\002", !1, !"_ZTS1A", !7, null, null, null, i32 0, !11} ; [ DW_TAG_subprogram ] [line 2] [A]
87 !7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
88 !8 = !{null, !9, !10}
89 !9 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A]
90 !10 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
91 !11 = !{i32 786468}
92 !12 = !{!"0x2e\00~A\00~A\00\003\000\000\000\006\00256\000\003", !1, !"_ZTS1A", !13, null, null, null, i32 0, !15} ; [ DW_TAG_subprogram ] [line 3] [~A]
93 !13 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !14, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
94 !14 = !{null, !9}
95 !15 = !{i32 786468}
96 !16 = !{!17, !18, !19}
97 !17 = !{!"0x2e\00~A\00~A\00_ZN1AD2Ev\006\000\001\000\006\00256\000\006", !1, !"_ZTS1A", !13, null, void (%struct.A*)* @_ZN1AD2Ev, null, !12, !2} ; [ DW_TAG_subprogram ] [line 6] [def] [~A]
98 !18 = !{!"0x2e\00~A\00~A\00_ZN1AD1Ev\006\000\001\000\006\00256\000\006", !1, !"_ZTS1A", !13, null, void (%struct.A*)* @_ZN1AD1Ev, null, !12, !2} ; [ DW_TAG_subprogram ] [line 6] [def] [~A]
99 !19 = !{!"0x2e\00foo\00foo\00_Z3foov\0010\000\001\000\006\00256\000\0010", !1, !20, !21, null, void ()* @_Z3foov, null, null, !2} ; [ DW_TAG_subprogram ] [line 10] [def] [foo]
100 !20 = !{!"0x29", !1}         ; [ DW_TAG_file_type ] [linkage-name.cpp]
101 !21 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !22, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
102 !22 = !{null}
103 !23 = !{i32 2, !"Dwarf Version", i32 2}
104 !24 = !{i32 1, !"Debug Info Version", i32 2}
105 !25 = !{!"clang version 3.5.0 "}
106 !26 = !{!"0x101\00this\0016777216\001088", !17, null, !27} ; [ DW_TAG_arg_variable ] [this] [line 0]
107 !27 = !{!"0xf\00\000\0064\0064\000\000", null, null, !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1A]
108 !28 = !MDLocation(line: 0, scope: !17)
109 !29 = !MDLocation(line: 8, scope: !17)
110 !30 = !{!"0x101\00this\0016777216\001088", !18, null, !27} ; [ DW_TAG_arg_variable ] [this] [line 0]
111 !31 = !MDLocation(line: 0, scope: !18)
112 !32 = !MDLocation(line: 6, scope: !18)
113 !33 = !MDLocation(line: 8, scope: !18)
114 !34 = !{!"0x100\00a\0011\000", !19, !20, !"_ZTS1A"} ; [ DW_TAG_auto_variable ] [a] [line 11]
115 !35 = !MDLocation(line: 11, scope: !19)
116 !36 = !MDLocation(line: 12, scope: !19)