From 86287716e8edba8da03305250e02e23eedc0d754 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 24 Oct 2016 18:04:01 +0200 Subject: [PATCH] cxx-pretty-print.c (pp_cxx_check_constraint): Use VAR_P (x) instead of TREE_CODE (x) == VAR_DECL. * cxx-pretty-print.c (pp_cxx_check_constraint): Use VAR_P (x) instead of TREE_CODE (x) == VAR_DECL. * constraint.cc (get_concept_definition): Likewise. (finish_shorthand_constraint): Likewise. * init.c (warn_placement_new_too_small): Likewise. * cp-gimplify.c (cp_genericize_r): Likewise. From-SVN: r241480 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/constraint.cc | 8 +++----- gcc/cp/cp-gimplify.c | 2 +- gcc/cp/cxx-pretty-print.c | 2 +- gcc/cp/init.c | 8 ++++---- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d9135369a02..0c5da96c3d3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2016-10-24 Jakub Jelinek + + * cxx-pretty-print.c (pp_cxx_check_constraint): Use VAR_P (x) + instead of TREE_CODE (x) == VAR_DECL. + * constraint.cc (get_concept_definition): Likewise. + (finish_shorthand_constraint): Likewise. + * init.c (warn_placement_new_too_small): Likewise. + * cp-gimplify.c (cp_genericize_r): Likewise. + 2016-10-21 Jason Merrill PR c++/77656 diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index b4d85c908c6..801f5a3d740 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -509,7 +509,7 @@ get_variable_initializer (tree var) tree get_concept_definition (tree decl) { - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) return get_variable_initializer (decl); else if (TREE_CODE (decl) == FUNCTION_DECL) return get_returned_expression (decl); @@ -1286,10 +1286,8 @@ finish_shorthand_constraint (tree decl, tree constr) the constraint an expansion. */ tree check; tree tmpl = DECL_TI_TEMPLATE (con); - if (TREE_CODE (con) == VAR_DECL) - { - check = build_concept_check (tmpl, arg, args); - } + if (VAR_P (con)) + check = build_concept_check (tmpl, arg, args); else { tree ovl = build_overload (tmpl, NULL_TREE); diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index b085f3a5731..9b9b51135aa 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1350,7 +1350,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) else if (TREE_CODE (stmt) == DECL_EXPR) { tree d = DECL_EXPR_DECL (stmt); - if (TREE_CODE (d) == VAR_DECL) + if (VAR_P (d)) gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d)); } else if (TREE_CODE (stmt) == OMP_PARALLEL diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index 5157faba23e..8c701ff705e 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -2788,7 +2788,7 @@ pp_cxx_check_constraint (cxx_pretty_printer *pp, tree t) tree args = CHECK_CONSTR_ARGS (t); tree id = build_nt (TEMPLATE_ID_EXPR, tmpl, args); - if (TREE_CODE (decl) == VAR_DECL) + if (VAR_P (decl)) pp->expression (id); else if (TREE_CODE (decl) == FUNCTION_DECL) { diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 455995a58d7..2418a9d48c1 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2362,7 +2362,7 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) to placement new is not checked since it's unknown what it might point to. */ if (TREE_CODE (oper) == PARM_DECL - || TREE_CODE (oper) == VAR_DECL + || VAR_P (oper) || TREE_CODE (oper) == COMPONENT_REF) return; @@ -2435,13 +2435,13 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) { tree op0 = oper; while (TREE_CODE (op0 = TREE_OPERAND (op0, 0)) == COMPONENT_REF); - if (TREE_CODE (op0) == VAR_DECL) + if (VAR_P (op0)) var_decl = op0; oper = TREE_OPERAND (oper, 1); } if ((addr_expr || !POINTER_TYPE_P (TREE_TYPE (oper))) - && (TREE_CODE (oper) == VAR_DECL + && (VAR_P (oper) || TREE_CODE (oper) == FIELD_DECL || TREE_CODE (oper) == PARM_DECL)) { @@ -2455,7 +2455,7 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) /* Treat members of unions and members of structs uniformly, even though the size of a member of a union may be viewed as extending to the end of the union itself (it is by __builtin_object_size). */ - if ((TREE_CODE (oper) == VAR_DECL || use_obj_size) + if ((VAR_P (oper) || use_obj_size) && DECL_SIZE_UNIT (oper) && tree_fits_uhwi_p (DECL_SIZE_UNIT (oper))) { -- 2.30.2