public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] Show NULL call arguments
@ 2020-04-07 15:33 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-04-07 15:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:db372807726a1706e721fb3f2b006a3729673ff8

commit db372807726a1706e721fb3f2b006a3729673ff8
Author: Nathan Sidwell <nathan@acm.org>
Date:   Tue Apr 7 08:28:49 2020 -0700

    Show NULL call arguments
    
            gcc/
            * print-tree.c (print_node): Explicitly show CALL_EXPR null arguments.

Diff:
---
 ChangeLog.modules |  3 +++
 gcc/print-tree.c  | 20 +++++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog.modules b/ChangeLog.modules
index 0f8cbfa9f54..94cfcb40f5d 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,8 @@
 2020-04-07  Nathan Sidwell  <nathan@acm.org>
 
+	gcc/
+	* print-tree.c (print_node): Explicitly show CALL_EXPR null arguments.
+
 	gcc/cp/
 	* module.cc (trees_out::key_mergeable): Instantiations can have
 	requires.  Not just the template.
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 2a9c98ea7a0..7a3243bee47 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -742,20 +742,26 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
 	}
       if (code == CALL_EXPR)
 	{
-	  call_expr_arg_iterator iter;
-	  tree arg;
 	  print_node (file, "fn", CALL_EXPR_FN (node), indent + 4);
 	  print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node),
 		      indent + 4);
-	  i = 0;
-	  FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
+
+	  call_expr_arg_iterator iter;
+	  init_call_expr_arg_iterator (node, &iter);
+	  while (more_call_expr_args_p (&iter))
 	    {
 	      /* Buffer big enough to format a 32-bit UINT_MAX into, plus
 		 the text.  */
 	      char temp[15];
-	      sprintf (temp, "arg:%u", i);
-	      print_node (file, temp, arg, indent + 4);
-	      i++;
+	      sprintf (temp, "arg:%u", iter.i);
+	      tree arg = next_call_expr_arg (&iter);
+	      if (arg)
+		print_node (file, temp, arg, indent + 4);
+	      else
+		{
+		  indent_to (file, indent + 4);
+		  fprintf (file, "%s NULL", temp);
+		}
 	    }
 	}
       else


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-07 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 15:33 [gcc/devel/c++-modules] Show NULL call arguments Nathan Sidwell

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).