[llvm] r329599 - [demangler] Support for partially substituted sizeof....
Erik Pilkington via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 9 11:31:50 PDT 2018
Author: epilk
Date: Mon Apr 9 11:31:50 2018
New Revision: 329599
URL: http://llvm.org/viewvc/llvm-project?rev=329599&view=rev
Log:
[demangler] Support for partially substituted sizeof....
Modified:
llvm/trunk/lib/Demangle/ItaniumDemangle.cpp
Modified: llvm/trunk/lib/Demangle/ItaniumDemangle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Demangle/ItaniumDemangle.cpp?rev=329599&r1=329598&r2=329599&view=diff
==============================================================================
--- llvm/trunk/lib/Demangle/ItaniumDemangle.cpp (original)
+++ llvm/trunk/lib/Demangle/ItaniumDemangle.cpp Mon Apr 9 11:31:50 2018
@@ -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':
More information about the llvm-commits
mailing list