type-unique-simple2-a.ll 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. ; ModuleID = 'a.cpp'
  26. %class.A = type { i32 (...)** }
  27. @_ZTV1A = external unnamed_addr constant [4 x i8*]
  28. ; Function Attrs: nounwind
  29. define i32 @_Z3barv() #0 {
  30. entry:
  31. %tmp = alloca %class.A, align 8
  32. %0 = bitcast %class.A* %tmp to i8*, !dbg !38
  33. call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 8, i32 8, i1 false), !dbg !38
  34. call void @_ZN1AC1Ev(%class.A* %tmp) #1, !dbg !38
  35. %call = call i32 @_ZN1A6getFooEv(%class.A* %tmp), !dbg !38
  36. ret i32 %call, !dbg !38
  37. }
  38. ; Function Attrs: nounwind
  39. declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #1
  40. ; Function Attrs: inlinehint nounwind
  41. define linkonce_odr void @_ZN1AC1Ev(%class.A* %this) unnamed_addr #2 align 2 {
  42. entry:
  43. %this.addr = alloca %class.A*, align 8
  44. store %class.A* %this, %class.A** %this.addr, align 8
  45. call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !39, metadata !DIExpression()), !dbg !41
  46. %this1 = load %class.A*, %class.A** %this.addr
  47. call void @_ZN1AC2Ev(%class.A* %this1) #1, !dbg !42
  48. ret void, !dbg !42
  49. }
  50. declare i32 @_ZN1A6getFooEv(%class.A*)
  51. ; Function Attrs: nounwind readnone
  52. declare void @llvm.dbg.declare(metadata, metadata, metadata) #4
  53. ; Function Attrs: inlinehint nounwind
  54. define linkonce_odr void @_ZN1AC2Ev(%class.A* %this) unnamed_addr #2 align 2 {
  55. entry:
  56. %this.addr = alloca %class.A*, align 8
  57. store %class.A* %this, %class.A** %this.addr, align 8
  58. call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !44, metadata !DIExpression()), !dbg !45
  59. %this1 = load %class.A*, %class.A** %this.addr
  60. %0 = bitcast %class.A* %this1 to i8***, !dbg !46
  61. store i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @_ZTV1A, i64 0, i64 2), i8*** %0, !dbg !46
  62. ret void, !dbg !46
  63. }
  64. attributes #0 = { nounwind }
  65. attributes #1 = { nounwind }
  66. attributes #2 = { inlinehint nounwind }
  67. attributes #4 = { nounwind readnone }
  68. !llvm.dbg.cu = !{!0}
  69. !llvm.module.flags = !{!35, !36}
  70. !llvm.ident = !{!37}
  71. !0 = !DICompileUnit(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)
  72. !1 = !DIFile(filename: "<unknown>", directory: "")
  73. !2 = !{}
  74. !3 = !{!4}
  75. !4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 2, size: 64, align: 64, file: !5, elements: !6, vtableHolder: !"_ZTS1A", identifier: "_ZTS1A")
  76. !5 = !DIFile(filename: "./ab.h", directory: "")
  77. !6 = !{!7, !14, !19}
  78. !7 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 64, flags: DIFlagArtificial, file: !5, scope: !8, baseType: !9)
  79. !8 = !DIFile(filename: "./ab.h", directory: "")
  80. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !10)
  81. !10 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", size: 64, baseType: !11)
  82. !11 = !DISubroutineType(types: !12)
  83. !12 = !{!13}
  84. !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  85. !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: !"_ZTS1A", type: !15, containingType: !"_ZTS1A")
  86. !15 = !DISubroutineType(types: !16)
  87. !16 = !{null, !17}
  88. !17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
  89. !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: !"_ZTS1A", type: !20, containingType: !"_ZTS1A")
  90. !20 = !DISubroutineType(types: !21)
  91. !21 = !{!22, !17}
  92. !22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
  93. !23 = !DIDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !24, baseType: !13)
  94. !24 = !DIFile(filename: "a.cpp", directory: "")
  95. !26 = !{!27, !31, !34}
  96. !27 = !DISubprogram(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)
  97. !28 = !DIFile(filename: "a.cpp", directory: "")
  98. !29 = !DISubroutineType(types: !30)
  99. !30 = !{!23}
  100. !31 = !DISubprogram(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)
  101. !32 = !DISubprogram(name: "A", isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scope: !"_ZTS1A", type: !15)
  102. !34 = !DISubprogram(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)
  103. !35 = !{i32 2, !"Dwarf Version", i32 2}
  104. !36 = !{i32 1, !"Debug Info Version", i32 3}
  105. !37 = !{!"clang version 3.5 "}
  106. !38 = !DILocation(line: 3, scope: !27)
  107. !39 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !31, type: !40)
  108. !40 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A")
  109. !41 = !DILocation(line: 0, scope: !31)
  110. !42 = !DILocation(line: 2, scope: !43)
  111. !43 = !DILexicalBlockFile(discriminator: 0, file: !5, scope: !31)
  112. !44 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !34, type: !40)
  113. !45 = !DILocation(line: 0, scope: !34)
  114. !46 = !DILocation(line: 2, scope: !34)