summaryrefslogtreecommitdiff
path: root/absl/debugging/internal/demangle.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2020-08-17 15:25:15 -0700
committerGravatar vslashg <gfalcon@google.com>2020-08-18 13:12:43 -0400
commitdc969f34a79d019497abb61c2a3f79b5b4be2ea9 (patch)
tree8624fef4728784a788931518c47b3fedc3a3b527 /absl/debugging/internal/demangle.cc
parentd0c433455801e1c1fb6f486f0b447e22f946ab52 (diff)
Export of internal Abseil changes
-- caf65de1a20b1ad286796a9eaee38f8b59e93f3b by Samuel Benzaquen <sbenza@google.com>: Add a benchmark for StrAppend. PiperOrigin-RevId: 327111569 -- 2faa53fb3f4090f9609c7dea8951a82e1d72ce3a by Derek Mauro <dmauro@google.com>: Add the inline namespace to the code generated by gaussian_distribution_gentables A previous changed manually added it to the output PiperOrigin-RevId: 327022780 -- 29edfd86e49e4d7665e843463f8df3c72467e909 by Derek Mauro <dmauro@google.com>: Re-write the logic for detecting which stacktrace implementation to use on Linux. The visible change is to detect the presence of the `<execinfo.h>` header, which allows using the `backtrace`-based implementation when it is available. The logic has been simplified as well. Fixes #746 PiperOrigin-RevId: 326911875 -- ce198204b77aac240e98fc8d5931b17a8b26bac3 by Abseil Team <absl-team@google.com>: Demangle exception spec. PiperOrigin-RevId: 326909460 -- c41b89954545bdc4430d10e785d3ba64a55122d5 by Abseil Team <absl-team@google.com>: Add support for inheriting ctor. PiperOrigin-RevId: 326904919 GitOrigin-RevId: caf65de1a20b1ad286796a9eaee38f8b59e93f3b Change-Id: Ifd28b6a85a032839cbeafd1b16f88046dfd6c1d4
Diffstat (limited to 'absl/debugging/internal/demangle.cc')
-rw-r--r--absl/debugging/internal/demangle.cc54
1 files changed, 45 insertions, 9 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc
index 87f13e50..b980d1b2 100644
--- a/absl/debugging/internal/demangle.cc
+++ b/absl/debugging/internal/demangle.cc
@@ -1082,20 +1082,28 @@ static bool ParseVOffset(State *state) {
return false;
}
-// <ctor-dtor-name> ::= C1 | C2 | C3
+// <ctor-dtor-name> ::= C1 | C2 | C3 | CI1 <base-class-type> | CI2
+// <base-class-type>
// ::= D0 | D1 | D2
// # GCC extensions: "unified" constructor/destructor. See
-// # https://github.com/gcc-mirror/gcc/blob/7ad17b583c3643bd4557f29b8391ca7ef08391f5/gcc/cp/mangle.c#L1847
+// #
+// https://github.com/gcc-mirror/gcc/blob/7ad17b583c3643bd4557f29b8391ca7ef08391f5/gcc/cp/mangle.c#L1847
// ::= C4 | D4
static bool ParseCtorDtorName(State *state) {
ComplexityGuard guard(state);
if (guard.IsTooComplex()) return false;
ParseState copy = state->parse_state;
- if (ParseOneCharToken(state, 'C') && ParseCharClass(state, "1234")) {
- const char *const prev_name = state->out + state->parse_state.prev_name_idx;
- MaybeAppendWithLength(state, prev_name,
- state->parse_state.prev_name_length);
- return true;
+ if (ParseOneCharToken(state, 'C')) {
+ if (ParseCharClass(state, "1234")) {
+ const char *const prev_name =
+ state->out + state->parse_state.prev_name_idx;
+ MaybeAppendWithLength(state, prev_name,
+ state->parse_state.prev_name_length);
+ return true;
+ } else if (ParseOneCharToken(state, 'I') && ParseCharClass(state, "12") &&
+ ParseClassEnumType(state)) {
+ return true;
+ }
}
state->parse_state = copy;
@@ -1265,12 +1273,40 @@ static bool ParseBuiltinType(State *state) {
return false;
}
-// <function-type> ::= F [Y] <bare-function-type> [O] E
+// <exception-spec> ::= Do # non-throwing
+// exception-specification (e.g.,
+// noexcept, throw())
+// ::= DO <expression> E # computed (instantiation-dependent)
+// noexcept
+// ::= Dw <type>+ E # dynamic exception specification
+// with instantiation-dependent types
+static bool ParseExceptionSpec(State *state) {
+ ComplexityGuard guard(state);
+ if (guard.IsTooComplex()) return false;
+
+ if (ParseTwoCharToken(state, "Do")) return true;
+
+ ParseState copy = state->parse_state;
+ if (ParseTwoCharToken(state, "DO") && ParseExpression(state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ state->parse_state = copy;
+ if (ParseTwoCharToken(state, "Dw") && OneOrMore(ParseType, state) &&
+ ParseOneCharToken(state, 'E')) {
+ return true;
+ }
+ state->parse_state = copy;
+
+ return false;
+}
+
+// <function-type> ::= [exception-spec] F [Y] <bare-function-type> [O] E
static bool ParseFunctionType(State *state) {
ComplexityGuard guard(state);
if (guard.IsTooComplex()) return false;
ParseState copy = state->parse_state;
- if (ParseOneCharToken(state, 'F') &&
+ if (Optional(ParseExceptionSpec(state)) && ParseOneCharToken(state, 'F') &&
Optional(ParseOneCharToken(state, 'Y')) && ParseBareFunctionType(state) &&
Optional(ParseOneCharToken(state, 'O')) &&
ParseOneCharToken(state, 'E')) {