cxx-pretty-print.c (cxx_pretty_printer::statement): Handle RANGE_FOR_INIT_STMT.
authorMarek Polacek <polacek@redhat.com>
Sat, 8 Sep 2018 14:31:24 +0000 (14:31 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sat, 8 Sep 2018 14:31:24 +0000 (14:31 +0000)
* cxx-pretty-print.c (cxx_pretty_printer::statement) <case
RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.

From-SVN: r264170

gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c

index 70c462cad7817a529e0af68a41d6909512ccedc0..9ca0ef8c0fcce5e129bed9aa907132d05bf2576a 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-08  Marek Polacek  <polacek@redhat.com>
+
+       * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
+       RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
+
 2018-09-07  Marek Polacek  <polacek@redhat.com>
 
        PR c++/87152 - range-based for loops with initializer broken in templates.
index df81aa37ce89965106407943b15a8f0836edf795..8426c7246de76abd84de19da98871e88c292c225 100644 (file)
@@ -2021,6 +2021,12 @@ cxx_pretty_printer::statement (tree t)
       pp_cxx_ws_string (this, "for");
       pp_space (this);
       pp_cxx_left_paren (this);
+      if (RANGE_FOR_INIT_STMT (t))
+       {
+         statement (RANGE_FOR_INIT_STMT (t));
+         pp_needs_newline (this) = false;
+         pp_cxx_whitespace (this);
+       }
       statement (RANGE_FOR_DECL (t));
       pp_space (this);
       pp_needs_newline (this) = false;