This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to add RANGE_FOR_INIT_STMT to cxx_pretty_printer
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 8 Sep 2018 13:06:16 +0100
- Subject: Re: C++ PATCH to add RANGE_FOR_INIT_STMT to cxx_pretty_printer
- References: <20180907194809.GA12638@redhat.com>
OK.
On Fri, Sep 7, 2018 at 8:48 PM, Marek Polacek <polacek@redhat.com> wrote:
> Now that we have RANGE_FOR_INIT_STMT we should handle it in cxx_pretty_printer.
> I don't actually know how to trigger it but it seems straightforward to add.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>
> 2018-09-07 Marek Polacek <polacek@redhat.com>
>
> * cxx-pretty-print.c (cxx_pretty_printer::statement) <case
> RANGE_FOR_SMT>: Handle RANGE_FOR_INIT_STMT.
>
> diff --git gcc/cp/cxx-pretty-print.c gcc/cp/cxx-pretty-print.c
> index df81aa37ce8..8426c7246de 100644
> --- gcc/cp/cxx-pretty-print.c
> +++ 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;