Commit 86287716 by Jakub Jelinek Committed by Jakub Jelinek

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
parent a3f6007c
2016-10-24 Jakub Jelinek <jakub@redhat.com>
* 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 <jason@redhat.com> 2016-10-21 Jason Merrill <jason@redhat.com>
PR c++/77656 PR c++/77656
......
...@@ -509,7 +509,7 @@ get_variable_initializer (tree var) ...@@ -509,7 +509,7 @@ get_variable_initializer (tree var)
tree tree
get_concept_definition (tree decl) get_concept_definition (tree decl)
{ {
if (TREE_CODE (decl) == VAR_DECL) if (VAR_P (decl))
return get_variable_initializer (decl); return get_variable_initializer (decl);
else if (TREE_CODE (decl) == FUNCTION_DECL) else if (TREE_CODE (decl) == FUNCTION_DECL)
return get_returned_expression (decl); return get_returned_expression (decl);
...@@ -1286,10 +1286,8 @@ finish_shorthand_constraint (tree decl, tree constr) ...@@ -1286,10 +1286,8 @@ finish_shorthand_constraint (tree decl, tree constr)
the constraint an expansion. */ the constraint an expansion. */
tree check; tree check;
tree tmpl = DECL_TI_TEMPLATE (con); tree tmpl = DECL_TI_TEMPLATE (con);
if (TREE_CODE (con) == VAR_DECL) if (VAR_P (con))
{ check = build_concept_check (tmpl, arg, args);
check = build_concept_check (tmpl, arg, args);
}
else else
{ {
tree ovl = build_overload (tmpl, NULL_TREE); tree ovl = build_overload (tmpl, NULL_TREE);
......
...@@ -1350,7 +1350,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -1350,7 +1350,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
else if (TREE_CODE (stmt) == DECL_EXPR) else if (TREE_CODE (stmt) == DECL_EXPR)
{ {
tree d = DECL_EXPR_DECL (stmt); 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)); gcc_assert (CP_DECL_THREAD_LOCAL_P (d) == DECL_THREAD_LOCAL_P (d));
} }
else if (TREE_CODE (stmt) == OMP_PARALLEL else if (TREE_CODE (stmt) == OMP_PARALLEL
......
...@@ -2788,7 +2788,7 @@ pp_cxx_check_constraint (cxx_pretty_printer *pp, tree t) ...@@ -2788,7 +2788,7 @@ pp_cxx_check_constraint (cxx_pretty_printer *pp, tree t)
tree args = CHECK_CONSTR_ARGS (t); tree args = CHECK_CONSTR_ARGS (t);
tree id = build_nt (TEMPLATE_ID_EXPR, tmpl, args); tree id = build_nt (TEMPLATE_ID_EXPR, tmpl, args);
if (TREE_CODE (decl) == VAR_DECL) if (VAR_P (decl))
pp->expression (id); pp->expression (id);
else if (TREE_CODE (decl) == FUNCTION_DECL) else if (TREE_CODE (decl) == FUNCTION_DECL)
{ {
......
...@@ -2362,7 +2362,7 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) ...@@ -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 to placement new is not checked since it's unknown what it might
point to. */ point to. */
if (TREE_CODE (oper) == PARM_DECL if (TREE_CODE (oper) == PARM_DECL
|| TREE_CODE (oper) == VAR_DECL || VAR_P (oper)
|| TREE_CODE (oper) == COMPONENT_REF) || TREE_CODE (oper) == COMPONENT_REF)
return; return;
...@@ -2435,13 +2435,13 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) ...@@ -2435,13 +2435,13 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper)
{ {
tree op0 = oper; tree op0 = oper;
while (TREE_CODE (op0 = TREE_OPERAND (op0, 0)) == COMPONENT_REF); while (TREE_CODE (op0 = TREE_OPERAND (op0, 0)) == COMPONENT_REF);
if (TREE_CODE (op0) == VAR_DECL) if (VAR_P (op0))
var_decl = op0; var_decl = op0;
oper = TREE_OPERAND (oper, 1); oper = TREE_OPERAND (oper, 1);
} }
if ((addr_expr || !POINTER_TYPE_P (TREE_TYPE (oper))) 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) == FIELD_DECL
|| TREE_CODE (oper) == PARM_DECL)) || TREE_CODE (oper) == PARM_DECL))
{ {
...@@ -2455,7 +2455,7 @@ warn_placement_new_too_small (tree type, tree nelts, tree size, tree oper) ...@@ -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 /* Treat members of unions and members of structs uniformly, even
though the size of a member of a union may be viewed as extending 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). */ 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) && DECL_SIZE_UNIT (oper)
&& tree_fits_uhwi_p (DECL_SIZE_UNIT (oper))) && tree_fits_uhwi_p (DECL_SIZE_UNIT (oper)))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment