This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Simplify and generalize rust-demangle's unescaping logic.


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
>>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]