[llvm] r313329 - [codeview] Use a type index of zero for static method "this" types

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 14 17:59:07 PDT 2017


Author: rnk
Date: Thu Sep 14 17:59:07 2017
New Revision: 313329

URL: http://llvm.org/viewvc/llvm-project?rev=313329&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    llvm/trunk/test/DebugInfo/COFF/static-methods.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=313329&r1=313328&r2=313329&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Thu Sep 14 17:59:07 2017
@@ -1561,7 +1561,7 @@ TypeIndex CodeViewDebug::lowerTypeMember
     ReturnTypeIndex = ReturnAndArgTypesRef.front();
     ArgTypeIndices = ReturnAndArgTypesRef.drop_front();
   }
-  TypeIndex ThisTypeIndex = TypeIndex::Void();
+  TypeIndex ThisTypeIndex;
   if (!IsStaticMethod && !ArgTypeIndices.empty()) {
     ThisTypeIndex = ArgTypeIndices.front();
     ArgTypeIndices = ArgTypeIndices.drop_front();

Modified: llvm/trunk/test/DebugInfo/COFF/static-methods.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/static-methods.ll?rev=313329&r1=313328&r2=313329&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/static-methods.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/static-methods.ll Thu Sep 14 17:59:07 2017
@@ -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: }
 




More information about the llvm-commits mailing list