]> granicus.if.org Git - llvm/commitdiff
llvm-undname: Support demangling the spaceship operator
authorNico Weber <nicolasweber@gmx.de>
Tue, 23 Apr 2019 16:20:27 +0000 (16:20 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 23 Apr 2019 16:20:27 +0000 (16:20 +0000)
Also add a test for demanling the co_await operator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359007 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Demangle/MicrosoftDemangleNodes.h
lib/Demangle/MicrosoftDemangle.cpp
lib/Demangle/MicrosoftDemangleNodes.cpp
test/Demangle/ms-cxx20.test [new file with mode: 0644]

index b478418086b6cd124976a9304e24a66f269fae35..6638cb8e721f919aaf5ab6af3b214398c0cdfab3 100644 (file)
@@ -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
 };
 
index beb51695fc1fae9ba5b05b7c81feb25c4d9e235e..14c6e1e5ef5db2d2e5299d1ee24aebccd3e57dff 100644 (file)
@@ -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 <unused>
+      IFK::CoAwait,                    // ?__L operator co_await
+      IFK::Spaceship,                  // ?__M operator<=>
       IFK::None,                       // ?__N <unused>
       IFK::None,                       // ?__O <unused>
       IFK::None,                       // ?__P <unused>
@@ -687,7 +687,6 @@ Demangler::demangleFunctionIdentifierCode(StringView &MangledName,
           translateIntrinsicFunctionCode(CH, Group));
     }
   }
-  // No Mangling Yet:      Spaceship,                    // operator<=>
 
   DEMANGLE_UNREACHABLE;
 }
index e19d041b90ec38d271cd40cead09808defa52ec6..a3ee5f9d91d4d87386bdbfc16a92b830f3903787 100644 (file)
@@ -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/test/Demangle/ms-cxx20.test b/test/Demangle/ms-cxx20.test
new file mode 100644 (file)
index 0000000..7e116f1
--- /dev/null
@@ -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 &)