diff mbox series

core: debug-print whole call expr

Message ID 39303332-c0ba-8dc4-9a88-be134f6ba0cc@acm.org
State New
Headers show
Series core: debug-print whole call expr | expand

Commit Message

Nathan Sidwell Nov. 2, 2020, 4:40 p.m. UTC
In debugging some call-expr handling, I got confused because the debug
printer	elided NULL call operands.  This changes the printer to	display
them as NULL.

         gcc/
         * print-tree.c (print_node): Display all the operands of a call
         expr.

pushing to trunk
diff mbox series

Patch

diff --git i/gcc/print-tree.c w/gcc/print-tree.c
index d1150e472d5..84bf8199b1e 100644
--- i/gcc/print-tree.c
+++ w/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