From: Zachary Turner Date: Fri, 17 Aug 2018 21:32:07 +0000 (+0000) Subject: [MS Demangler] Properly print all thunk types. X-Git-Tag: llvmorg-8.0.0-rc1~10690 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4746aa7b8f27c743b0222a36f5f8068e06bab181;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp index 172ba0b..a307914 100644 --- a/llvm/lib/Demangle/MicrosoftDemangle.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp @@ -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(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 << "("; diff --git a/llvm/test/Demangle/ms-operators.test b/llvm/test/Demangle/ms-operators.test index 54da11c..de5c189 100644 --- a/llvm/test/Demangle/ms-operators.test +++ b/llvm/test/Demangle/ms-operators.test @@ -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::`default ctor closure'(void) diff --git a/llvm/test/Demangle/ms-thunks.test b/llvm/test/Demangle/ms-thunks.test new file mode 100644 index 0000000..668daa8 --- /dev/null +++ b/llvm/test/Demangle/ms-thunks.test @@ -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}}