From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128840 invoked by alias); 26 Aug 2019 20:04:08 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 128830 invoked by uid 89); 26 Aug 2019 20:04:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.8 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=u X-HELO: mail-vk1-f195.google.com Received: from mail-vk1-f195.google.com (HELO mail-vk1-f195.google.com) (209.85.221.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Aug 2019 20:04:07 +0000 Received: by mail-vk1-f195.google.com with SMTP id w20so4239859vkd.8 for ; Mon, 26 Aug 2019 13:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ov2tgZVxQx/0BTSHvWzFF6PWzq9J4XD537y0T9oawiY=; b=rhyw7kYjquAvdJfKRPhycMBJgfIHxmLjov9SOExS5BvBHnaoh5SORX5lc/qtuvsBEU +DD3c/AK6VsFgGjr+j0mx3BcP+wf00ZJlkCvizaMMEKPDqapkxA2ImU6py9vJdJ0wTRh KbYxhjxfHk3h/Sku3+ZOuf5Wg2nqV9xUP2YAFI83BDdwlAnxjOqqdycIfBVBCYMCUig2 vg+Rz9AHs7hjIKrNXv0zHZ4jaWoc5Yd7dsFmJACwvWTh1KD5NguEHDauL5CLiYVGS2vT FkStnkHC7p/Liat/XZ+M0hNeL0Rk2uKMDGf1XZrpnRzwEOu7eth/O/vFAh17aPVYyW+e sM3Q== MIME-Version: 1.0 References: <98de4121-72c8-4a87-bf44-ab917f6c2055@www.fastmail.com> In-Reply-To: <98de4121-72c8-4a87-bf44-ab917f6c2055@www.fastmail.com> From: "Ian Lance Taylor via gcc-patches" Reply-To: Ian Lance Taylor Date: Mon, 26 Aug 2019 20:46:00 -0000 Message-ID: Subject: Re: [PATCH] Simplify and generalize rust-demangle's unescaping logic. To: Eduard-Mihai Burtescu Cc: gcc-patches , Ian Lance Taylor Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-08/txt/msg01781.txt.bz2 On Wed, Aug 14, 2019 at 10:24 AM 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 > 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