This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Simplify and generalize rust-demangle's unescaping logic.
- From: Jeff Law <law at redhat dot com>
- To: Eduard-Mihai Burtescu <eddyb at lyken dot rs>, 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: Tue, 3 Sep 2019 14:04:48 -0600
- Subject: Re: [PATCH] Simplify and generalize rust-demangle's unescaping logic.
- References: <98de4121-72c8-4a87-bf44-ab917f6c2055@www.fastmail.com> <CAKOQZ8z0nuzY2jvgdcWg3cowON-pcKBa7=gdRkNiexKRN9+feg@mail.gmail.com> <3a39d463-1e2b-4385-92e4-a9ac7fcfcb3a@www.fastmail.com>
On 8/28/19 9:16 AM, Eduard-Mihai Burtescu wrote:
> Could you, or someone else, commit this for me (as I have no commit access)?
I've added this to the trunk.
Thanks,
jeff
>
> Thanks.
>
> 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 <eddyb@lyken.rs> 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 <eddyb@lyken.rs>
>>> 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.
>>
>> Thanks.
>>
>> Ian
>>