diff options
author | Chris Mihelich <cmihelic@google.com> | 2024-06-07 07:51:38 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-06-07 07:52:56 -0700 |
commit | 59d0a7d141084dbec666b6f05ffa8c4210d61956 (patch) | |
tree | e8db3217b55e866a65c5a3746b0738b524e9a9a7 | |
parent | 6e607350cccd7e5157ca4b522489920db45c8e8b (diff) |
Demangle transaction-safety notations GTt and Dx.
PiperOrigin-RevId: 641249074
Change-Id: Id410ce6c3b7a9a2b10aedf9c70ec65d3e37af06d
-rw-r--r-- | absl/debugging/internal/demangle.cc | 10 | ||||
-rw-r--r-- | absl/debugging/internal/demangle_test.cc | 15 |
2 files changed, 24 insertions, 1 deletions
diff --git a/absl/debugging/internal/demangle.cc b/absl/debugging/internal/demangle.cc index 8b76ce01..9f4a8352 100644 --- a/absl/debugging/internal/demangle.cc +++ b/absl/debugging/internal/demangle.cc @@ -1112,6 +1112,7 @@ static bool ParseOperatorName(State *state, int *arity) { // ::= GV <(object) name> // ::= GR <(object) name> [<seq-id>] _ // ::= T <call-offset> <(base) encoding> +// ::= GTt <encoding> # transaction-safe entry point // G++ extensions: // ::= TC <type> <(offset) number> _ <(base) type> // ::= TF <type> @@ -1205,6 +1206,12 @@ static bool ParseSpecialName(State *state) { } state->parse_state = copy; + if (ParseThreeCharToken(state, "GTt") && + MaybeAppend(state, "transaction clone for ") && ParseEncoding(state)) { + return true; + } + state->parse_state = copy; + if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "hv") && ParseCallOffset(state) && ParseEncoding(state)) { return true; @@ -1509,7 +1516,7 @@ static bool ParseExceptionSpec(State *state) { } // <function-type> ::= -// [exception-spec] F [Y] <bare-function-type> [<ref-qualifier>] E +// [exception-spec] [Dx] F [Y] <bare-function-type> [<ref-qualifier>] E // // <ref-qualifier> ::= R | O static bool ParseFunctionType(State *state) { @@ -1517,6 +1524,7 @@ static bool ParseFunctionType(State *state) { if (guard.IsTooComplex()) return false; ParseState copy = state->parse_state; Optional(ParseExceptionSpec(state)); + Optional(ParseTwoCharToken(state, "Dx")); if (!ParseOneCharToken(state, 'F')) { state->parse_state = copy; return false; diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 108642a8..974b15f0 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc @@ -759,6 +759,21 @@ TEST(Demangle, GnuVectorSizeIsADependentOperatorExpression) { EXPECT_STREQ("f<>()", tmp); } +TEST(Demangle, TransactionSafeEntryPoint) { + char tmp[80]; + + EXPECT_TRUE(Demangle("_ZGTt1fv", tmp, sizeof(tmp))); + EXPECT_STREQ("transaction clone for f()", tmp); +} + +TEST(Demangle, TransactionSafeFunctionType) { + char tmp[80]; + + // GNU demangling: f(void (*)() transaction_safe) + EXPECT_TRUE(Demangle("_Z1fPDxFvvE", tmp, sizeof(tmp))); + EXPECT_STREQ("f()", tmp); +} + TEST(Demangle, EnableIfAttributeOnGlobalFunction) { char tmp[80]; |