[11/14] objc: use _P() defines from tree.h
Checks
Commit Message
From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
gcc/objc/ChangeLog:
* objc-act.cc (objc_volatilize_decl): Use _P() defines from tree.h.
(objc_is_global_reference_p): Ditto.
(objc_generate_write_barrier): Ditto.
(objc_gimplify_property_ref): Ditto.
* objc-next-runtime-abi-01.cc (next_runtime_abi_01_receiver_is_class_object): Ditto.
* objc-next-runtime-abi-02.cc (next_runtime_abi_02_receiver_is_class_object): Ditto.
(next_runtime_abi_02_build_objc_method_call): Ditto.
---
gcc/objc/objc-act.cc | 10 +++++-----
gcc/objc/objc-next-runtime-abi-01.cc | 2 +-
gcc/objc/objc-next-runtime-abi-02.cc | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
Comments
H Bernhard,
> On 14 May 2023, at 00:23, Bernhard Reutner-Fischer via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
>
> gcc/objc/ChangeLog:
>
> * objc-act.cc (objc_volatilize_decl): Use _P() defines from tree.h.
> (objc_is_global_reference_p): Ditto.
> (objc_generate_write_barrier): Ditto.
> (objc_gimplify_property_ref): Ditto.
> * objc-next-runtime-abi-01.cc (next_runtime_abi_01_receiver_is_class_object): Ditto.
> * objc-next-runtime-abi-02.cc (next_runtime_abi_02_receiver_is_class_object): Ditto.
> (next_runtime_abi_02_build_objc_method_call): Ditto.
> —
This is OK for trunk,
thanks for the clean-up.
Iain
@@ -2338,7 +2338,7 @@ objc_volatilize_decl (tree decl)
/* Do not mess with variables that are 'static' or (already)
'volatile'. */
if (!TREE_THIS_VOLATILE (decl) && !TREE_STATIC (decl)
- && (TREE_CODE (decl) == VAR_DECL
+ && (VAR_P (decl)
|| TREE_CODE (decl) == PARM_DECL))
{
if (local_variables_to_volatilize == NULL)
@@ -3793,7 +3793,7 @@ objc_is_ivar_reference_p (tree expr)
static int
objc_is_global_reference_p (tree expr)
{
- return (TREE_CODE (expr) == INDIRECT_REF || TREE_CODE (expr) == PLUS_EXPR
+ return (INDIRECT_REF_P (expr) || TREE_CODE (expr) == PLUS_EXPR
? objc_is_global_reference_p (TREE_OPERAND (expr, 0))
: DECL_P (expr)
? (DECL_FILE_SCOPE_P (expr) || TREE_STATIC (expr))
@@ -3812,7 +3812,7 @@ objc_generate_write_barrier (tree lhs, enum tree_code modifycode, tree rhs)
/* See if we have any lhs casts, and strip them out. NB: The lvalue casts
will have been transformed to the form '*(type *)&expr'. */
- if (TREE_CODE (lhs) == INDIRECT_REF)
+ if (INDIRECT_REF_P (lhs))
{
outer = TREE_OPERAND (lhs, 0);
@@ -3864,7 +3864,7 @@ objc_generate_write_barrier (tree lhs, enum tree_code modifycode, tree rhs)
|| TREE_CODE (outer) == ARRAY_REF))
outer = TREE_OPERAND (outer, 0);
- if (TREE_CODE (outer) == INDIRECT_REF)
+ if (INDIRECT_REF_P (outer))
{
outer = TREE_OPERAND (outer, 0);
indirect_p = 1;
@@ -9694,7 +9694,7 @@ objc_gimplify_property_ref (tree *expr_p)
if (TREE_CODE (getter) == TARGET_EXPR)
{
gcc_assert (MAYBE_CLASS_TYPE_P (TREE_TYPE (getter)));
- gcc_assert (TREE_CODE (TREE_OPERAND (getter, 0)) == VAR_DECL);
+ gcc_assert (VAR_P (TREE_OPERAND (getter, 0)));
call_exp = TREE_OPERAND (getter, 1);
}
#endif
@@ -754,7 +754,7 @@ next_runtime_abi_01_get_arg_type_list_base (vec<tree, va_gc> **argtypes,
static tree
next_runtime_abi_01_receiver_is_class_object (tree receiver)
{
- if (TREE_CODE (receiver) == VAR_DECL
+ if (VAR_P (receiver)
&& IS_CLASS (TREE_TYPE (receiver)))
{
/* The receiver is a variable created by build_class_reference_decl. */
@@ -1571,7 +1571,7 @@ next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
static tree
next_runtime_abi_02_receiver_is_class_object (tree receiver)
{
- if (TREE_CODE (receiver) == VAR_DECL
+ if (VAR_P (receiver)
&& IS_CLASS (TREE_TYPE (receiver))
&& vec_safe_length (classrefs))
{
@@ -1824,7 +1824,7 @@ next_runtime_abi_02_build_objc_method_call (location_t loc,
checked. */
bool check_for_nil = flag_objc_nilcheck;
if (super
- || (TREE_CODE (receiver) == VAR_DECL
+ || (VAR_P (receiver)
&& TREE_TYPE (receiver) == objc_class_type))
check_for_nil = false;