From 9605d816c5ed3ad5e68b155974389fb84580b5b4 Mon Sep 17 00:00:00 2001 From: Chris Mihelich Date: Thu, 30 May 2024 16:56:42 -0700 Subject: Demangle constrained auto types (Dk ). PiperOrigin-RevId: 638831461 Change-Id: Ie30ff381e7d74a40a689b52e66b2e8bb81e0fda6 --- absl/debugging/internal/demangle.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'absl/debugging/internal/demangle.cc') diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index d32d5980..8bff73bb 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -621,6 +621,7 @@ static bool ParseExprPrimary(State *state); static bool ParseExprCastValueAndTrailingE(State *state); static bool ParseQRequiresClauseExpr(State *state); static bool ParseRequirement(State *state); +static bool ParseTypeConstraint(State *state); static bool ParseLocalName(State *state); static bool ParseLocalNameSuffix(State *state); static bool ParseDiscriminator(State *state); @@ -1274,6 +1275,7 @@ static bool ParseDecltype(State *state) { // ::= // ::= Dp # pack expansion of (C++0x) // ::= Dv _ # GNU vector extension +// ::= Dk # constrained auto // static bool ParseType(State *state) { ComplexityGuard guard(state); @@ -1346,6 +1348,11 @@ static bool ParseType(State *state) { } state->parse_state = copy; + if (ParseTwoCharToken(state, "Dk") && ParseTypeConstraint(state)) { + return true; + } + state->parse_state = copy; + // For this notation see CXXNameMangler::mangleType in Clang's source code. // The relevant logic and its comment "not clear how to mangle this!" date // from 2011, so it may be with us awhile. @@ -2292,8 +2299,6 @@ static bool ParseQRequiresClauseExpr(State *state) { // ::= T // ::= Q // -// ::= -// // ::= // // https://github.com/itanium-cxx-abi/cxx-abi/issues/24 @@ -2307,7 +2312,7 @@ static bool ParseRequirement(State *state) { Optional(ParseOneCharToken(state, 'N')) && // This logic backtracks cleanly if we eat an R but a valid type doesn't // follow it. - (!ParseOneCharToken(state, 'R') || ParseName(state))) { + (!ParseOneCharToken(state, 'R') || ParseTypeConstraint(state))) { return true; } state->parse_state = copy; @@ -2321,6 +2326,11 @@ static bool ParseRequirement(State *state) { return false; } +// ::= +static bool ParseTypeConstraint(State *state) { + return ParseName(state); +} + // ::= Z <(function) encoding> E <(entity) name> [] // ::= Z <(function) encoding> E s [] // ::= Z <(function) encoding> E d [<(parameter) number>] _ -- cgit v1.2.3