aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.cc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2024-03-01 13:36:51 -0500
committerMarek Polacek <polacek@redhat.com>2024-05-07 15:09:20 -0400
commit7887d808876c00e682e11c19caae1a0dbc9fa3a8 (patch)
tree2f8ff1e33989dc8d18641b15ad2e548b53128c60 /gcc/cp/parser.cc
parent76e591200f54226290ddb49b8ac6231a694bf882 (diff)
downloadgcc-7887d808876c00e682e11c19caae1a0dbc9fa3a8.zip
gcc-7887d808876c00e682e11c19caae1a0dbc9fa3a8.tar.gz
gcc-7887d808876c00e682e11c19caae1a0dbc9fa3a8.tar.bz2
c++: DECL_DECOMPOSITION_P cleanup
DECL_DECOMPOSITION_P already checks VAR_P but we repeat the check in a lot of places. gcc/cp/ChangeLog: * decl.cc (duplicate_decls): Don't check VAR_P before DECL_DECOMPOSITION_P. * init.cc (build_aggr_init): Likewise. * parser.cc (cp_parser_range_for): Likewise. (do_range_for_auto_deduction): Likewise. (cp_convert_range_for): Likewise. (cp_convert_omp_range_for): Likewise. (cp_finish_omp_range_for): Likewise. * pt.cc (extract_locals_r): Likewise. (tsubst_omp_for_iterator): Likewise. (tsubst_decomp_names): Likewise. (tsubst_stmt): Likewise. * typeck.cc (maybe_warn_about_returning_address_of_local): Likewise.
Diffstat (limited to 'gcc/cp/parser.cc')
-rw-r--r--gcc/cp/parser.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 66ce161..775067e 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -14122,7 +14122,6 @@ cp_parser_range_for (cp_parser *parser, tree scope, tree init, tree range_decl,
/* For decomposition declaration get all of the corresponding
declarations out of the way. */
if (TREE_CODE (v) == ARRAY_REF
- && VAR_P (TREE_OPERAND (v, 0))
&& DECL_DECOMPOSITION_P (TREE_OPERAND (v, 0)))
{
tree d = range_decl;
@@ -14243,7 +14242,7 @@ do_range_for_auto_deduction (tree decl, tree range_expr, cp_decomp *decomp)
iter_decl, auto_node,
tf_warning_or_error,
adc_variable_type);
- if (VAR_P (decl) && DECL_DECOMPOSITION_P (decl))
+ if (DECL_DECOMPOSITION_P (decl))
cp_finish_decomp (decl, decomp);
}
}
@@ -14442,7 +14441,7 @@ cp_convert_range_for (tree statement, tree range_decl, tree range_expr,
cp_finish_decl (range_decl, deref_begin,
/*is_constant_init*/false, NULL_TREE,
LOOKUP_ONLYCONVERTING, decomp);
- if (VAR_P (range_decl) && DECL_DECOMPOSITION_P (range_decl))
+ if (DECL_DECOMPOSITION_P (range_decl))
cp_finish_decomp (range_decl, decomp);
warn_for_range_copy (range_decl, deref_begin);
@@ -44440,7 +44439,6 @@ cp_convert_omp_range_for (tree &this_pre_body, tree &sl,
{
tree v = DECL_VALUE_EXPR (decl);
if (TREE_CODE (v) == ARRAY_REF
- && VAR_P (TREE_OPERAND (v, 0))
&& DECL_DECOMPOSITION_P (TREE_OPERAND (v, 0)))
{
d = TREE_OPERAND (v, 0);
@@ -44545,7 +44543,6 @@ cp_convert_omp_range_for (tree &this_pre_body, tree &sl,
{
tree v = DECL_VALUE_EXPR (orig_decl);
if (TREE_CODE (v) == ARRAY_REF
- && VAR_P (TREE_OPERAND (v, 0))
&& DECL_DECOMPOSITION_P (TREE_OPERAND (v, 0)))
{
tree d = orig_decl;
@@ -44623,7 +44620,7 @@ cp_finish_omp_range_for (tree orig, tree begin)
tree decl = TREE_VEC_ELT (TREE_CHAIN (orig), 2);
cp_decomp decomp_d, *decomp = NULL;
- if (VAR_P (decl) && DECL_DECOMPOSITION_P (decl))
+ if (DECL_DECOMPOSITION_P (decl))
{
decomp = &decomp_d;
decomp_d.decl = TREE_VEC_ELT (TREE_CHAIN (orig), 3);
@@ -44649,7 +44646,7 @@ cp_finish_omp_range_for (tree orig, tree begin)
NULL_TREE, tf_warning_or_error),
/*is_constant_init*/false, NULL_TREE,
LOOKUP_ONLYCONVERTING, decomp);
- if (VAR_P (decl) && DECL_DECOMPOSITION_P (decl))
+ if (DECL_DECOMPOSITION_P (decl))
cp_finish_decomp (decl, decomp);
}