From: Reid Kleckner Date: Fri, 15 Sep 2017 00:59:07 +0000 (+0000) Subject: [codeview] Use a type index of zero for static method "this" types X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89921cc8f5567987ba714b243ce51f056d621ab5;p=llvm [codeview] Use a type index of zero for static method "this" types Otherwise VS won't show anything in the autos or watch window of static methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313329 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 7e778c542c0..87aeb1f03dd 100644 --- a/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1561,7 +1561,7 @@ TypeIndex CodeViewDebug::lowerTypeMemberFunction(const DISubroutineType *Ty, ReturnTypeIndex = ReturnAndArgTypesRef.front(); ArgTypeIndices = ReturnAndArgTypesRef.drop_front(); } - TypeIndex ThisTypeIndex = TypeIndex::Void(); + TypeIndex ThisTypeIndex; if (!IsStaticMethod && !ArgTypeIndices.empty()) { ThisTypeIndex = ArgTypeIndices.front(); ArgTypeIndices = ArgTypeIndices.drop_front(); diff --git a/test/DebugInfo/COFF/static-methods.ll b/test/DebugInfo/COFF/static-methods.ll index e5e26fe05ca..77ff031b221 100644 --- a/test/DebugInfo/COFF/static-methods.ll +++ b/test/DebugInfo/COFF/static-methods.ll @@ -12,24 +12,60 @@ ; A *p = new A; ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll +; CHECK: MemberFunction ([[STATIC_VOID:0x.*]]) { +; CHECK-NEXT: TypeLeafKind: LF_MFUNCTION (0x1009) +; CHECK-NEXT: ReturnType: void (0x3) +; CHECK-NEXT: ClassType: A ({{.*}}) +; CHECK-NEXT: ThisType: 0x0 +; CHECK-NEXT: CallingConvention: NearC (0x0) +; CHECK-NEXT: FunctionOptions [ (0x0) +; CHECK-NEXT: ] +; CHECK-NEXT: NumParameters: 0 +; CHECK-NEXT: ArgListType: () ({{.*}}) +; CHECK-NEXT: ThisAdjustment: 0 +; CHECK-NEXT: } +; CHECK: MemberFunction ([[INSTANCE_VOID:0x.*]]) { +; CHECK-NEXT: TypeLeafKind: LF_MFUNCTION (0x1009) +; CHECK-NEXT: ReturnType: void (0x3) +; CHECK-NEXT: ClassType: A ({{.*}}) +; CHECK-NEXT: ThisType: A* ({{.*}}) +; CHECK-NEXT: CallingConvention: ThisCall (0xB) +; CHECK-NEXT: FunctionOptions [ (0x0) +; CHECK-NEXT: ] +; CHECK-NEXT: NumParameters: 0 +; CHECK-NEXT: ArgListType: () ({{.*}}) +; CHECK-NEXT: ThisAdjustment: 0 +; CHECK-NEXT: } +; CHECK: MemberFunction ([[STATIC_TWO:0x.*]]) { +; CHECK-NEXT: TypeLeafKind: LF_MFUNCTION (0x1009) +; CHECK-NEXT: ReturnType: void (0x3) +; CHECK-NEXT: ClassType: A ({{.*}}) +; CHECK-NEXT: ThisType: 0x0 +; CHECK-NEXT: CallingConvention: NearC (0x0) +; CHECK-NEXT: FunctionOptions [ (0x0) +; CHECK-NEXT: ] +; CHECK-NEXT: NumParameters: 2 +; CHECK-NEXT: ArgListType: (int, int) ({{.*}} +; CHECK-NEXT: ThisAdjustment: 0 +; CHECK-NEXT: } ; CHECK: OneMethod { ; CHECK-NEXT: TypeLeafKind: LF_ONEMETHOD (0x1511) ; CHECK-NEXT: AccessSpecifier: Public (0x3) ; CHECK-NEXT: MethodKind: Static (0x2) -; CHECK-NEXT: Type: void A::() ({{.*}}) +; CHECK-NEXT: Type: void A::() ([[STATIC_VOID]]) ; CHECK-NEXT: Name: f ; CHECK-NEXT: } ; CHECK-NEXT: OneMethod { ; CHECK-NEXT: TypeLeafKind: LF_ONEMETHOD (0x1511) ; CHECK-NEXT: AccessSpecifier: Public (0x3) -; CHECK-NEXT: Type: void A::() ({{.*}}) +; CHECK-NEXT: Type: void A::() ([[INSTANCE_VOID]]) ; CHECK-NEXT: Name: g ; CHECK-NEXT: } ; CHECK-NEXT: OneMethod { ; CHECK-NEXT: TypeLeafKind: LF_ONEMETHOD (0x1511) ; CHECK-NEXT: AccessSpecifier: Public (0x3) ; CHECK-NEXT: MethodKind: Static (0x2) -; CHECK-NEXT: Type: void A::(int, int) ({{.*}}) +; CHECK-NEXT: Type: void A::(int, int) ([[STATIC_TWO]]) ; CHECK-NEXT: Name: h ; CHECK-NEXT: }