diff options
author | Erik Pilkington <erik.pilkington@gmail.com> | 2018-04-09 18:31:50 +0000 |
---|---|---|
committer | Erik Pilkington <erik.pilkington@gmail.com> | 2018-04-09 18:31:50 +0000 |
commit | abd2440de06f1ef3d5378718bc3b30ecee52a2a3 (patch) | |
tree | 446a48238468db8542e9ba947ad682b56dd10825 /libcxxabi/src | |
parent | 643ee0da8f3cd6de648ca3312b978cf009eb8264 (diff) |
[demangler] Support for partially substituted sizeof....
Diffstat (limited to 'libcxxabi/src')
-rw-r--r-- | libcxxabi/src/cxa_demangle.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp index 9253e830b18..05bdc18e3a3 100644 --- a/libcxxabi/src/cxa_demangle.cpp +++ b/libcxxabi/src/cxa_demangle.cpp @@ -161,6 +161,7 @@ public: class Node { public: enum Kind : unsigned char { + KNodeArrayNode, KDotSuffix, KVendorExtQualType, KQualType, @@ -323,6 +324,14 @@ public: } }; +struct NodeArrayNode : Node { + NodeArray Array; + NodeArrayNode(NodeArray Array_) : Node(KNodeArrayNode), Array(Array_) {} + void printLeft(OutputStream &S) const override { + Array.printWithComma(S); + } +}; + class DotSuffix final : public Node { const Node *Prefix; const StringView Suffix; @@ -3821,6 +3830,7 @@ Node *Db::parseBracedExpr() { // ::= ds <expression> <expression> # expr.*expr // ::= sZ <template-param> # size of a parameter pack // ::= sZ <function-param> # size of a function parameter pack +// ::= sP <template-arg>* E # sizeof...(T), size of a captured template parameter pack from an alias template // ::= sp <expression> # pack expansion // ::= tw <expression> # throw expression // ::= tr # throw with no operand (rethrow) @@ -4221,9 +4231,22 @@ Node *Db::parseExpr() { Node *FP = parseFunctionParam(); if (FP == nullptr) return nullptr; - return make<EnclosingExpr>("sizeof...", FP, ")"); + return make<EnclosingExpr>("sizeof... (", FP, ")"); } return nullptr; + case 'P': { + First += 2; + size_t ArgsBegin = Names.size(); + while (!consumeIf('E')) { + Node *Arg = parseTemplateArg(); + if (Arg == nullptr) + return nullptr; + Names.push_back(Arg); + } + return make<EnclosingExpr>( + "sizeof... (", make<NodeArrayNode>(popTrailingNodeArray(ArgsBegin)), + ")"); + } } return nullptr; case 't': |