[llvm] r340088 - [MS Demangler] Properly print all thunk types.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 17 14:32:07 PDT 2018


Author: zturner
Date: Fri Aug 17 14:32:07 2018
New Revision: 340088

URL: http://llvm.org/viewvc/llvm-project?rev=340088&view=rev
Log:
[MS Demangler] Properly print all thunk types.

We were only printing the vtordisp thunk before as the previous
patch was more aimed at getting special operators working, one
of which was a thunk.  This patch gets all thunk types to print
properly, and adds a test for each one.

Added:
    llvm/trunk/test/Demangle/ms-thunks.test
Modified:
    llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
    llvm/trunk/test/Demangle/ms-operators.test

Modified: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp?rev=340088&r1=340087&r2=340088&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Fri Aug 17 14:32:07 2018
@@ -945,7 +945,6 @@ static void outputSpecialOperator(Output
     break;
   }
   case OperatorTy::Vcall: {
-    // [thunk]: __cdecl Base::`vcall'{8, {flat}}' }'
     const VirtualMemberPtrThunk &Thunk =
         static_cast<const VirtualMemberPtrThunk &>(Oper);
     OS << "[thunk]: ";
@@ -1194,9 +1193,17 @@ void FunctionType::outputPost(OutputStre
   if (FunctionClass & NoPrototype)
     return;
 
-  if (FunctionClass & VirtualThisAdjust) {
-    OS << "`vtordisp{" << ThisAdjust->VtordispOffset << ", "
-       << ThisAdjust->StaticOffset << "}'";
+  if (FunctionClass & StaticThisAdjust) {
+    OS << "`adjustor{" << ThisAdjust->StaticOffset << "}'";
+  } else if (FunctionClass & VirtualThisAdjust) {
+    if (FunctionClass & VirtualThisAdjustEx) {
+      OS << "`vtordispex{" << ThisAdjust->VBPtrOffset << ", "
+         << ThisAdjust->VBOffsetOffset << ", " << ThisAdjust->VtordispOffset
+         << ", " << ThisAdjust->StaticOffset << "}'";
+    } else {
+      OS << "`vtordisp{" << ThisAdjust->VtordispOffset << ", "
+         << ThisAdjust->StaticOffset << "}'";
+    }
   }
 
   OS << "(";

Modified: llvm/trunk/test/Demangle/ms-operators.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-operators.test?rev=340088&r1=340087&r2=340088&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-operators.test (original)
+++ llvm/trunk/test/Demangle/ms-operators.test Fri Aug 17 14:32:07 2018
@@ -158,9 +158,6 @@
 ??_EBase@@UEAAPEAXI at Z
 ; CHECK: virtual void * __cdecl Base::`vector deleting dtor'(unsigned int)
 
-??_EDerived@@$4PPPPPPPM at A@EAAPEAXI at Z
-; CHECK: [thunk]: virtual void * __cdecl Derived::`vector deleting dtor'`vtordisp{-4, 0}'(unsigned int)
-
 ??_F?$SomeTemplate at H@@QAEXXZ
 ; CHECK: void __thiscall SomeTemplate<int>::`default ctor closure'(void)
 

Added: llvm/trunk/test/Demangle/ms-thunks.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-thunks.test?rev=340088&view=auto
==============================================================================
--- llvm/trunk/test/Demangle/ms-thunks.test (added)
+++ llvm/trunk/test/Demangle/ms-thunks.test Fri Aug 17 14:32:07 2018
@@ -0,0 +1,15 @@
+; RUN: llvm-undname < %s | FileCheck %s
+
+; CHECK-NOT: Invalid mangled name
+
+?f at C@@WBA at EAAHXZ
+; CHECK: [thunk]: virtual int __cdecl C::f`adjustor{16}'(void)
+
+??_EDerived@@$4PPPPPPPM at A@EAAPEAXI at Z
+; CHECK: [thunk]: virtual void * __cdecl Derived::`vector deleting dtor'`vtordisp{-4, 0}'(unsigned int)
+
+?f at A@simple@@$R477PPPPPPPM at 7AEXXZ
+; CHECK: [thunk]: virtual void __thiscall simple::A::f`vtordispex{8, 8, -4, 8}'(void)
+
+??_9Base@@$B7AA
+; CHECK: [thunk]: __cdecl Base::`vcall'{8, {flat}}




More information about the llvm-commits mailing list