public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Adam Butcher <adam@jessamine.co.uk>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org,
	Gabriel Dos Reis <gdr@integrable-solutions.net>,
	Andrew Sutton <andrew.n.sutton@gmail.com>,
	Adam Butcher <adam@jessamine.co.uk>
Subject: [PATCH 3/3] Support dumping type bindings in lambda diagnostics.
Date: Sun, 11 Aug 2013 19:50:00 -0000	[thread overview]
Message-ID: <1376250573-13753-4-git-send-email-adam@jessamine.co.uk> (raw)
In-Reply-To: <1376250573-13753-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 440169a..bd5f8cc 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1374,14 +1374,7 @@ dump_function_decl (tree t, int flags)
   int do_outer_scope = ! (flags & TFF_UNQUALIFIED_NAME);
   tree exceptions;
   vec<tree, va_gc> *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 (DECL_CONTEXT (t), flags);
-      return;
-    }
+  bool lambda_p = false;
 
   flags &= ~(TFF_UNQUALIFIED_NAME | TFF_TEMPLATE_NAME);
   if (TREE_CODE (t) == TEMPLATE_DECL)
@@ -1443,16 +1436,23 @@ dump_function_decl (tree t, int flags)
   else if (cname)
     {
       dump_type (cname, flags);
-      pp_cxx_colon_colon (cxx_pp);
+      if (LAMBDA_TYPE_P (cname))
+	lambda_p = true;
+      else
+	pp_cxx_colon_colon (cxx_pp);
     }
   else
     dump_scope (CP_DECL_CONTEXT (t), flags);
 
-  dump_function_name (t, flags);
+  /* A lambda's signature is essentially its "type", which has already been
+     dumped.  */
+  if (!lambda_p)
+    dump_function_name (t, flags);
 
   if (!(flags & TFF_NO_FUNCTION_ARGUMENTS))
     {
-      dump_parameters (parmtypes, flags);
+      if (!lambda_p)
+	dump_parameters (parmtypes, flags);
 
       if (TREE_CODE (fntype) == METHOD_TYPE)
 	{
-- 
1.8.3

  parent reply	other threads:[~2013-08-11 19:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11 19:50 Lambda templates and implicit function templates Adam Butcher
2013-08-11 19:50 ` [PATCH 1/3] Support lambda templates Adam Butcher
2013-08-12 15:47   ` Jason Merrill
2013-08-12 23:52     ` Adam Butcher
2013-08-13 12:29       ` Jason Merrill
2013-08-11 19:50 ` [PATCH 2/3] Support using 'auto' in a function parameter list to introduce an implicit template parameter Adam Butcher
2013-08-12 16:52   ` Jason Merrill
2013-08-13  0:34     ` Adam Butcher
2013-08-14 14:07       ` Jason Merrill
2013-08-14 14:29         ` Gabriel Dos Reis
2013-08-11 19:50 ` Adam Butcher [this message]
2013-08-27 16:57   ` [PATCH 3/3] Support dumping type bindings in lambda diagnostics Jason Merrill
2013-08-27 19:43     ` Adam Butcher
2013-08-28  3:02       ` Jason Merrill
2013-08-28  9:08         ` [PATCH] Support dumping type bindings and 'mutable' qualifier " Adam Butcher
2013-08-28 12:57           ` Gabriel Dos Reis
2013-08-29 15:15             ` Adam Butcher
2013-08-29 15:57               ` Gabriel Dos Reis
2013-08-29 18:24                 ` Adam Butcher
2013-08-29 18:51                   ` Adam Butcher
2013-08-29 19:38                     ` Gabriel Dos Reis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376250573-13753-4-git-send-email-adam@jessamine.co.uk \
    --to=adam@jessamine.co.uk \
    --cc=andrew.n.sutton@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdr@integrable-solutions.net \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).