Commit 22d03525 by Marek Polacek Committed by Marek Polacek

array-notation-common.c (find_rank): Use INDIRECT_REF_P.

	* array-notation-common.c (find_rank): Use INDIRECT_REF_P.
	* c-common.c (c_fully_fold_internal): Likewise.
	(c_alignof_expr): Likewise.
	* c-pretty-print.c (c_pretty_printer::postfix_expression): Likewise.
	* c-ubsan.c (ubsan_instrument_bounds): Likewise.
	* cilk.c (create_parm_list): Likewise. 

	* c-array-notation.c (fix_builtin_array_notation_fn): Use
	INDIRECT_REF_P.
	* c-typeck.c (array_to_pointer_conversion): Likewise.
	(build_unary_op): Likewise.
	(c_finish_return): Likewise.

From-SVN: r225080
parent 504a5fe6
2015-06-26 Marek Polacek <polacek@redhat.com> 2015-06-26 Marek Polacek <polacek@redhat.com>
* array-notation-common.c (find_rank): Use INDIRECT_REF_P.
* c-common.c (c_fully_fold_internal): Likewise.
(c_alignof_expr): Likewise.
* c-pretty-print.c (c_pretty_printer::postfix_expression): Likewise.
* c-ubsan.c (ubsan_instrument_bounds): Likewise.
* cilk.c (create_parm_list): Likewise.
2015-06-26 Marek Polacek <polacek@redhat.com>
* c-common.c (handle_unused_attribute): Use VAR_OR_FUNCTION_DECL_P. * c-common.c (handle_unused_attribute): Use VAR_OR_FUNCTION_DECL_P.
2015-06-25 Andrew MacLeod <amacleod@redhat.com> 2015-06-25 Andrew MacLeod <amacleod@redhat.com>
......
...@@ -228,7 +228,7 @@ find_rank (location_t loc, tree orig_expr, tree expr, bool ignore_builtin_fn, ...@@ -228,7 +228,7 @@ find_rank (location_t loc, tree orig_expr, tree expr, bool ignore_builtin_fn,
ii_tree = ARRAY_NOTATION_ARRAY (ii_tree); ii_tree = ARRAY_NOTATION_ARRAY (ii_tree);
} }
else if (handled_component_p (ii_tree) else if (handled_component_p (ii_tree)
|| TREE_CODE (ii_tree) == INDIRECT_REF) || INDIRECT_REF_P (ii_tree))
ii_tree = TREE_OPERAND (ii_tree, 0); ii_tree = TREE_OPERAND (ii_tree, 0);
else if (TREE_CODE (ii_tree) == PARM_DECL else if (TREE_CODE (ii_tree) == PARM_DECL
|| VAR_P (ii_tree)) || VAR_P (ii_tree))
......
...@@ -1436,7 +1436,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, ...@@ -1436,7 +1436,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
if (op0 != orig_op0 if (op0 != orig_op0
&& code == ADDR_EXPR && code == ADDR_EXPR
&& (op1 = get_base_address (op0)) != NULL_TREE && (op1 = get_base_address (op0)) != NULL_TREE
&& TREE_CODE (op1) == INDIRECT_REF && INDIRECT_REF_P (op1)
&& TREE_CONSTANT (TREE_OPERAND (op1, 0))) && TREE_CONSTANT (TREE_OPERAND (op1, 0)))
ret = fold_convert_loc (loc, TREE_TYPE (expr), fold_offsetof_1 (op0)); ret = fold_convert_loc (loc, TREE_TYPE (expr), fold_offsetof_1 (op0));
else if (op0 != orig_op0 || in_init) else if (op0 != orig_op0 || in_init)
...@@ -1447,7 +1447,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, ...@@ -1447,7 +1447,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
ret = fold (expr); ret = fold (expr);
if (code == INDIRECT_REF if (code == INDIRECT_REF
&& ret != expr && ret != expr
&& TREE_CODE (ret) == INDIRECT_REF) && INDIRECT_REF_P (ret))
{ {
TREE_READONLY (ret) = TREE_READONLY (expr); TREE_READONLY (ret) = TREE_READONLY (expr);
TREE_SIDE_EFFECTS (ret) = TREE_SIDE_EFFECTS (expr); TREE_SIDE_EFFECTS (ret) = TREE_SIDE_EFFECTS (expr);
...@@ -5377,7 +5377,7 @@ c_alignof_expr (location_t loc, tree expr) ...@@ -5377,7 +5377,7 @@ c_alignof_expr (location_t loc, tree expr)
&& TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL) && TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL)
t = size_int (DECL_ALIGN_UNIT (TREE_OPERAND (expr, 1))); t = size_int (DECL_ALIGN_UNIT (TREE_OPERAND (expr, 1)));
else if (TREE_CODE (expr) == INDIRECT_REF) else if (INDIRECT_REF_P (expr))
{ {
tree t = TREE_OPERAND (expr, 0); tree t = TREE_OPERAND (expr, 0);
tree best = t; tree best = t;
......
...@@ -1607,7 +1607,7 @@ c_pretty_printer::postfix_expression (tree e) ...@@ -1607,7 +1607,7 @@ c_pretty_printer::postfix_expression (tree e)
case COMPONENT_REF: case COMPONENT_REF:
{ {
tree object = TREE_OPERAND (e, 0); tree object = TREE_OPERAND (e, 0);
if (TREE_CODE (object) == INDIRECT_REF) if (INDIRECT_REF_P (object))
{ {
postfix_expression (TREE_OPERAND (object, 0)); postfix_expression (TREE_OPERAND (object, 0));
pp_c_arrow (this); pp_c_arrow (this);
......
...@@ -290,8 +290,7 @@ ubsan_instrument_bounds (location_t loc, tree array, tree *index, ...@@ -290,8 +290,7 @@ ubsan_instrument_bounds (location_t loc, tree array, tree *index,
tree base = get_base_address (array); tree base = get_base_address (array);
if ((flag_sanitize & SANITIZE_BOUNDS_STRICT) == 0 if ((flag_sanitize & SANITIZE_BOUNDS_STRICT) == 0
&& TREE_CODE (array) == COMPONENT_REF && TREE_CODE (array) == COMPONENT_REF
&& base && (TREE_CODE (base) == INDIRECT_REF && base && (INDIRECT_REF_P (base) || TREE_CODE (base) == MEM_REF))
|| TREE_CODE (base) == MEM_REF))
{ {
tree next = NULL_TREE; tree next = NULL_TREE;
tree cref = array; tree cref = array;
......
...@@ -392,7 +392,7 @@ create_parm_list (struct wrapper_data *wd, tree *val0, tree arg) ...@@ -392,7 +392,7 @@ create_parm_list (struct wrapper_data *wd, tree *val0, tree arg)
val = TREE_OPERAND (val, 0); val = TREE_OPERAND (val, 0);
*val0 = val; *val0 = val;
gcc_assert (TREE_CODE (val) == INDIRECT_REF); gcc_assert (INDIRECT_REF_P (val));
parm = TREE_OPERAND (val, 0); parm = TREE_OPERAND (val, 0);
STRIP_NOPS (parm); STRIP_NOPS (parm);
} }
......
2015-06-26 Marek Polacek <polacek@redhat.com>
* c-array-notation.c (fix_builtin_array_notation_fn): Use
INDIRECT_REF_P.
* c-typeck.c (array_to_pointer_conversion): Likewise.
(build_unary_op): Likewise.
(c_finish_return): Likewise.
2015-06-25 Andrew MacLeod <amacleod@redhat.com> 2015-06-25 Andrew MacLeod <amacleod@redhat.com>
* c-decl.c: Remove ipa-ref.h and plugin-api.h from include list. * c-decl.c: Remove ipa-ref.h and plugin-api.h from include list.
......
...@@ -324,7 +324,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var) ...@@ -324,7 +324,7 @@ fix_builtin_array_notation_fn (tree an_builtin_fn, tree *new_var)
array_ind_value = build_decl (location, VAR_DECL, NULL_TREE, array_ind_value = build_decl (location, VAR_DECL, NULL_TREE,
TREE_TYPE (func_parm)); TREE_TYPE (func_parm));
array_op0 = (*array_operand)[0]; array_op0 = (*array_operand)[0];
if (TREE_CODE (array_op0) == INDIRECT_REF) if (INDIRECT_REF_P (array_op0))
array_op0 = TREE_OPERAND (array_op0, 0); array_op0 = TREE_OPERAND (array_op0, 0);
switch (an_type) switch (an_type)
{ {
......
...@@ -1826,7 +1826,7 @@ array_to_pointer_conversion (location_t loc, tree exp) ...@@ -1826,7 +1826,7 @@ array_to_pointer_conversion (location_t loc, tree exp)
ptrtype = build_pointer_type (restype); ptrtype = build_pointer_type (restype);
if (TREE_CODE (exp) == INDIRECT_REF) if (INDIRECT_REF_P (exp))
return convert (ptrtype, TREE_OPERAND (exp, 0)); return convert (ptrtype, TREE_OPERAND (exp, 0));
/* In C++ array compound literals are temporary objects unless they are /* In C++ array compound literals are temporary objects unless they are
...@@ -4146,12 +4146,11 @@ build_unary_op (location_t location, ...@@ -4146,12 +4146,11 @@ build_unary_op (location_t location,
unary '*' operator. */ unary '*' operator. */
if (VOID_TYPE_P (TREE_TYPE (arg)) if (VOID_TYPE_P (TREE_TYPE (arg))
&& TYPE_QUALS (TREE_TYPE (arg)) == TYPE_UNQUALIFIED && TYPE_QUALS (TREE_TYPE (arg)) == TYPE_UNQUALIFIED
&& (TREE_CODE (arg) != INDIRECT_REF && (!INDIRECT_REF_P (arg) || !flag_isoc99))
|| !flag_isoc99))
pedwarn (location, 0, "taking address of expression of type %<void%>"); pedwarn (location, 0, "taking address of expression of type %<void%>");
/* Let &* cancel out to simplify resulting code. */ /* Let &* cancel out to simplify resulting code. */
if (TREE_CODE (arg) == INDIRECT_REF) if (INDIRECT_REF_P (arg))
{ {
/* Don't let this be an lvalue. */ /* Don't let this be an lvalue. */
if (lvalue_p (TREE_OPERAND (arg, 0))) if (lvalue_p (TREE_OPERAND (arg, 0)))
...@@ -4220,7 +4219,7 @@ build_unary_op (location_t location, ...@@ -4220,7 +4219,7 @@ build_unary_op (location_t location,
/* ??? Cope with user tricks that amount to offsetof. Delete this /* ??? Cope with user tricks that amount to offsetof. Delete this
when we have proper support for integer constant expressions. */ when we have proper support for integer constant expressions. */
val = get_base_address (arg); val = get_base_address (arg);
if (val && TREE_CODE (val) == INDIRECT_REF if (val && INDIRECT_REF_P (val)
&& TREE_CONSTANT (TREE_OPERAND (val, 0))) && TREE_CONSTANT (TREE_OPERAND (val, 0)))
{ {
ret = fold_convert_loc (location, argtype, fold_offsetof_1 (arg)); ret = fold_convert_loc (location, argtype, fold_offsetof_1 (arg));
...@@ -9465,7 +9464,7 @@ c_finish_return (location_t loc, tree retval, tree origtype) ...@@ -9465,7 +9464,7 @@ c_finish_return (location_t loc, tree retval, tree origtype)
inner = TREE_OPERAND (inner, 0); inner = TREE_OPERAND (inner, 0);
while (REFERENCE_CLASS_P (inner) while (REFERENCE_CLASS_P (inner)
&& TREE_CODE (inner) != INDIRECT_REF) && !INDIRECT_REF_P (inner))
inner = TREE_OPERAND (inner, 0); inner = TREE_OPERAND (inner, 0);
if (DECL_P (inner) if (DECL_P (inner)
......
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