1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
2; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
3
4; ModuleID = 'foo.3a1fbbbh-cgu.0'
5source_filename = "foo.3a1fbbbh-cgu.0"
6target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
7target triple = "x86_64-pc-windows-msvc"
8
9; Rust source to regenerate:
10; $ cat foo.rs
11; pub struct Foo;
12; impl Foo {
13;     pub fn foo() {}
14; }
15; $ rustc foo.rs --crate-type lib -Cdebuginfo=1 --emit=llvm-ir
16
17; CHECK:      CodeViewTypes [
18; CHECK:        MemberFunction (0x1006) {
19; CHECK-NEXT:     TypeLeafKind: LF_MFUNCTION (0x1009)
20; CHECK-NEXT:     ReturnType: void (0x3)
21; CHECK-NEXT:     ClassType: foo::Foo (0x1000)
22; CHECK-NEXT:     ThisType: 0x0
23; CHECK-NEXT:     CallingConvention: NearC (0x0)
24; CHECK-NEXT:     FunctionOptions [ (0x0)
25; CHECK-NEXT:     ]
26; CHECK-NEXT:     NumParameters: 0
27; CHECK-NEXT:     ArgListType: () (0x1005)
28; CHECK-NEXT:     ThisAdjustment: 0
29; CHECK-NEXT:   }
30; CHECK-NEXT:   MemberFuncId (0x1007) {
31; CHECK-NEXT:     TypeLeafKind: LF_MFUNC_ID (0x1602)
32; CHECK-NEXT:     ClassType: foo::Foo (0x1000)
33; CHECK-NEXT:     FunctionType: void foo::Foo::() (0x1006)
34; CHECK-NEXT:     Name: foo
35; CHECK-NEXT:   }
36; CHECK:      CodeViewDebugInfo [
37; CHECK:        FunctionLineTable [
38; CHECK-NEXT:     LinkageName: _ZN3foo3Foo3foo17hc557c2121772885bE
39; CHECK-NEXT:     Flags: 0x0
40; CHECK-NEXT:     CodeSize: 0x1
41; CHECK-NEXT:     FilenameSegment [
42; CHECK-NEXT:       Filename: D:\rust\foo.rs (0x0)
43; CHECK-NEXT:       +0x0 [
44; CHECK-NEXT:         LineNumberStart: 3
45; CHECK-NEXT:         LineNumberEndDelta: 0
46; CHECK-NEXT:         IsStatement: No
47; CHECK-NEXT:       ]
48; CHECK-NEXT:     ]
49; CHECK-NEXT:   ]
50
51; foo::Foo::foo
52; Function Attrs: uwtable
53define void @_ZN3foo3Foo3foo17hc557c2121772885bE() unnamed_addr #0 !dbg !5 {
54start:
55  ret void, !dbg !10
56}
57
58attributes #0 = { uwtable "target-cpu"="x86-64" }
59
60!llvm.dbg.cu = !{!0}
61!llvm.module.flags = !{!3, !4}
62
63!0 = distinct !DICompileUnit(language: DW_LANG_Rust, file: !1, producer: "clang LLVM (rustc version 1.33.0-nightly (8b0f0156e 2019-01-22))", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)
64!1 = !DIFile(filename: "foo.rs", directory: "D:\5Crust")
65!2 = !{}
66!3 = !{i32 2, !"CodeView", i32 1}
67!4 = !{i32 2, !"Debug Info Version", i32 3}
68!5 = distinct !DISubprogram(name: "foo", linkageName: "_ZN3foo3Foo3foo17hc557c2121772885bE", scope: !6, file: !1, line: 3, type: !9, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, templateParams: !2, retainedNodes: !2)
69!6 = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", scope: !8, file: !7, align: 8, elements: !2, templateParams: !2, identifier: "5105d9fe1a2a3c68518268151b672274")
70!7 = !DIFile(filename: "<unknown>", directory: "")
71!8 = !DINamespace(name: "foo", scope: null)
72!9 = !DISubroutineType(types: !2)
73!10 = !DILocation(line: 3, scope: !5)
74