public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++: improve dumping of templated decls
@ 2021-09-22 15:56 Patrick Palka
  2021-09-22 20:05 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2021-09-22 15:56 UTC (permalink / raw)
  To: gcc-patches

This makes the dumping routines output more information for templated
decls, to help streamline debugging.

Tested on x86_64-pc-linux-gnu, does this look OK for trunk?

gcc/cp/ChangeLog:

	* ptree.c (cxx_print_decl): Dump the DECL_TEMPLATE_RESULT of
	a TEMPLATE_DECL.  Dump the DECL_TEMPLATE_INFO rather than just
	printing its pointer.
---
 gcc/cp/ptree.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index 7f140f5f06b..1dcd764af01 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -51,6 +51,7 @@ cxx_print_decl (FILE *file, tree node, int indent)
     }
   else if (TREE_CODE (node) == TEMPLATE_DECL)
     {
+      print_node (file, "result", DECL_TEMPLATE_RESULT (node), indent + 4);
       print_node (file, "parms", DECL_TEMPLATE_PARMS (node), indent + 4);
       indent_to (file, indent + 3);
       fprintf (file, " full-name \"%s\"",
@@ -115,13 +116,8 @@ cxx_print_decl (FILE *file, tree node, int indent)
   
   if (VAR_OR_FUNCTION_DECL_P (node)
       && DECL_TEMPLATE_INFO (node))
-    {
-      if (need_indent)
-	indent_to (file, indent + 3);
-      fprintf (file, " template-info %p",
-	       (void *) DECL_TEMPLATE_INFO (node));
-      need_indent = false;
-    }
+    print_node (file, "template-info", DECL_TEMPLATE_INFO (node),
+		indent + 4);
 }
 
 void
-- 
2.33.0.514.g99c99ed825


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] c++: improve dumping of templated decls
  2021-09-22 15:56 [PATCH] c++: improve dumping of templated decls Patrick Palka
@ 2021-09-22 20:05 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2021-09-22 20:05 UTC (permalink / raw)
  To: Patrick Palka, gcc-patches

On 9/22/21 11:56, Patrick Palka wrote:
> This makes the dumping routines output more information for templated
> decls, to help streamline debugging.
> 
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?

OK.

> gcc/cp/ChangeLog:
> 
> 	* ptree.c (cxx_print_decl): Dump the DECL_TEMPLATE_RESULT of
> 	a TEMPLATE_DECL.  Dump the DECL_TEMPLATE_INFO rather than just
> 	printing its pointer.
> ---
>   gcc/cp/ptree.c | 10 +++-------
>   1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
> index 7f140f5f06b..1dcd764af01 100644
> --- a/gcc/cp/ptree.c
> +++ b/gcc/cp/ptree.c
> @@ -51,6 +51,7 @@ cxx_print_decl (FILE *file, tree node, int indent)
>       }
>     else if (TREE_CODE (node) == TEMPLATE_DECL)
>       {
> +      print_node (file, "result", DECL_TEMPLATE_RESULT (node), indent + 4);
>         print_node (file, "parms", DECL_TEMPLATE_PARMS (node), indent + 4);
>         indent_to (file, indent + 3);
>         fprintf (file, " full-name \"%s\"",
> @@ -115,13 +116,8 @@ cxx_print_decl (FILE *file, tree node, int indent)
>     
>     if (VAR_OR_FUNCTION_DECL_P (node)
>         && DECL_TEMPLATE_INFO (node))
> -    {
> -      if (need_indent)
> -	indent_to (file, indent + 3);
> -      fprintf (file, " template-info %p",
> -	       (void *) DECL_TEMPLATE_INFO (node));
> -      need_indent = false;
> -    }
> +    print_node (file, "template-info", DECL_TEMPLATE_INFO (node),
> +		indent + 4);
>   }
>   
>   void
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-22 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 15:56 [PATCH] c++: improve dumping of templated decls Patrick Palka
2021-09-22 20:05 ` 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).