[llvm] r357645 - llvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtors

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 3 16:14:34 PDT 2019


Author: nico
Date: Wed Apr  3 16:14:33 2019
New Revision: 357645

URL: http://llvm.org/viewvc/llvm-project?rev=357645&view=rev
Log:
llvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtors

These are variant 4, cf
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1851
https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1880
and gcc seems to sometimes emit them still.

Differential Revision: https://reviews.llvm.org/D60229

Modified:
    llvm/trunk/include/llvm/Demangle/ItaniumDemangle.h

Modified: llvm/trunk/include/llvm/Demangle/ItaniumDemangle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Demangle/ItaniumDemangle.h?rev=357645&r1=357644&r2=357645&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Demangle/ItaniumDemangle.h (original)
+++ llvm/trunk/include/llvm/Demangle/ItaniumDemangle.h Wed Apr  3 16:14:33 2019
@@ -2794,11 +2794,13 @@ AbstractManglingParser<Derived, Alloc>::
 // <ctor-dtor-name> ::= C1  # complete object constructor
 //                  ::= C2  # base object constructor
 //                  ::= C3  # complete object allocating constructor
-//   extension      ::= C5    # ?
+//   extension      ::= C4  # gcc old-style "[unified]" constructor
+//   extension      ::= C5  # the COMDAT used for ctors
 //                  ::= D0  # deleting destructor
 //                  ::= D1  # complete object destructor
 //                  ::= D2  # base object destructor
-//   extension      ::= D5    # ?
+//   extension      ::= D4  # gcc old-style "[unified]" destructor
+//   extension      ::= D5  # the COMDAT used for dtors
 template <typename Derived, typename Alloc>
 Node *
 AbstractManglingParser<Derived, Alloc>::parseCtorDtorName(Node *&SoFar,
@@ -2821,7 +2823,8 @@ AbstractManglingParser<Derived, Alloc>::
 
   if (consumeIf('C')) {
     bool IsInherited = consumeIf('I');
-    if (look() != '1' && look() != '2' && look() != '3' && look() != '5')
+    if (look() != '1' && look() != '2' && look() != '3' && look() != '4' &&
+        look() != '5')
       return nullptr;
     int Variant = look() - '0';
     ++First;
@@ -2830,15 +2833,15 @@ AbstractManglingParser<Derived, Alloc>::
       if (getDerived().parseName(State) == nullptr)
         return nullptr;
     }
-    return make<CtorDtorName>(SoFar, false, Variant);
+    return make<CtorDtorName>(SoFar, /*IsDtor=*/false, Variant);
   }
 
-  if (look() == 'D' &&
-      (look(1) == '0' || look(1) == '1' || look(1) == '2' || look(1) == '5')) {
+  if (look() == 'D' && (look(1) == '0' || look(1) == '1' || look(1) == '2' ||
+                        look(1) == '4' || look(1) == '5')) {
     int Variant = look(1) - '0';
     First += 2;
     if (State) State->CtorDtorConversion = true;
-    return make<CtorDtorName>(SoFar, true, Variant);
+    return make<CtorDtorName>(SoFar, /*IsDtor=*/true, Variant);
   }
 
   return nullptr;




More information about the llvm-commits mailing list