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