xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/objc/objc-tree.def (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
136ac495dSmrg/* This file contains the definitions and documentation for the
236ac495dSmrg   additional tree codes used in the Objective C front end (see tree.def
336ac495dSmrg   for the standard codes).
4*8feb0f0bSmrg   Copyright (C) 1990-2020 Free Software Foundation, Inc.
536ac495dSmrg
636ac495dSmrgThis file is part of GCC.
736ac495dSmrg
836ac495dSmrgGCC is free software; you can redistribute it and/or modify
936ac495dSmrgit under the terms of the GNU General Public License as published by
1036ac495dSmrgthe Free Software Foundation; either version 3, or (at your option)
1136ac495dSmrgany later version.
1236ac495dSmrg
1336ac495dSmrgGCC is distributed in the hope that it will be useful,
1436ac495dSmrgbut WITHOUT ANY WARRANTY; without even the implied warranty of
1536ac495dSmrgMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1636ac495dSmrgGNU General Public License for more details.
1736ac495dSmrg
1836ac495dSmrgYou should have received a copy of the GNU General Public License
1936ac495dSmrgalong with GCC; see the file COPYING3.  If not see
2036ac495dSmrg<http://www.gnu.org/licenses/>.  */
2136ac495dSmrg
2236ac495dSmrg
2336ac495dSmrg/* Objective-C types.  */
2436ac495dSmrgDEFTREECODE (CLASS_INTERFACE_TYPE, "class_interface_type", tcc_type, 0)
2536ac495dSmrgDEFTREECODE (CLASS_IMPLEMENTATION_TYPE, "class_implementation_type",
2636ac495dSmrg	     tcc_type, 0)
2736ac495dSmrgDEFTREECODE (CATEGORY_INTERFACE_TYPE, "category_interface_type", tcc_type, 0)
2836ac495dSmrgDEFTREECODE (CATEGORY_IMPLEMENTATION_TYPE,"category_implementation_type",
2936ac495dSmrg	     tcc_type, 0)
3036ac495dSmrgDEFTREECODE (PROTOCOL_INTERFACE_TYPE, "protocol_interface_type", tcc_type, 0)
3136ac495dSmrg
3236ac495dSmrg/* Objective-C decls.  */
3336ac495dSmrgDEFTREECODE (KEYWORD_DECL, "keyword_decl", tcc_declaration, 0)
3436ac495dSmrgDEFTREECODE (INSTANCE_METHOD_DECL, "instance_method_decl", tcc_declaration, 0)
3536ac495dSmrgDEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", tcc_declaration, 0)
3636ac495dSmrgDEFTREECODE (PROPERTY_DECL, "property_decl", tcc_declaration, 0)
3736ac495dSmrg
3836ac495dSmrg/* Objective-C expressions.  */
3936ac495dSmrgDEFTREECODE (MESSAGE_SEND_EXPR, "message_send_expr", tcc_expression, 3)
4036ac495dSmrgDEFTREECODE (CLASS_REFERENCE_EXPR, "class_reference_expr", tcc_expression, 1)
4136ac495dSmrg
4236ac495dSmrg/* This tree is used to represent the expression 'object.property',
4336ac495dSmrg   where 'object' is an Objective-C object and 'property' is an
4436ac495dSmrg   Objective-C property.  Operand 0 is the object (the tree
4536ac495dSmrg   representing the expression), and Operand 1 is the property (the
4636ac495dSmrg   PROPERTY_DECL).  Operand 2 is the 'getter' call, ready to be used;
4736ac495dSmrg   we pregenerate it because it is hard to generate it properly later
4836ac495dSmrg   on.  Operand 3 records whether using the 'getter' call should
4936ac495dSmrg   generate a deprecation warning or not.
5036ac495dSmrg
5136ac495dSmrg   A PROPERTY_REF tree needs to be transformed into 'setter' and
5236ac495dSmrg   'getter' calls at some point; at the moment this happens in two
5336ac495dSmrg   places:
5436ac495dSmrg
5536ac495dSmrg     * if we detect that a modify expression is being applied to a
5636ac495dSmrg       PROPERTY_REF, then we transform that into a 'getter' call (this
5736ac495dSmrg       happens in build_modify_expr() or cp_build_modify_expr()).
5836ac495dSmrg
5936ac495dSmrg    * else, it will remain as a PROPERTY_REF until we get to
6036ac495dSmrg      gimplification; at that point, we convert each PROPERTY_REF into
6136ac495dSmrg      a 'getter' call during ObjC/ObjC++ gimplify.  At that point, it
6236ac495dSmrg      is quite hard to build a 'getter' call, but we have already built
6336ac495dSmrg      it and we just need to swap Operand 2 in, and emit the deprecation
6436ac495dSmrg      warnings from Operand 3 if needed.
6536ac495dSmrg
6636ac495dSmrg  Please note that when the Objective-C 2.0 "dot-syntax" 'object.component'
6736ac495dSmrg  is encountered, where 'component' is not a property but there are valid
6836ac495dSmrg  setter/getter methods for it, an artificial PROPERTY_DECL is generated
6936ac495dSmrg  and used in the PROPERTY_REF.  */
7036ac495dSmrgDEFTREECODE (PROPERTY_REF, "property_ref", tcc_expression, 4)
7136ac495dSmrg
7236ac495dSmrg/*
7336ac495dSmrgLocal variables:
7436ac495dSmrgmode:c
7536ac495dSmrgEnd:
7636ac495dSmrg*/
77