1 ; REQUIRES: object-emission
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
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: _ZN1A6setFooEv
22 ; CHECK: DW_AT_accessibility [DW_FORM_data1] (DW_ACCESS_public)
23 ; CHECK-NOT: DW_AT_accessibility
28 %class.A = type { i32 (...)** }
30 @_ZTV1A = external unnamed_addr constant [4 x i8*]
32 ; Function Attrs: nounwind
33 define i32 @_Z3barv() #0 {
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
43 ; Function Attrs: nounwind
44 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1
46 ; Function Attrs: inlinehint nounwind
47 define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr #2 align 2 {
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, metadata !MDExpression()), !dbg !41
52 %this1 = load %class.A*, %class.A** %this.addr
53 call void @_ZN1AC2Ev(%class.A* %this1) #1, !dbg !42
57 declare i32 @_ZN1A6getFooEv(%class.A*)
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(%class.A* %this) unnamed_addr #2 align 2 {
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, metadata !MDExpression()), !dbg !45
68 %this1 = load %class.A*, %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
74 attributes #0 = { nounwind }
75 attributes #1 = { nounwind }
76 attributes #2 = { inlinehint nounwind }
77 attributes #4 = { nounwind readnone }
80 !llvm.module.flags = !{!35, !36}
83 !0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !26, globals: !2, imports: !2)
84 !1 = !MDFile(filename: "<unknown>", directory: "")
87 !4 = !MDCompositeType(tag: DW_TAG_class_type, name: "A", line: 2, size: 64, align: 64, file: !5, elements: !6, vtableHolder: !"_ZTS1A", identifier: "_ZTS1A")
88 !5 = !MDFile(filename: "./ab.h", directory: "")
90 !7 = !MDDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 64, flags: DIFlagArtificial, file: !5, scope: !8, baseType: !9)
91 !8 = !MDFile(filename: "./ab.h", directory: "")
92 !9 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !10)
93 !10 = !MDDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", size: 64, baseType: !11)
94 !11 = !MDSubroutineType(types: !12)
96 !13 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
97 !14 = !MDSubprogram(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: !"_ZTS1A", type: !15, containingType: !"_ZTS1A", variables: !18)
98 !15 = !MDSubroutineType(types: !16)
100 !17 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
102 !19 = !MDSubprogram(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: !"_ZTS1A", type: !20, containingType: !"_ZTS1A", variables: !25)
103 !20 = !MDSubroutineType(types: !21)
105 !22 = !MDDerivedType(tag: DW_TAG_const_type, baseType: !23)
106 !23 = !MDDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !24, baseType: !13)
107 !24 = !MDFile(filename: "a.cpp", directory: "")
109 !26 = !{!27, !31, !34}
110 !27 = !MDSubprogram(name: "bar", linkageName: "_Z3barv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !24, scope: !28, type: !29, function: i32 ()* @_Z3barv, variables: !2)
111 !28 = !MDFile(filename: "a.cpp", directory: "")
112 !29 = !MDSubroutineType(types: !30)
114 !31 = !MDSubprogram(name: "A", linkageName: "_ZN1AC1Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !15, function: void (%class.A*)* @_ZN1AC1Ev, declaration: !32, variables: !2)
115 !32 = !MDSubprogram(name: "A", isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !"_ZTS1A", type: !15, variables: !33)
117 !34 = !MDSubprogram(name: "A", linkageName: "_ZN1AC2Ev", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !"_ZTS1A", type: !15, function: void (%class.A*)* @_ZN1AC2Ev, declaration: !32, variables: !2)
118 !35 = !{i32 2, !"Dwarf Version", i32 2}
119 !36 = !{i32 1, !"Debug Info Version", i32 3}
120 !37 = !{!"clang version 3.5 "}
121 !38 = !MDLocation(line: 3, scope: !27)
122 !39 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !40)
123 !40 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A")
124 !41 = !MDLocation(line: 0, scope: !31)
125 !42 = !MDLocation(line: 2, scope: !43)
126 !43 = !MDLexicalBlockFile(discriminator: 0, file: !5, scope: !31)
127 !44 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, type: !40)
128 !45 = !MDLocation(line: 0, scope: !34)
129 !46 = !MDLocation(line: 2, scope: !34)