[llvm] r340239 - [MS Demangler] Demangle special operator 'dynamic initializer'.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 16:59:22 PDT 2018
Author: zturner
Date: Mon Aug 20 16:59:21 2018
New Revision: 340239
URL: http://llvm.org/viewvc/llvm-project?rev=340239&view=rev
Log:
[MS Demangler] Demangle special operator 'dynamic initializer'.
This is encoded as __E and should print something like
"dynamic initializer for 'Foo'(void)"
This also adds support for dynamic atexit destructor, which is
basically identical but encoded as __F with slightly different
description.
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=340239&r1=340238&r2=340239&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp Mon Aug 20 16:59:21 2018
@@ -271,6 +271,8 @@ enum class OperatorTy : uint8_t {
LocalVftableCtorClosure, // ?_T # local vftable constructor closure
ArrayNew, // ?_U operator new[]
ArrayDelete, // ?_V operator delete[]
+ DynamicInitializer, // ?__E dynamic initializer for `T'
+ DynamicAtexitDestructor, // ?__F dynamic atexit destructor for `T'
LiteralOperator, // ?__K operator ""_name
CoAwait, // ?__L co_await
Spaceship, // operator<=>
@@ -360,6 +362,8 @@ OperatorMapEntry OperatorMap[] = {
{"_T", "`local vftable ctor closure'", OperatorTy::LocalVftableCtorClosure},
{"_U", "operator new[]", OperatorTy::ArrayNew},
{"_V", "operator delete[]", OperatorTy::ArrayDelete},
+ {"__E", "dynamic initializer", OperatorTy::DynamicInitializer},
+ {"__F", "dynamic atexit destructor", OperatorTy::DynamicAtexitDestructor},
{"__K", "operator \"\"", OperatorTy::LiteralOperator},
{"__L", "co_await", OperatorTy::CoAwait},
};
@@ -883,12 +887,20 @@ static void outputName(OutputStream &OS,
const OperatorInfo *Operator = lastComponentAsOperator(TheName);
const VirtualMemberPtrThunk *Thunk = nullptr;
+ bool PrintLastScopeSeparator = true;
if (Operator) {
if (Operator->Info->Operator == OperatorTy::Vcall) {
Thunk = static_cast<const VirtualMemberPtrThunk *>(Operator);
OS << "[thunk]: ";
outputCallingConvention(OS, Thunk->CC);
OS << " ";
+ } else if (Operator->Info->Operator == OperatorTy::DynamicInitializer) {
+ OS << "`dynamic initializer for '";
+ PrintLastScopeSeparator = false;
+ } else if (Operator->Info->Operator ==
+ OperatorTy::DynamicAtexitDestructor) {
+ OS << "`dynamic atexit destructor for '";
+ PrintLastScopeSeparator = false;
}
}
@@ -897,7 +909,8 @@ static void outputName(OutputStream &OS,
for (; TheName->Next; TheName = TheName->Next) {
Previous = TheName;
outputNameComponent(OS, *TheName);
- OS << "::";
+ if (TheName->Next != Operator || PrintLastScopeSeparator)
+ OS << "::";
}
// Print out a regular name.
@@ -946,6 +959,10 @@ static void outputName(OutputStream &OS,
OS << Thunk->OffsetInVTable << ", {flat}}";
break;
}
+ case OperatorTy::DynamicInitializer:
+ case OperatorTy::DynamicAtexitDestructor:
+ OS << "''";
+ break;
case OperatorTy::LocalStaticGuard: {
const LocalStaticGuardVariable &LSG =
Modified: llvm/trunk/test/Demangle/ms-operators.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Demangle/ms-operators.test?rev=340239&r1=340238&r2=340239&view=diff
==============================================================================
--- llvm/trunk/test/Demangle/ms-operators.test (original)
+++ llvm/trunk/test/Demangle/ms-operators.test Mon Aug 20 16:59:21 2018
@@ -215,6 +215,12 @@
??_R4Base@@6B@
; CHECK: const Base::`RTTI Complete Object Locator'
+??__EFoo@@YAXXZ
+void __cdecl `dynamic initializer for 'Foo''(void)
+
+??__FFoo@@YAXXZ
+void __cdecl `dynamic atexit destructor for 'Foo''(void)
+
??__K_deg@@YAHO at Z
; CHECK: int __cdecl operator ""_deg(long double)
More information about the llvm-commits
mailing list