From e8f21b1a6b01e75f247f8aa84bdfefc17bf71dd8 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 23 Apr 2019 16:20:27 +0000 Subject: [PATCH] llvm-undname: Support demangling the spaceship operator Also add a test for demanling the co_await operator. llvm-svn: 359007 --- llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h | 4 ++-- llvm/lib/Demangle/MicrosoftDemangle.cpp | 5 ++--- llvm/lib/Demangle/MicrosoftDemangleNodes.cpp | 5 +++-- llvm/test/Demangle/ms-cxx20.test | 9 +++++++++ 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 llvm/test/Demangle/ms-cxx20.test diff --git a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h index b478418..6638cb8 100644 --- a/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h +++ b/llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h @@ -170,8 +170,8 @@ enum class IntrinsicFunctionKind : uint8_t { VectorCopyCtorIter, // ?__G vector copy constructor iterator VectorVbaseCopyCtorIter, // ?__H vector vbase copy constructor iterator ManVectorVbaseCopyCtorIter, // ?__I managed vector vbase copy constructor - CoAwait, // ?__L co_await - Spaceship, // operator<=> + CoAwait, // ?__L operator co_await + Spaceship, // ?__M operator<=> MaxIntrinsic }; diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp index beb5169..14c6e1e 100644 --- a/llvm/lib/Demangle/MicrosoftDemangle.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp @@ -626,8 +626,8 @@ Demangler::translateIntrinsicFunctionCode(char CH, // iter IFK::None, // ?__J local static thread guard IFK::None, // ?__K operator ""_name - IFK::CoAwait, // ?__L co_await - IFK::None, // ?__M + IFK::CoAwait, // ?__L operator co_await + IFK::Spaceship, // ?__M operator<=> IFK::None, // ?__N IFK::None, // ?__O IFK::None, // ?__P @@ -687,7 +687,6 @@ Demangler::demangleFunctionIdentifierCode(StringView &MangledName, translateIntrinsicFunctionCode(CH, Group)); } } - // No Mangling Yet: Spaceship, // operator<=> DEMANGLE_UNREACHABLE; } diff --git a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp index e19d041..a3ee5f9 100644 --- a/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangleNodes.cpp @@ -337,8 +337,9 @@ void IntrinsicFunctionIdentifierNode::output(OutputStream &OS, "`vector vbase copy constructor iterator'"); OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, ManVectorVbaseCopyCtorIter, "`managed vector vbase copy constructor iterator'"); - OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, CoAwait, "co_await"); - OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Spaceship, "operator <=>"); + OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, CoAwait, + "operator co_await"); + OUTPUT_ENUM_CLASS_VALUE(IntrinsicFunctionKind, Spaceship, "operator<=>"); case IntrinsicFunctionKind::MaxIntrinsic: case IntrinsicFunctionKind::None: break; diff --git a/llvm/test/Demangle/ms-cxx20.test b/llvm/test/Demangle/ms-cxx20.test new file mode 100644 index 0000000..7e116f1 --- /dev/null +++ b/llvm/test/Demangle/ms-cxx20.test @@ -0,0 +1,9 @@ +; RUN: llvm-undname < %s | FileCheck %s + +; CHECK-NOT: Invalid mangled name + +??__LA@@QEAA?AUno_suspend@@XZ +; CHECK: struct no_suspend __cdecl A::operator co_await(void) + +??__MS@@QEAA?AVstrong_ordering@std@@AEBU0@@Z' +; CHECK: class std::strong_ordering __cdecl S::operator<=>(struct S const &) -- 2.7.4