From patchwork Wed Mar 7 23:18:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 145365 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 62801B6EE8 for ; Thu, 8 Mar 2012 11:08:05 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1331770085; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=YvNWe9a aC+68Ckc++QWy8PI5gY4=; b=H51Hb5oRixNYtgh4WAN5ZxcqwHHz4XTC0lf1hob AcACy+yj/rQ0WDngCaBPIkhLGpvHzbP91AFHiv06WyxZeVRaflPqaQokTlVfYHSf KZNSdb409FB/YgD6AEmp69TbQ2b7GWnp/0HFRXc0TPhs+N4n3RNnlokqdff8fYI7 Qr10= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=m1rl10ySaI1LlUZFbHQn+2a5s9f9y5z8NiJ8PWD853NyAeC6wocEAZ8OO6oA8Y E4v9Ln1+6CmC1cgejLO9Exs6CD80x63h+SGpTUN4zt57RVPrPqsrmfkzXvvKhk1O qR0F9Zo3T87JIv52moq3nqIQBEpMSeefwTx0Wu8eUot2k=; Received: (qmail 11575 invoked by alias); 8 Mar 2012 00:08:01 -0000 Received: (qmail 11565 invoked by uid 22791); 8 Mar 2012 00:07:59 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Mar 2012 00:07:41 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2807fJ0020623 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 7 Mar 2012 19:07:41 -0500 Received: from [10.3.113.115] (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q27NImVs005127 for ; Wed, 7 Mar 2012 18:18:49 -0500 Message-ID: <4F57ECD8.2060409@redhat.com> Date: Wed, 07 Mar 2012 18:18:48 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: cp-demangle PATCH for user-defined literal operator demangling Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The discussion of 52521 also noted that the demangler doesn't support literal operators yet. Tested x86_64-pc-linux-gnu, applying to trunk. commit ee622f8167f66b6ae9fff1526688a2dfdd84a8be Author: Jason Merrill Date: Wed Mar 7 17:50:19 2012 -0500 * cp-demangle.c (cplus_demangle_operators): Add li. (d_unqualified_name): Handle it specially. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 18b84a1..2b3d182 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1419,7 +1419,12 @@ d_unqualified_name (struct d_info *di) ret = d_operator_name (di); if (ret != NULL && ret->type == DEMANGLE_COMPONENT_OPERATOR) - di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2; + { + di->expansion += sizeof "operator" + ret->u.s_operator.op->len - 2; + if (!strcmp (ret->u.s_operator.op->code, "li")) + ret = d_make_comp (di, DEMANGLE_COMPONENT_UNARY, ret, + d_source_name (di)); + } return ret; } else if (peek == 'C' || peek == 'D') @@ -1596,6 +1601,7 @@ const struct demangle_operator_info cplus_demangle_operators[] = { "ix", NL ("[]"), 2 }, { "lS", NL ("<<="), 2 }, { "le", NL ("<="), 2 }, + { "li", NL ("operator\"\" "), 1 }, { "ls", NL ("<<"), 2 }, { "lt", NL ("<"), 2 }, { "mI", NL ("-="), 2 }, diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 408c4f4..036c481 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4072,6 +4072,9 @@ decltype (g({parm#1}, {})) f1(int) --format=gnu-v3 _Z2f1IiEDTnw_T_ilEES0_ decltype (new int{}) f1(int) +--format=gnu-v3 +_Zli2_wPKc +operator"" _w(char const*) # # Ada (GNAT) tests. #