This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 3/4] Support dumping type bindings in lambda diagnostics.
- From: Adam Butcher <adam at jessamine dot co dot uk>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Andrew Sutton <andrew dot n dot sutton at gmail dot com>, Adam Butcher <adam at jessamine dot co dot uk>
- Date: Tue, 27 Aug 2013 20:42:52 +0100
- Subject: [PATCH 3/4] Support dumping type bindings in lambda diagnostics.
- Authentication-results: sourceware.org; auth=none
- References: <1377632573-14453-1-git-send-email-adam at jessamine dot co dot 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<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 (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)
{
--
1.8.4