This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Reinstate dump_generic_expr_loc
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard Sandiford <richard dot sandiford at arm dot com>, David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 2 Jul 2018 00:27:30 -0400
- Subject: [committed] Reinstate dump_generic_expr_loc
In r262149 ("Introduce dump_location_t", aka
c309657f69df19eaa590b6650acf4d3bea9ac9e6), I removed dump_generic_expr_loc
from dumpfile.h/c as it was unused in the source tree.
It looks like this was overzealous of me, as Richard wants to use it in
"Re: [14/n] PR85694: Rework overwidening detection"
https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01872.html
(which also reinstates the function, porting it to dump_location_t).
Sorry about the breakage.
This is a minimal patch to reinstate it, as I have followup patches to
dumpfile.c which need to touch it (and the other dump_* functions),
towards being able to save optimization records to a file.
I believe it's a subset of Richard's patch above.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
Committed to trunk as r262295 under the "obvious" rule.
gcc/ChangeLog:
* dumpfile.c (dump_generic_expr_loc): Undo removal of this
function in r262149, changing "loc" param from source_location to
const dump_location_t &.
* dumpfile.h (dump_generic_expr_loc): Undo removal of this
declaration, as above.
---
gcc/dumpfile.c | 22 ++++++++++++++++++++++
gcc/dumpfile.h | 2 ++
2 files changed, 24 insertions(+)
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 93bc651..5f69f9b 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -506,6 +506,28 @@ dump_generic_expr (dump_flags_t dump_kind, dump_flags_t extra_dump_flags,
print_generic_expr (alt_dump_file, t, dump_flags | extra_dump_flags);
}
+
+/* Similar to dump_generic_expr, except additionally print the source
+ location. */
+
+void
+dump_generic_expr_loc (dump_flags_t dump_kind, const dump_location_t &loc,
+ dump_flags_t extra_dump_flags, tree t)
+{
+ location_t srcloc = loc.get_location_t ();
+ if (dump_file && (dump_kind & pflags))
+ {
+ dump_loc (dump_kind, dump_file, srcloc);
+ print_generic_expr (dump_file, t, dump_flags | extra_dump_flags);
+ }
+
+ if (alt_dump_file && (dump_kind & alt_flags))
+ {
+ dump_loc (dump_kind, alt_dump_file, srcloc);
+ print_generic_expr (alt_dump_file, t, dump_flags | extra_dump_flags);
+ }
+}
+
/* Output a formatted message using FORMAT on appropriate dump streams. */
void
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 9828a3f..0e588a6 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -425,6 +425,8 @@ extern void dump_printf_loc (dump_flags_t, const dump_location_t &,
const char *, ...) ATTRIBUTE_PRINTF_3;
extern void dump_function (int phase, tree fn);
extern void dump_basic_block (dump_flags_t, basic_block, int);
+extern void dump_generic_expr_loc (dump_flags_t, const dump_location_t &,
+ dump_flags_t, tree);
extern void dump_generic_expr (dump_flags_t, dump_flags_t, tree);
extern void dump_gimple_stmt_loc (dump_flags_t, const dump_location_t &,
dump_flags_t, gimple *, int);
--
1.8.5.3