[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.

llvm-svn: 340088
This commit is contained in:
Zachary Turner 2018-08-17 21:32:07 +00:00
parent 62dd1b1b4f
commit 4746aa7b8f
3 changed files with 26 additions and 7 deletions

View File

@ -945,7 +945,6 @@ static void outputSpecialOperator(OutputStream &OS, const Name *OuterName,
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(OutputStream &OS, NameResolver &Resolver) {
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 << "(";

View File

@ -158,9 +158,6 @@
??_EBase@@UEAAPEAXI@Z
; CHECK: virtual void * __cdecl Base::`vector deleting dtor'(unsigned int)
??_EDerived@@$4PPPPPPPM@A@EAAPEAXI@Z
; CHECK: [thunk]: virtual void * __cdecl Derived::`vector deleting dtor'`vtordisp{-4, 0}'(unsigned int)
??_F?$SomeTemplate@H@@QAEXXZ
; CHECK: void __thiscall SomeTemplate<int>::`default ctor closure'(void)

View File

@ -0,0 +1,15 @@
; RUN: llvm-undname < %s | FileCheck %s
; CHECK-NOT: Invalid mangled name
?f@C@@WBA@EAAHXZ
; CHECK: [thunk]: virtual int __cdecl C::f`adjustor{16}'(void)
??_EDerived@@$4PPPPPPPM@A@EAAPEAXI@Z
; CHECK: [thunk]: virtual void * __cdecl Derived::`vector deleting dtor'`vtordisp{-4, 0}'(unsigned int)
?f@A@simple@@$R477PPPPPPPM@7AEXXZ
; CHECK: [thunk]: virtual void __thiscall simple::A::f`vtordispex{8, 8, -4, 8}'(void)
??_9Base@@$B7AA
; CHECK: [thunk]: __cdecl Base::`vcall'{8, {flat}}