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; Check for the appropriate MethodKind below. 5 6; C++ source used to generate IR: 7; $ cat t.cpp 8; struct A { 9; static void f(); 10; void g(); 11; static void h(int x, int y); 12; }; 13; A *p = new A; 14; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll 15 16; CHECK: MemberFunction ([[STATIC_VOID:0x.*]]) { 17; CHECK-NEXT: TypeLeafKind: LF_MFUNCTION (0x1009) 18; CHECK-NEXT: ReturnType: void (0x3) 19; CHECK-NEXT: ClassType: A ({{.*}}) 20; CHECK-NEXT: ThisType: 0x0 21; CHECK-NEXT: CallingConvention: NearC (0x0) 22; CHECK-NEXT: FunctionOptions [ (0x0) 23; CHECK-NEXT: ] 24; CHECK-NEXT: NumParameters: 0 25; CHECK-NEXT: ArgListType: () ({{.*}}) 26; CHECK-NEXT: ThisAdjustment: 0 27; CHECK-NEXT: } 28; CHECK: MemberFunction ([[INSTANCE_VOID:0x.*]]) { 29; CHECK-NEXT: TypeLeafKind: LF_MFUNCTION (0x1009) 30; CHECK-NEXT: ReturnType: void (0x3) 31; CHECK-NEXT: ClassType: A ({{.*}}) 32; CHECK-NEXT: ThisType: A* const ({{.*}}) 33; CHECK-NEXT: CallingConvention: ThisCall (0xB) 34; CHECK-NEXT: FunctionOptions [ (0x0) 35; CHECK-NEXT: ] 36; CHECK-NEXT: NumParameters: 0 37; CHECK-NEXT: ArgListType: () ({{.*}}) 38; CHECK-NEXT: ThisAdjustment: 0 39; CHECK-NEXT: } 40; CHECK: MemberFunction ([[STATIC_TWO:0x.*]]) { 41; CHECK-NEXT: TypeLeafKind: LF_MFUNCTION (0x1009) 42; CHECK-NEXT: ReturnType: void (0x3) 43; CHECK-NEXT: ClassType: A ({{.*}}) 44; CHECK-NEXT: ThisType: 0x0 45; CHECK-NEXT: CallingConvention: NearC (0x0) 46; CHECK-NEXT: FunctionOptions [ (0x0) 47; CHECK-NEXT: ] 48; CHECK-NEXT: NumParameters: 2 49; CHECK-NEXT: ArgListType: (int, int) ({{.*}} 50; CHECK-NEXT: ThisAdjustment: 0 51; CHECK-NEXT: } 52; CHECK: OneMethod { 53; CHECK-NEXT: TypeLeafKind: LF_ONEMETHOD (0x1511) 54; CHECK-NEXT: AccessSpecifier: Public (0x3) 55; CHECK-NEXT: MethodKind: Static (0x2) 56; CHECK-NEXT: Type: void A::() ([[STATIC_VOID]]) 57; CHECK-NEXT: Name: f 58; CHECK-NEXT: } 59; CHECK-NEXT: OneMethod { 60; CHECK-NEXT: TypeLeafKind: LF_ONEMETHOD (0x1511) 61; CHECK-NEXT: AccessSpecifier: Public (0x3) 62; CHECK-NEXT: Type: void A::() ([[INSTANCE_VOID]]) 63; CHECK-NEXT: Name: g 64; CHECK-NEXT: } 65; CHECK-NEXT: OneMethod { 66; CHECK-NEXT: TypeLeafKind: LF_ONEMETHOD (0x1511) 67; CHECK-NEXT: AccessSpecifier: Public (0x3) 68; CHECK-NEXT: MethodKind: Static (0x2) 69; CHECK-NEXT: Type: void A::(int, int) ([[STATIC_TWO]]) 70; CHECK-NEXT: Name: h 71; CHECK-NEXT: } 72 73; ModuleID = 't.cpp' 74source_filename = "t.cpp" 75target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 76target triple = "i686-pc-windows-msvc19.0.24215" 77 78%struct.A = type { i8 } 79 80@"\01?p@@3PAUA@@A" = global %struct.A* null, align 4, !dbg !0 81@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_t.cpp, i8* null }] 82 83; Function Attrs: noinline 84define internal void @"\01??__Ep@@YAXXZ"() #0 !dbg !25 { 85entry: 86 %call = call i8* @"\01??2@YAPAXI@Z"(i32 1) #2, !dbg !26 87 %0 = bitcast i8* %call to %struct.A*, !dbg !26 88 store %struct.A* %0, %struct.A** @"\01?p@@3PAUA@@A", align 4, !dbg !26 89 ret void, !dbg !27 90} 91 92; Function Attrs: nobuiltin 93declare noalias i8* @"\01??2@YAPAXI@Z"(i32) #1 94 95; Function Attrs: noinline 96define internal void @_GLOBAL__sub_I_t.cpp() #0 !dbg !28 { 97entry: 98 call void @"\01??__Ep@@YAXXZ"(), !dbg !30 99 ret void 100} 101 102attributes #0 = { noinline "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "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"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } 103attributes #1 = { nobuiltin "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-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" } 104attributes #2 = { builtin } 105 106!llvm.dbg.cu = !{!2} 107!llvm.module.flags = !{!20, !21, !22, !23} 108!llvm.ident = !{!24} 109 110!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 111!1 = distinct !DIGlobalVariable(name: "p", linkageName: "\01?p@@3PAUA@@A", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true) 112!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5) 113!3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Ct", checksumkind: CSK_MD5, checksum: "168f4e5caded7d526f64a37783785c64") 114!4 = !{} 115!5 = !{!0} 116!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32) 117!7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 8, elements: !8, identifier: ".?AUA@@") 118!8 = !{!9, !12, !16} 119!9 = !DISubprogram(name: "f", linkageName: "\01?f@A@@SAXXZ", scope: !7, file: !3, line: 2, type: !10, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped | DIFlagStaticMember, isOptimized: false) 120!10 = !DISubroutineType(types: !11) 121!11 = !{null} 122!12 = !DISubprogram(name: "g", linkageName: "\01?g@A@@QAEXXZ", scope: !7, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false) 123!13 = !DISubroutineType(cc: DW_CC_BORLAND_thiscall, types: !14) 124!14 = !{null, !15} 125!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 32, flags: DIFlagArtificial | DIFlagObjectPointer) 126!16 = !DISubprogram(name: "h", linkageName: "\01?h@A@@SAXHH@Z", scope: !7, file: !3, line: 4, type: !17, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped | DIFlagStaticMember, isOptimized: false) 127!17 = !DISubroutineType(types: !18) 128!18 = !{null, !19, !19} 129!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 130!20 = !{i32 1, !"NumRegisterParameters", i32 0} 131!21 = !{i32 2, !"CodeView", i32 1} 132!22 = !{i32 2, !"Debug Info Version", i32 3} 133!23 = !{i32 1, !"wchar_size", i32 2} 134!24 = !{!"clang version 6.0.0 "} 135!25 = distinct !DISubprogram(name: "??__Ep@@YAXXZ", scope: !3, file: !3, line: 7, type: !10, isLocal: true, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4) 136!26 = !DILocation(line: 7, column: 8, scope: !25) 137!27 = !DILocation(line: 7, column: 12, scope: !25) 138!28 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_t.cpp", scope: !3, file: !3, type: !29, isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !2, retainedNodes: !4) 139!29 = !DISubroutineType(types: !4) 140!30 = !DILocation(line: 0, scope: !28) 141