• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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]   (DW_ACCESS_public)
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
33define i32 @_Z3barv() #0 {
34entry:
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
44declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1
45
46; Function Attrs: inlinehint nounwind
47define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr #2 align 2 {
48entry:
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
54  ret void, !dbg !42
55}
56
57declare i32 @_ZN1A6getFooEv(%class.A*)
58
59; Function Attrs: nounwind readnone
60declare void @llvm.dbg.declare(metadata, metadata, metadata) #4
61
62; Function Attrs: inlinehint nounwind
63define linkonce_odr void @_ZN1AC2Ev(%class.A* %this) unnamed_addr #2 align 2 {
64entry:
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*], [4 x i8*]* @_ZTV1A, i64 0, i64 2), i8*** %0, !dbg !46
71  ret void, !dbg !46
72}
73
74attributes #0 = { nounwind }
75attributes #1 = { nounwind }
76attributes #2 = { inlinehint nounwind }
77attributes #4 = { nounwind readnone }
78
79!llvm.dbg.cu = !{!0}
80!llvm.module.flags = !{!35, !36}
81!llvm.ident = !{!37}
82
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: "")
85!2 = !{}
86!3 = !{!4}
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: "")
89!6 = !{!7, !14, !19}
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)
95!12 = !{!13}
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")
98!15 = !MDSubroutineType(types: !16)
99!16 = !{null, !17}
100!17 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
101!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")
102!20 = !MDSubroutineType(types: !21)
103!21 = !{!22, !17}
104!22 = !MDDerivedType(tag: DW_TAG_const_type, baseType: !23)
105!23 = !MDDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !24, baseType: !13)
106!24 = !MDFile(filename: "a.cpp", directory: "")
107!26 = !{!27, !31, !34}
108!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)
109!28 = !MDFile(filename: "a.cpp", directory: "")
110!29 = !MDSubroutineType(types: !30)
111!30 = !{!23}
112!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)
113!32 = !MDSubprogram(name: "A", isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !"_ZTS1A", type: !15)
114!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)
115!35 = !{i32 2, !"Dwarf Version", i32 2}
116!36 = !{i32 1, !"Debug Info Version", i32 3}
117!37 = !{!"clang version 3.5 "}
118!38 = !MDLocation(line: 3, scope: !27)
119!39 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !40)
120!40 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A")
121!41 = !MDLocation(line: 0, scope: !31)
122!42 = !MDLocation(line: 2, scope: !43)
123!43 = !MDLexicalBlockFile(discriminator: 0, file: !5, scope: !31)
124!44 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, type: !40)
125!45 = !MDLocation(line: 0, scope: !34)
126!46 = !MDLocation(line: 2, scope: !34)
127