Commit 5b5dce39 by Marek Polacek Committed by Marek Polacek

cp-gimplify.c (genericize_if_stmt): Use protected_set_expr_location.

	* cp-gimplify.c (genericize_if_stmt): Use protected_set_expr_location.
	(genericize_cp_loop): Likewise.
	* decl.c (cxx_maybe_build_cleanup): Likewise.
	* parser.c (cp_parser_binary_expression): Likewise.
	(cp_parser_omp_for_loop): Likewise.
	(cp_parser_omp_construct): Likewise.
	* semantics.c (finish_transaction_stmt): Likewise.
	(build_transaction_expr): Likewise.

From-SVN: r228560
parent 00852255
2015-10-07 Marek Polacek <polacek@redhat.com>
* cp-gimplify.c (genericize_if_stmt): Use protected_set_expr_location.
(genericize_cp_loop): Likewise.
* decl.c (cxx_maybe_build_cleanup): Likewise.
* parser.c (cp_parser_binary_expression): Likewise.
(cp_parser_omp_for_loop): Likewise.
(cp_parser_omp_construct): Likewise.
* semantics.c (finish_transaction_stmt): Likewise.
(build_transaction_expr): Likewise.
2015-10-06 Jason Merrill <jason@redhat.com> 2015-10-06 Jason Merrill <jason@redhat.com>
PR c++/67810 PR c++/67810
......
...@@ -207,8 +207,8 @@ genericize_if_stmt (tree *stmt_p) ...@@ -207,8 +207,8 @@ genericize_if_stmt (tree *stmt_p)
stmt = else_; stmt = else_;
else else
stmt = build3 (COND_EXPR, void_type_node, cond, then_, else_); stmt = build3 (COND_EXPR, void_type_node, cond, then_, else_);
if (CAN_HAVE_LOCATION_P (stmt) && !EXPR_HAS_LOCATION (stmt)) if (!EXPR_HAS_LOCATION (stmt))
SET_EXPR_LOCATION (stmt, locus); protected_set_expr_location (stmt, locus);
*stmt_p = stmt; *stmt_p = stmt;
} }
...@@ -231,8 +231,7 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body, ...@@ -231,8 +231,7 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
blab = begin_bc_block (bc_break, start_locus); blab = begin_bc_block (bc_break, start_locus);
clab = begin_bc_block (bc_continue, start_locus); clab = begin_bc_block (bc_continue, start_locus);
if (incr && EXPR_P (incr)) protected_set_expr_location (incr, start_locus);
SET_EXPR_LOCATION (incr, start_locus);
cp_walk_tree (&cond, cp_genericize_r, data, NULL); cp_walk_tree (&cond, cp_genericize_r, data, NULL);
cp_walk_tree (&body, cp_genericize_r, data, NULL); cp_walk_tree (&body, cp_genericize_r, data, NULL);
......
...@@ -14964,8 +14964,7 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain) ...@@ -14964,8 +14964,7 @@ cxx_maybe_build_cleanup (tree decl, tsubst_flags_t complain)
a "jumpy" behaviour for users of debuggers when they step around a "jumpy" behaviour for users of debuggers when they step around
the end of the block. So let's unset the location of the the end of the block. So let's unset the location of the
destructor call instead. */ destructor call instead. */
if (cleanup != NULL && EXPR_P (cleanup)) protected_set_expr_location (cleanup, UNKNOWN_LOCATION);
SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION);
if (cleanup if (cleanup
&& !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl))) && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl)))
......
...@@ -8612,8 +8612,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p, ...@@ -8612,8 +8612,7 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p,
rhs, rhs_type, &overload, rhs, rhs_type, &overload,
complain_flags (decltype_p)); complain_flags (decltype_p));
current.lhs_type = current.tree_type; current.lhs_type = current.tree_type;
if (EXPR_P (current.lhs)) protected_set_expr_location (current.lhs, current.loc);
SET_EXPR_LOCATION (current.lhs, current.loc);
/* If the binary operator required the use of an overloaded operator, /* If the binary operator required the use of an overloaded operator,
then this expression cannot be an integral constant-expression. then this expression cannot be an integral constant-expression.
...@@ -32046,8 +32045,8 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses, ...@@ -32046,8 +32045,8 @@ cp_parser_omp_for_loop (cp_parser *parser, enum tree_code code, tree clauses,
incr = cp_parser_omp_for_incr (parser, real_decl); incr = cp_parser_omp_for_incr (parser, real_decl);
else else
incr = cp_parser_expression (parser); incr = cp_parser_expression (parser);
if (CAN_HAVE_LOCATION_P (incr) && !EXPR_HAS_LOCATION (incr)) if (!EXPR_HAS_LOCATION (incr))
SET_EXPR_LOCATION (incr, input_location); protected_set_expr_location (incr, input_location);
} }
if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN)) if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN))
...@@ -34045,8 +34044,7 @@ cp_parser_omp_construct (cp_parser *parser, cp_token *pragma_tok) ...@@ -34045,8 +34044,7 @@ cp_parser_omp_construct (cp_parser *parser, cp_token *pragma_tok)
gcc_unreachable (); gcc_unreachable ();
} }
if (stmt) protected_set_expr_location (stmt, pragma_tok->location);
SET_EXPR_LOCATION (stmt, pragma_tok->location);
} }
/* Transactional Memory parsing routines. */ /* Transactional Memory parsing routines. */
...@@ -7086,9 +7086,8 @@ finish_transaction_stmt (tree stmt, tree compound_stmt, int flags, tree noex) ...@@ -7086,9 +7086,8 @@ finish_transaction_stmt (tree stmt, tree compound_stmt, int flags, tree noex)
{ {
tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt), tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt),
noex); noex);
/* This may not be true when the STATEMENT_LIST is empty. */ protected_set_expr_location
if (EXPR_P (body)) (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
TREE_SIDE_EFFECTS (body) = 1; TREE_SIDE_EFFECTS (body) = 1;
TRANSACTION_EXPR_BODY (stmt) = body; TRANSACTION_EXPR_BODY (stmt) = body;
} }
...@@ -7108,8 +7107,7 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex) ...@@ -7108,8 +7107,7 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex)
if (noex) if (noex)
{ {
expr = build_must_not_throw_expr (expr, noex); expr = build_must_not_throw_expr (expr, noex);
if (EXPR_P (expr)) protected_set_expr_location (expr, loc);
SET_EXPR_LOCATION (expr, loc);
TREE_SIDE_EFFECTS (expr) = 1; TREE_SIDE_EFFECTS (expr) = 1;
} }
ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr); ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr);
......
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