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]

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


Ping: https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01007.html

On Wed, Aug 14, 2019, at 8:22 PM, Eduard-Mihai Burtescu 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.


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