From 7887d808876c00e682e11c19caae1a0dbc9fa3a8 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 1 Mar 2024 13:36:51 -0500 Subject: 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. --- gcc/cp/parser.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'gcc/cp/parser.cc') 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); } -- cgit v1.1