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; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s 5; RUN: llc --try-experimental-debuginfo-iterators < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s 6 7; C++ source to regenerate: 8; $ cat t.cpp 9; typedef void (*FuncTypedef)(int, float, ...); 10; FuncTypedef funcVar; 11; namespace MemberTest { 12; class A { 13; public: 14; int MemberFunc(...) { return 1; } 15; }; 16; } 17; int f () { 18; MemberTest::A v1; 19; v1.MemberFunc(1,20,0); 20; return 1; 21; } 22; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll 23 24; CHECK: MemberFuncId (0x100B) { 25; CHECK: TypeLeafKind: LF_MFUNC_ID (0x1602) 26; CHECK: ClassType: MemberTest::A (0x1003) 27; CHECK: FunctionType: int MemberTest::A::(<no type>) (0x1006) 28; CHECK: Name: MemberFunc 29; CHECK: } 30; CHECK: Subsection [ 31; CHECK: SubSectionType: Symbols (0xF1) 32; CHECK: SubSectionSize: 33; CHECK: UDTSym { 34; CHECK: Kind: S_UDT (0x1108) 35; CHECK: Type: MemberTest::A (0x1008) 36; CHECK: UDTName: MemberTest::A 37; CHECK: } 38; CHECK: UDTSym { 39; CHECK: Kind: S_UDT (0x1108) 40; CHECK: Type: void (int, float, <no type>)* (0x100F) 41; CHECK: UDTName: FuncTypedef 42; CHECK: } 43; CHECK: ] 44 45; ModuleID = 't.cpp' 46source_filename = "t.cpp" 47target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" 48target triple = "x86_64-pc-windows-msvc19.11.25507" 49 50%"class.MemberTest::A" = type { i8 } 51 52$"\01?MemberFunc@A@MemberTest@@QEAAHZZ" = comdat any 53 54@"\01?funcVar@@3P6AXHMZZEA" = global ptr null, align 8, !dbg !0 55 56; Function Attrs: noinline optnone uwtable 57define i32 @"\01?f@@YAHXZ"() #0 !dbg !17 { 58entry: 59 %v1 = alloca %"class.MemberTest::A", align 1 60 call void @llvm.dbg.declare(metadata ptr %v1, metadata !20, metadata !DIExpression()), !dbg !28 61 %call = call i32 (ptr, ...) @"\01?MemberFunc@A@MemberTest@@QEAAHZZ"(ptr %v1, i32 1, i32 20, i64 0), !dbg !29 62 ret i32 1, !dbg !30 63} 64 65; Function Attrs: nounwind readnone speculatable 66declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 67 68; Function Attrs: noinline nounwind optnone uwtable 69define linkonce_odr i32 @"\01?MemberFunc@A@MemberTest@@QEAAHZZ"(ptr %this, ...) #2 comdat align 2 !dbg !31 { 70entry: 71 %this.addr = alloca ptr, align 8 72 store ptr %this, ptr %this.addr, align 8 73 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !32, metadata !DIExpression()), !dbg !34 74 %this1 = load ptr, ptr %this.addr, align 8 75 ret i32 1, !dbg !35 76} 77 78attributes #0 = { noinline optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 79attributes #1 = { nounwind readnone speculatable } 80attributes #2 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 81 82!llvm.dbg.cu = !{!2} 83!llvm.module.flags = !{!12, !13, !14, !15} 84!llvm.ident = !{!16} 85 86!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 87!1 = distinct !DIGlobalVariable(name: "funcVar", linkageName: "\01?funcVar@@3P6AXHMZZEA", scope: !2, file: !3, line: 4, type: !6, isLocal: false, isDefinition: true) 88!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 89!3 = !DIFile(filename: "t.cpp", directory: "D:\5Cupstream\5Cllvm\5Ctest\5CDebugInfo\5CCOFF", checksumkind: CSK_MD5, checksum: "d6582aff49f975763b736524db75f999") 90!4 = !{} 91!5 = !{!0} 92!6 = !DIDerivedType(tag: DW_TAG_typedef, name: "FuncTypedef", file: !3, line: 3, baseType: !7) 93!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64) 94!8 = !DISubroutineType(types: !9) 95!9 = !{null, !10, !11, null} 96!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 97!11 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float) 98!12 = !{i32 2, !"CodeView", i32 1} 99!13 = !{i32 2, !"Debug Info Version", i32 3} 100!14 = !{i32 1, !"wchar_size", i32 2} 101!15 = !{i32 7, !"PIC Level", i32 2} 102!16 = !{!"clang version 7.0.0 "} 103!17 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAHXZ", scope: !3, file: !3, line: 11, type: !18, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4) 104!18 = !DISubroutineType(types: !19) 105!19 = !{!10} 106!20 = !DILocalVariable(name: "v1", scope: !17, file: !3, line: 12, type: !21) 107!21 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "A", scope: !22, file: !3, line: 6, size: 8, elements: !23, identifier: ".?AVA@MemberTest@@") 108!22 = !DINamespace(name: "MemberTest", scope: null) 109!23 = !{!24} 110!24 = !DISubprogram(name: "MemberFunc", linkageName: "\01?MemberFunc@A@MemberTest@@QEAAHZZ", scope: !21, file: !3, line: 8, type: !25, isLocal: false, isDefinition: false, scopeLine: 8, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false) 111!25 = !DISubroutineType(types: !26) 112!26 = !{!10, !27, null} 113!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) 114!28 = !DILocation(line: 12, column: 18, scope: !17) 115!29 = !DILocation(line: 13, column: 7, scope: !17) 116!30 = !DILocation(line: 14, column: 4, scope: !17) 117!31 = distinct !DISubprogram(name: "MemberFunc", linkageName: "\01?MemberFunc@A@MemberTest@@QEAAHZZ", scope: !21, file: !3, line: 8, type: !25, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !2, declaration: !24, retainedNodes: !4) 118!32 = !DILocalVariable(name: "this", arg: 1, scope: !31, type: !33, flags: DIFlagArtificial | DIFlagObjectPointer) 119!33 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 64) 120!34 = !DILocation(line: 0, scope: !31) 121!35 = !DILocation(line: 8, column: 28, scope: !31) 122