From bb42836b34dca74aab99035ac236fa6e81b1d4c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez?= Date: Fri, 3 Oct 2014 21:22:10 +0000 Subject: [PATCH] tree-pretty-print.c (dump_location): Make it extern. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit gcc/ChangeLog: 2014-10-03 Manuel López-Ibáñez * tree-pretty-print.c (dump_location): Make it extern. Dump also the column. * tree-pretty-print.h (dump_location): Declare. * gimple-pretty-print.c (dump_gimple_phi): Use dump_location. (pp_gimple_stmt_1): Likewise. (dump_implicit_edges): Likewise. * gimplify.c (gimplify_call_expr): Use LOCATION_FILE and LOCATION_LINE. gcc/testsuite/ChangeLog: 2014-10-03 Manuel López-Ibáñez * gcc.dg/tm/debug-1.c: Update regex. * c-c++-common/raw-string-18.c: Update regex. * c-c++-common/raw-string-19.c: Update regex. From-SVN: r215879 --- gcc/ChangeLog | 12 ++++++ gcc/gimple-pretty-print.c | 48 ++-------------------- gcc/gimplify.c | 8 ++-- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/c-c++-common/raw-string-18.c | 2 +- gcc/testsuite/c-c++-common/raw-string-19.c | 2 +- gcc/testsuite/gcc.dg/tm/debug-1.c | 8 ++-- gcc/tree-pretty-print.c | 6 ++- gcc/tree-pretty-print.h | 1 + 9 files changed, 37 insertions(+), 56 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7c42405773..96845dd8a32 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2014-10-03 Manuel López-Ibáñez + + * tree-pretty-print.c (dump_location): Make it extern. Dump also + the column. + * tree-pretty-print.h (dump_location): Declare. + * gimple-pretty-print.c (dump_gimple_phi): Use dump_location. + (pp_gimple_stmt_1): Likewise. + (dump_implicit_edges): Likewise. + * gimplify.c (gimplify_call_expr): Use LOCATION_FILE and + LOCATION_LINE. + + 2014-10-03 David Malcolm * gcc.c (driver::global_initializations): Remove "const" so diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 60b56b0d3d4..4a42d270a63 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1834,21 +1834,7 @@ dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, bool comment, for (i = 0; i < gimple_phi_num_args (phi); i++) { if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i)) - { - expanded_location xloc; - - xloc = expand_location (gimple_phi_arg_location (phi, i)); - pp_left_bracket (buffer); - if (xloc.file) - { - pp_string (buffer, xloc.file); - pp_string (buffer, " : "); - } - pp_decimal_int (buffer, xloc.line); - pp_colon (buffer); - pp_decimal_int (buffer, xloc.column); - pp_string (buffer, "] "); - } + dump_location (buffer, gimple_phi_arg_location (phi, i)); dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags, false); pp_left_paren (buffer); @@ -2076,19 +2062,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) pp_printf (buffer, "<&%p> ", (void *) gs); if ((flags & TDF_LINENO) && gimple_has_location (gs)) - { - expanded_location xloc = expand_location (gimple_location (gs)); - pp_left_bracket (buffer); - if (xloc.file) - { - pp_string (buffer, xloc.file); - pp_string (buffer, " : "); - } - pp_decimal_int (buffer, xloc.line); - pp_colon (buffer); - pp_decimal_int (buffer, xloc.column); - pp_string (buffer, "] "); - } + dump_location (buffer, gimple_location (gs)); if (flags & TDF_EH) { @@ -2404,22 +2378,8 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent, INDENT (indent); if ((flags & TDF_LINENO) - && e->goto_locus != UNKNOWN_LOCATION - ) - { - expanded_location goto_xloc; - goto_xloc = expand_location (e->goto_locus); - pp_left_bracket (buffer); - if (goto_xloc.file) - { - pp_string (buffer, goto_xloc.file); - pp_string (buffer, " : "); - } - pp_decimal_int (buffer, goto_xloc.line); - pp_string (buffer, " : "); - pp_decimal_int (buffer, goto_xloc.column); - pp_string (buffer, "] "); - } + && e->goto_locus != UNKNOWN_LOCATION) + dump_location (buffer, e->goto_locus); pp_cfg_jump (buffer, e->dest); pp_newline (buffer); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 5933dd2f668..6ee85f24d36 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2317,14 +2317,14 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) } case BUILT_IN_LINE: { - expanded_location loc = expand_location (EXPR_LOCATION (*expr_p)); - *expr_p = build_int_cst (TREE_TYPE (*expr_p), loc.line); + *expr_p = build_int_cst (TREE_TYPE (*expr_p), + LOCATION_LINE (EXPR_LOCATION (*expr_p))); return GS_OK; } case BUILT_IN_FILE: { - expanded_location loc = expand_location (EXPR_LOCATION (*expr_p)); - *expr_p = build_string_literal (strlen (loc.file) + 1, loc.file); + const char *locfile = LOCATION_FILE (EXPR_LOCATION (*expr_p)); + *expr_p = build_string_literal (strlen (locfile) + 1, locfile); return GS_OK; } case BUILT_IN_FUNCTION: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b8611ff0793..d0587414873 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-10-03 Manuel López-Ibáñez + + * gcc.dg/tm/debug-1.c: Update regex. + * c-c++-common/raw-string-18.c: Update regex. + * c-c++-common/raw-string-19.c: Update regex. + 2014-10-03 Marek Polacek PR c/63453 diff --git a/gcc/testsuite/c-c++-common/raw-string-18.c b/gcc/testsuite/c-c++-common/raw-string-18.c index 8d4381d1310..01dd339b180 100644 --- a/gcc/testsuite/c-c++-common/raw-string-18.c +++ b/gcc/testsuite/c-c++-common/raw-string-18.c @@ -17,5 +17,5 @@ main () } /* Verify call to foo is on line 15. */ -/* { dg-final { scan-tree-dump ": 15\[]:]\[^\n\r]*foo" "optimized" } } */ +/* { dg-final { scan-tree-dump "c:15:\[^\n\r\]*foo" "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/c-c++-common/raw-string-19.c b/gcc/testsuite/c-c++-common/raw-string-19.c index 08121a89f84..abbecfb950f 100644 --- a/gcc/testsuite/c-c++-common/raw-string-19.c +++ b/gcc/testsuite/c-c++-common/raw-string-19.c @@ -17,6 +17,6 @@ main () } /* Verify call to foo is on line 15. */ -/* { dg-final { scan-tree-dump ": 15\[]:]\[^\n\r]*foo" "optimized" } } */ +/* { dg-final { scan-tree-dump "c:15:\[^\n\r\]*foo" "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ /* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/tm/debug-1.c b/gcc/testsuite/gcc.dg/tm/debug-1.c index bccc0b31646..691cd77578a 100644 --- a/gcc/testsuite/gcc.dg/tm/debug-1.c +++ b/gcc/testsuite/gcc.dg/tm/debug-1.c @@ -19,8 +19,8 @@ int main() { return 0; } -/* { dg-final { scan-tree-dump-times ": 13:.*b = 9898" 1 "tmmark" } } */ -/* { dg-final { scan-tree-dump-times ": 14:.*_ITM_beginTransaction" 1 "tmmark" } } */ -/* { dg-final { scan-tree-dump-times ": 15:.*ITM_WU. \\(&z" 1 "tmmark" } } */ -/* { dg-final { scan-tree-dump-times ": 16:.*ITM_WU. \\(&a" 1 "tmmark" } } */ +/* { dg-final { scan-tree-dump-times ":13:.*b = 9898" 1 "tmmark" } } */ +/* { dg-final { scan-tree-dump-times ":14:.*_ITM_beginTransaction" 1 "tmmark" } } */ +/* { dg-final { scan-tree-dump-times ":15:.*ITM_WU. \\(&z" 1 "tmmark" } } */ +/* { dg-final { scan-tree-dump-times ":16:.*ITM_WU. \\(&a" 1 "tmmark" } } */ /* { dg-final { cleanup-tree-dump "tmmark" } } */ diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index ce0c655bd3d..0a59aac6572 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -677,7 +677,7 @@ dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags) /* Dump location LOC to BUFFER. */ -static void +void dump_location (pretty_printer *buffer, location_t loc) { expanded_location xloc = expand_location (loc); @@ -686,9 +686,11 @@ dump_location (pretty_printer *buffer, location_t loc) if (xloc.file) { pp_string (buffer, xloc.file); - pp_string (buffer, " : "); + pp_string (buffer, ":"); } pp_decimal_int (buffer, xloc.line); + pp_colon (buffer); + pp_decimal_int (buffer, xloc.column); pp_string (buffer, "] "); } diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h index d2ab0b75f39..bc73df73baa 100644 --- a/gcc/tree-pretty-print.h +++ b/gcc/tree-pretty-print.h @@ -50,5 +50,6 @@ extern void percent_K_format (text_info *); extern void pp_tree_identifier (pretty_printer *, tree); extern void dump_function_header (FILE *, tree, int); extern void pp_double_int (pretty_printer *pp, double_int d, bool uns); +extern void dump_location (pretty_printer *buffer, location_t loc); #endif /* ! GCC_TREE_PRETTY_PRINT_H */ -- 2.30.2