From patchwork Tue Aug 27 19:42:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 270211 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 "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 237FE2C00E6 for ; Wed, 28 Aug 2013 05:43:50 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=n4zC/A21OK0Vcq8qRgVdPvqw/dK1/ZcGY23J44FI5ex0M296dzIxv 1BMtJRZpqsYLGKcOY4nxC/VLiKxF7NWTld2cHIq8wyrcmtrbGl8j+ukZOc7RiG8d xsnOtVmVHaR9FTAfczyFZlEeVAeybJehrM++Ofw8DRpQVd0kXF/z0U= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=4xJLVp1QFht6J4+zwar/bDI0eXY=; b=NWjH9WW4sqOpAE4zPfjN rfeubv2T90jfXadwDAx1eh7HQq7hR5FPRTRS0z4/gvnvv1F095Kis0kIbwc5uW/K FJC33pXR54H0xBx84zDfprsHLut1T278MZlepCYEIPm+v7vHUOs59zixaGrRYisf /iqoD6HquJ0gwKyzC45I0DM= Received: (qmail 16069 invoked by alias); 27 Aug 2013 19:43:10 -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 16045 invoked by uid 89); 27 Aug 2013 19:43:10 -0000 Received: from mail-we0-f181.google.com (HELO mail-we0-f181.google.com) (74.125.82.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 27 Aug 2013 19:43:10 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=ALL_TRUSTED, AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED autolearn=ham version=3.3.2 X-HELO: mail-we0-f181.google.com Received: by mail-we0-f181.google.com with SMTP id q57so4220186wes.26 for ; Tue, 27 Aug 2013 12:43:06 -0700 (PDT) X-Received: by 10.180.38.98 with SMTP id f2mr6896992wik.39.1377632586610; Tue, 27 Aug 2013 12:43:06 -0700 (PDT) Received: from sphere.lan (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id ff5sm28553968wib.2.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Aug 2013 12:43:05 -0700 (PDT) From: Adam Butcher To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Gabriel Dos Reis , Andrew Sutton , Adam Butcher Subject: [PATCH 3/4] Support dumping type bindings in lambda diagnostics. Date: Tue, 27 Aug 2013 20:42:52 +0100 Message-Id: <1377632573-14453-4-git-send-email-adam@jessamine.co.uk> In-Reply-To: <1377632573-14453-1-git-send-email-adam@jessamine.co.uk> References: <1377632573-14453-1-git-send-email-adam@jessamine.co.uk> * error.c (dump_function_decl): Use standard diagnostic flow to dump a lambda diagnostic, albeit without stating the function name or duplicating the parameter spec (which is dumped as part of the type). --- gcc/cp/error.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gcc/cp/error.c b/gcc/cp/error.c index c82a0ce..27ff962 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1380,14 +1380,7 @@ dump_function_decl (cxx_pretty_printer *pp, tree t, int flags) int do_outer_scope = ! (flags & TFF_UNQUALIFIED_NAME); tree exceptions; vec *typenames = NULL; - - if (DECL_NAME (t) && LAMBDA_FUNCTION_P (t)) - { - /* A lambda's signature is essentially its "type", so defer. */ - gcc_assert (LAMBDA_TYPE_P (DECL_CONTEXT (t))); - dump_type (pp, DECL_CONTEXT (t), flags); - return; - } + bool lambda_p = false; flags &= ~(TFF_UNQUALIFIED_NAME | TFF_TEMPLATE_NAME); if (TREE_CODE (t) == TEMPLATE_DECL) @@ -1449,16 +1442,23 @@ dump_function_decl (cxx_pretty_printer *pp, tree t, int flags) else if (cname) { dump_type (pp, cname, flags); - pp_cxx_colon_colon (pp); + if (LAMBDA_TYPE_P (cname)) + lambda_p = true; + else + pp_cxx_colon_colon (pp); } else dump_scope (pp, CP_DECL_CONTEXT (t), flags); - dump_function_name (pp, t, flags); + /* A lambda's signature is essentially its "type", which has already been + dumped. */ + if (!lambda_p) + dump_function_name (pp, t, flags); if (!(flags & TFF_NO_FUNCTION_ARGUMENTS)) { - dump_parameters (pp, parmtypes, flags); + if (!lambda_p) + dump_parameters (pp, parmtypes, flags); if (TREE_CODE (fntype) == METHOD_TYPE) {