1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s 2; RUN: llc < %s | llvm-mc -filetype=obj --triple=i686-windows | llvm-readobj - --codeview | FileCheck %s 3 4; C++ source to regenerate: 5; $ cat t.cpp 6; void usevars(int, ...); 7; void f() { 8; int a[5] = {9, 4, 5, 4, 2}; 9; usevars(a[0], a); 10; } 11; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll 12 13; CHECK: CodeViewTypes [ 14; CHECK: Section: .debug$T (6) 15; CHECK: Magic: 0x4 16; CHECK: ArgList (0x1000) { 17; CHECK: TypeLeafKind: LF_ARGLIST (0x1201) 18; CHECK: NumArgs: 0 19; CHECK: Arguments [ 20; CHECK: ] 21; CHECK: } 22; CHECK: Procedure (0x1001) { 23; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008) 24; CHECK: ReturnType: void (0x3) 25; CHECK: CallingConvention: NearC (0x0) 26; CHECK: FunctionOptions [ (0x0) 27; CHECK: ] 28; CHECK: NumParameters: 0 29; CHECK: ArgListType: () (0x1000) 30; CHECK: } 31; CHECK: FuncId (0x1002) { 32; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601) 33; CHECK: ParentScope: 0x0 34; CHECK: FunctionType: void () (0x1001) 35; CHECK: Name: f 36; CHECK: } 37; CHECK: Array (0x1003) { 38; CHECK: TypeLeafKind: LF_ARRAY (0x1503) 39; CHECK: ElementType: int (0x74) 40; CHECK: IndexType: unsigned long (0x22) 41; CHECK: SizeOf: 20 42; CHECK: Name: 43; CHECK: } 44; CHECK: ] 45; CHECK: CodeViewDebugInfo [ 46; CHECK: Section: .debug$S (5) 47; CHECK: Magic: 0x4 48; CHECK: Subsection [ 49; CHECK: SubSectionType: Symbols (0xF1) 50; CHECK: {{.*}}Proc{{.*}}Sym { 51; CHECK: PtrParent: 0x0 52; CHECK: PtrEnd: 0x0 53; CHECK: PtrNext: 0x0 54; CHECK: CodeSize: 0x39 55; CHECK: DbgStart: 0x0 56; CHECK: DbgEnd: 0x0 57; CHECK: FunctionType: f (0x1002) 58; CHECK: CodeOffset: ?f@@YAXXZ+0x0 59; CHECK: Segment: 0x0 60; CHECK: Flags [ (0x0) 61; CHECK: ] 62; CHECK: DisplayName: f 63; CHECK: LinkageName: ?f@@YAXXZ 64; CHECK: } 65; CHECK: LocalSym { 66; CHECK: Type: 0x1003 67; CHECK: Flags [ (0x0) 68; CHECK: ] 69; CHECK: VarName: a 70; CHECK: } 71; CHECK: DefRangeFramePointerRelSym { 72; CHECK: Offset: -20 73; CHECK: LocalVariableAddrRange { 74; CHECK: OffsetStart: .text+0x6 75; CHECK: ISectStart: 0x0 76; CHECK: Range: 0x33 77; CHECK: } 78; CHECK: } 79; CHECK: ProcEnd { 80; CHECK: } 81; CHECK: ] 82 83; ModuleID = 't.cpp' 84source_filename = "t.cpp" 85target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 86target triple = "i686-pc-windows-msvc19.0.23918" 87 88@"\01?a@?1??f@@YAXXZ@3PAHA" = private unnamed_addr constant [5 x i32] [i32 9, i32 4, i32 5, i32 4, i32 2], align 4 89 90define void @"\01?f@@YAXXZ"() #0 !dbg !6 { 91entry: 92 %a = alloca [5 x i32], align 4 93 call void @llvm.dbg.declare(metadata [5 x i32]* %a, metadata !9, metadata !14), !dbg !15 94 %0 = bitcast [5 x i32]* %a to i8*, !dbg !15 95 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 bitcast ([5 x i32]* @"\01?a@?1??f@@YAXXZ@3PAHA" to i8*), i32 20, i1 false), !dbg !15 96 %arraydecay = getelementptr inbounds [5 x i32], [5 x i32]* %a, i32 0, i32 0, !dbg !16 97 %arrayidx = getelementptr inbounds [5 x i32], [5 x i32]* %a, i32 0, i32 0, !dbg !17 98 %1 = load i32, i32* %arrayidx, align 4, !dbg !17 99 call void (i32, ...) @"\01?usevars@@YAXHZZ"(i32 %1, i32* %arraydecay), !dbg !18 100 ret void, !dbg !19 101} 102 103; Function Attrs: nounwind readnone 104declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 105 106; Function Attrs: argmemonly nounwind 107declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #2 108 109declare void @"\01?usevars@@YAXHZZ"(i32, ...) #3 110 111attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 112attributes #1 = { nounwind readnone } 113attributes #2 = { argmemonly nounwind } 114attributes #3 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 115 116!llvm.dbg.cu = !{!0} 117!llvm.module.flags = !{!3, !4} 118!llvm.ident = !{!5} 119 120!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 121!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cllvm\5Ctest\5CDebugInfo\5CCOFF") 122!2 = !{} 123!3 = !{i32 2, !"CodeView", i32 1} 124!4 = !{i32 2, !"Debug Info Version", i32 3} 125!5 = !{!"clang version 3.9.0 "} 126!6 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAXXZ", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 127!7 = !DISubroutineType(types: !8) 128!8 = !{null} 129!9 = !DILocalVariable(name: "a", scope: !6, file: !1, line: 3, type: !10) 130!10 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, size: 160, align: 32, elements: !12) 131!11 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 132!12 = !{!13} 133!13 = !DISubrange(count: 5) 134!14 = !DIExpression() 135!15 = !DILocation(line: 3, column: 7, scope: !6) 136!16 = !DILocation(line: 4, column: 17, scope: !6) 137!17 = !DILocation(line: 4, column: 11, scope: !6) 138!18 = !DILocation(line: 4, column: 3, scope: !6) 139!19 = !DILocation(line: 5, column: 1, scope: !6) 140