1*38fd1498Szrj/* This file contains the definitions and documentation for the
2*38fd1498Szrj   additional tree codes used in the Objective C front end (see tree.def
3*38fd1498Szrj   for the standard codes).
4*38fd1498Szrj   Copyright (C) 1990-2018 Free Software Foundation, Inc.
5*38fd1498Szrj
6*38fd1498SzrjThis file is part of GCC.
7*38fd1498Szrj
8*38fd1498SzrjGCC is free software; you can redistribute it and/or modify
9*38fd1498Szrjit under the terms of the GNU General Public License as published by
10*38fd1498Szrjthe Free Software Foundation; either version 3, or (at your option)
11*38fd1498Szrjany later version.
12*38fd1498Szrj
13*38fd1498SzrjGCC is distributed in the hope that it will be useful,
14*38fd1498Szrjbut WITHOUT ANY WARRANTY; without even the implied warranty of
15*38fd1498SzrjMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*38fd1498SzrjGNU General Public License for more details.
17*38fd1498Szrj
18*38fd1498SzrjYou should have received a copy of the GNU General Public License
19*38fd1498Szrjalong with GCC; see the file COPYING3.  If not see
20*38fd1498Szrj<http://www.gnu.org/licenses/>.  */
21*38fd1498Szrj
22*38fd1498Szrj
23*38fd1498Szrj/* Objective-C types.  */
24*38fd1498SzrjDEFTREECODE (CLASS_INTERFACE_TYPE, "class_interface_type", tcc_type, 0)
25*38fd1498SzrjDEFTREECODE (CLASS_IMPLEMENTATION_TYPE, "class_implementation_type",
26*38fd1498Szrj	     tcc_type, 0)
27*38fd1498SzrjDEFTREECODE (CATEGORY_INTERFACE_TYPE, "category_interface_type", tcc_type, 0)
28*38fd1498SzrjDEFTREECODE (CATEGORY_IMPLEMENTATION_TYPE,"category_implementation_type",
29*38fd1498Szrj	     tcc_type, 0)
30*38fd1498SzrjDEFTREECODE (PROTOCOL_INTERFACE_TYPE, "protocol_interface_type", tcc_type, 0)
31*38fd1498Szrj
32*38fd1498Szrj/* Objective-C decls.  */
33*38fd1498SzrjDEFTREECODE (KEYWORD_DECL, "keyword_decl", tcc_declaration, 0)
34*38fd1498SzrjDEFTREECODE (INSTANCE_METHOD_DECL, "instance_method_decl", tcc_declaration, 0)
35*38fd1498SzrjDEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", tcc_declaration, 0)
36*38fd1498SzrjDEFTREECODE (PROPERTY_DECL, "property_decl", tcc_declaration, 0)
37*38fd1498Szrj
38*38fd1498Szrj/* Objective-C expressions.  */
39*38fd1498SzrjDEFTREECODE (MESSAGE_SEND_EXPR, "message_send_expr", tcc_expression, 3)
40*38fd1498SzrjDEFTREECODE (CLASS_REFERENCE_EXPR, "class_reference_expr", tcc_expression, 1)
41*38fd1498Szrj
42*38fd1498Szrj/* This tree is used to represent the expression 'object.property',
43*38fd1498Szrj   where 'object' is an Objective-C object and 'property' is an
44*38fd1498Szrj   Objective-C property.  Operand 0 is the object (the tree
45*38fd1498Szrj   representing the expression), and Operand 1 is the property (the
46*38fd1498Szrj   PROPERTY_DECL).  Operand 2 is the 'getter' call, ready to be used;
47*38fd1498Szrj   we pregenerate it because it is hard to generate it properly later
48*38fd1498Szrj   on.  Operand 3 records whether using the 'getter' call should
49*38fd1498Szrj   generate a deprecation warning or not.
50*38fd1498Szrj
51*38fd1498Szrj   A PROPERTY_REF tree needs to be transformed into 'setter' and
52*38fd1498Szrj   'getter' calls at some point; at the moment this happens in two
53*38fd1498Szrj   places:
54*38fd1498Szrj
55*38fd1498Szrj     * if we detect that a modify expression is being applied to a
56*38fd1498Szrj       PROPERTY_REF, then we transform that into a 'getter' call (this
57*38fd1498Szrj       happens in build_modify_expr() or cp_build_modify_expr()).
58*38fd1498Szrj
59*38fd1498Szrj    * else, it will remain as a PROPERTY_REF until we get to
60*38fd1498Szrj      gimplification; at that point, we convert each PROPERTY_REF into
61*38fd1498Szrj      a 'getter' call during ObjC/ObjC++ gimplify.  At that point, it
62*38fd1498Szrj      is quite hard to build a 'getter' call, but we have already built
63*38fd1498Szrj      it and we just need to swap Operand 2 in, and emit the deprecation
64*38fd1498Szrj      warnings from Operand 3 if needed.
65*38fd1498Szrj
66*38fd1498Szrj  Please note that when the Objective-C 2.0 "dot-syntax" 'object.component'
67*38fd1498Szrj  is encountered, where 'component' is not a property but there are valid
68*38fd1498Szrj  setter/getter methods for it, an artificial PROPERTY_DECL is generated
69*38fd1498Szrj  and used in the PROPERTY_REF.  */
70*38fd1498SzrjDEFTREECODE (PROPERTY_REF, "property_ref", tcc_expression, 4)
71*38fd1498Szrj
72*38fd1498Szrj/*
73*38fd1498SzrjLocal variables:
74*38fd1498Szrjmode:c
75*38fd1498SzrjEnd:
76*38fd1498Szrj*/
77