Commit e368f44f by Dehao Chen Committed by Dehao Chen

tree-eh.c (lower_try_finally_onedest): Set correct location for deallocator.

gcc:
	2012-10-10  Dehao Chen  <dehao@google.com>

	* tree-eh.c (lower_try_finally_onedest): Set correct location for
	deallocator.
	* gimplify.c (gimplify_expr): Set correct location for TRY stmt.

gcc/cp:
	2012-10-10  Dehao Chen  <dehao@google.com>

	* cp-gimplify.c (cp_genericize_r): Set location for TRY expr.

testsuite:
	2012-10-10  Dehao Chen  <dehao@google.com>

	* g++.dg/debug/dwarf2/deallocator.C: Cover more deallocator cases.

From-SVN: r192285
parent 2c62c8ec
2012-10-10 Dehao Chen <dehao@google.com>
* tree-eh.c (lower_try_finally_onedest): Set correct location for
deallocator.
* gimplify.c (gimplify_expr): Set correct location for TRY stmt.
2012-10-10 Oleg Endo <olegendo@gcc.gnu.org> 2012-10-10 Oleg Endo <olegendo@gcc.gnu.org>
PR target/52480 PR target/52480
......
2012-10-10 Dehao Chen <dehao@google.com>
* cp-gimplify.c (cp_genericize_r): Set location for TRY expr.
2012-10-09 Lawrence Crowl <crowl@google.com> 2012-10-09 Lawrence Crowl <crowl@google.com>
* Make-lang.in (class.o): Add dependence on hash-table.h. * Make-lang.in (class.o): Add dependence on hash-table.h.
......
...@@ -948,11 +948,12 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -948,11 +948,12 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
to lower this construct before scanning it, so we need to lower these to lower this construct before scanning it, so we need to lower these
before doing anything else. */ before doing anything else. */
else if (TREE_CODE (stmt) == CLEANUP_STMT) else if (TREE_CODE (stmt) == CLEANUP_STMT)
*stmt_p = build2 (CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR *stmt_p = build2_loc (EXPR_LOCATION (stmt),
: TRY_FINALLY_EXPR, CLEANUP_EH_ONLY (stmt) ? TRY_CATCH_EXPR
void_type_node, : TRY_FINALLY_EXPR,
CLEANUP_BODY (stmt), void_type_node,
CLEANUP_EXPR (stmt)); CLEANUP_BODY (stmt),
CLEANUP_EXPR (stmt));
else if (TREE_CODE (stmt) == IF_STMT) else if (TREE_CODE (stmt) == IF_STMT)
{ {
......
...@@ -7475,6 +7475,10 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, ...@@ -7475,6 +7475,10 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
TREE_CODE (*expr_p) == TRY_FINALLY_EXPR TREE_CODE (*expr_p) == TRY_FINALLY_EXPR
? GIMPLE_TRY_FINALLY ? GIMPLE_TRY_FINALLY
: GIMPLE_TRY_CATCH); : GIMPLE_TRY_CATCH);
if (LOCATION_LOCUS (saved_location) != UNKNOWN_LOCATION)
gimple_set_location (try_, saved_location);
else
gimple_set_location (try_, EXPR_LOCATION (save_expr));
if (TREE_CODE (*expr_p) == TRY_CATCH_EXPR) if (TREE_CODE (*expr_p) == TRY_CATCH_EXPR)
gimple_try_set_catch_is_cleanup (try_, gimple_try_set_catch_is_cleanup (try_,
TRY_CATCH_IS_CLEANUP (*expr_p)); TRY_CATCH_IS_CLEANUP (*expr_p));
......
2012-10-10 Dehao Chen <dehao@google.com>
* g++.dg/debug/dwarf2/deallocator.C: Cover more deallocator cases.
2012-10-10 Oleg Endo <olegendo@gcc.gnu.org> 2012-10-10 Oleg Endo <olegendo@gcc.gnu.org>
PR target/52480 PR target/52480
......
...@@ -18,6 +18,7 @@ int bar(); ...@@ -18,6 +18,7 @@ int bar();
void foo(int i) void foo(int i)
{ {
t test_outside;
for (int j = 0; j < 10; j++) for (int j = 0; j < 10; j++)
{ {
t test; t test;
...@@ -28,6 +29,18 @@ void foo(int i) ...@@ -28,6 +29,18 @@ void foo(int i)
return; return;
} }
} }
if (i)
{
t test;
if (i == 10)
{
test.bar();
}
}
test_outside.foo();
return; return;
} }
// { dg-final { scan-assembler "deallocator.C:28" } } // { dg-final { scan-assembler "deallocator.C:29" } }
// { dg-final { scan-assembler "deallocator.C:31" } }
// { dg-final { scan-assembler "deallocator.C:38" } }
// { dg-final { scan-assembler "deallocator.C:41" } }
...@@ -1100,6 +1100,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf) ...@@ -1100,6 +1100,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
struct goto_queue_node *q, *qe; struct goto_queue_node *q, *qe;
gimple x; gimple x;
gimple_seq finally; gimple_seq finally;
gimple_stmt_iterator gsi;
tree finally_label; tree finally_label;
location_t loc = gimple_location (tf->try_finally_expr); location_t loc = gimple_location (tf->try_finally_expr);
...@@ -1120,6 +1121,17 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf) ...@@ -1120,6 +1121,17 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
lower_eh_constructs_1 (state, &finally); lower_eh_constructs_1 (state, &finally);
for (gsi = gsi_start (finally); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
{
tree block = gimple_block (stmt);
gimple_set_location (stmt, gimple_location (tf->try_finally_expr));
gimple_set_block (stmt, block);
}
}
if (tf->may_throw) if (tf->may_throw)
{ {
/* Only reachable via the exception edge. Add the given label to /* Only reachable via the exception edge. Add the given label to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment