aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 0fe3afc..fa956da 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5148,33 +5148,23 @@ protected_set_expr_location (tree t, location_t loc)
SET_EXPR_LOCATION (t, loc);
else if (t && TREE_CODE (t) == STATEMENT_LIST)
{
- /* With -gstatement-frontiers we could have a STATEMENT_LIST with
- DEBUG_BEGIN_STMT(s) and only a single other stmt, which with
- -g wouldn't be present and we'd have that single other stmt
- directly instead. */
- struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (t);
- if (!n)
- return;
- while (TREE_CODE (n->stmt) == DEBUG_BEGIN_STMT)
- {
- n = n->next;
- if (!n)
- return;
- }
- tree t2 = n->stmt;
- do
- {
- n = n->next;
- if (!n)
- {
- protected_set_expr_location (t2, loc);
- return;
- }
- }
- while (TREE_CODE (n->stmt) == DEBUG_BEGIN_STMT);
+ t = expr_single (t);
+ if (t && CAN_HAVE_LOCATION_P (t))
+ SET_EXPR_LOCATION (t, loc);
}
}
+/* Like PROTECTED_SET_EXPR_LOCATION, but only do that if T has
+ UNKNOWN_LOCATION. */
+
+void
+protected_set_expr_location_if_unset (tree t, location_t loc)
+{
+ t = expr_single (t);
+ if (t && !EXPR_HAS_LOCATION (t))
+ protected_set_expr_location (t, loc);
+}
+
/* Data used when collecting DECLs and TYPEs for language data removal. */
class free_lang_data_d