aboutsummaryrefslogtreecommitdiff
path: root/absl/debugging/internal/demangle.cc
diff options
context:
space:
mode:
authorChris Mihelich <cmihelic@google.com>2024-05-30 16:56:42 -0700
committerCopybara-Service <copybara-worker@google.com>2024-05-30 16:57:28 -0700
commit9605d816c5ed3ad5e68b155974389fb84580b5b4 (patch)
treee27bd2b2d4466ce907adb808efc22f1795aa5b3d /absl/debugging/internal/demangle.cc
parent9a2da1a407278eb70be13e5cd392a898cfc11792 (diff)
downloadabseil-9605d816c5ed3ad5e68b155974389fb84580b5b4.tar.gz
abseil-9605d816c5ed3ad5e68b155974389fb84580b5b4.tar.bz2
abseil-9605d816c5ed3ad5e68b155974389fb84580b5b4.zip
Demangle constrained auto types (Dk <type-constraint>).
PiperOrigin-RevId: 638831461 Change-Id: Ie30ff381e7d74a40a689b52e66b2e8bb81e0fda6
Diffstat (limited to 'absl/debugging/internal/demangle.cc')
-rw-r--r--absl/debugging/internal/demangle.cc16
1 files changed, 13 insertions, 3 deletions
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) {
// ::= <substitution>
// ::= Dp <type> # pack expansion of (C++0x)
// ::= Dv <num-elems> _ # GNU vector extension
+// ::= Dk <type-constraint> # 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) {
// <requirement> ::= T <type>
// <requirement> ::= Q <constraint-expression>
//
-// <type-constraint> ::= <name>
-//
// <constraint-expression> ::= <expression>
//
// 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;
}
+// <type-constraint> ::= <name>
+static bool ParseTypeConstraint(State *state) {
+ return ParseName(state);
+}
+
// <local-name> ::= Z <(function) encoding> E <(entity) name> [<discriminator>]
// ::= Z <(function) encoding> E s [<discriminator>]
// ::= Z <(function) encoding> E d [<(parameter) number>] _ <name>