* [patch] add LAMBDA_EXPR support to debug_tree()
@ 2015-03-06 20:09 Aldy Hernandez
2015-03-06 21:51 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2015-03-06 20:09 UTC (permalink / raw)
To: jason merrill; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
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
[-- Attachment #2: curr --]
[-- Type: text/plain, Size: 1746 bytes --]
commit 67794c518d439ff2f6a886b19c8e9f0ad32de43b
Author: Aldy Hernandez <aldyh@redhat.com>
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] add LAMBDA_EXPR support to debug_tree()
2015-03-06 20:09 [patch] add LAMBDA_EXPR support to debug_tree() Aldy Hernandez
@ 2015-03-06 21:51 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2015-03-06 21:51 UTC (permalink / raw)
To: Aldy Hernandez; +Cc: gcc-patches
OK, sure.
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-06 21:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-06 20:09 [patch] add LAMBDA_EXPR support to debug_tree() Aldy Hernandez
2015-03-06 21:51 ` Jason Merrill
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).