type-unique-simple2-b.ll 5.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. ; RUN: true
  2. ; This file belongs to type-unique-simple2-a.ll.
  3. ;
  4. ; $ cat b.cpp
  5. ; #include "ab.h"
  6. ; void A::setFoo() {}
  7. ; const
  8. ; foo_t A::getFoo() { return 1; }
  9. ; ModuleID = 'b.cpp'
  10. ; target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
  11. ; target triple = "x86_64-apple-macosx10.9.0"
  12. %class.A = type { i32 (...)** }
  13. @_ZTV1A = unnamed_addr constant [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (void (%class.A*)* @_ZN1A6setFooEv to i8*), i8* bitcast (i32 (%class.A*)* @_ZN1A6getFooEv to i8*)]
  14. @_ZTVN10__cxxabiv117__class_type_infoE = external global i8*
  15. @_ZTS1A = constant [3 x i8] c"1A\00"
  16. @_ZTI1A = unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }
  17. ; Function Attrs: nounwind
  18. define void @_ZN1A6setFooEv(%class.A* %this) unnamed_addr #0 align 2 {
  19. entry:
  20. %this.addr = alloca %class.A*, align 8
  21. store %class.A* %this, %class.A** %this.addr, align 8
  22. call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !32, metadata !DIExpression()), !dbg !34
  23. %this1 = load %class.A*, %class.A** %this.addr
  24. ret void, !dbg !35
  25. }
  26. ; Function Attrs: nounwind readnone
  27. declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
  28. ; Function Attrs: nounwind
  29. define i32 @_ZN1A6getFooEv(%class.A* %this) unnamed_addr #0 align 2 {
  30. entry:
  31. %this.addr = alloca %class.A*, align 8
  32. store %class.A* %this, %class.A** %this.addr, align 8
  33. call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !36, metadata !DIExpression()), !dbg !37
  34. %this1 = load %class.A*, %class.A** %this.addr
  35. ret i32 1, !dbg !38
  36. }
  37. attributes #0 = { nounwind }
  38. attributes #1 = { nounwind readnone }
  39. !llvm.dbg.cu = !{!0}
  40. !llvm.module.flags = !{!29, !30}
  41. !llvm.ident = !{!31}
  42. !0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !3, subprograms: !25, globals: !2, imports: !2)
  43. !1 = !DIFile(filename: "<unknown>", directory: "")
  44. !2 = !{}
  45. !3 = !{!4}
  46. !4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 2, size: 64, align: 64, file: !5, elements: !6, vtableHolder: !"_ZTS1A", identifier: "_ZTS1A")
  47. !5 = !DIFile(filename: "./ab.h", directory: "")
  48. !6 = !{!7, !14, !19}
  49. !7 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$A", size: 64, flags: DIFlagArtificial, file: !5, scope: !8, baseType: !9)
  50. !8 = !DIFile(filename: "./ab.h", directory: "")
  51. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, baseType: !10)
  52. !10 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", size: 64, baseType: !11)
  53. !11 = !DISubroutineType(types: !12)
  54. !12 = !{!13}
  55. !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  56. !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")
  57. !15 = !DISubroutineType(types: !16)
  58. !16 = !{null, !17}
  59. !17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
  60. !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")
  61. !20 = !DISubroutineType(types: !21)
  62. !21 = !{!22, !17}
  63. !22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
  64. !23 = !DIDerivedType(tag: DW_TAG_typedef, name: "foo_t", line: 1, file: !5, baseType: !13)
  65. !25 = !{!26, !28}
  66. !26 = !DISubprogram(name: "setFoo", linkageName: "_ZN1A6setFooEv", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !27, scope: !"_ZTS1A", type: !15, function: void (%class.A*)* @_ZN1A6setFooEv, declaration: !14, variables: !2)
  67. !27 = !DIFile(filename: "b.cpp", directory: "")
  68. !28 = !DISubprogram(name: "getFoo", linkageName: "_ZN1A6getFooEv", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false, scopeLine: 4, file: !27, scope: !"_ZTS1A", type: !20, function: i32 (%class.A*)* @_ZN1A6getFooEv, declaration: !19, variables: !2)
  69. !29 = !{i32 2, !"Dwarf Version", i32 2}
  70. !30 = !{i32 1, !"Debug Info Version", i32 3}
  71. !31 = !{!"clang version 3.5 "}
  72. !32 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !26, type: !33)
  73. !33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A")
  74. !34 = !DILocation(line: 0, scope: !26)
  75. !35 = !DILocation(line: 2, scope: !26)
  76. !36 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !28, type: !33)
  77. !37 = !DILocation(line: 0, scope: !28)
  78. !38 = !DILocation(line: 4, scope: !28)