[libcxxabi] r329599 - [demangler] Support for partially substituted sizeof....
Erik Pilkington via cfe-commits
cfe-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:
libcxxabi/trunk/src/cxa_demangle.cpp
libcxxabi/trunk/test/test_demangle.pass.cpp
Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=329599&r1=329598&r2=329599&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Mon Apr 9 11:31:50 2018
@@ -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':
Modified: libcxxabi/trunk/test/test_demangle.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/test_demangle.pass.cpp?rev=329599&r1=329598&r2=329599&view=diff
==============================================================================
--- libcxxabi/trunk/test/test_demangle.pass.cpp (original)
+++ libcxxabi/trunk/test/test_demangle.pass.cpp Mon Apr 9 11:31:50 2018
@@ -29738,6 +29738,8 @@ const char* cases[][2] =
{"_ZN5OuterI4MarpEcvT_I4MerpEEv", "Outer<Marp>::operator Merp<Merp>()"},
{"_ZZN5OuterI4MarpEcv7MuncherIJT_T0_DpT1_EEI4MerpS0_JicfEEEvEN1ScvS9_Ev", "Outer<Marp>::operator Muncher<Merp, Marp, int, char, float><Merp, Marp, int, char, float>()::S::operator Merp()"},
{"_ZN1Scv7MuncherIJDpPT_EEIJFivEA_iEEEv", "S::operator Muncher<int (*)(), int (*) []><int (), int []>()"},
+
+ {"_Z2f8IiJ8identityIiES0_IfEEEvRAsPiDpT0_T_DpNS3_4typeEE_i", "void f8<int, identity<int>, identity<float> >(int (&) [sizeof... (int, identity<int>, identity<float>, int, identity<int>::type, identity<float>::type)])"},
};
const unsigned N = sizeof(cases) / sizeof(cases[0]);
More information about the cfe-commits
mailing list