From 61856507f42eef2a1474d4b629ed7db641b48a4f Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Sat, 8 Sep 2018 14:31:24 +0000 Subject: [PATCH] cxx-pretty-print.c (cxx_pretty_printer::statement): Handle RANGE_FOR_INIT_STMT. * cxx-pretty-print.c (cxx_pretty_printer::statement) : Handle RANGE_FOR_INIT_STMT. From-SVN: r264170 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/cxx-pretty-print.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 70c462cad78..9ca0ef8c0fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-09-08 Marek Polacek + + * cxx-pretty-print.c (cxx_pretty_printer::statement) : Handle RANGE_FOR_INIT_STMT. + 2018-09-07 Marek Polacek PR c++/87152 - range-based for loops with initializer broken in templates. diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index df81aa37ce8..8426c7246de 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -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; -- 2.30.2