cp-tree.def revision 132718
150397Sobrien/* This file contains the definitions and documentation for the 250397Sobrien additional tree codes used in the GNU C++ compiler (see tree.def 350397Sobrien for the standard codes). 4132718Skan Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998, 2003, 5132718Skan 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 650397Sobrien Hacked by Michael Tiemann (tiemann@cygnus.com) 750397Sobrien 8132718SkanThis file is part of GCC. 950397Sobrien 10132718SkanGCC is free software; you can redistribute it and/or modify 1150397Sobrienit under the terms of the GNU General Public License as published by 1250397Sobrienthe Free Software Foundation; either version 2, or (at your option) 1350397Sobrienany later version. 1450397Sobrien 15132718SkanGCC is distributed in the hope that it will be useful, 1650397Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1750397SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1850397SobrienGNU General Public License for more details. 1950397Sobrien 2050397SobrienYou should have received a copy of the GNU General Public License 21132718Skanalong with GCC; see the file COPYING. If not, write to 2250397Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330, 2350397SobrienBoston, MA 02111-1307, USA. */ 2450397Sobrien 2550397Sobrien 26117395Skan/* An OFFSET_REF is used in two situations: 27117395Skan 28117395Skan 1. An expression of the form `A::m' where `A' is a class and `m' is 29132718Skan a non-static member. In this case, operand 0 will be a TYPE 30132718Skan (corresponding to `A') and operand 1 will be a FIELD_DECL, 31132718Skan BASELINK, or TEMPLATE_ID_EXPR (corresponding to `m'). 32117395Skan 33117395Skan The expression is a pointer-to-member if its address is taken, 34117395Skan but simply denotes a member of the object if its address isnot 35117395Skan taken. In the latter case, resolve_offset_ref is used to 36117395Skan convert it to a representation of the member referred to by the 37117395Skan OFFSET_REF. 38132718Skan 39132718Skan This form is only used during the parsing phase; once semantic 40132718Skan analysis has taken place they are eliminated. 41117395Skan 42117395Skan 2. An expression of the form `x.*p'. In this case, operand 0 will 43117395Skan be an expression corresponding to `x' and operand 1 will be an 44132718Skan expression with pointer-to-member type. */ 4550397SobrienDEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2) 4650397Sobrien 4752284Sobrien/* A pointer-to-member constant. For a pointer-to-member constant 4852284Sobrien `X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the 4952284Sobrien PTRMEM_CST_MEMBER is the _DECL for `Y'. */ 50132718SkanDEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 0) 5152284Sobrien 5250397Sobrien/* For NEW_EXPR, operand 0 is the placement list. 5350397Sobrien Operand 1 is the new-declarator. 5450397Sobrien Operand 2 is the initializer. */ 5550397SobrienDEFTREECODE (NEW_EXPR, "nw_expr", 'e', 3) 5650397SobrienDEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3) 5750397Sobrien 5850397Sobrien/* For DELETE_EXPR, operand 0 is the store to be destroyed. 5950397Sobrien Operand 1 is the value to pass to the destroying function 6050397Sobrien saying whether the store should be deallocated as well. */ 6150397SobrienDEFTREECODE (DELETE_EXPR, "dl_expr", 'e', 2) 6250397SobrienDEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", 'e', 2) 6350397Sobrien 6450397Sobrien/* Value is reference to particular overloaded class method. 65132718Skan Operand 0 is the class, operand 1 is the field 6650397Sobrien The COMPLEXITY field holds the class level (usually 0). */ 6750397SobrienDEFTREECODE (SCOPE_REF, "scope_ref", 'r', 2) 6850397Sobrien 6950397Sobrien/* When composing an object with a member, this is the result. 7050397Sobrien Operand 0 is the object. Operand 1 is the member (usually 7150397Sobrien a dereferenced pointer to member). */ 7250397SobrienDEFTREECODE (MEMBER_REF, "member_ref", 'r', 2) 7350397Sobrien 7450397Sobrien/* Type conversion operator in C++. TREE_TYPE is type that this 7550397Sobrien operator converts to. Operand is expression to be converted. */ 7650397SobrienDEFTREECODE (TYPE_EXPR, "type_expr", 'e', 1) 7750397Sobrien 7850397Sobrien/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization, 7950397Sobrien operand 1 is argument list to initialization function, 8050397Sobrien and operand 2 is the slot which was allocated for this expression. */ 8150397SobrienDEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3) 8250397Sobrien 8350397Sobrien/* A throw expression. operand 0 is the expression, if there was one, 8450397Sobrien else it is NULL_TREE. */ 8550397SobrienDEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1) 8650397Sobrien 8790075Sobrien/* An empty class object. The TREE_TYPE gives the class type. We use 8890075Sobrien these to avoid actually creating instances of the empty classes. */ 8990075SobrienDEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0) 9050397Sobrien 91132718Skan/* A DECL which is really just a placeholder for an expression. Used to 92132718Skan implement non-class scope anonymous unions. */ 93132718SkanDEFTREECODE (ALIAS_DECL, "alias_decl", 'd', 0) 94132718Skan 95117395Skan/* A reference to a member function or member functions from a base 96117395Skan class. BASELINK_FUNCTIONS gives the FUNCTION_DECL, 97117395Skan TEMPLATE_DECL, OVERLOAD, or TEMPLATE_ID_EXPR corresponding to the 98117395Skan functions. BASELINK_BINFO gives the base from which the functions 99117395Skan come, i.e., the base to which the `this' pointer must be converted 100117395Skan before the functions are called. BASELINK_ACCESS_BINFO gives the 101117395Skan base used to name the functions. 102117395Skan 103117395Skan A BASELINK is an expression; the TREE_TYPE of the BASELINK gives 104117395Skan the type of the expression. This type is either a FUNCTION_TYPE, 105117395Skan METHOD_TYPE, or `unknown_type_node' indicating that the function is 106117395Skan overloaded. */ 107132718SkanDEFTREECODE (BASELINK, "baselink", 'x', 0) 108117395Skan 10950397Sobrien/* Template definition. The following fields have the specified uses, 11050397Sobrien although there are other macros in cp-tree.h that should be used for 11150397Sobrien accessing this data. 11250397Sobrien DECL_ARGUMENTS template parm vector 11350397Sobrien DECL_TEMPLATE_INFO template text &c 11450397Sobrien DECL_VINDEX list of instantiations already produced; 11550397Sobrien only done for functions so far 11650397Sobrien For class template: 11750397Sobrien DECL_INITIAL associated templates (methods &c) 11890075Sobrien DECL_TEMPLATE_RESULT null 11950397Sobrien For non-class templates: 12050397Sobrien TREE_TYPE type of object to be constructed 12190075Sobrien DECL_TEMPLATE_RESULT decl for object to be created 12250397Sobrien (e.g., FUNCTION_DECL with tmpl parms used) 12350397Sobrien */ 12450397SobrienDEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) 12550397Sobrien 12650397Sobrien/* Index into a template parameter list. The TEMPLATE_PARM_IDX gives 12750397Sobrien the index (from 0) of the parameter, while the TEMPLATE_PARM_LEVEL 12850397Sobrien gives the level (from 1) of the parameter. 12950397Sobrien 13050397Sobrien Here's an example: 13150397Sobrien 13250397Sobrien template <class T> // Index 0, Level 1. 13350397Sobrien struct S 13450397Sobrien { 13550397Sobrien template <class U, // Index 0, Level 2. 13650397Sobrien class V> // Index 1, Level 2. 13750397Sobrien void f(); 13850397Sobrien }; 13950397Sobrien 14050397Sobrien The DESCENDANTS will be a chain of TEMPLATE_PARM_INDEXs descended 14150397Sobrien from this one. The first descendant will have the same IDX, but 14250397Sobrien its LEVEL will be one less. The TREE_CHAIN field is used to chain 14350397Sobrien together the descendants. The TEMPLATE_PARM_DECL is the 14450397Sobrien declaration of this parameter, either a TYPE_DECL or CONST_DECL. 14550397Sobrien The TEMPLATE_PARM_ORIG_LEVEL is the LEVEL of the most distant 14650397Sobrien parent, i.e., the LEVEL that the parameter originally had when it 14750397Sobrien was declared. For example, if we instantiate S<int>, we will have: 14850397Sobrien 14950397Sobrien struct S<int> 15050397Sobrien { 15150397Sobrien template <class U, // Index 0, Level 1, Orig Level 2 15250397Sobrien class V> // Index 1, Level 1, Orig Level 2 15350397Sobrien void f(); 15450397Sobrien }; 15550397Sobrien 15650397Sobrien The LEVEL is the level of the parameter when we are worrying about 15750397Sobrien the types of things; the ORIG_LEVEL is the level when we are 15850397Sobrien worrying about instantiating things. */ 159132718SkanDEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 0) 16050397Sobrien 16150397Sobrien/* Index into a template parameter list. This parameter must be a type. 16250397Sobrien The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */ 16350397SobrienDEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0) 16450397Sobrien 16590075Sobrien/* Index into a template parameter list for template template parameters. 16690075Sobrien This parameter must be a type. The TYPE_FIELDS value will be a 16790075Sobrien TEMPLATE_PARM_INDEX. 16890075Sobrien 16990075Sobrien It is used without template arguments like TT in C<TT>, 17090075Sobrien TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO is NULL_TREE 17190075Sobrien and TYPE_NAME is a TEMPLATE_DECL. */ 17250397SobrienDEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0) 17350397Sobrien 17490075Sobrien/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments 17590075Sobrien like TT<int>. 17690075Sobrien In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the 17790075Sobrien template name and its bound arguments. TYPE_NAME is a TYPE_DECL. */ 17890075SobrienDEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm", 't', 0) 17990075Sobrien 18052284Sobrien/* A type designated by `typename T::t'. TYPE_CONTEXT is `T', 18152284Sobrien TYPE_NAME is an IDENTIFIER_NODE for `t'. If the type was named via 18252284Sobrien template-id, TYPENAME_TYPE_FULLNAME will hold the TEMPLATE_ID_EXPR. 18352284Sobrien If TREE_TYPE is present, this type was generated by the implicit 18452284Sobrien typename extension, and the TREE_TYPE is a _TYPE from a baseclass 18552284Sobrien of `T'. */ 18650397SobrienDEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0) 18750397Sobrien 18890075Sobrien/* For template template argument of the form `T::template C'. 18990075Sobrien TYPE_CONTEXT is `T', the template parameter dependent object. 19090075Sobrien TYPE_NAME is an IDENTIFIER_NODE for `C', the member class template. */ 19190075SobrienDEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", 't', 0) 19290075Sobrien 19352284Sobrien/* A type designated by `__typeof (expr)'. TYPE_FIELDS is the 19452284Sobrien expression in question. */ 19552284SobrienDEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0) 19652284Sobrien 19750397Sobrien/* A using declaration. DECL_INITIAL contains the specified scope. 198132718Skan This is not an alias, but is later expanded into multiple aliases. 199132718Skan The decl will have a NULL_TYPE iff the scope is a dependent scope, 200132718Skan otherwise it will have a void type. */ 20150397SobrienDEFTREECODE (USING_DECL, "using_decl", 'd', 0) 20250397Sobrien 20390075Sobrien/* A using directive. The operand is USING_STMT_NAMESPACE. */ 20490075SobrienDEFTREECODE (USING_STMT, "using_directive", 'e', 1) 20590075Sobrien 20650397Sobrien/* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */ 207132718SkanDEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 0) 20850397Sobrien 20952284Sobrien/* A template-id, like foo<int>. The first operand is the template. 210132718Skan The second is NULL if there are no explicit arguments, or a 211132718Skan TREE_VEC of arguments. The template will be a FUNCTION_DECL, 212132718Skan TEMPLATE_DECL, or an OVERLOAD. If the template-id refers to a 213132718Skan member template, the template may be an IDENTIFIER_NODE. */ 21450397SobrienDEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2) 21550397Sobrien 21650397Sobrien/* A list-like node for chaining overloading candidates. TREE_TYPE is 21750397Sobrien the original name, and the parameter is the FUNCTION_DECL. */ 218132718SkanDEFTREECODE (OVERLOAD, "overload", 'x', 0) 21950397Sobrien 22050397Sobrien/* A generic wrapper for something not tree that we want to include in 22150397Sobrien tree structure. */ 222132718SkanDEFTREECODE (WRAPPER, "wrapper", 'x', 0) 22350397Sobrien 22450397Sobrien/* A whole bunch of tree codes for the initial, superficial parsing of 22550397Sobrien templates. */ 22650397SobrienDEFTREECODE (MODOP_EXPR, "modop_expr", 'e', 3) 22750397SobrienDEFTREECODE (CAST_EXPR, "cast_expr", '1', 1) 22850397SobrienDEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", '1', 1) 22950397SobrienDEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", '1', 1) 23050397SobrienDEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", '1', 1) 23150397SobrienDEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", '1', 1) 23250397SobrienDEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2) 23350397SobrienDEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1) 23490075SobrienDEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3) 23550397Sobrien 236132718Skan/* A placeholder for an expression that is not type-dependent, but 237132718Skan does occur in a template. When an expression that is not 238132718Skan type-dependent appears in a larger expression, we must compute the 239132718Skan type of that larger expression. That computation would normally 240132718Skan modify the original expression, which would change the mangling of 241132718Skan that expression if it appeared in a template argument list. In 242132718Skan that situation, we create a NON_DEPENDENT_EXPR to take the place of 243132718Skan the original expression. The expression is the only operand -- it 244132718Skan is only needed for diagnostics. */ 245132718SkanDEFTREECODE (NON_DEPENDENT_EXPR, "non_dependent_expr", 'e', 1) 246132718Skan 24790075Sobrien/* CTOR_INITIALIZER is a placeholder in template code for a call to 24890075Sobrien setup_vtbl_pointer (and appears in all functions, not just ctors). */ 249117395SkanDEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 1) 25090075SobrienDEFTREECODE (TRY_BLOCK, "try_block", 'e', 2) 25190075SobrienDEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", 'e', 2) 25290075Sobrien/* A HANDLER wraps a catch handler for the HANDLER_TYPE. If this is 25390075Sobrien CATCH_ALL_TYPE, then the handler catches all types. The declaration of 25490075Sobrien the catch variable is in HANDLER_PARMS, and the body block in 25590075Sobrien HANDLER_BODY. */ 25690075SobrienDEFTREECODE (HANDLER, "handler", 'e', 2) 25750397Sobrien 25890075Sobrien/* A MUST_NOT_THROW_EXPR wraps an expression that may not 25990075Sobrien throw, and must call terminate if it does. */ 26090075SobrienDEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", 'e', 1) 26190075Sobrien 26250397SobrienDEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0) 26350397Sobrien 264117395Skan/* The following codes are used to represent implicit conversion 265117395Skan sequences, in the sense of [over.best.ics]. The conversion 266117395Skan sequences are connected through their first operands, with the 267117395Skan first conversion to be performed at the end of the chain. 26850397Sobrien 269117395Skan The innermost conversion (i.e, the one at the end of the chain) is 270117395Skan always an IDENTITY_CONV, corresponding to the identity conversion. */ 271117395Skan 27250397SobrienDEFTREECODE (IDENTITY_CONV, "identity_conv", 'e', 1) 27350397SobrienDEFTREECODE (LVALUE_CONV, "lvalue_conv", 'e', 1) 27450397SobrienDEFTREECODE (QUAL_CONV, "qual_conv", 'e', 1) 27550397SobrienDEFTREECODE (STD_CONV, "std_conv", 'e', 1) 27650397SobrienDEFTREECODE (PTR_CONV, "ptr_conv", 'e', 1) 27750397SobrienDEFTREECODE (PMEM_CONV, "pmem_conv", 'e', 1) 27850397SobrienDEFTREECODE (BASE_CONV, "base_conv", 'e', 1) 27950397SobrienDEFTREECODE (REF_BIND, "ref_bind", 'e', 1) 28050397SobrienDEFTREECODE (USER_CONV, "user_conv", 'e', 2) 28150397SobrienDEFTREECODE (AMBIG_CONV, "ambig_conv", 'e', 1) 28250397SobrienDEFTREECODE (RVALUE_CONV, "rvalue_conv", 'e', 1) 28350397Sobrien 28450397Sobrien/* 28550397SobrienLocal variables: 28650397Sobrienmode:c 28750397SobrienEnd: 28850397Sobrien*/ 289