Commit 8ece6dc4 by Chris Mihelich Committed by Copybara-Service

Demangle nx... syntax for noexcept(e) as an expression in a dependent signature.

PiperOrigin-RevId: 640590102
Change-Id: I2641cddd35119062328a197162bb700d8309fc05
parent 699fcf35
...@@ -1998,6 +1998,7 @@ static bool ParseBracedExpression(State *state) { ...@@ -1998,6 +1998,7 @@ static bool ParseBracedExpression(State *state) {
// ::= st <type> // ::= st <type>
// ::= at <type> // ::= at <type>
// ::= az <expression> // ::= az <expression>
// ::= nx <expression>
// ::= <template-param> // ::= <template-param>
// ::= <function-param> // ::= <function-param>
// ::= sZ <template-param> // ::= sZ <template-param>
...@@ -2136,6 +2137,12 @@ static bool ParseExpression(State *state) { ...@@ -2136,6 +2137,12 @@ static bool ParseExpression(State *state) {
} }
state->parse_state = copy; state->parse_state = copy;
// noexcept(expression) appearing as an expression in a dependent signature
if (ParseTwoCharToken(state, "nx") && ParseExpression(state)) {
return true;
}
state->parse_state = copy;
// sizeof...(pack) // sizeof...(pack)
// //
// <expression> ::= sZ <template-param> // <expression> ::= sZ <template-param>
......
...@@ -1128,6 +1128,21 @@ TEST(Demangle, AlignofExpression) { ...@@ -1128,6 +1128,21 @@ TEST(Demangle, AlignofExpression) {
EXPECT_STREQ("f<>()", tmp); EXPECT_STREQ("f<>()", tmp);
} }
TEST(Demangle, NoexceptExpression) {
char tmp[80];
// Source:
//
// template <class T> void f(T (&a)[noexcept(T{})]) {}
// template void f<int>(int (&)[noexcept(int{})]);
//
// Full LLVM demangling of the instantiation of f:
//
// void f<int>(int (&) [noexcept (int{})])
EXPECT_TRUE(Demangle("_Z1fIiEvRAnxtlT_E_S0_", tmp, sizeof(tmp)));
EXPECT_STREQ("f<>()", tmp);
}
TEST(Demangle, ThreadLocalWrappers) { TEST(Demangle, ThreadLocalWrappers) {
char tmp[80]; char tmp[80];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment