support TARGET_MEM_REF in C/C++ error pretty-printing [PR97197]
authorJakub Jelinek <jakub@redhat.com>
Mon, 5 Oct 2020 16:33:17 +0000 (18:33 +0200)
committerJakub Jelinek <jakub@redhat.com>
Mon, 5 Oct 2020 16:41:53 +0000 (18:41 +0200)
commitac1c65ad1a16d83ec63674efa07c00b062562f15
treef89a8b33f8afa2ae081f75e9762bffc3c3a798f2
parentf92a504fdd943527687faf9557e0b39ff7fe6125
support TARGET_MEM_REF in C/C++ error pretty-printing [PR97197]

> See my comment above for Martins attempts to improve things.  I don't
> really want to try decide what to do with those late diagnostic IL
> printing but my commit was blamed for showing target-mem-ref unsupported.
>
> I don't have much time to spend to think what to best print and what not,
> but yes, printing only the MEM_REF part is certainly imprecise.

Here is an updated version of the patch that prints TARGET_MEM_REF the way
it should be printed - as C representation of what it actually means.
Of course it would be better to have the original expressions, but with the
late diagnostics we no longer have them.

2020-10-05  Richard Biener  <rguenther@suse.de>
    Jakub Jelinek  <jakub@redhat.com>

PR c++/97197
gcc/cp/
* error.c (dump_expr): Handle TARGET_MEM_REF.
gcc/c-family/
* c-pretty-print.c: Include langhooks.h.
(c_pretty_printer::postfix_expression): Handle TARGET_MEM_REF as
expression.
(c_pretty_printer::expression): Handle TARGET_MEM_REF as
unary_expression.
(c_pretty_printer::unary_expression): Handle TARGET_MEM_REF.
gcc/c-family/c-pretty-print.c
gcc/cp/error.c