1 ; REQUIRES: object-emission
3 ; RUN: llvm-link %s %p/type-unique-simple2-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -v -debug-info - | FileCheck %s
5 ; Tests for a merge error where attributes are inserted twice into the same DIE.
11 ; virtual void setFoo();
12 ; virtual const foo_t getFoo();
18 ; return A().getFoo();
21 ; CHECK: DW_AT_name {{.*}}"setFoo"
23 ; CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
24 ; CHECK-NOT: DW_AT_accessibility
29 %class.A = type { ptr }
31 @_ZTV1A = external unnamed_addr constant [4 x ptr]
33 ; Function Attrs: nounwind
34 define i32 @_Z3barv() #0 !dbg !27 {
36 %tmp = alloca %class.A, align 8
37 call void @llvm.memset.p0.i64(ptr align 8 %tmp, i8 0, i64 8, i1 false), !dbg !38
38 call void @_ZN1AC1Ev(ptr %tmp) #1, !dbg !38
39 %call = call i32 @_ZN1A6getFooEv(ptr %tmp), !dbg !38
40 ret i32 %call, !dbg !38
43 ; Function Attrs: nounwind
44 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) #1
46 ; Function Attrs: inlinehint nounwind
47 define linkonce_odr void @_ZN1AC1Ev(ptr %this) unnamed_addr #2 align 2 !dbg !31 {
49 %this.addr = alloca ptr, align 8
50 store ptr %this, ptr %this.addr, align 8
51 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !39, metadata !DIExpression()), !dbg !41
52 %this1 = load ptr, ptr %this.addr
53 call void @_ZN1AC2Ev(ptr %this1) #1, !dbg !42
57 declare i32 @_ZN1A6getFooEv(ptr)
59 ; Function Attrs: nounwind readnone
60 declare void @llvm.dbg.declare(metadata, metadata, metadata) #4
62 ; Function Attrs: inlinehint nounwind
63 define linkonce_odr void @_ZN1AC2Ev(ptr %this) unnamed_addr #2 align 2 !dbg !34 {
65 %this.addr = alloca ptr, align 8
66 store ptr %this, ptr %this.addr, align 8
67 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !44, metadata !DIExpression()), !dbg !45
68 %this1 = load ptr, ptr %this.addr
69 store ptr getelementptr inbounds ([4 x ptr], ptr @_ZTV1A, i64 0, i64 2), ptr %this1, !dbg !46
73 attributes #0 = { nounwind }
74 attributes #1 = { nounwind }
75 attributes #2 = { inlinehint nounwind }
76 attributes #4 = { nounwind readnone }
79 !llvm.module.flags = !{!35, !36}
82 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
83 !1 = !DIFile(filename: "<unknown>", directory: "")
86 !4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 2, size: 64, align: 64, file: !5, elements: !6, vtableHolder: !4, identifier: "_ZTS1A")
87 !5 = !DIFile(filename: "./ab.h", directory: "")
89 !7 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 64, flags: DIFlagArtificial, file: !5, scope: !8, baseType: !9)
90 !8 = !DIFile(filename: "./ab.h", directory: "")
91 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !10)
92 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", size: 64, baseType: !11)
93 !11 = !DISubroutineType(types: !12)
95 !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
96 !14 = !DISubprogram(name: "setFoo", linkageName: "_ZN1A6setFooEv", line: 4, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !5, scope: !4, type: !15, containingType: !4)
97 !15 = !DISubroutineType(types: !16)
99 !17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !4)
100 !19 = !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 5, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !5, scope: !4, type: !20, containingType: !4)
101 !20 = !DISubroutineType(types: !21)
103 !22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
104 !23 = !DIDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !24, baseType: !13)
105 !24 = !DIFile(filename: "a.cpp", directory: "")
106 !27 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !24, scope: !28, type: !29, retainedNodes: !2)
107 !28 = !DIFile(filename: "a.cpp", directory: "")
108 !29 = !DISubroutineType(types: !30)
110 !31 = distinct !DISubprogram(name: "A", linkageName: "_ZN1AC1Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !5, scope: !4, type: !15, declaration: !32, retainedNodes: !2)
111 !32 = !DISubprogram(name: "A", isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !4, type: !15)
112 !34 = distinct !DISubprogram(name: "A", linkageName: "_ZN1AC2Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !5, scope: !4, type: !15, declaration: !32, retainedNodes: !2)
113 !35 = !{i32 2, !"Dwarf Version", i32 3}
114 !36 = !{i32 1, !"Debug Info Version", i32 3}
115 !37 = !{!"clang version 3.5 "}
116 !38 = !DILocation(line: 3, scope: !27)
117 !39 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !40)
118 !40 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !4)
119 !41 = !DILocation(line: 0, scope: !31)
120 !42 = !DILocation(line: 2, scope: !43)
121 !43 = !DILexicalBlockFile(discriminator: 0, file: !5, scope: !31)
122 !44 = !DILocalVariable(name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, type: !40)
123 !45 = !DILocation(line: 0, scope: !34)
124 !46 = !DILocation(line: 2, scope: !34)