1 ; REQUIRES: object-emission 2 ; 3 ; RUN: llvm-link %s %p/type-unique-simple2-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s 4 ; 5 ; Tests for a merge error where attributes are inserted twice into the same DIE. 6 ; 7 ; $ cat ab.h 8 ; typedef int foo_t; 9 ; class A { 10 ; public: 11 ; virtual void setFoo(); 12 ; virtual const foo_t getFoo(); 13 ; }; 14 ; 15 ; $ cat a.cpp 16 ; #include "ab.h" 17 ; foo_t bar() { 18 ; return A().getFoo(); 19 ; } 20 ; 21 ; CHECK: _ZN1A6setFooEv 22 ; CHECK: DW_AT_accessibility [DW_FORM_data1] (0x01) 23 ; CHECK-NOT: DW_AT_accessibility 24 ; CHECK: DW_TAG 25 26 ; ModuleID = 'a.cpp' 27 28 %class.A = type { i32 (...)** } 29 30 @_ZTV1A = external unnamed_addr constant [4 x i8*] 31 32 ; Function Attrs: nounwind 33 define i32 @_Z3barv() #0 { 34 entry: 35 %tmp = alloca %class.A, align 8 36 %0 = bitcast %class.A* %tmp to i8*, !dbg !38 37 call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 8, i32 8, i1 false), !dbg !38 38 call void @_ZN1AC1Ev(%class.A* %tmp) #1, !dbg !38 39 %call = call i32 @_ZN1A6getFooEv(%class.A* %tmp), !dbg !38 40 ret i32 %call, !dbg !38 41 } 42 43 ; Function Attrs: nounwind 44 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1 45 46 ; Function Attrs: inlinehint nounwind 47 define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr #2 align 2 { 48 entry: 49 %this.addr = alloca %class.A*, align 8 50 store %class.A* %this, %class.A** %this.addr, align 8 51 call void @llvm.dbg.declare(metadata !{%class.A** %this.addr}, metadata !39), !dbg !41 52 %this1 = load %class.A** %this.addr 53 call void @_ZN1AC2Ev(%class.A* %this1) #1, !dbg !42 54 ret void, !dbg !42 55 } 56 57 declare i32 @_ZN1A6getFooEv(%class.A*) 58 59 ; Function Attrs: nounwind readnone 60 declare void @llvm.dbg.declare(metadata, metadata) #4 61 62 ; Function Attrs: inlinehint nounwind 63 define linkonce_odr void @_ZN1AC2Ev(%class.A* %this) unnamed_addr #2 align 2 { 64 entry: 65 %this.addr = alloca %class.A*, align 8 66 store %class.A* %this, %class.A** %this.addr, align 8 67 call void @llvm.dbg.declare(metadata !{%class.A** %this.addr}, metadata !44), !dbg !45 68 %this1 = load %class.A** %this.addr 69 %0 = bitcast %class.A* %this1 to i8***, !dbg !46 70 store i8** getelementptr inbounds ([4 x i8*]* @_ZTV1A, i64 0, i64 2), i8*** %0, !dbg !46 71 ret void, !dbg !46 72 } 73 74 attributes #0 = { nounwind } 75 attributes #1 = { nounwind } 76 attributes #2 = { inlinehint nounwind } 77 attributes #4 = { nounwind readnone } 78 79 !llvm.dbg.cu = !{!0} 80 !llvm.module.flags = !{!35, !36} 81 !llvm.ident = !{!37} 82 83 !0 = metadata !{i32 786449, metadata !1, i32 4, metadata !"clang version 3.5 ", i1 false, metadata !"", i32 0, metadata !2, metadata !3, metadata !26, metadata !2, metadata !2, metadata !""} ; [ DW_TAG_compile_unit ] [/<unknown>] [DW_LANG_C_plus_plus] 84 !1 = metadata !{metadata !"<unknown>", metadata !""} 85 !2 = metadata !{} 86 !3 = metadata !{metadata !4} 87 !4 = metadata !{i32 786434, metadata !5, null, metadata !"A", i32 2, i64 64, i64 64, i32 0, i32 0, null, metadata !6, i32 0, metadata !"_ZTS1A", null, metadata !"_ZTS1A"} ; [ DW_TAG_class_type ] [A] [line 2, size 64, align 64, offset 0] [def] [from ] 88 !5 = metadata !{metadata !"./ab.h", metadata !""} 89 !6 = metadata !{metadata !7, metadata !14, metadata !19} 90 !7 = metadata !{i32 786445, metadata !5, metadata !8, metadata !"_vptr$A", i32 0, i64 64, i64 0, i64 0, i32 64, metadata !9} ; [ DW_TAG_member ] [_vptr$A] [line 0, size 64, align 0, offset 0] [artificial] [from ] 91 !8 = metadata !{i32 786473, metadata !5} ; [ DW_TAG_file_type ] [/./ab.h] 92 !9 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 0, i64 0, i32 0, metadata !10} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 0, offset 0] [from __vtbl_ptr_type] 93 !10 = metadata !{i32 786447, null, null, metadata !"__vtbl_ptr_type", i32 0, i64 64, i64 0, i64 0, i32 0, metadata !11} ; [ DW_TAG_pointer_type ] [__vtbl_ptr_type] [line 0, size 64, align 0, offset 0] [from ] 94 !11 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 95 !12 = metadata !{metadata !13} 96 !13 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] 97 !14 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1A", metadata !"setFoo", metadata !"setFoo", metadata !"_ZN1A6setFooEv", i32 4, metadata !15, i1 false, i1 false, i32 1, i32 0, metadata !"_ZTS1A", i32 256, i1 false, null, null, i32 0, metadata !18, i32 4} ; [ DW_TAG_subprogram ] [line 4] [setFoo] 98 !15 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !16, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 99 !16 = metadata !{null, metadata !17} 100 !17 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 1088, metadata !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1A] 101 !18 = metadata !{i32 786468} 102 !19 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1A", metadata !"getFoo", metadata !"getFoo", metadata !"_ZN1A6getFooEv", i32 5, metadata !20, i1 false, i1 false, i32 1, i32 1, metadata !"_ZTS1A", i32 256, i1 false, null, null, i32 0, metadata !25, i32 5} ; [ DW_TAG_subprogram ] [line 5] [getFoo] 103 !20 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !21, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 104 !21 = metadata !{metadata !22, metadata !17} 105 !22 = metadata !{i32 786470, null, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, metadata !23} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from foo_t] 106 !23 = metadata !{i32 786454, metadata !24, null, metadata !"foo_t", i32 1, i64 0, i64 0, i64 0, i32 0, metadata !13} ; [ DW_TAG_typedef ] [foo_t] [line 1, size 0, align 0, offset 0] [from int] 107 !24 = metadata !{metadata !"a.cpp", metadata !""} 108 !25 = metadata !{i32 786468} 109 !26 = metadata !{metadata !27, metadata !31, metadata !34} 110 !27 = metadata !{i32 786478, metadata !24, metadata !28, metadata !"bar", metadata !"bar", metadata !"_Z3barv", i32 2, metadata !29, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 false, i32 ()* @_Z3barv, null, null, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 2] [def] [bar] 111 !28 = metadata !{i32 786473, metadata !24} ; [ DW_TAG_file_type ] [/a.cpp] 112 !29 = metadata !{i32 786453, i32 0, null, metadata !"", i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !30, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 113 !30 = metadata !{metadata !23} 114 !31 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1A", metadata !"A", metadata !"A", metadata !"_ZN1AC1Ev", i32 2, metadata !15, i1 false, i1 true, i32 0, i32 0, null, i32 320, i1 false, void (%class.A*)* @_ZN1AC1Ev, null, metadata !32, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 2] [def] [A] 115 !32 = metadata !{i32 786478, null, metadata !"_ZTS1A", metadata !"A", metadata !"A", metadata !"", i32 0, metadata !15, i1 false, i1 false, i32 0, i32 0, null, i32 320, i1 false, null, null, i32 0, metadata !33, i32 0} ; [ DW_TAG_subprogram ] [line 0] [A] 116 !33 = metadata !{i32 786468} 117 !34 = metadata !{i32 786478, metadata !5, metadata !"_ZTS1A", metadata !"A", metadata !"A", metadata !"_ZN1AC2Ev", i32 2, metadata !15, i1 false, i1 true, i32 0, i32 0, null, i32 320, i1 false, void (%class.A*)* @_ZN1AC2Ev, null, metadata !32, metadata !2, i32 2} ; [ DW_TAG_subprogram ] [line 2] [def] [A] 118 !35 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} 119 !36 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} 120 !37 = metadata !{metadata !"clang version 3.5 "} 121 !38 = metadata !{i32 3, i32 0, metadata !27, null} 122 !39 = metadata !{i32 786689, metadata !31, metadata !"this", null, i32 16777216, metadata !40, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0] 123 !40 = metadata !{i32 786447, null, null, metadata !"", i32 0, i64 64, i64 64, i64 0, i32 0, metadata !"_ZTS1A"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS1A] 124 !41 = metadata !{i32 0, i32 0, metadata !31, null} 125 !42 = metadata !{i32 2, i32 0, metadata !43, null} 126 !43 = metadata !{i32 786443, metadata !5, metadata !31} ; [ DW_TAG_lexical_block ] [/./ab.h] 127 !44 = metadata !{i32 786689, metadata !34, metadata !"this", null, i32 16777216, metadata !40, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [this] [line 0] 128 !45 = metadata !{i32 0, i32 0, metadata !34, null} 129 !46 = metadata !{i32 2, i32 0, metadata !34, null} 130