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