[PATCH] D53063: Port llvm r342166 to libcxxabi demangler

Pavel Labath via Phabricator reviews at reviews.llvm.org
Wed Oct 10 00:50:45 PDT 2018


labath created this revision.
labath added reviewers: erik.pilkington, rsmith.
Herald added a reviewer: EricWF.
Herald added subscribers: ldionne, christof.

This was committed back in september (https://reviews.llvm.org/D51463), but it seems it never
made it into the libcxxabi copy.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D53063

Files:
  src/demangle/ItaniumDemangle.h


Index: src/demangle/ItaniumDemangle.h
===================================================================
--- src/demangle/ItaniumDemangle.h
+++ src/demangle/ItaniumDemangle.h
@@ -642,7 +642,7 @@
   NodeOrString Dimension;
 
 public:
-  ArrayType(const Node *Base_, NodeOrString Dimension_ = NodeOrString())
+  ArrayType(const Node *Base_, NodeOrString Dimension_)
       : Node(KArrayType,
              /*RHSComponentCache=*/Cache::Yes,
              /*ArrayCache=*/Cache::Yes),
@@ -1365,12 +1365,14 @@
 class CtorDtorName final : public Node {
   const Node *Basename;
   const bool IsDtor;
+  const int Variant;
 
 public:
-  CtorDtorName(const Node *Basename_, bool IsDtor_)
-      : Node(KCtorDtorName), Basename(Basename_), IsDtor(IsDtor_) {}
+  CtorDtorName(const Node *Basename_, bool IsDtor_, int Variant_)
+      : Node(KCtorDtorName), Basename(Basename_), IsDtor(IsDtor_),
+        Variant(Variant_) {}
 
-  template<typename Fn> void match(Fn F) const { F(Basename, IsDtor); }
+  template<typename Fn> void match(Fn F) const { F(Basename, IsDtor, Variant); }
 
   void printLeft(OutputStream &S) const override {
     if (IsDtor)
@@ -2805,20 +2807,22 @@
     bool IsInherited = consumeIf('I');
     if (look() != '1' && look() != '2' && look() != '3' && look() != '5')
       return nullptr;
+    int Variant = look() - '0';
     ++First;
     if (State) State->CtorDtorConversion = true;
     if (IsInherited) {
       if (parseName(State) == nullptr)
         return nullptr;
     }
-    return make<CtorDtorName>(SoFar, false);
+    return make<CtorDtorName>(SoFar, false, Variant);
   }
 
   if (look() == 'D' &&
       (look(1) == '0' || look(1) == '1' || look(1) == '2' || look(1) == '5')) {
+    int Variant = look(1) - '0';
     First += 2;
     if (State) State->CtorDtorConversion = true;
-    return make<CtorDtorName>(SoFar, true);
+    return make<CtorDtorName>(SoFar, true, Variant);
   }
 
   return nullptr;
@@ -3297,32 +3301,25 @@
   if (!consumeIf('A'))
     return nullptr;
 
+  NodeOrString Dimension;
+
   if (std::isdigit(look())) {
-    StringView Dimension = parseNumber();
+    Dimension = parseNumber();
     if (!consumeIf('_'))
       return nullptr;
-    Node *Ty = parseType();
-    if (Ty == nullptr)
-      return nullptr;
-    return make<ArrayType>(Ty, Dimension);
-  }
-
-  if (!consumeIf('_')) {
+  } else if (!consumeIf('_')) {
     Node *DimExpr = parseExpr();
     if (DimExpr == nullptr)
       return nullptr;
     if (!consumeIf('_'))
       return nullptr;
-    Node *ElementType = parseType();
-    if (ElementType == nullptr)
-      return nullptr;
-    return make<ArrayType>(ElementType, DimExpr);
+    Dimension = DimExpr;
   }
 
   Node *Ty = parseType();
   if (Ty == nullptr)
     return nullptr;
-  return make<ArrayType>(Ty);
+  return make<ArrayType>(Ty, Dimension);
 }
 
 // <pointer-to-member-type> ::= M <class type> <member type>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53063.168945.patch
Type: text/x-patch
Size: 2901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181010/8fbaa89b/attachment.bin>


More information about the libcxx-commits mailing list