78f9be57a0c923ce68ea1a30af3dd5609014e718
[oota-llvm.git] / test / DebugInfo / X86 / DW_TAG_friend.ll
1 ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
2 ; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3
4 ; Check that the friend tag is there and is followed by a DW_AT_friend that has a reference back.
5
6 ; CHECK: [[BACK:0x[0-9a-f]*]]:   DW_TAG_class_type
7 ; CHECK-NEXT: DW_AT_name [DW_FORM_strp]       ( .debug_str[{{.*}}] = "A")
8 ; CHECK: DW_TAG_friend
9 ; CHECK-NEXT: DW_AT_friend [DW_FORM_ref4]   (cu + 0x{{[0-9a-f]*}} => {[[BACK]]})
10
11
12 %class.A = type { i32 }
13 %class.B = type { i32 }
14
15 @a = global %class.A zeroinitializer, align 4
16 @b = global %class.B zeroinitializer, align 4
17
18 !llvm.dbg.cu = !{!0}
19 !llvm.module.flags = !{!29}
20
21 !0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 (trunk 153413) (llvm/trunk 153428)", isOptimized: false, emissionKind: 0, file: !28, enums: !1, retainedTypes: !1, subprograms: !1, globals: !3, imports:  !1)
22 !1 = !{}
23 !3 = !{!5, !17}
24 !5 = !MDGlobalVariable(name: "a", line: 10, isLocal: false, isDefinition: true, scope: null, file: !6, type: !7, variable: %class.A* @a)
25 !6 = !MDFile(filename: "foo.cpp", directory: "/Users/echristo/tmp")
26 !7 = !MDCompositeType(tag: DW_TAG_class_type, name: "A", line: 1, size: 32, align: 32, file: !28, elements: !8)
27 !8 = !{!9, !11}
28 !9 = !MDDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, flags: DIFlagPrivate, file: !28, scope: !7, baseType: !10)
29 !10 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
30 !11 = !MDSubprogram(name: "A", line: 1, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !6, scope: !7, type: !12, variables: !15)
31 !12 = !MDSubroutineType(types: !13)
32 !13 = !{null, !14}
33 !14 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !7)
34 !15 = !{!16}
35 !16 = !{} ; previously: invalid DW_TAG_base_type
36 !17 = !MDGlobalVariable(name: "b", line: 11, isLocal: false, isDefinition: true, scope: null, file: !6, type: !18, variable: %class.B* @b)
37 !18 = !MDCompositeType(tag: DW_TAG_class_type, name: "B", line: 5, size: 32, align: 32, file: !28, elements: !19)
38 !19 = !{!20, !21, !27}
39 !20 = !MDDerivedType(tag: DW_TAG_member, name: "b", line: 7, size: 32, align: 32, flags: DIFlagPrivate, file: !28, scope: !18, baseType: !10)
40 !21 = !MDSubprogram(name: "B", line: 5, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 5, file: !6, scope: !18, type: !22, variables: !25)
41 !22 = !MDSubroutineType(types: !23)
42 !23 = !{null, !24}
43 !24 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !18)
44 !25 = !{!26}
45 !26 = !{} ; previously: invalid DW_TAG_base_type
46 !27 = !MDDerivedType(tag: DW_TAG_friend, file: !18, baseType: !7)
47 !28 = !MDFile(filename: "foo.cpp", directory: "/Users/echristo/tmp")
48 !29 = !{i32 1, !"Debug Info Version", i32 3}