diff options
-rw-r--r-- | absl/debugging/internal/demangle.cc | 11 | ||||
-rw-r--r-- | absl/debugging/internal/demangle_test.cc | 30 |
2 files changed, 41 insertions, 0 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index 1d14ac6c..8887ee47 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -2014,6 +2014,8 @@ static bool ParseBracedExpression(State *state) { // ::= fr <binary operator-name> <expression> // ::= fL <binary operator-name> <expression> <expression> // ::= fR <binary operator-name> <expression> <expression> +// ::= tw <expression> +// ::= tr // ::= sr <type> <unqualified-name> <template-args> // ::= sr <type> <unqualified-name> // ::= u <source-name> <template-arg>* E # vendor extension @@ -2197,6 +2199,15 @@ static bool ParseExpression(State *state) { } state->parse_state = copy; + // tw <expression>: throw e + if (ParseTwoCharToken(state, "tw") && ParseExpression(state)) { + return true; + } + state->parse_state = copy; + + // tr: throw (rethrows an exception from the handler that caught it) + if (ParseTwoCharToken(state, "tr")) return true; + // Object and pointer member access expressions. // // <expression> ::= (dt | pt) <expression> <unresolved-name> diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 9050e96e..85a20f0a 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -1177,6 +1177,36 @@ TEST(Demangle, NoexceptExpression) { EXPECT_STREQ("f<>()", tmp); } +TEST(Demangle, UnaryThrow) { + char tmp[80]; + + // Source: + // + // template <bool b> decltype(b ? throw b : 0) f() { return 0; } + // template decltype(false ? throw false : 0) f<false>(); + // + // Full LLVM demangling of the instantiation of f: + // + // decltype(false ? throw false : 0) f<false>() + EXPECT_TRUE(Demangle("_Z1fILb0EEDTquT_twT_Li0EEv", tmp, sizeof(tmp))); + EXPECT_STREQ("f<>()", tmp); +} + +TEST(Demangle, NullaryThrow) { + char tmp[80]; + + // Source: + // + // template <bool b> decltype(b ? throw : 0) f() { return 0; } + // template decltype(false ? throw : 0) f<false>(); + // + // Full LLVM demangling of the instantiation of f: + // + // decltype(false ? throw : 0) f<false>() + EXPECT_TRUE(Demangle("_Z1fILb0EEDTquT_trLi0EEv", tmp, sizeof(tmp))); + EXPECT_STREQ("f<>()", tmp); +} + TEST(Demangle, ThreadLocalWrappers) { char tmp[80]; |