aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-10-24 18:04:01 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-10-24 18:04:01 +0200
commit86287716e8edba8da03305250e02e23eedc0d754 (patch)
tree4162746b9bc8ce44af52f51250d517ce50e09dc2
parenta3f6007cbc84242c088097e46602a65f9654a349 (diff)
downloadgcc-86287716e8edba8da03305250e02e23eedc0d754.zip
gcc-86287716e8edba8da03305250e02e23eedc0d754.tar.gz
gcc-86287716e8edba8da03305250e02e23eedc0d754.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/constraint.cc8
-rw-r--r--gcc/cp/cp-gimplify.c2
-rw-r--r--gcc/cp/cxx-pretty-print.c2
-rw-r--r--gcc/cp/init.c8
5 files changed, 18 insertions, 11 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d913536..0c5da96 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+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>
PR c++/77656
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index b4d85c9..801f5a3 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 b085f3a..9b9b511 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 5157fab..8c701ff 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 455995a..2418a9d 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)))
{