1; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
2; RUN: llvm-dwarfdump -all %t | FileCheck %s
3
4; Checks that we don't emit a size for a pointer type.
5; CHECK: DW_TAG_pointer_type
6; CHECK-NEXT: DW_AT_type
7; CHECK-NOT: DW_AT_byte_size
8; CHECK: DW_TAG
9; CHECK: .debug_info contents
10
11%struct.A = type { i32 }
12
13define i32 @_Z3fooP1A(%struct.A* %a) nounwind uwtable ssp !dbg !5 {
14entry:
15  %a.addr = alloca %struct.A*, align 8
16  store %struct.A* %a, %struct.A** %a.addr, align 8
17  call void @llvm.dbg.declare(metadata %struct.A** %a.addr, metadata !16, metadata !DIExpression()), !dbg !17
18  %0 = load %struct.A*, %struct.A** %a.addr, align 8, !dbg !18
19  %b = getelementptr inbounds %struct.A, %struct.A* %0, i32 0, i32 0, !dbg !18
20  %1 = load i32, i32* %b, align 4, !dbg !18
21  ret i32 %1, !dbg !18
22}
23
24declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
25
26!llvm.dbg.cu = !{!0}
27!llvm.module.flags = !{!21}
28
29!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 (trunk 150996)", isOptimized: false, emissionKind: FullDebug, file: !20, enums: !1, retainedTypes: !1, globals: !1, imports:  !1)
30!1 = !{}
31!5 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooP1A", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !20, scope: !6, type: !7)
32!6 = !DIFile(filename: "foo.cpp", directory: "/Users/echristo")
33!7 = !DISubroutineType(types: !8)
34!8 = !{!9, !10}
35!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
36!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !11)
37!11 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 1, size: 32, align: 32, file: !20, elements: !12)
38!12 = !{!13}
39!13 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 1, size: 32, align: 32, file: !20, scope: !11, baseType: !9)
40!16 = !DILocalVariable(name: "a", line: 3, arg: 1, scope: !5, file: !6, type: !10)
41!17 = !DILocation(line: 3, column: 13, scope: !5)
42!18 = !DILocation(line: 4, column: 3, scope: !19)
43!19 = distinct !DILexicalBlock(line: 3, column: 16, file: !20, scope: !5)
44!20 = !DIFile(filename: "foo.cpp", directory: "/Users/echristo")
45!21 = !{i32 1, !"Debug Info Version", i32 3}
46