From patchwork Fri Mar 6 20:09:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 447421 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6256114011D for ; Sat, 7 Mar 2015 07:09:51 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XIfwdLMi; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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:cc:subject:content-type; q=dns; s=default; b=yG/fHfc3DSvEC1+0qXCrOU9cHTVnlx5Nx5YvJ8ZDO8d zY2myAMgQs3pALE587ZjGIpnucDkUKVm19rAMLbdMoP9kGd7KSyJyNT+6dASEIs4 IY6mqcpTLh3XwlP/Kq7oQUu4lhivdM1UBXDVA2z/47EMRfqasQvJJA8M9U911isc = 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:cc:subject:content-type; s=default; bh=kTSVdc0kKYmvawTHpQxGIi2kiPw=; b=XIfwdLMiiXZ4NO8KY Eo0mNyD+YmBrOafKCi7icgBi22IamxElmZVAwkFXe2kCTVslyNRNKrLINvbQpkJe Y02J/5tVSzVGYm68zq1OjjURgt7wnTUAwfxtyGA5ryiDRieTFM/ajt0BcDPMKajh Ts4dLv64iuZGEhXnpSzsf/sx3g= Received: (qmail 73548 invoked by alias); 6 Mar 2015 20:09:43 -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 73526 invoked by uid 89); 6 Mar 2015 20:09:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 06 Mar 2015 20:09:42 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t26K9etP016887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 6 Mar 2015 15:09:41 -0500 Received: from reynosa.quesejoda.com (vpn-60-107.rdu2.redhat.com [10.10.60.107]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t26K9d62001203; Fri, 6 Mar 2015 15:09:40 -0500 Message-ID: <54FA0983.3010302@redhat.com> Date: Fri, 06 Mar 2015 12:09:39 -0800 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: jason merrill CC: gcc-patches Subject: [patch] add LAMBDA_EXPR support to debug_tree() Hi Jason. I know LAMBDA_EXPR will never make it to the -fdump-* files, but debugging them internally is a pain. I don't know how you fly blind :). Would it be ok to add tree dump support for them? Not pretty, but practical... Aldy commit 67794c518d439ff2f6a886b19c8e9f0ad32de43b Author: Aldy Hernandez Date: Fri Mar 6 11:54:31 2015 -0800 * ptree.c (cxx_print_lambda_node): New. (cxx_print_xnode): Handle LAMBDA_EXPR. diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index 79c80a3..2d0b584 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -204,6 +204,34 @@ cxx_print_identifier (FILE *file, tree node, int indent) } void +cxx_print_lambda_node (FILE *file, tree node, int indent) +{ + if (LAMBDA_EXPR_MUTABLE_P (node)) + fprintf (file, " /mutable"); + fprintf (file, " default_capture_mode=["); + switch (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (node)) + { + case CPLD_NONE: + fprintf (file, "NONE"); + break; + case CPLD_COPY: + fprintf (file, "COPY"); + break; + case CPLD_REFERENCE: + fprintf (file, "CPLD_REFERENCE"); + break; + default: + fprintf (file, "??"); + break; + } + fprintf (file, "] "); + print_node (file, "capture_list", LAMBDA_EXPR_CAPTURE_LIST (node), indent + 4); + print_node (file, "this_capture", LAMBDA_EXPR_THIS_CAPTURE (node), indent + 4); + print_node (file, "return_type", LAMBDA_EXPR_RETURN_TYPE (node), indent + 4); + print_node (file, "closure", LAMBDA_EXPR_CLOSURE (node), indent + 4); +} + +void cxx_print_xnode (FILE *file, tree node, int indent) { switch (TREE_CODE (node)) @@ -243,6 +271,9 @@ cxx_print_xnode (FILE *file, tree node, int indent) print_node (file, "pattern", DEFERRED_NOEXCEPT_PATTERN (node), indent+4); print_node (file, "args", DEFERRED_NOEXCEPT_ARGS (node), indent+4); break; + case LAMBDA_EXPR: + cxx_print_lambda_node (file, node, indent); + break; default: break; }