Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/DW_AT_linkage_name.ll

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