diff options
Diffstat (limited to 'absl/debugging')
-rw-r--r-- | absl/debugging/internal/demangle.cc | 10 | ||||
-rw-r--r-- | absl/debugging/internal/demangle_test.cc | 16 |
2 files changed, 26 insertions, 0 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index e9edd4f8..7ce14713 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -1978,6 +1978,7 @@ static bool ParseBracedExpression(State *state) { // ::= <function-param> // ::= sZ <template-param> // ::= sZ <function-param> +// ::= sP <template-arg>* E // ::= <expr-primary> // ::= dt <expression> <unresolved-name> # expr.name // ::= pt <expression> <unresolved-name> # expr->name @@ -2109,6 +2110,15 @@ static bool ParseExpression(State *state) { } state->parse_state = copy; + // sizeof...(pack) captured from an alias template + // + // <expression> ::= sP <template-arg>* E + if (ParseTwoCharToken(state, "sP") && ZeroOrMore(ParseTemplateArg, state) && + ParseOneCharToken(state, 'E')) { + return true; + } + state->parse_state = copy; + // Unary folds (... op pack) and (pack op ...). // // <expression> ::= fl <binary operator-name> <expression> diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index cb8b36d0..052c66bb 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -812,6 +812,22 @@ TEST(Demangle, SizeofPacks) { EXPECT_STREQ("g<>()", tmp); } +TEST(Demangle, SizeofPackInvolvingAnAliasTemplate) { + char tmp[80]; + + // Source: + // + // template <class... T> using A = char[sizeof...(T)]; + // template <class... U> void f(const A<U..., int>&) {} + // template void f<int>(const A<int, int>&); + // + // Full LLVM demangling of the instantiation of f: + // + // void f<int>(char const (&) [sizeof... (int, int)]) + EXPECT_TRUE(Demangle("_Z1fIJiEEvRAsPDpT_iE_Kc", tmp, sizeof(tmp))); + EXPECT_STREQ("f<>()", tmp); +} + TEST(Demangle, Spaceship) { char tmp[80]; |