diff options
author | Jason Merrill <jason@redhat.com> | 2010-10-31 22:04:39 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-10-31 22:04:39 -0400 |
commit | ec52b1115dda4b0e38aa5620b0c3914b69008a24 (patch) | |
tree | c668c63e9650ae10b834fb88da25c23030215504 /gcc/gimplify.c | |
parent | 202be748c9997016f1b08c98291db4b7b9b02a5f (diff) | |
download | gcc-ec52b1115dda4b0e38aa5620b0c3914b69008a24.zip gcc-ec52b1115dda4b0e38aa5620b0c3914b69008a24.tar.gz gcc-ec52b1115dda4b0e38aa5620b0c3914b69008a24.tar.bz2 |
tree.h (EXPR_LOC_OR_HERE): New macro.
* tree.h (EXPR_LOC_OR_HERE): New macro.
* builtins.c (c_strlen): Use it.
* c-decl.c (build_enumerator): Likewise.
* gimplify.c (internal_get_tmp_var): Likewise.
(shortcut_cond_expr): Likewise.
(gimplify_one_sizepos): Likewise.
c-family/
* c-common.c (conversion_warning, warn_for_collisions_1): Use
EXPR_LOC_OR_HERE.
cp/
* decl.c (pop_switch): Use EXPR_LOC_OR_HERE.
* typeck.c (convert_for_assignment): Likewise.
From-SVN: r166123
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 87b57f0..885f013 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -587,10 +587,7 @@ internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p, mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val)); - if (EXPR_HAS_LOCATION (val)) - SET_EXPR_LOCATION (mod, EXPR_LOCATION (val)); - else - SET_EXPR_LOCATION (mod, input_location); + SET_EXPR_LOCATION (mod, EXPR_LOC_OR_HERE (val)); /* gimplify_modify_expr might want to reduce this further. */ gimplify_and_add (mod, pre_p); @@ -2620,8 +2617,7 @@ shortcut_cond_expr (tree expr) while (TREE_CODE (pred) == TRUTH_ANDIF_EXPR) { /* Keep the original source location on the first 'if'. */ - location_t locus = EXPR_HAS_LOCATION (expr) - ? EXPR_LOCATION (expr) : input_location; + location_t locus = EXPR_LOC_OR_HERE (expr); TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1); /* Set the source location of the && on the second 'if'. */ if (EXPR_HAS_LOCATION (pred)) @@ -2643,8 +2639,7 @@ shortcut_cond_expr (tree expr) while (TREE_CODE (pred) == TRUTH_ORIF_EXPR) { /* Keep the original source location on the first 'if'. */ - location_t locus = EXPR_HAS_LOCATION (expr) - ? EXPR_LOCATION (expr) : input_location; + location_t locus = EXPR_LOC_OR_HERE (expr); TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1); /* Set the source location of the || on the second 'if'. */ if (EXPR_HAS_LOCATION (pred)) @@ -2708,8 +2703,7 @@ shortcut_cond_expr (tree expr) /* If there was nothing else in our arms, just forward the label(s). */ if (!then_se && !else_se) return shortcut_cond_r (pred, true_label_p, false_label_p, - EXPR_HAS_LOCATION (expr) - ? EXPR_LOCATION (expr) : input_location); + EXPR_LOC_OR_HERE (expr)); /* If our last subexpression already has a terminal label, reuse it. */ if (else_se) @@ -2741,8 +2735,7 @@ shortcut_cond_expr (tree expr) jump_over_else = block_may_fallthru (then_); pred = shortcut_cond_r (pred, true_label_p, false_label_p, - EXPR_HAS_LOCATION (expr) - ? EXPR_LOCATION (expr) : input_location); + EXPR_LOC_OR_HERE (expr)); expr = NULL; append_to_statement_list (pred, &expr); @@ -7638,10 +7631,7 @@ gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p) *expr_p = create_tmp_var (type, NULL); tmp = build1 (NOP_EXPR, type, expr); stmt = gimplify_assign (*expr_p, tmp, stmt_p); - if (EXPR_HAS_LOCATION (expr)) - gimple_set_location (stmt, EXPR_LOCATION (expr)); - else - gimple_set_location (stmt, input_location); + gimple_set_location (stmt, EXPR_LOC_OR_HERE (expr)); } } |