cp-tree.def revision 90075
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).
490075Sobrien   Copyright (C) 1987, 1988, 1990, 1993, 1997, 1998,
590075Sobrien   1999, 2000, 2001 Free Software Foundation, Inc.
650397Sobrien   Hacked by Michael Tiemann (tiemann@cygnus.com)
750397Sobrien
850397SobrienThis file is part of GNU CC.
950397Sobrien
1050397SobrienGNU CC 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
1550397SobrienGNU CC 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
2150397Sobrienalong with GNU CC; see the file COPYING.  If not, write to
2250397Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330,
2350397SobrienBoston, MA 02111-1307, USA.  */
2450397Sobrien
2550397Sobrien 
2650397Sobrien/* Reference to the contents of an offset
2750397Sobrien   (a value whose type is an OFFSET_TYPE).
2850397Sobrien   Operand 0 is the object within which the offset is taken.
2950397Sobrien   Operand 1 is the offset.  The language independent OFFSET_REF
3050397Sobrien   just won't work for us.  */
3150397SobrienDEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2)
3250397Sobrien
3352284Sobrien/* A pointer-to-member constant.  For a pointer-to-member constant
3452284Sobrien   `X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the
3552284Sobrien   PTRMEM_CST_MEMBER is the _DECL for `Y'.  */
3690075SobrienDEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 2)
3752284Sobrien
3850397Sobrien/* For NEW_EXPR, operand 0 is the placement list.
3950397Sobrien   Operand 1 is the new-declarator.
4050397Sobrien   Operand 2 is the initializer.  */
4150397SobrienDEFTREECODE (NEW_EXPR, "nw_expr", 'e', 3)
4250397SobrienDEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3)
4350397Sobrien
4450397Sobrien/* For DELETE_EXPR, operand 0 is the store to be destroyed.
4550397Sobrien   Operand 1 is the value to pass to the destroying function
4650397Sobrien   saying whether the store should be deallocated as well.  */
4750397SobrienDEFTREECODE (DELETE_EXPR, "dl_expr", 'e', 2)
4850397SobrienDEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", 'e', 2)
4950397Sobrien
5050397Sobrien/* Value is reference to particular overloaded class method.
5150397Sobrien   Operand 0 is the class name (an IDENTIFIER_NODE);
5250397Sobrien   operand 1 is the field (also an IDENTIFIER_NODE).
5350397Sobrien   The COMPLEXITY field holds the class level (usually 0).  */
5450397SobrienDEFTREECODE (SCOPE_REF, "scope_ref", 'r', 2)
5550397Sobrien
5650397Sobrien/* When composing an object with a member, this is the result.
5750397Sobrien   Operand 0 is the object.  Operand 1 is the member (usually
5850397Sobrien   a dereferenced pointer to member).  */
5950397SobrienDEFTREECODE (MEMBER_REF, "member_ref", 'r', 2)
6050397Sobrien
6150397Sobrien/* Type conversion operator in C++.  TREE_TYPE is type that this
6250397Sobrien   operator converts to.  Operand is expression to be converted.  */
6350397SobrienDEFTREECODE (TYPE_EXPR, "type_expr", 'e', 1)
6450397Sobrien
6550397Sobrien/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization,
6650397Sobrien   operand 1 is argument list to initialization function,
6750397Sobrien   and operand 2 is the slot which was allocated for this expression.  */
6850397SobrienDEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3)
6950397Sobrien
7050397Sobrien/* A throw expression.  operand 0 is the expression, if there was one,
7150397Sobrien   else it is NULL_TREE.  */
7250397SobrienDEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1)
7350397Sobrien
7490075Sobrien/* An empty class object.  The TREE_TYPE gives the class type.  We use
7590075Sobrien   these to avoid actually creating instances of the empty classes.  */
7690075SobrienDEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0)
7750397Sobrien
7850397Sobrien/* Template definition.  The following fields have the specified uses,
7950397Sobrien   although there are other macros in cp-tree.h that should be used for
8050397Sobrien   accessing this data.
8150397Sobrien        DECL_ARGUMENTS          template parm vector
8250397Sobrien        DECL_TEMPLATE_INFO      template text &c
8350397Sobrien	DECL_VINDEX		list of instantiations already produced;
8450397Sobrien				only done for functions so far
8550397Sobrien   For class template:
8650397Sobrien        DECL_INITIAL            associated templates (methods &c)
8790075Sobrien        DECL_TEMPLATE_RESULT    null
8850397Sobrien   For non-class templates:
8950397Sobrien	TREE_TYPE		type of object to be constructed
9090075Sobrien        DECL_TEMPLATE_RESULT    decl for object to be created
9150397Sobrien                                (e.g., FUNCTION_DECL with tmpl parms used)
9250397Sobrien */
9350397SobrienDEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
9450397Sobrien
9550397Sobrien/* Index into a template parameter list.  The TEMPLATE_PARM_IDX gives
9650397Sobrien   the index (from 0) of the parameter, while the TEMPLATE_PARM_LEVEL
9750397Sobrien   gives the level (from 1) of the parameter.
9850397Sobrien
9950397Sobrien   Here's an example:
10050397Sobrien   
10150397Sobrien   template <class T> // Index 0, Level 1.
10250397Sobrien   struct S
10350397Sobrien   {
10450397Sobrien      template <class U, // Index 0, Level 2.
10550397Sobrien                class V> // Index 1, Level 2.
10650397Sobrien      void f();
10750397Sobrien   };  
10850397Sobrien
10950397Sobrien   The DESCENDANTS will be a chain of TEMPLATE_PARM_INDEXs descended
11050397Sobrien   from this one.  The first descendant will have the same IDX, but
11150397Sobrien   its LEVEL will be one less.  The TREE_CHAIN field is used to chain
11250397Sobrien   together the descendants.  The TEMPLATE_PARM_DECL is the
11350397Sobrien   declaration of this parameter, either a TYPE_DECL or CONST_DECL.
11450397Sobrien   The TEMPLATE_PARM_ORIG_LEVEL is the LEVEL of the most distant
11550397Sobrien   parent, i.e., the LEVEL that the parameter originally had when it
11650397Sobrien   was declared.  For example, if we instantiate S<int>, we will have:
11750397Sobrien
11850397Sobrien   struct S<int>
11950397Sobrien   {
12050397Sobrien     template <class U, // Index 0, Level 1, Orig Level 2
12150397Sobrien               class V> // Index 1, Level 1, Orig Level 2
12250397Sobrien     void f();
12350397Sobrien   };
12450397Sobrien  
12550397Sobrien   The LEVEL is the level of the parameter when we are worrying about
12650397Sobrien   the types of things; the ORIG_LEVEL is the level when we are
12750397Sobrien   worrying about instantiating things.  */
12850397SobrienDEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 
12990075Sobrien	     /* The addition of (sizeof(tree) - 1) in the next expression
13090075Sobrien		is to handle the case when padding pushes us past an even
13190075Sobrien		multiple of sizeof(tree).  */
13290075Sobrien	     /* We used to try to calculate this using
13390075Sobrien		1+3*sizeof(HOST_WIDE_INT), but that fails if alignment
13490075Sobrien		makes it bigger.  */
13590075Sobrien	     ((sizeof (template_parm_index) - sizeof (struct tree_common))
13690075Sobrien	      + sizeof (tree) - 1)
13790075Sobrien	     / sizeof (tree))
13850397Sobrien
13950397Sobrien/* Index into a template parameter list.  This parameter must be a type.
14050397Sobrien   The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX.  */
14150397SobrienDEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0)
14250397Sobrien
14390075Sobrien/* Index into a template parameter list for template template parameters.
14490075Sobrien   This parameter must be a type.  The TYPE_FIELDS value will be a 
14590075Sobrien   TEMPLATE_PARM_INDEX.
14690075Sobrien
14790075Sobrien   It is used without template arguments like TT in C<TT>, 
14890075Sobrien   TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO is NULL_TREE
14990075Sobrien   and TYPE_NAME is a TEMPLATE_DECL.  */
15050397SobrienDEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0)
15150397Sobrien
15290075Sobrien/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments 
15390075Sobrien   like TT<int>.
15490075Sobrien   In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the
15590075Sobrien   template name and its bound arguments.  TYPE_NAME is a TYPE_DECL.  */
15690075SobrienDEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm", 't', 0)
15790075Sobrien
15852284Sobrien/* A type designated by `typename T::t'.  TYPE_CONTEXT is `T',
15952284Sobrien   TYPE_NAME is an IDENTIFIER_NODE for `t'.  If the type was named via
16052284Sobrien   template-id, TYPENAME_TYPE_FULLNAME will hold the TEMPLATE_ID_EXPR.
16152284Sobrien   If TREE_TYPE is present, this type was generated by the implicit
16252284Sobrien   typename extension, and the TREE_TYPE is a _TYPE from a baseclass
16352284Sobrien   of `T'.  */
16450397SobrienDEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0)
16550397Sobrien
16690075Sobrien/* For template template argument of the form `T::template C'.
16790075Sobrien   TYPE_CONTEXT is `T', the template parameter dependent object.
16890075Sobrien   TYPE_NAME is an IDENTIFIER_NODE for `C', the member class template.  */
16990075SobrienDEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", 't', 0)
17090075Sobrien
17152284Sobrien/* A type designated by `__typeof (expr)'.  TYPE_FIELDS is the
17252284Sobrien   expression in question.  */
17352284SobrienDEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0)
17452284Sobrien
17550397Sobrien/* A using declaration.  DECL_INITIAL contains the specified scope.  
17650397Sobrien   This is not an alias, but is later expanded into multiple aliases.  */
17750397SobrienDEFTREECODE (USING_DECL, "using_decl", 'd', 0)
17850397Sobrien
17990075Sobrien/* A using directive. The operand is USING_STMT_NAMESPACE. */     
18090075SobrienDEFTREECODE (USING_STMT, "using_directive", 'e', 1)
18190075Sobrien
18250397Sobrien/* An un-parsed default argument.  Looks like an IDENTIFIER_NODE.  */
18390075SobrienDEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 2)
18450397Sobrien
18552284Sobrien/* A template-id, like foo<int>.  The first operand is the template.
18652284Sobrien   The second is the TREE_LIST or TREE_VEC of explicitly specified
18752284Sobrien   arguments.  The template will be a FUNCTION_DECL, TEMPLATE_DECL, or
18852284Sobrien   an OVERLOAD.  If the template-id refers to a member template, the
18952284Sobrien   template may be an IDENTIFIER_NODE.  */
19050397SobrienDEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2)
19150397Sobrien
19252284Sobrien/* An association between name and entity. Parameters are the scope
19352284Sobrien   and the (non-type) value.  TREE_TYPE indicates the type bound to
19452284Sobrien   the name. */
19550397SobrienDEFTREECODE (CPLUS_BINDING, "binding", 'x', 2)
19650397Sobrien
19750397Sobrien/* A list-like node for chaining overloading candidates. TREE_TYPE is 
19850397Sobrien   the original name, and the parameter is the FUNCTION_DECL.  */
19950397SobrienDEFTREECODE (OVERLOAD, "overload", 'x', 1)
20050397Sobrien
20150397Sobrien/* A generic wrapper for something not tree that we want to include in
20250397Sobrien   tree structure.  */
20350397SobrienDEFTREECODE (WRAPPER, "wrapper", 'x', 1)
20450397Sobrien
20552284Sobrien/* Used to represent deferred name lookup for dependent names while
20652284Sobrien   parsing a template declaration.  The first argument is an
20752284Sobrien   IDENTIFIER_NODE for the name in question.  The TREE_TYPE is
20852284Sobrien   unused.  */
20952284SobrienDEFTREECODE (LOOKUP_EXPR, "lookup_expr", 'e', 1)
21052284Sobrien
21150397Sobrien/* A whole bunch of tree codes for the initial, superficial parsing of
21250397Sobrien   templates.  */
21350397SobrienDEFTREECODE (MODOP_EXPR, "modop_expr", 'e', 3)
21450397SobrienDEFTREECODE (CAST_EXPR, "cast_expr", '1', 1)
21550397SobrienDEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", '1', 1)
21650397SobrienDEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", '1', 1)
21750397SobrienDEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", '1', 1)
21850397SobrienDEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", '1', 1)
21950397SobrienDEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2)
22050397SobrienDEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1)
22190075SobrienDEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3)
22250397Sobrien
22390075Sobrien/* A SUBOBJECT statement marks the point at which a sub-object is
22490075Sobrien   fully constructed.  After this point, the SUBOBJECT_CLEANUP must be
22590075Sobrien   run if an exception is thrown before the end of the enclosing
22690075Sobrien   function.  */
22790075SobrienDEFTREECODE (SUBOBJECT, "subobject", 'e', 1)
22890075Sobrien/* An CTOR_STMT marks the beginning (if CTOR_BEGIN_P holds) or end of
22990075Sobrien   a constructor (if CTOR_END_P) holds.  At the end of a constructor,
23090075Sobrien   the cleanups associated with any SUBOBJECT_CLEANUPS need no longer
23190075Sobrien   be run.  */
23290075SobrienDEFTREECODE (CTOR_STMT, "ctor_stmt", 'e', 0)
23390075Sobrien/* A CLEANUP_STMT marks the point at which a declaration is fully
23490075Sobrien   constructed.  If, after this point, the CLEANUP_DECL goes out of
23590075Sobrien   scope, the CLEANUP_EXPR must be run.  */
23690075SobrienDEFTREECODE (CLEANUP_STMT, "cleanup_stmt", 'e', 2)
23790075Sobrien/* CTOR_INITIALIZER is a placeholder in template code for a call to
23890075Sobrien   setup_vtbl_pointer (and appears in all functions, not just ctors).  */
23950397SobrienDEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 2)
24050397SobrienDEFTREECODE (RETURN_INIT, "return_init", 'e', 2)
24190075SobrienDEFTREECODE (TRY_BLOCK, "try_block", 'e', 2)
24290075SobrienDEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", 'e', 2)
24390075Sobrien/* A HANDLER wraps a catch handler for the HANDLER_TYPE.  If this is
24490075Sobrien   CATCH_ALL_TYPE, then the handler catches all types.  The declaration of
24590075Sobrien   the catch variable is in HANDLER_PARMS, and the body block in
24690075Sobrien   HANDLER_BODY.  */
24790075SobrienDEFTREECODE (HANDLER, "handler", 'e', 2)
24850397Sobrien
24990075Sobrien/* A MUST_NOT_THROW_EXPR wraps an expression that may not
25090075Sobrien   throw, and must call terminate if it does.  */
25190075SobrienDEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", 'e', 1)
25290075Sobrien
25350397SobrienDEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
25450397Sobrien
25550397Sobrien/* And some codes for expressing conversions for overload resolution.  */
25650397Sobrien
25750397SobrienDEFTREECODE (IDENTITY_CONV, "identity_conv", 'e', 1)
25850397SobrienDEFTREECODE (LVALUE_CONV, "lvalue_conv", 'e', 1)
25950397SobrienDEFTREECODE (QUAL_CONV, "qual_conv", 'e', 1)
26050397SobrienDEFTREECODE (STD_CONV, "std_conv", 'e', 1)
26150397SobrienDEFTREECODE (PTR_CONV, "ptr_conv", 'e', 1)
26250397SobrienDEFTREECODE (PMEM_CONV, "pmem_conv", 'e', 1)
26350397SobrienDEFTREECODE (BASE_CONV, "base_conv", 'e', 1)
26450397SobrienDEFTREECODE (REF_BIND, "ref_bind", 'e', 1)
26550397SobrienDEFTREECODE (USER_CONV, "user_conv", 'e', 2)
26650397SobrienDEFTREECODE (AMBIG_CONV, "ambig_conv", 'e', 1)
26750397SobrienDEFTREECODE (RVALUE_CONV, "rvalue_conv", 'e', 1)
26850397Sobrien
26950397Sobrien/*
27050397SobrienLocal variables:
27150397Sobrienmode:c
27250397SobrienEnd:
27350397Sobrien*/
274