1; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
2; RUN: verify-uselistorder %s
3
4; CHECK: define void @_Z3foov() !dbg !9
5define void @_Z3foov() !dbg !9 {
6  ret void
7}
8
9; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !16, !17, !18, !19}
10!named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12, !13, !14, !15, !17, !19, !20, !21}
11
12!0 = !{null}
13!1 = distinct !DICompositeType(tag: DW_TAG_structure_type)
14!2 = !DIFile(filename: "path/to/file", directory: "/path/to/dir")
15!3 = !DISubroutineType(types: !0)
16!4 = distinct !DICompositeType(tag: DW_TAG_structure_type)
17!5 = distinct !{}
18!6 = distinct !{}
19
20; CHECK: !7 = distinct !DISubprogram(scope: null, spFlags: DISPFlagDefinition, unit: !8)
21!7 = distinct !DISubprogram(unit: !8)
22
23!8 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang",
24                             file: !2,
25                             isOptimized: true, flags: "-O2",
26                             splitDebugFilename: "abc.debug", emissionKind: 2)
27
28; CHECK: !9 = !DISubprogram(scope: null, spFlags: 0)
29!9 = !DISubprogram(isDefinition: false)
30
31; CHECK: !10 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1, file: !2, line: 7, type: !3, scopeLine: 8, containingType: !4, virtualIndex: 10, thisAdjustment: 3, flags: DIFlagPrototyped | DIFlagNoReturn, spFlags: DISPFlagPureVirtual | DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !8, templateParams: !5, declaration: !9, retainedNodes: !6)
32!10 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
33                            file: !2, line: 7, type: !3, isLocal: true,
34                            isDefinition: true, scopeLine: 8,
35                            containingType: !4,
36                            virtuality: DW_VIRTUALITY_pure_virtual,
37                            virtualIndex: 10, thisAdjustment: 3, flags: DIFlagPrototyped | DIFlagNoReturn,
38                            isOptimized: true, unit: !8, templateParams: !5,
39                            declaration: !9, retainedNodes: !6)
40
41; CHECK: !11 = distinct !DISubprogram
42; CHECK-SAME: virtualIndex: 0,
43!11 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
44                            file: !2, line: 7, type: !3, isLocal: true,
45                            isDefinition: true, scopeLine: 8,
46                            containingType: !4,
47                            virtuality: DW_VIRTUALITY_pure_virtual,
48                            virtualIndex: 0,
49                            flags: DIFlagPrototyped, isOptimized: true,
50                            unit: !8, templateParams: !5, declaration: !9,
51                            retainedNodes: !6)
52
53; CHECK: !12 = distinct !DISubprogram
54; CHECK-NOT: virtualIndex
55!12 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
56                            file: !2, line: 7, type: !3, isLocal: true,
57                            isDefinition: true, scopeLine: 8,
58                            containingType: !4,
59                            virtuality: DW_VIRTUALITY_none,
60                            flags: DIFlagPrototyped, isOptimized: true,
61                            unit: !8,
62                            templateParams: !5, declaration: !9, retainedNodes: !6)
63
64!13 = !{!4}
65; CHECK: !13 = !{!4}
66; CHECK: !14 = distinct !DISubprogram(name: "foo", scope: !1, file: !2, line: 1, type: !3, scopeLine: 2, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !8, thrownTypes: !13)
67!14 = distinct !DISubprogram(name: "foo", scope: !1,
68                            file: !2, line: 1, type: !3, isLocal: true,
69                            isDefinition: true, scopeLine: 2, isOptimized: false,
70                            unit: !8, thrownTypes: !13)
71
72; CHECK: !15 = distinct !DISubprogram({{.*}}, flags: DIFlagPrototyped, spFlags: DISPFlagPureVirtual | DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized,
73!15 = distinct !DISubprogram(name: "foo", linkageName: "_Zfoov", scope: !1,
74                             file: !2, line: 7, type: !3, scopeLine: 8,
75							 containingType: !4, virtualIndex: 0,
76							 flags: DIFlagPrototyped,
77							 spFlags: DISPFlagPureVirtual | DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized,
78							 unit: !8, templateParams: !5, declaration: !9,
79							 retainedNodes: !6)
80
81!16 = !{i32 1, !"Debug Info Version", i32 3}
82!llvm.module.flags = !{!16}
83!llvm.dbg.cu = !{!8}
84
85; CHECK: !DISubprogram({{.*}}subroutine1{{.*}}, spFlags: DISPFlagDefinition | DISPFlagPure,
86; CHECK: !DISubprogram({{.*}}subroutine2{{.*}}, spFlags: DISPFlagDefinition | DISPFlagElemental,
87; CHECK: !DISubprogram({{.*}}subroutine3{{.*}}, spFlags: DISPFlagDefinition | DISPFlagRecursive,
88; CHECK: !DISubprogram({{.*}}subroutine4{{.*}}, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive,
89
90!17 = distinct !DISubprogram(name: "subroutine1", scope: !1, file: !2, line: 1, type: !18, scopeLine: 2, spFlags: DISPFlagDefinition | DISPFlagPure, unit: !8, retainedNodes: !6)
91!18 = !DISubroutineType(types: !0)
92!19 = distinct !DISubprogram(name: "subroutine2", scope: !1, file: !2, line: 5, type: !18, scopeLine: 6, spFlags: DISPFlagDefinition | DISPFlagElemental, unit: !8, retainedNodes: !6)
93!20 = distinct !DISubprogram(name: "subroutine3", scope: !1, file: !2, line: 9, type: !18, scopeLine: 10, spFlags: DISPFlagDefinition | DISPFlagRecursive, unit: !8, retainedNodes: !6)
94!21 = distinct !DISubprogram(name: "subroutine4", scope: !1, file: !2, line: 13, type: !18, scopeLine: 14, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !8, retainedNodes: !6)
95