diff options
author | Marek Polacek <polacek@redhat.com> | 2024-09-24 17:54:04 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2024-09-25 09:52:22 -0400 |
commit | 1fea6f82489006cfec3171f77bde8b5ed3527616 (patch) | |
tree | e6d422432a9cf3622c1b53cc7b8dc91cb2939b4a /gcc/cp/tree.cc | |
parent | 08b8341f209be7c7e301853bdbbcad4f8e1695f5 (diff) | |
download | gcc-1fea6f82489006cfec3171f77bde8b5ed3527616.zip gcc-1fea6f82489006cfec3171f77bde8b5ed3527616.tar.gz gcc-1fea6f82489006cfec3171f77bde8b5ed3527616.tar.bz2 |
c++: use TARGET_EXPR accessors
While futzing around with PR116416 I noticed that we can use
the _SLOT and _INITIAL macros to make the code more readable.
gcc/c-family/ChangeLog:
* c-pretty-print.cc (c_pretty_printer::primary_expression): Use
TARGET_EXPR accessors.
(c_pretty_printer::expression): Likewise.
gcc/cp/ChangeLog:
* coroutines.cc (build_co_await): Use TARGET_EXPR accessors.
(finish_co_yield_expr): Likewise.
(register_awaits): Likewise.
(tmp_target_expr_p): Likewise.
(flatten_await_stmt): Likewise.
* error.cc (dump_expr): Likewise.
* semantics.cc (finish_omp_target_clauses): Likewise.
* tree.cc (bot_manip): Likewise.
(cp_tree_equal): Likewise.
* typeck.cc (cxx_mark_addressable): Likewise.
(cp_build_compound_expr): Likewise.
(cp_build_modify_expr): Likewise.
(check_return_expr): Likewise.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp/tree.cc')
-rw-r--r-- | gcc/cp/tree.cc | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index f43febe..e8d8b2a 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -3138,17 +3138,17 @@ bot_manip (tree* tp, int* walk_subtrees, void* data_) { tree u; - if (TREE_CODE (TREE_OPERAND (t, 1)) == AGGR_INIT_EXPR) + if (TREE_CODE (TARGET_EXPR_INITIAL (t)) == AGGR_INIT_EXPR) { - u = build_cplus_new (TREE_TYPE (t), TREE_OPERAND (t, 1), + u = build_cplus_new (TREE_TYPE (t), TARGET_EXPR_INITIAL (t), tf_warning_or_error); if (u == error_mark_node) return u; - if (AGGR_INIT_ZERO_FIRST (TREE_OPERAND (t, 1))) - AGGR_INIT_ZERO_FIRST (TREE_OPERAND (u, 1)) = true; + if (AGGR_INIT_ZERO_FIRST (TARGET_EXPR_INITIAL (t))) + AGGR_INIT_ZERO_FIRST (TARGET_EXPR_INITIAL (u)) = true; } else - u = force_target_expr (TREE_TYPE (t), TREE_OPERAND (t, 1), + u = force_target_expr (TREE_TYPE (t), TARGET_EXPR_INITIAL (t), tf_warning_or_error); TARGET_EXPR_IMPLICIT_P (u) = TARGET_EXPR_IMPLICIT_P (t); @@ -3158,12 +3158,12 @@ bot_manip (tree* tp, int* walk_subtrees, void* data_) /* Map the old variable to the new one. */ splay_tree_insert (target_remap, - (splay_tree_key) TREE_OPERAND (t, 0), - (splay_tree_value) TREE_OPERAND (u, 0)); + (splay_tree_key) TARGET_EXPR_SLOT (t), + (splay_tree_value) TARGET_EXPR_SLOT (u)); - TREE_OPERAND (u, 1) = break_out_target_exprs (TREE_OPERAND (u, 1), - data.clear_location); - if (TREE_OPERAND (u, 1) == error_mark_node) + TARGET_EXPR_INITIAL (u) = break_out_target_exprs (TARGET_EXPR_INITIAL (u), + data.clear_location); + if (TARGET_EXPR_INITIAL (u) == error_mark_node) return error_mark_node; if (data.clear_location) @@ -4034,8 +4034,8 @@ cp_tree_equal (tree t1, tree t2) case TARGET_EXPR: { - tree o1 = TREE_OPERAND (t1, 0); - tree o2 = TREE_OPERAND (t2, 0); + tree o1 = TARGET_EXPR_SLOT (t1); + tree o2 = TARGET_EXPR_SLOT (t2); /* Special case: if either target is an unallocated VAR_DECL, it means that it's going to be unified with whatever the @@ -4050,7 +4050,8 @@ cp_tree_equal (tree t1, tree t2) else if (!cp_tree_equal (o1, o2)) return false; - return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1)); + return cp_tree_equal (TARGET_EXPR_INITIAL (t1), + TARGET_EXPR_INITIAL (t2)); } case PARM_DECL: |