1; RUN: llc -mtriple=x86_64-linux < %s -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
2
3; test that we add DW_AT_inline even when we only have concrete out of line
4; instances.
5
6; first check that we have a TAG_subprogram at a given offset and it has
7; AT_inline.
8
9; CHECK: DW_TAG_class_type
10; CHECK:   DW_TAG_subprogram
11; CHECK:   DW_TAG_subprogram
12; CHECK:     DW_AT_linkage_name {{.*}} "_ZN12nsAutoRefCntaSEi"
13
14; CHECK: DW_TAG_class_type
15; CHECK:   DW_TAG_subprogram
16; CHECK:     DW_AT_linkage_name {{.*}} "_ZN17nsAutoRefCnt7ReleaseEv"
17; CHECK:   DW_TAG_subprogram
18; CHECK:     DW_AT_name {{.*}} "~nsAutoRefCnt"
19
20; CHECK: DW_TAG_subprogram
21; CHECK-NEXT:     DW_AT_decl_line {{.*}}18
22; CHECK-NEXT:     DW_AT_{{.*}}linkage_name {{.*}}D2
23; CHECK-NEXT:     DW_AT_specification {{.*}} "~nsAutoRefCnt"
24; CHECK-NEXT:     DW_AT_inline
25; CHECK-NOT:      DW_AT
26; CHECK: DW_TAG
27; CHECK: DW_TAG_subprogram
28; CHECK-NEXT:     DW_AT_decl_line {{.*}}18
29; CHECK-NEXT:     DW_AT_{{.*}}linkage_name {{.*}}D1
30; CHECK-NEXT:     DW_AT_specification {{.*}} "~nsAutoRefCnt"
31; CHECK-NEXT:     DW_AT_inline
32; CHECK-NOT:     DW_AT
33; CHECK: [[D1_THIS_ABS:.*]]: DW_TAG_formal_parameter
34
35; CHECK: DW_TAG_subprogram
36; CHECK:     DW_AT_specification {{.*}} "_ZN17nsAutoRefCnt7ReleaseEv"
37; CHECK: DW_TAG_formal_parameter
38; CHECK-NOT: NULL
39; CHECK-NOT: DW_TAG
40; CHECK: DW_TAG_inlined_subroutine
41; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "_ZN12nsAutoRefCntaSEi"
42; CHECK-NOT: NULL
43; CHECK-NOT: DW_TAG
44; CHECK: DW_TAG_inlined_subroutine
45; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "_ZN17nsAutoRefCntD1Ev"
46; CHECK-NOT: NULL
47; CHECK-NOT: DW_TAG
48; CHECK: DW_TAG_inlined_subroutine
49; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "_ZN17nsAutoRefCntD2Ev"
50
51; and then that a TAG_subprogram refers to it with AT_abstract_origin.
52
53; CHECK: DW_TAG_subprogram
54; CHECK-NOT: DW_TAG
55; CHECK: DW_AT_abstract_origin {{.*}} "_ZN17nsAutoRefCntD1Ev"
56; CHECK: DW_TAG_formal_parameter
57; CHECK-NOT: DW_TAG
58; CHECK: DW_AT_abstract_origin {{.*}} {[[D1_THIS_ABS]]} "this"
59; CHECK: DW_TAG_inlined_subroutine
60; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "_ZN17nsAutoRefCntD2Ev"
61
62
63define i32 @_ZN17nsAutoRefCnt7ReleaseEv() !dbg !5 {
64entry:
65  store i32 1, i32* null, align 4, !dbg !50
66  tail call void @_Z8moz_freePv(i8* null) nounwind, !dbg !54
67  ret i32 0
68}
69
70define void @_ZN17nsAutoRefCntD1Ev() !dbg !23 {
71entry:
72  tail call void @_Z8moz_freePv(i8* null) nounwind, !dbg !57
73  ret void
74}
75
76declare void @_Z8moz_freePv(i8*)
77
78!llvm.dbg.cu = !{!0}
79!llvm.module.flags = !{!60}
80
81!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 ()", isOptimized: true, emissionKind: FullDebug, file: !59, enums: !1, retainedTypes: !1, globals: !47, imports:  !1)
82!1 = !{}
83!5 = distinct !DISubprogram(name: "Release", linkageName: "_ZN17nsAutoRefCnt7ReleaseEv", line: 14, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 14, file: !6, scope: null, type: !7 , declaration: !12, variables: !20)
84!6 = !DIFile(filename: "nsAutoRefCnt.ii", directory: "/Users/espindola/mozilla-central/obj-x86_64-apple-darwin11.2.0/netwerk/base/src")
85!7 = !DISubroutineType(types: !8)
86!8 = !{!9, !10}
87!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
88!10 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !11)
89!11 = !DICompositeType(tag: DW_TAG_structure_type, name: "nsAutoRefCnt", line: 10, flags: DIFlagFwdDecl, file: !59)
90!12 = !DISubprogram(name: "Release", linkageName: "_ZN17nsAutoRefCnt7ReleaseEv", line: 11, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 11, file: !6, scope: !13, type: !7, variables: !18)
91!13 = !DICompositeType(tag: DW_TAG_class_type, name: "nsAutoRefCnt", line: 10, size: 8, align: 8, file: !59, elements: !14)
92!14 = !{!12, !15}
93!15 = !DISubprogram(name: "~nsAutoRefCnt", line: 12, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 12, file: !6, scope: !13, type: !16, variables: !18)
94!16 = !DISubroutineType(types: !17)
95!17 = !{null, !10}
96!18 = !{}
97!20 = !{!22}
98!22 = !DILocalVariable(name: "this", line: 14, arg: 1, flags: DIFlagArtificial, scope: !5, file: !6, type: !10)
99!23 = distinct !DISubprogram(name: "~nsAutoRefCnt", linkageName: "_ZN17nsAutoRefCntD1Ev", line: 18, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 18, file: !6, scope: null, type: !16, declaration: !15, variables: !24)
100!24 = !{!26}
101!26 = !DILocalVariable(name: "this", line: 18, arg: 1, flags: DIFlagArtificial, scope: !23, file: !6, type: !10)
102!27 = distinct !DISubprogram(name: "~nsAutoRefCnt", linkageName: "_ZN17nsAutoRefCntD2Ev", line: 18, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 18, file: !6, scope: null, type: !16, declaration: !15, variables: !28)
103!28 = !{!30}
104!30 = !DILocalVariable(name: "this", line: 18, arg: 1, flags: DIFlagArtificial, scope: !27, file: !6, type: !10)
105!31 = distinct !DISubprogram(name: "operator=", linkageName: "_ZN12nsAutoRefCntaSEi", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 4, file: !6, scope: null, type: !32, declaration: !36, variables: !43)
106!32 = !DISubroutineType(types: !33)
107!33 = !{!9, !34, !9}
108!34 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !35)
109!35 = !DICompositeType(tag: DW_TAG_structure_type, name: "nsAutoRefCnt", line: 2, flags: DIFlagFwdDecl, file: !59)
110!36 = !DISubprogram(name: "operator=", linkageName: "_ZN12nsAutoRefCntaSEi", line: 4, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 4, file: !6, scope: !37, type: !32, variables: !18)
111!37 = !DICompositeType(tag: DW_TAG_class_type, name: "nsAutoRefCnt", line: 2, size: 32, align: 32, file: !59, elements: !38)
112!38 = !{!39, !40, !36}
113!39 = !DIDerivedType(tag: DW_TAG_member, name: "mValue", line: 7, size: 32, align: 32, file: !59, scope: !37, baseType: !9)
114!40 = !DISubprogram(name: "nsAutoRefCnt", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 3, file: !6, scope: !37, type: !41, variables: !18)
115!41 = !DISubroutineType(types: !42)
116!42 = !{null, !34}
117!43 = !{!45, !46}
118!45 = !DILocalVariable(name: "this", line: 4, arg: 1, flags: DIFlagArtificial, scope: !31, file: !6, type: !34)
119!46 = !DILocalVariable(name: "aValue", line: 4, arg: 2, scope: !31, file: !6, type: !9)
120!47 = !{!49}
121!49 = !DIGlobalVariable(name: "mRefCnt", line: 9, isLocal: false, isDefinition: true, scope: null, file: !6, type: !37, variable: i32* null)
122!50 = !DILocation(line: 5, column: 5, scope: !51, inlinedAt: !52)
123!51 = distinct !DILexicalBlock(line: 4, column: 29, file: !6, scope: !31)
124!52 = !DILocation(line: 15, scope: !53)
125!53 = distinct !DILexicalBlock(line: 14, column: 34, file: !6, scope: !5)
126!54 = !DILocation(line: 19, column: 3, scope: !55, inlinedAt: !56)
127!55 = distinct !DILexicalBlock(line: 18, column: 41, file: !6, scope: !27)
128!56 = !DILocation(line: 18, column: 41, scope: !23, inlinedAt: !52)
129!57 = !DILocation(line: 19, column: 3, scope: !55, inlinedAt: !58)
130!58 = !DILocation(line: 18, column: 41, scope: !23)
131!59 = !DIFile(filename: "nsAutoRefCnt.ii", directory: "/Users/espindola/mozilla-central/obj-x86_64-apple-darwin11.2.0/netwerk/base/src")
132!60 = !{i32 1, !"Debug Info Version", i32 3}
133