From patchwork Wed Mar 27 16:31:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 231743 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D75572C00A9 for ; Thu, 28 Mar 2013 03:32:15 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=Y/eqP9Gbv4GTIWRp+U9Zn9Hmcz3neG/oO7RrnoN9BjS9MC rA9c7+WxWV/3S6WZAjRuR2Bba1oy0t4BiK5zPiuNxeDA5iFtWfCHadAXdFBk+3qo pvbN2TKB52AMLUt7NzZFTkSEXAdKX7+bxnoe2N84BTzyXnJ4yfSSNQV/mTY+M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=8/kD5IXs5JnoLmuQeXN+0Z1VjZI=; b=lETrm6BBbw36gcmVsxQN 97aY0TOSyADkTUP3oHS8ZzGXvD+oX4+eAZuOYBgWogncxBHznUNLnokn+9xspTAV WInr3jssVucObCPHpSUlMzxfRfrzsKXD/ry+VEY1mdKXWZy/Ma3cu9TqQgawsSPR J+zuWUsdN7hwmA2XMMiLUvQ= Received: (qmail 16807 invoked by alias); 27 Mar 2013 16:31:58 -0000 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 Received: (qmail 16786 invoked by uid 89); 27 Mar 2013 16:31:49 -0000 X-Spam-SWARE-Status: No, score=-7.0 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 27 Mar 2013 16:31:47 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2RGVjuW029045 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Mar 2013 12:31:45 -0400 Received: from houston.quesejoda.com (vpn-58-46.rdu2.redhat.com [10.10.58.46]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2RGVio7021994; Wed, 27 Mar 2013 12:31:45 -0400 Message-ID: <51531EF0.4020102@redhat.com> Date: Wed, 27 Mar 2013 11:31:44 -0500 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: gcc-patches , "Iyer, Balaji V" Subject: [cilkplus-merge] Handle generic pretty printing of ARRAY_NOTATION_REF X-Virus-Found: No While debugging some code I noticed that dump_generic_stmt() does not work on ARRAY_NOTATION_REFs. Attached is a patch adding the smarts to tree-pretty-print. There is no testcase because ARRAY_NOTATION_REFs are expanded by the parser, so by the time the tree dumps happen, there are no more ARRAY_NOTATION_REFs to look at. I am using TREE_OPERAND instead of the preferred ARRAY_NOTATION_* accessors, because these accessors are defined in c-family/c-common.h. Perhaps when both the C and C++ array notations are contributed, we could move the accessors to tree.h or something. Balaji, are you ok with these changes? If you are ok, I will commit this as a fairly trivial and obvious change. commit 6a865bd29f24f94039c9017766d82d05085f320f Author: Aldy Hernandez Date: Wed Mar 27 11:19:56 2013 -0500 Handle generic pretty printing of ARRAY_NOTATION_REF. diff --git a/gcc/ChangeLog.cilkplus b/gcc/ChangeLog.cilkplus index 7c0834d..a0ecc76 100644 --- a/gcc/ChangeLog.cilkplus +++ b/gcc/ChangeLog.cilkplus @@ -8,3 +8,5 @@ ARRAY_NOTATION_REF storage. * Makefile.in (C_COMMON_OBJS): Added c-family/array-notation-common.o. + * tree-pretty-print.c (dump_generic_node): Add case for + ARRAY_NOTATION_REF. diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 1613142..36a9f5a 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1266,6 +1266,17 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, pp_string (buffer, ">"); break; + case ARRAY_NOTATION_REF: + dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false); + pp_character (buffer, '['); + dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false); + pp_character (buffer, ':'); + dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false); + pp_character (buffer, ':'); + dump_generic_node (buffer, TREE_OPERAND (node, 3), spc, flags, false); + pp_character (buffer, ']'); + break; + case ARRAY_REF: case ARRAY_RANGE_REF: op0 = TREE_OPERAND (node, 0);