Commit 457fdbf9 by Chris Mihelich Committed by Copybara-Service

Demangle decltype(expr)::nested_type (NDT...E).

PiperOrigin-RevId: 638094845
Change-Id: I189ce357ccecbe6f341a311e405f9189bf6c0fee
parent 40b2776e
...@@ -760,6 +760,7 @@ static bool ParseNestedName(State *state) { ...@@ -760,6 +760,7 @@ static bool ParseNestedName(State *state) {
// <prefix> ::= <prefix> <unqualified-name> // <prefix> ::= <prefix> <unqualified-name>
// ::= <template-prefix> <template-args> // ::= <template-prefix> <template-args>
// ::= <template-param> // ::= <template-param>
// ::= <decltype>
// ::= <substitution> // ::= <substitution>
// ::= # empty // ::= # empty
// <template-prefix> ::= <prefix> <(template) unqualified-name> // <template-prefix> ::= <prefix> <(template) unqualified-name>
...@@ -771,7 +772,7 @@ static bool ParsePrefix(State *state) { ...@@ -771,7 +772,7 @@ static bool ParsePrefix(State *state) {
bool has_something = false; bool has_something = false;
while (true) { while (true) {
MaybeAppendSeparator(state); MaybeAppendSeparator(state);
if (ParseTemplateParam(state) || if (ParseTemplateParam(state) || ParseDecltype(state) ||
ParseSubstitution(state, /*accept_std=*/true) || ParseSubstitution(state, /*accept_std=*/true) ||
ParseUnscopedName(state) || ParseUnscopedName(state) ||
(ParseOneCharToken(state, 'M') && ParseUnnamedTypeName(state))) { (ParseOneCharToken(state, 'M') && ParseUnnamedTypeName(state))) {
......
...@@ -477,6 +477,22 @@ TEST(Demangle, DependentMemberOperatorCall) { ...@@ -477,6 +477,22 @@ TEST(Demangle, DependentMemberOperatorCall) {
EXPECT_STREQ("f<>()", tmp); EXPECT_STREQ("f<>()", tmp);
} }
TEST(Demangle, TypeNestedUnderDecltype) {
char tmp[80];
// Source:
//
// template <class T> struct S { using t = int; };
// template <class T> decltype(S<T>{})::t f() { return {}; }
// void g() { f<int>(); }
//
// Full LLVM demangling of the instantiation of f:
//
// decltype(S<int>{})::t f<int>()
EXPECT_TRUE(Demangle("_Z1fIiENDTtl1SIT_EEE1tEv", tmp, sizeof(tmp)));
EXPECT_STREQ("f<>()", tmp);
}
// Test subobject-address template parameters. // Test subobject-address template parameters.
TEST(Demangle, SubobjectAddresses) { TEST(Demangle, SubobjectAddresses) {
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