This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Simplify and generalize rust-demangle's unescaping logic.
- From: "Eduard-Mihai Burtescu" <eddyb at lyken dot rs>
- To: "Ian Lance Taylor" <iant at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "Ian Lance Taylor" <ian at airs dot com>
- Date: Wed, 28 Aug 2019 18:16:26 +0300
- Subject: Re: [PATCH] Simplify and generalize rust-demangle's unescaping logic.
- References: <firstname.lastname@example.org> <CAKOQZ8z0nuzY2jvgdcWg3cowON-pcKBa7=gdRkNiexKRN9email@example.com>
Could you, or someone else, commit this for me (as I have no commit access)?
On Mon, Aug 26, 2019, at 11:04 PM, Ian Lance Taylor wrote:
> On Wed, Aug 14, 2019 at 10:24 AM Eduard-Mihai Burtescu <firstname.lastname@example.org> wrote:
> > Previously, rust-demangle.c was special-casing a fixed number
> > of '$uXY$' escapes, but 'XY' can technically be any hex value,
> > representing some Unicode codepoint.
> > This patch adds more general support for '$u...$' escapes,
> > similar to https://github.com/alexcrichton/rustc-demangle/pull/29,
> > but only for the the ASCII subset. More complete Unicode support
> > may come at a later time, but right now I want to keep it simple.
> > Escapes that decode to ASCII control codes are considered invalid,
> > as the Rust compiler should never emit them, and to avoid any
> > undesirable effects from accidentally outputting a control code.
> > Additionally, the switch statements, which had one case for each
> > alphanumeric character, were replaced with if-else chains.
> > Bootstrapped and tested on x86_64-unknown-linux-gnu.
> > 2019-08-14 Eduard-Mihai Burtescu <email@example.com>
> > libiberty/ChangeLog:
> > * rust-demangle.c (unescape): Remove.
> > (parse_lower_hex_nibble): New function.
> > (parse_legacy_escape): New function.
> > (is_prefixed_hash): Use parse_lower_hex_nibble.
> > (looks_like_rust): Use parse_legacy_escape.
> > (rust_demangle_sym): Use parse_legacy_escape.
> > * testsuite/rust-demangle-expected: Add 'llv$u6d$' test.
> This is OK.