This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH to add RANGE_FOR_INIT_STMT to cxx_pretty_printer


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]