[demangler] Support for partially substituted sizeof....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329599 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Erik Pilkington
2018-04-09 18:31:50 +00:00
parent b9f22e8394
commit 526e92a9cf
+24 -1
View File
@@ -153,6 +153,7 @@ public:
class Node {
public:
enum Kind : unsigned char {
KNodeArrayNode,
KDotSuffix,
KVendorExtQualType,
KQualType,
@@ -315,6 +316,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;
@@ -3813,6 +3822,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)
@@ -4213,9 +4223,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':