118334Speter/* Definitions for C++ parsing and type checking. 290075Sobrien Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3169689Skan 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 490075Sobrien Contributed by Michael Tiemann (tiemann@cygnus.com) 518334Speter 6132718SkanThis file is part of GCC. 718334Speter 8132718SkanGCC is free software; you can redistribute it and/or modify 918334Speterit under the terms of the GNU General Public License as published by 1018334Speterthe Free Software Foundation; either version 2, or (at your option) 1118334Speterany later version. 1218334Speter 13132718SkanGCC is distributed in the hope that it will be useful, 1418334Speterbut WITHOUT ANY WARRANTY; without even the implied warranty of 1518334SpeterMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1618334SpeterGNU General Public License for more details. 1718334Speter 1818334SpeterYou should have received a copy of the GNU General Public License 19132718Skanalong with GCC; see the file COPYING. If not, write to 20169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor, 21169689SkanBoston, MA 02110-1301, USA. */ 2218334Speter 23117395Skan#ifndef GCC_CP_TREE_H 24117395Skan#define GCC_CP_TREE_H 25117395Skan 26132718Skan#include "ggc.h" 2790075Sobrien#include "function.h" 2890075Sobrien#include "hashtab.h" 2990075Sobrien#include "splay-tree.h" 30169689Skan#include "vec.h" 3190075Sobrien#include "varray.h" 3290075Sobrien#include "c-common.h" 33132718Skan#include "name-lookup.h" 34117395Skanstruct diagnostic_context; 35117395Skan 3650397Sobrien/* Usage of TREE_LANG_FLAG_?: 37169689Skan 0: IDENTIFIER_MARKED (IDENTIFIER_NODEs) 3850397Sobrien NEW_EXPR_USE_GLOBAL (in NEW_EXPR). 3950397Sobrien DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR). 40132718Skan COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR). 4152284Sobrien TREE_INDIRECT_USING (in NAMESPACE_DECL). 4290075Sobrien CLEANUP_P (in TRY_BLOCK) 4390075Sobrien AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR) 4490075Sobrien PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF) 45169689Skan PAREN_STRING_LITERAL (in STRING_CST) 46132718Skan DECL_PRETTY_FUNCTION_P (in VAR_DECL) 47132718Skan KOENIG_LOOKUP_P (in CALL_EXPR) 48169689Skan STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST). 49169689Skan EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT) 50169689Skan STMT_EXPR_NO_SCOPE (in STMT_EXPR) 51169689Skan BIND_EXPR_TRY_BLOCK (in BIND_EXPR) 52169689Skan TYPENAME_IS_ENUM_P (in TYPENAME_TYPE) 53169689Skan REFERENCE_REF_P (in INDIRECT_EXPR) 54169689Skan QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF) 55169689Skan OMP_ATOMIC_DEPENDENT_P (in OMP_ATOMIC) 56169689Skan OMP_FOR_GIMPLIFYING_P (in OMP_FOR) 57169689Skan BASELINK_QUALIFIED_P (in BASELINK) 58169689Skan TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR) 59169689Skan 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE) 6050397Sobrien TI_PENDING_TEMPLATE_FLAG. 6150397Sobrien TEMPLATE_PARMS_FOR_INLINE. 6250397Sobrien DELETE_EXPR_USE_VEC (in DELETE_EXPR). 6350397Sobrien (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out). 6490075Sobrien ICS_ELLIPSIS_FLAG (in _CONV) 65117395Skan DECL_INITIALIZED_P (in VAR_DECL) 66169689Skan TYPENAME_IS_CLASS_P (in TYPENAME_TYPE) 67169689Skan STMT_IS_FULL_EXPR_P (in _STMT) 68169689Skan 2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE) 6990075Sobrien ICS_THIS_FLAG (in _CONV) 70132718Skan DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL) 71169689Skan STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST) 72169689Skan 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out). 7390075Sobrien ICS_BAD_FLAG (in _CONV) 7490075Sobrien FN_TRY_BLOCK_P (in TRY_BLOCK) 7590075Sobrien IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE) 76169689Skan BIND_EXPR_BODY_BLOCK (in BIND_EXPR) 77169689Skan DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) 78169689Skan 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, 79169689Skan or FIELD_DECL). 8090075Sobrien IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE) 81169689Skan DECL_TINFO_P (in VAR_DECL) 8290075Sobrien 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE) 83132718Skan DECL_VTABLE_OR_VTT_P (in VAR_DECL) 84169689Skan 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE) 85169689Skan DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL) 86169689Skan TYPE_MARKED_P (in _TYPE) 8718334Speter 8850397Sobrien Usage of TYPE_LANG_FLAG_?: 89132718Skan 0: TYPE_DEPENDENT_P 9050397Sobrien 1: TYPE_HAS_CONSTRUCTOR. 91169689Skan 2: Unused 9250397Sobrien 3: TYPE_FOR_JAVA. 9390075Sobrien 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR 9450397Sobrien 5: IS_AGGR_TYPE. 95132718Skan 6: TYPE_DEPENDENT_P_VALID 9650397Sobrien 9750397Sobrien Usage of DECL_LANG_FLAG_?: 9850397Sobrien 0: DECL_ERROR_REPORTED (in VAR_DECL). 9990075Sobrien DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL) 10090075Sobrien DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL) 10190075Sobrien DECL_MUTABLE_P (in FIELD_DECL) 102169689Skan DECL_DEPENDENT_P (in USING_DECL) 10350397Sobrien 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL). 10452284Sobrien DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL) 105169689Skan DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL) 10650397Sobrien 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL). 10790075Sobrien DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL) 10850397Sobrien 3: DECL_IN_AGGR_P. 109117395Skan 4: DECL_C_BIT_FIELD (in a FIELD_DECL) 110171825Skan DECL_ANON_UNION_VAR_P (in a VAR_DECL) 111119256Skan DECL_SELF_REFERENCE_P (in a TYPE_DECL) 112169689Skan DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL) 11350397Sobrien 5: DECL_INTERFACE_KNOWN. 11450397Sobrien 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). 115169689Skan DECL_FIELD_IS_BASE (in FIELD_DECL) 11650397Sobrien 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). 11790075Sobrien DECL_THUNK_P (in a member FUNCTION_DECL) 11852284Sobrien 11952284Sobrien Usage of language-independent fields in a language-dependent manner: 12090075Sobrien 12152284Sobrien TYPE_ALIAS_SET 12252284Sobrien This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so 12352284Sobrien forth as a substitute for the mark bits provided in `lang_type'. 12452284Sobrien At present, only the six low-order bits are used. 12552284Sobrien 126169689Skan TYPE_LANG_SLOT_1 12752284Sobrien For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO. 12890075Sobrien For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS 12952284Sobrien 13090075Sobrien BINFO_VIRTUALS 131117395Skan For a binfo, this is a TREE_LIST. There is an entry for each 132117395Skan virtual function declared either in BINFO or its direct and 133117395Skan indirect primary bases. 13450397Sobrien 135117395Skan The BV_DELTA of each node gives the amount by which to adjust the 136117395Skan `this' pointer when calling the function. If the method is an 137132718Skan overridden version of a base class method, then it is assumed 138117395Skan that, prior to adjustment, the this pointer points to an object 139117395Skan of the base class. 140117395Skan 14190075Sobrien The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable 142169689Skan index of the vcall offset for this entry. 14390075Sobrien 14490075Sobrien The BV_FN is the declaration for the virtual function itself. 14590075Sobrien 14690075Sobrien BINFO_VTABLE 14790075Sobrien This is an expression with POINTER_TYPE that gives the value 14890075Sobrien to which the vptr should be initialized. Use get_vtbl_decl_for_binfo 14990075Sobrien to extract the VAR_DECL for the complete vtable. 15090075Sobrien 15190075Sobrien DECL_ARGUMENTS 15290075Sobrien For a VAR_DECL this is DECL_ANON_UNION_ELEMS. 15390075Sobrien 15490075Sobrien DECL_VINDEX 15590075Sobrien This field is NULL for a non-virtual function. For a virtual 15690075Sobrien function, it is eventually set to an INTEGER_CST indicating the 15790075Sobrien index in the vtable at which this function can be found. When 15890075Sobrien a virtual function is declared, but before it is known what 159132718Skan function is overridden, this field is the error_mark_node. 16090075Sobrien 16190075Sobrien Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is 16290075Sobrien the virtual function this one overrides, and whose TREE_CHAIN is 16390075Sobrien the old DECL_VINDEX. */ 16490075Sobrien 165117395Skan/* Language-specific tree checkers. */ 16690075Sobrien 167169689Skan#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \ 168169689Skan TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL) 16990075Sobrien 170169689Skan#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \ 171169689Skan TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL) 17290075Sobrien 173169689Skan#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \ 174169689Skan TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL) 17590075Sobrien 176169689Skan#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \ 177169689Skan TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM) 17890075Sobrien 179169689Skan#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) 180169689Skan#define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \ 181169689Skan({ const tree __t = (NODE); \ 182169689Skan if (TREE_CODE (__t) != FUNCTION_DECL && \ 183169689Skan TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \ 184169689Skan && __t->decl_common.lang_specific->decl_flags.thunk_p) \ 185169689Skan tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ 18690075Sobrien __t; }) 187169689Skan#define THUNK_FUNCTION_CHECK(NODE) __extension__ \ 188169689Skan({ const tree __t = (NODE); \ 189169689Skan if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \ 190169689Skan || !__t->decl_common.lang_specific->decl_flags.thunk_p) \ 191169689Skan tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \ 192169689Skan __t; }) 193169689Skan#else 194169689Skan#define NON_THUNK_FUNCTION_CHECK(NODE) (NODE) 195169689Skan#define THUNK_FUNCTION_CHECK(NODE) (NODE) 19690075Sobrien#endif 19790075Sobrien 19818334Speter/* Language-dependent contents of an identifier. */ 19918334Speter 200117395Skanstruct lang_identifier GTY(()) 20118334Speter{ 202117395Skan struct c_common_identifier c_common; 203117395Skan cxx_binding *namespace_bindings; 204117395Skan cxx_binding *bindings; 20518334Speter tree class_template_info; 206132718Skan tree label_value; 20718334Speter}; 20818334Speter 20990075Sobrien/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a 21090075Sobrien keyword. C_RID_CODE (node) is then the RID_* value of the keyword, 21190075Sobrien and C_RID_YYCODE is the token number wanted by Yacc. */ 21290075Sobrien 21390075Sobrien#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID) 21490075Sobrien 21590075Sobrien#define LANG_IDENTIFIER_CAST(NODE) \ 21690075Sobrien ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE)) 21790075Sobrien 218169689Skanstruct template_parm_index_s GTY(()) 21950397Sobrien{ 22090075Sobrien struct tree_common common; 22150397Sobrien HOST_WIDE_INT index; 22250397Sobrien HOST_WIDE_INT level; 22350397Sobrien HOST_WIDE_INT orig_level; 22450397Sobrien tree decl; 225169689Skan}; 226169689Skantypedef struct template_parm_index_s template_parm_index; 22750397Sobrien 228169689Skanstruct tinst_level_s GTY(()) 229169689Skan{ 230169689Skan struct tree_common common; 231169689Skan tree decl; 232169689Skan location_t locus; 233169689Skan int in_system_header_p; 234169689Skan}; 235169689Skantypedef struct tinst_level_s * tinst_level_t; 236169689Skan 237117395Skanstruct ptrmem_cst GTY(()) 23852284Sobrien{ 23990075Sobrien struct tree_common common; 24090075Sobrien /* This isn't used, but the middle-end expects all constants to have 24190075Sobrien this field. */ 24290075Sobrien rtx rtl; 24352284Sobrien tree member; 244117395Skan}; 245117395Skantypedef struct ptrmem_cst * ptrmem_cst_t; 24652284Sobrien 24750397Sobrien#define IDENTIFIER_GLOBAL_VALUE(NODE) \ 24890075Sobrien namespace_binding ((NODE), global_namespace) 24950397Sobrien#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \ 25090075Sobrien set_namespace_binding ((NODE), global_namespace, (VAL)) 25150397Sobrien#define IDENTIFIER_NAMESPACE_VALUE(NODE) \ 25290075Sobrien namespace_binding ((NODE), current_namespace) 25350397Sobrien#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \ 25490075Sobrien set_namespace_binding ((NODE), current_namespace, (VAL)) 25550397Sobrien 256169689Skan#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE)) 25790075Sobrien 258169689Skan#define BIND_EXPR_TRY_BLOCK(NODE) \ 259169689Skan TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE)) 260169689Skan 261169689Skan/* Used to mark the block around the member initializers and cleanups. */ 262169689Skan#define BIND_EXPR_BODY_BLOCK(NODE) \ 263169689Skan TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE)) 264169689Skan#define FUNCTION_NEEDS_BODY_BLOCK(NODE) \ 265169689Skan (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE)) 266169689Skan 267169689Skan#define STATEMENT_LIST_NO_SCOPE(NODE) \ 268169689Skan TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE)) 269169689Skan#define STATEMENT_LIST_TRY_BLOCK(NODE) \ 270169689Skan TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE)) 271169689Skan 272169689Skan/* Nonzero if this statement should be considered a full-expression, 273169689Skan i.e., if temporaries created during this statement should have 274169689Skan their destructors run at the end of this statement. */ 275169689Skan#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE)) 276169689Skan 277169689Skan/* Marks the result of a statement expression. */ 278169689Skan#define EXPR_STMT_STMT_EXPR_RESULT(NODE) \ 279169689Skan TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE)) 280169689Skan 281169689Skan/* Nonzero if this statement-expression does not have an associated scope. */ 282169689Skan#define STMT_EXPR_NO_SCOPE(NODE) \ 283169689Skan TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE)) 284169689Skan 28590075Sobrien/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual 28690075Sobrien sense of `same'. */ 28790075Sobrien#define same_type_p(TYPE1, TYPE2) \ 28890075Sobrien comptypes ((TYPE1), (TYPE2), COMPARE_STRICT) 28990075Sobrien 29090075Sobrien/* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring 29190075Sobrien top-level qualifiers. */ 29290075Sobrien#define same_type_ignoring_top_level_qualifiers_p(TYPE1, TYPE2) \ 29390075Sobrien same_type_p (TYPE_MAIN_VARIANT (TYPE1), TYPE_MAIN_VARIANT (TYPE2)) 29490075Sobrien 295117395Skan/* Nonzero if we are presently building a statement tree, rather 29690075Sobrien than expanding each statement as we encounter it. */ 297169689Skan#define building_stmt_tree() (cur_stmt_list != NULL_TREE) 29890075Sobrien 299117395Skan/* Returns nonzero iff NODE is a declaration for the global function 30090075Sobrien `main'. */ 30190075Sobrien#define DECL_MAIN_P(NODE) \ 302169689Skan (DECL_EXTERN_C_FUNCTION_P (NODE) \ 30390075Sobrien && DECL_NAME (NODE) != NULL_TREE \ 30490075Sobrien && MAIN_NAME_P (DECL_NAME (NODE))) 30590075Sobrien 306117395Skan/* The overloaded FUNCTION_DECL. */ 30790075Sobrien#define OVL_FUNCTION(NODE) \ 30890075Sobrien (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function) 30990075Sobrien#define OVL_CHAIN(NODE) TREE_CHAIN (NODE) 310117395Skan/* Polymorphic access to FUNCTION and CHAIN. */ 311169689Skan#define OVL_CURRENT(NODE) \ 31290075Sobrien ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE)) 313169689Skan#define OVL_NEXT(NODE) \ 31490075Sobrien ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE) 31550397Sobrien/* If set, this was imported in a using declaration. 31650397Sobrien This is not to confuse with being used somewhere, which 317117395Skan is not important for this node. */ 318169689Skan#define OVL_USED(NODE) TREE_USED (NODE) 31950397Sobrien 320117395Skanstruct tree_overload GTY(()) 32150397Sobrien{ 32290075Sobrien struct tree_common common; 32350397Sobrien tree function; 32450397Sobrien}; 32550397Sobrien 326117395Skan/* Returns true iff NODE is a BASELINK. */ 32752284Sobrien#define BASELINK_P(NODE) \ 328117395Skan (TREE_CODE (NODE) == BASELINK) 329117395Skan/* The BINFO indicating the base from which the BASELINK_FUNCTIONS came. */ 330117395Skan#define BASELINK_BINFO(NODE) \ 331132718Skan (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo) 332117395Skan/* The functions referred to by the BASELINK; either a FUNCTION_DECL, 333117395Skan a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */ 334117395Skan#define BASELINK_FUNCTIONS(NODE) \ 335132718Skan (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions) 336169689Skan/* The BINFO in which the search for the functions indicated by this baselink 337169689Skan began. This base is used to determine the accessibility of functions 338117395Skan selected by overload resolution. */ 339117395Skan#define BASELINK_ACCESS_BINFO(NODE) \ 340132718Skan (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo) 341117395Skan/* For a type-conversion operator, the BASELINK_OPTYPE indicates the type 342117395Skan to which the conversion should occur. This value is important if 343117395Skan the BASELINK_FUNCTIONS include a template conversion operator -- 344117395Skan the BASELINK_OPTYPE can be used to determine what type the user 345117395Skan requested. */ 346117395Skan#define BASELINK_OPTYPE(NODE) \ 347117395Skan (TREE_CHAIN (BASELINK_CHECK (NODE))) 348169689Skan/* Non-zero if this baselink was from a qualified lookup. */ 349169689Skan#define BASELINK_QUALIFIED_P(NODE) \ 350169689Skan TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE)) 35152284Sobrien 352132718Skanstruct tree_baselink GTY(()) 353132718Skan{ 354132718Skan struct tree_common common; 355132718Skan tree binfo; 356132718Skan tree functions; 357132718Skan tree access_binfo; 358132718Skan}; 359132718Skan 360169689Skan/* The different kinds of ids that we encounter. */ 36150397Sobrien 362132718Skantypedef enum cp_id_kind 36350397Sobrien{ 364132718Skan /* Not an id at all. */ 365132718Skan CP_ID_KIND_NONE, 366132718Skan /* An unqualified-id that is not a template-id. */ 367132718Skan CP_ID_KIND_UNQUALIFIED, 368132718Skan /* An unqualified-id that is a dependent name. */ 369132718Skan CP_ID_KIND_UNQUALIFIED_DEPENDENT, 370132718Skan /* An unqualified template-id. */ 371132718Skan CP_ID_KIND_TEMPLATE_ID, 372132718Skan /* A qualified-id. */ 373132718Skan CP_ID_KIND_QUALIFIED 374132718Skan} cp_id_kind; 37550397Sobrien 37618334Speter/* Macros for access to language-specific slots in an identifier. */ 37718334Speter 37850397Sobrien#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \ 37990075Sobrien (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings) 38018334Speter#define IDENTIFIER_TEMPLATE(NODE) \ 38190075Sobrien (LANG_IDENTIFIER_CAST (NODE)->class_template_info) 38218334Speter 383117395Skan/* The IDENTIFIER_BINDING is the innermost cxx_binding for the 384117395Skan identifier. It's PREVIOUS is the next outermost binding. Each 385132718Skan VALUE field is a DECL for the associated declaration. Thus, 38652284Sobrien name lookup consists simply of pulling off the node at the front 38752284Sobrien of the list (modulo oddities for looking up the names of types, 388132718Skan and such.) You can use SCOPE field to determine the scope 389132718Skan that bound the name. */ 39052284Sobrien#define IDENTIFIER_BINDING(NODE) \ 39190075Sobrien (LANG_IDENTIFIER_CAST (NODE)->bindings) 39252284Sobrien 39350397Sobrien/* TREE_TYPE only indicates on local and class scope the current 39450397Sobrien type. For namespace scope, the presence of a type in any namespace 39550397Sobrien is indicated with global_type_node, and the real type behind must 396117395Skan be found through lookup. */ 39790075Sobrien#define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE) 39890075Sobrien#define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE) 39990075Sobrien#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE)) 40050397Sobrien#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0) 40118334Speter 40290075Sobrien#define IDENTIFIER_LABEL_VALUE(NODE) \ 403132718Skan (LANG_IDENTIFIER_CAST (NODE)->label_value) 40490075Sobrien#define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \ 405132718Skan IDENTIFIER_LABEL_VALUE (NODE) = (VALUE) 40618334Speter 40790075Sobrien/* Nonzero if this identifier is used as a virtual function name somewhere 40890075Sobrien (optimizes searches). */ 40990075Sobrien#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE) 41018334Speter 41190075Sobrien/* Nonzero if this identifier is the prefix for a mangled C++ operator 41290075Sobrien name. */ 41390075Sobrien#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE) 41418334Speter 41552284Sobrien/* Nonzero if this identifier is the name of a type-conversion 41652284Sobrien operator. */ 41790075Sobrien#define IDENTIFIER_TYPENAME_P(NODE) \ 41890075Sobrien TREE_LANG_FLAG_4 (NODE) 41918334Speter 42090075Sobrien/* Nonzero if this identifier is the name of a constructor or 42190075Sobrien destructor. */ 42290075Sobrien#define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \ 42390075Sobrien TREE_LANG_FLAG_3 (NODE) 42418334Speter 425169689Skan/* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague 426169689Skan linkage which the prelinker has assigned to this translation 427169689Skan unit. */ 428169689Skan#define IDENTIFIER_REPO_CHOSEN(NAME) \ 429169689Skan (TREE_LANG_FLAG_6 (NAME)) 430169689Skan 43118334Speter/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ 432132718Skan#define C_TYPE_FIELDS_READONLY(TYPE) \ 433132718Skan (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly) 43418334Speter 435132718Skan/* The tokens stored in the default argument. */ 436132718Skan 437132718Skan#define DEFARG_TOKENS(NODE) \ 438132718Skan (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens) 439169689Skan#define DEFARG_INSTANTIATIONS(NODE) \ 440169689Skan (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations) 441132718Skan 442132718Skanstruct tree_default_arg GTY (()) 443132718Skan{ 444132718Skan struct tree_common common; 445132718Skan struct cp_token_cache *tokens; 446169689Skan VEC(tree,gc) *instantiations; 447132718Skan}; 448132718Skan 449117395Skanenum cp_tree_node_structure_enum { 450117395Skan TS_CP_GENERIC, 451117395Skan TS_CP_IDENTIFIER, 452117395Skan TS_CP_TPI, 453169689Skan TS_CP_TINST_LEVEL, 454117395Skan TS_CP_PTRMEM, 455132718Skan TS_CP_BINDING, 456117395Skan TS_CP_OVERLOAD, 457132718Skan TS_CP_BASELINK, 458117395Skan TS_CP_WRAPPER, 459132718Skan TS_CP_DEFAULT_ARG, 460117395Skan LAST_TS_CP_ENUM 461117395Skan}; 462117395Skan 463117395Skan/* The resulting tree type. */ 464117395Skanunion lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), 465117395Skan chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) 466117395Skan{ 467117395Skan union tree_node GTY ((tag ("TS_CP_GENERIC"), 468117395Skan desc ("tree_node_structure (&%h)"))) generic; 469117395Skan struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi; 470169689Skan struct tinst_level_s GTY ((tag ("TS_CP_TINST_LEVEL"))) tinst_level; 471117395Skan struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem; 472117395Skan struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload; 473132718Skan struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink; 474132718Skan struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg; 475117395Skan struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier; 476117395Skan}; 477117395Skan 47818334Speter 47990075Sobrienenum cp_tree_index 48090075Sobrien{ 48190075Sobrien CPTI_JAVA_BYTE_TYPE, 48290075Sobrien CPTI_JAVA_SHORT_TYPE, 48390075Sobrien CPTI_JAVA_INT_TYPE, 48490075Sobrien CPTI_JAVA_LONG_TYPE, 48590075Sobrien CPTI_JAVA_FLOAT_TYPE, 48690075Sobrien CPTI_JAVA_DOUBLE_TYPE, 48790075Sobrien CPTI_JAVA_CHAR_TYPE, 48890075Sobrien CPTI_JAVA_BOOLEAN_TYPE, 48918334Speter 49090075Sobrien CPTI_WCHAR_DECL, 49190075Sobrien CPTI_VTABLE_ENTRY_TYPE, 49290075Sobrien CPTI_DELTA_TYPE, 49390075Sobrien CPTI_VTABLE_INDEX_TYPE, 49490075Sobrien CPTI_CLEANUP_TYPE, 49590075Sobrien CPTI_VTT_PARM_TYPE, 49650397Sobrien 49790075Sobrien CPTI_CLASS_TYPE, 49890075Sobrien CPTI_UNKNOWN_TYPE, 49990075Sobrien CPTI_VTBL_TYPE, 50090075Sobrien CPTI_VTBL_PTR_TYPE, 50190075Sobrien CPTI_STD, 50290075Sobrien CPTI_ABI, 503169689Skan CPTI_CONST_TYPE_INFO_TYPE, 504102780Skan CPTI_TYPE_INFO_PTR_TYPE, 50590075Sobrien CPTI_ABORT_FNDECL, 50690075Sobrien CPTI_GLOBAL_DELETE_FNDECL, 50790075Sobrien CPTI_AGGR_TAG, 50818334Speter 50990075Sobrien CPTI_CTOR_IDENTIFIER, 51090075Sobrien CPTI_COMPLETE_CTOR_IDENTIFIER, 51190075Sobrien CPTI_BASE_CTOR_IDENTIFIER, 51290075Sobrien CPTI_DTOR_IDENTIFIER, 51390075Sobrien CPTI_COMPLETE_DTOR_IDENTIFIER, 51490075Sobrien CPTI_BASE_DTOR_IDENTIFIER, 51590075Sobrien CPTI_DELETING_DTOR_IDENTIFIER, 51690075Sobrien CPTI_DELTA_IDENTIFIER, 51790075Sobrien CPTI_IN_CHARGE_IDENTIFIER, 51890075Sobrien CPTI_VTT_PARM_IDENTIFIER, 51990075Sobrien CPTI_NELTS_IDENTIFIER, 52090075Sobrien CPTI_THIS_IDENTIFIER, 52190075Sobrien CPTI_PFN_IDENTIFIER, 52290075Sobrien CPTI_VPTR_IDENTIFIER, 52390075Sobrien CPTI_STD_IDENTIFIER, 52418334Speter 52590075Sobrien CPTI_LANG_NAME_C, 52690075Sobrien CPTI_LANG_NAME_CPLUSPLUS, 52790075Sobrien CPTI_LANG_NAME_JAVA, 52890075Sobrien 52990075Sobrien CPTI_EMPTY_EXCEPT_SPEC, 53090075Sobrien CPTI_JCLASS, 53190075Sobrien CPTI_TERMINATE, 53290075Sobrien CPTI_CALL_UNEXPECTED, 53390075Sobrien CPTI_ATEXIT, 53490075Sobrien CPTI_DSO_HANDLE, 53590075Sobrien CPTI_DCAST, 53690075Sobrien 537117395Skan CPTI_KEYED_CLASSES, 538117395Skan 53990075Sobrien CPTI_MAX 54090075Sobrien}; 54190075Sobrien 542117395Skanextern GTY(()) tree cp_global_trees[CPTI_MAX]; 54390075Sobrien 54490075Sobrien#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE] 54590075Sobrien#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE] 54690075Sobrien#define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE] 54790075Sobrien#define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE] 54890075Sobrien#define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE] 54990075Sobrien#define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE] 55090075Sobrien#define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE] 55190075Sobrien#define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE] 55290075Sobrien 55390075Sobrien#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] 55490075Sobrien#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] 55590075Sobrien/* The type used to represent an offset by which to adjust the `this' 55690075Sobrien pointer in pointer-to-member types. */ 55790075Sobrien#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE] 55890075Sobrien/* The type used to represent an index into the vtable. */ 559169689Skan#define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE] 56090075Sobrien 56190075Sobrien#define class_type_node cp_global_trees[CPTI_CLASS_TYPE] 56290075Sobrien#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE] 56390075Sobrien#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE] 56490075Sobrien#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE] 56590075Sobrien#define std_node cp_global_trees[CPTI_STD] 566169689Skan#define abi_node cp_global_trees[CPTI_ABI] 567169689Skan#define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE] 568102780Skan#define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE] 56990075Sobrien#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL] 57090075Sobrien#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL] 57190075Sobrien#define current_aggr cp_global_trees[CPTI_AGGR_TAG] 57290075Sobrien 57390075Sobrien/* We cache these tree nodes so as to call get_identifier less 57490075Sobrien frequently. */ 57590075Sobrien 57690075Sobrien/* The name of a constructor that takes an in-charge parameter to 57790075Sobrien decide whether or not to construct virtual base classes. */ 578169689Skan#define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER] 57990075Sobrien/* The name of a constructor that constructs virtual base classes. */ 580169689Skan#define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER] 58190075Sobrien/* The name of a constructor that does not construct virtual base classes. */ 582169689Skan#define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER] 58390075Sobrien/* The name of a destructor that takes an in-charge parameter to 58490075Sobrien decide whether or not to destroy virtual base classes and whether 58590075Sobrien or not to delete the object. */ 586169689Skan#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER] 58790075Sobrien/* The name of a destructor that destroys virtual base classes. */ 588169689Skan#define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER] 58990075Sobrien/* The name of a destructor that does not destroy virtual base 59090075Sobrien classes. */ 591169689Skan#define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER] 59290075Sobrien/* The name of a destructor that destroys virtual base classes, and 59390075Sobrien then deletes the entire object. */ 594169689Skan#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER] 595169689Skan#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER] 596169689Skan#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER] 59790075Sobrien/* The name of the parameter that contains a pointer to the VTT to use 59890075Sobrien for this subobject constructor or destructor. */ 599169689Skan#define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER] 600169689Skan#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER] 601169689Skan#define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER] 602169689Skan#define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER] 603169689Skan#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER] 60490075Sobrien/* The name of the std namespace. */ 605169689Skan#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER] 606169689Skan#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C] 607169689Skan#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS] 608169689Skan#define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA] 60990075Sobrien 61090075Sobrien/* Exception specifier used for throw(). */ 611169689Skan#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC] 61290075Sobrien 613117395Skan/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */ 614169689Skan#define jclass_node cp_global_trees[CPTI_JCLASS] 61590075Sobrien 61690075Sobrien/* The declaration for `std::terminate'. */ 617169689Skan#define terminate_node cp_global_trees[CPTI_TERMINATE] 61890075Sobrien 61990075Sobrien/* The declaration for "__cxa_call_unexpected". */ 620169689Skan#define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED] 62190075Sobrien 62290075Sobrien/* A pointer to `std::atexit'. */ 623169689Skan#define atexit_node cp_global_trees[CPTI_ATEXIT] 62490075Sobrien 62590075Sobrien/* A pointer to `__dso_handle'. */ 626169689Skan#define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE] 62790075Sobrien 62890075Sobrien/* The declaration of the dynamic_cast runtime. */ 629169689Skan#define dynamic_cast_node cp_global_trees[CPTI_DCAST] 63090075Sobrien 63190075Sobrien/* The type of a destructor. */ 632169689Skan#define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE] 63390075Sobrien 63490075Sobrien/* The type of the vtt parameter passed to subobject constructors and 63590075Sobrien destructors. */ 636169689Skan#define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE] 63790075Sobrien 638117395Skan/* A TREE_LIST of the dynamic classes whose vtables may have to be 639117395Skan emitted in this translation unit. */ 640117395Skan 641169689Skan#define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES] 642117395Skan 643132718Skan/* Node to indicate default access. This must be distinct from the 644132718Skan access nodes in tree.h. */ 645132718Skan 646132718Skan#define access_default_node null_node 647132718Skan 64890075Sobrien/* Global state. */ 64990075Sobrien 650117395Skanstruct saved_scope GTY(()) 65190075Sobrien{ 652169689Skan VEC(cxx_saved_binding,gc) *old_bindings; 65390075Sobrien tree old_namespace; 65490075Sobrien tree decl_ns_list; 65590075Sobrien tree class_name; 65690075Sobrien tree class_type; 65790075Sobrien tree access_specifier; 65890075Sobrien tree function_decl; 659169689Skan VEC(tree,gc) *lang_base; 66090075Sobrien tree lang_name; 66190075Sobrien tree template_parms; 662169689Skan struct cp_binding_level *x_previous_class_level; 66390075Sobrien tree x_saved_tree; 66490075Sobrien 66590075Sobrien HOST_WIDE_INT x_processing_template_decl; 66690075Sobrien int x_processing_specialization; 667132718Skan bool x_processing_explicit_instantiation; 66890075Sobrien int need_pop_function_context; 669169689Skan bool skip_evaluation; 67090075Sobrien 67190075Sobrien struct stmt_tree_s x_stmt_tree; 67290075Sobrien 673117395Skan struct cp_binding_level *class_bindings; 674117395Skan struct cp_binding_level *bindings; 67590075Sobrien 67690075Sobrien struct saved_scope *prev; 67790075Sobrien}; 67890075Sobrien 67990075Sobrien/* The current open namespace. */ 68090075Sobrien 68190075Sobrien#define current_namespace scope_chain->old_namespace 68290075Sobrien 683117395Skan/* The stack for namespaces of current declarations. */ 68490075Sobrien 68590075Sobrien#define decl_namespace_list scope_chain->decl_ns_list 68690075Sobrien 68790075Sobrien/* IDENTIFIER_NODE: name of current class */ 68890075Sobrien 68990075Sobrien#define current_class_name scope_chain->class_name 69090075Sobrien 69190075Sobrien/* _TYPE: the type of the current class */ 69290075Sobrien 69390075Sobrien#define current_class_type scope_chain->class_type 69490075Sobrien 69590075Sobrien/* When parsing a class definition, the access specifier most recently 69690075Sobrien given by the user, or, if no access specifier was given, the 69790075Sobrien default value appropriate for the kind of class (i.e., struct, 69890075Sobrien class, or union). */ 69990075Sobrien 70090075Sobrien#define current_access_specifier scope_chain->access_specifier 70190075Sobrien 70290075Sobrien/* Pointer to the top of the language name stack. */ 70390075Sobrien 70490075Sobrien#define current_lang_base scope_chain->lang_base 70590075Sobrien#define current_lang_name scope_chain->lang_name 70690075Sobrien 70790075Sobrien/* Parsing a function declarator leaves a list of parameter names 70890075Sobrien or a chain or parameter decls here. */ 70990075Sobrien 71090075Sobrien#define current_template_parms scope_chain->template_parms 71190075Sobrien 71290075Sobrien#define processing_template_decl scope_chain->x_processing_template_decl 71390075Sobrien#define processing_specialization scope_chain->x_processing_specialization 71490075Sobrien#define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation 71590075Sobrien 716169689Skan/* The cached class binding level, from the most recently exited 717169689Skan class, or NULL if none. */ 71890075Sobrien 719169689Skan#define previous_class_level scope_chain->x_previous_class_level 72090075Sobrien 72190075Sobrien/* A list of private types mentioned, for deferred access checking. */ 72290075Sobrien 723117395Skanextern GTY(()) struct saved_scope *scope_chain; 72490075Sobrien 725169689Skanstruct cxx_int_tree_map GTY(()) 726169689Skan{ 727169689Skan unsigned int uid; 728169689Skan tree to; 729169689Skan}; 730169689Skan 731169689Skanextern unsigned int cxx_int_tree_map_hash (const void *); 732169689Skanextern int cxx_int_tree_map_eq (const void *, const void *); 733169689Skan 73490075Sobrien/* Global state pertinent to the current function. */ 73590075Sobrien 736117395Skanstruct language_function GTY(()) 73790075Sobrien{ 738117395Skan struct c_language_function base; 73990075Sobrien 740169689Skan tree x_cdtor_label; 74190075Sobrien tree x_current_class_ptr; 74290075Sobrien tree x_current_class_ref; 74390075Sobrien tree x_eh_spec_block; 74490075Sobrien tree x_in_charge_parm; 74590075Sobrien tree x_vtt_parm; 74690075Sobrien tree x_return_value; 74790075Sobrien 74890075Sobrien int returns_value; 74990075Sobrien int returns_null; 75096263Sobrien int returns_abnormally; 75190075Sobrien int in_function_try_handler; 752117395Skan int in_base_initializer; 75390075Sobrien 754117395Skan /* True if this function can throw an exception. */ 755132718Skan BOOL_BITFIELD can_throw : 1; 756117395Skan 757169689Skan htab_t GTY((param_is(struct named_label_entry))) x_named_labels; 758117395Skan struct cp_binding_level *bindings; 759169689Skan VEC(tree,gc) *x_local_names; 760169689Skan htab_t GTY((param_is (struct cxx_int_tree_map))) extern_decl_map; 76190075Sobrien}; 76290075Sobrien 76390075Sobrien/* The current C++-specific per-function global variables. */ 76490075Sobrien 765117395Skan#define cp_function_chain (cfun->language) 76690075Sobrien 767169689Skan/* In a constructor destructor, the point at which all derived class 768169689Skan destroying/construction has been has been done. Ie. just before a 769169689Skan constructor returns, or before any base class destroying will be done 770169689Skan in a destructor. */ 77190075Sobrien 772169689Skan#define cdtor_label cp_function_chain->x_cdtor_label 77390075Sobrien 77490075Sobrien/* When we're processing a member function, current_class_ptr is the 77590075Sobrien PARM_DECL for the `this' pointer. The current_class_ref is an 77690075Sobrien expression for `*this'. */ 77790075Sobrien 77890075Sobrien#define current_class_ptr \ 77990075Sobrien (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE) 78090075Sobrien#define current_class_ref \ 78190075Sobrien (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE) 78290075Sobrien 78390075Sobrien/* The EH_SPEC_BLOCK for the exception-specifiers for the current 78490075Sobrien function, if any. */ 78590075Sobrien 78690075Sobrien#define current_eh_spec_block cp_function_chain->x_eh_spec_block 78790075Sobrien 78890075Sobrien/* The `__in_chrg' parameter for the current function. Only used for 78990075Sobrien constructors and destructors. */ 79090075Sobrien 79190075Sobrien#define current_in_charge_parm cp_function_chain->x_in_charge_parm 79290075Sobrien 79390075Sobrien/* The `__vtt_parm' parameter for the current function. Only used for 79490075Sobrien constructors and destructors. */ 79590075Sobrien 79690075Sobrien#define current_vtt_parm cp_function_chain->x_vtt_parm 79790075Sobrien 79890075Sobrien/* Set to 0 at beginning of a function definition, set to 1 if 79990075Sobrien a return statement that specifies a return value is seen. */ 80090075Sobrien 80190075Sobrien#define current_function_returns_value cp_function_chain->returns_value 80290075Sobrien 80390075Sobrien/* Set to 0 at beginning of a function definition, set to 1 if 80490075Sobrien a return statement with no argument is seen. */ 80590075Sobrien 80690075Sobrien#define current_function_returns_null cp_function_chain->returns_null 80790075Sobrien 80896263Sobrien/* Set to 0 at beginning of a function definition, set to 1 if 80996263Sobrien a call to a noreturn function is seen. */ 81096263Sobrien 81196263Sobrien#define current_function_returns_abnormally \ 81296263Sobrien cp_function_chain->returns_abnormally 81396263Sobrien 814132718Skan/* Nonzero if we are processing a base initializer. Zero elsewhere. */ 815117395Skan#define in_base_initializer cp_function_chain->in_base_initializer 816117395Skan 81790075Sobrien#define in_function_try_handler cp_function_chain->in_function_try_handler 81890075Sobrien 81990075Sobrien/* Expression always returned from function, or error_mark_node 82090075Sobrien otherwise, for use by the automatic named return value optimization. */ 82190075Sobrien 82290075Sobrien#define current_function_return_value \ 82390075Sobrien (cp_function_chain->x_return_value) 82490075Sobrien 825132718Skan/* True if NAME is the IDENTIFIER_NODE for an overloaded "operator 826132718Skan new" or "operator delete". */ 827132718Skan#define NEW_DELETE_OPNAME_P(NAME) \ 828169689Skan ((NAME) == ansi_opname (NEW_EXPR) \ 829169689Skan || (NAME) == ansi_opname (VEC_NEW_EXPR) \ 830169689Skan || (NAME) == ansi_opname (DELETE_EXPR) \ 831132718Skan || (NAME) == ansi_opname (VEC_DELETE_EXPR)) 83250397Sobrien 83390075Sobrien#define ansi_opname(CODE) \ 83490075Sobrien (operator_name_info[(int) (CODE)].identifier) 83590075Sobrien#define ansi_assopname(CODE) \ 83690075Sobrien (assignment_operator_name_info[(int) (CODE)].identifier) 83718334Speter 838117395Skan/* True if NODE is an erroneous expression. */ 83918334Speter 840117395Skan#define error_operand_p(NODE) \ 841169689Skan ((NODE) == error_mark_node \ 842117395Skan || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node)) 84318334Speter 84418334Speter/* C++ language-specific tree codes. */ 84518334Speter#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM, 84618334Speterenum cplus_tree_code { 84790075Sobrien CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE, 84850397Sobrien#include "cp-tree.def" 84918334Speter LAST_CPLUS_TREE_CODE 85018334Speter}; 85118334Speter#undef DEFTREECODE 85218334Speter 853169689Skan/* TRUE if a tree code represents a statement. */ 854169689Skanextern bool statement_code_p[MAX_TREE_CODES]; 855132718Skan 856169689Skan#define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)] 857169689Skan 85850397Sobrienenum languages { lang_c, lang_cplusplus, lang_java }; 85918334Speter 86018334Speter/* Macros to make error reporting functions' lives easier. */ 86118334Speter#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE))) 86290075Sobrien#define TYPE_LINKAGE_IDENTIFIER(NODE) \ 86390075Sobrien (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE))) 86418334Speter#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE))) 86518334Speter#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE))) 86618334Speter 86790075Sobrien/* Nonzero if NODE has no name for linkage purposes. */ 86890075Sobrien#define TYPE_ANONYMOUS_P(NODE) \ 86990075Sobrien (TAGGED_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE))) 87090075Sobrien 87118334Speter/* The _DECL for this _TYPE. */ 87250397Sobrien#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE))) 87318334Speter 87452284Sobrien/* Nonzero if T is a class (or struct or union) type. Also nonzero 87590075Sobrien for template type parameters, typename types, and instantiated 87690075Sobrien template template parameters. Despite its name, 87752284Sobrien this macro has nothing to do with the definition of aggregate given 878169689Skan in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. Keep 879169689Skan these checks in ascending code order. */ 88090075Sobrien#define IS_AGGR_TYPE(T) \ 88190075Sobrien (TREE_CODE (T) == TEMPLATE_TYPE_PARM \ 88290075Sobrien || TREE_CODE (T) == TYPENAME_TYPE \ 88390075Sobrien || TREE_CODE (T) == TYPEOF_TYPE \ 88490075Sobrien || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \ 88590075Sobrien || TYPE_LANG_FLAG_5 (T)) 88652284Sobrien 88790075Sobrien/* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or 88890075Sobrien union type. */ 88952284Sobrien#define SET_IS_AGGR_TYPE(T, VAL) \ 89052284Sobrien (TYPE_LANG_FLAG_5 (T) = (VAL)) 89152284Sobrien 89252284Sobrien/* Nonzero if T is a class type. Zero for template type parameters, 89352284Sobrien typename types, and so forth. */ 89490075Sobrien#define CLASS_TYPE_P(T) \ 895169689Skan (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T)) 89652284Sobrien 897169689Skan/* Keep these checks in ascending code order. */ 898169689Skan#define IS_AGGR_TYPE_CODE(T) \ 899169689Skan ((T) == RECORD_TYPE || (T) == UNION_TYPE) 90090075Sobrien#define TAGGED_TYPE_P(T) \ 90190075Sobrien (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE) 90290075Sobrien#define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T) 90318334Speter 904117395Skan/* True if this a "Java" type, defined in 'extern "Java"'. */ 90590075Sobrien#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE) 90618334Speter 907132718Skan/* True if this type is dependent. This predicate is only valid if 908132718Skan TYPE_DEPENDENT_P_VALID is true. */ 909132718Skan#define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE) 910132718Skan 911132718Skan/* True if dependent_type_p has been called for this type, with the 912132718Skan result that TYPE_DEPENDENT_P is valid. */ 913132718Skan#define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE) 914132718Skan 91552284Sobrien/* Nonzero if this type is const-qualified. */ 91652284Sobrien#define CP_TYPE_CONST_P(NODE) \ 91790075Sobrien ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0) 91852284Sobrien 91952284Sobrien/* Nonzero if this type is volatile-qualified. */ 92052284Sobrien#define CP_TYPE_VOLATILE_P(NODE) \ 92190075Sobrien ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0) 92252284Sobrien 92352284Sobrien/* Nonzero if this type is restrict-qualified. */ 92452284Sobrien#define CP_TYPE_RESTRICT_P(NODE) \ 92590075Sobrien ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0) 92652284Sobrien 92752284Sobrien/* Nonzero if this type is const-qualified, but not 92852284Sobrien volatile-qualified. Other qualifiers are ignored. This macro is 92952284Sobrien used to test whether or not it is OK to bind an rvalue to a 93052284Sobrien reference. */ 93152284Sobrien#define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \ 93290075Sobrien ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ 93352284Sobrien == TYPE_QUAL_CONST) 93452284Sobrien 93590075Sobrien#define FUNCTION_ARG_CHAIN(NODE) \ 93690075Sobrien TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))) 93750397Sobrien 93890075Sobrien/* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES 93990075Sobrien which refers to a user-written parameter. */ 94090075Sobrien#define FUNCTION_FIRST_USER_PARMTYPE(NODE) \ 94190075Sobrien skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE))) 94290075Sobrien 94390075Sobrien/* Similarly, but for DECL_ARGUMENTS. */ 94490075Sobrien#define FUNCTION_FIRST_USER_PARM(NODE) \ 94590075Sobrien skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE)) 94690075Sobrien 94790075Sobrien#define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \ 94818334Speter (((CODE) == TREE_CODE (NODE) \ 94990075Sobrien && IS_AGGR_TYPE (TREE_TYPE (NODE))) \ 95018334Speter || IS_AGGR_TYPE (NODE)) 95118334Speter 95290075Sobrien/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and 95390075Sobrien ambiguity issues. */ 95490075Sobrien#define DERIVED_FROM_P(PARENT, TYPE) \ 955132718Skan (lookup_base ((TYPE), (PARENT), ba_any, NULL) != NULL_TREE) 95690075Sobrien/* Nonzero iff TYPE is uniquely derived from PARENT. Ignores 95790075Sobrien accessibility. */ 95890075Sobrien#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \ 959169689Skan (lookup_base ((TYPE), (PARENT), ba_unique | ba_quiet, NULL) != NULL_TREE) 96090075Sobrien/* Nonzero iff TYPE is publicly & uniquely derived from PARENT. */ 96190075Sobrien#define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \ 962169689Skan (lookup_base ((TYPE), (PARENT), ba_ignore_scope | ba_check | ba_quiet, \ 963169689Skan NULL) != NULL_TREE) 964169689Skan 965169689Skan/* Gives the visibility specification for a class type. */ 966169689Skan#define CLASSTYPE_VISIBILITY(TYPE) \ 967169689Skan DECL_VISIBILITY (TYPE_NAME (TYPE)) 968169689Skan#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \ 969169689Skan DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE)) 970169689Skan 971169689Skantypedef struct tree_pair_s GTY (()) 972169689Skan{ 973169689Skan tree purpose; 974169689Skan tree value; 975169689Skan} tree_pair_s; 976169689Skantypedef tree_pair_s *tree_pair_p; 977169689SkanDEF_VEC_O (tree_pair_s); 978169689SkanDEF_VEC_ALLOC_O (tree_pair_s,gc); 979169689Skan 980117395Skan/* This is a few header flags for 'struct lang_type'. Actually, 981117395Skan all but the first are used only for lang_type_class; they 982117395Skan are put in this structure to save space. */ 983117395Skanstruct lang_type_header GTY(()) 984117395Skan{ 985132718Skan BOOL_BITFIELD is_lang_type_class : 1; 986117395Skan 987132718Skan BOOL_BITFIELD has_type_conversion : 1; 988132718Skan BOOL_BITFIELD has_init_ref : 1; 989132718Skan BOOL_BITFIELD has_default_ctor : 1; 990132718Skan BOOL_BITFIELD const_needs_init : 1; 991132718Skan BOOL_BITFIELD ref_needs_init : 1; 992132718Skan BOOL_BITFIELD has_const_assign_ref : 1; 993169689Skan 994169689Skan BOOL_BITFIELD spare : 1; 995117395Skan}; 996117395Skan 99752284Sobrien/* This structure provides additional information above and beyond 99852284Sobrien what is provide in the ordinary tree_type. In the past, we used it 99952284Sobrien for the types of class types, template parameters types, typename 100052284Sobrien types, and so forth. However, there can be many (tens to hundreds 100152284Sobrien of thousands) of template parameter types in a compilation, and 100252284Sobrien there's no need for this additional information in that case. 100352284Sobrien Therefore, we now use this data structure only for class types. 100452284Sobrien 100552284Sobrien In the past, it was thought that there would be relatively few 100652284Sobrien class types. However, in the presence of heavy use of templates, 100752284Sobrien many (i.e., thousands) of classes can easily be generated. 100852284Sobrien Therefore, we should endeavor to keep the size of this structure to 100952284Sobrien a minimum. */ 1010117395Skanstruct lang_type_class GTY(()) 101118334Speter{ 1012117395Skan struct lang_type_header h; 1013169689Skan 101490075Sobrien unsigned char align; 101518334Speter 101690075Sobrien unsigned has_mutable : 1; 101790075Sobrien unsigned com_interface : 1; 101890075Sobrien unsigned non_pod_class : 1; 101990075Sobrien unsigned nearly_empty_p : 1; 102090075Sobrien unsigned user_align : 1; 102190075Sobrien unsigned has_assign_ref : 1; 102290075Sobrien unsigned has_new : 1; 102390075Sobrien unsigned has_array_new : 1; 102450397Sobrien 102590075Sobrien unsigned gets_delete : 2; 102690075Sobrien unsigned interface_only : 1; 102790075Sobrien unsigned interface_unknown : 1; 1028132718Skan unsigned contains_empty_class_p : 1; 1029132718Skan unsigned anon_aggr : 1; 1030132718Skan unsigned non_zero_init : 1; 1031132718Skan unsigned empty_p : 1; 103252284Sobrien 103390075Sobrien unsigned vec_new_uses_cookie : 1; 103490075Sobrien unsigned declared_class : 1; 1035169689Skan unsigned diamond_shaped : 1; 1036169689Skan unsigned repeated_base : 1; 103790075Sobrien unsigned being_defined : 1; 1038169689Skan unsigned java_interface : 1; 103990075Sobrien unsigned debug_requested : 1; 1040169689Skan unsigned fields_readonly : 1; 1041169689Skan 104290075Sobrien unsigned use_template : 2; 104390075Sobrien unsigned ptrmemfunc_flag : 1; 104490075Sobrien unsigned was_anonymous : 1; 1045169689Skan unsigned lazy_default_ctor : 1; 1046169689Skan unsigned lazy_copy_ctor : 1; 1047169689Skan unsigned lazy_assignment_op : 1; 1048169689Skan unsigned lazy_destructor : 1; 104952284Sobrien 105090075Sobrien unsigned has_const_init_ref : 1; 105190075Sobrien unsigned has_complex_init_ref : 1; 105290075Sobrien unsigned has_complex_assign_ref : 1; 105390075Sobrien unsigned non_aggregate : 1; 105418334Speter 1055260311Spfg /* APPLE LOCAL begin omit calls to empty destructors 5559195 */ 1056260311Spfg unsigned has_nontrivial_destructor_body : 1; 1057260311Spfg unsigned destructor_nontrivial_because_of_base : 1; 1058260311Spfg unsigned destructor_triviality_final : 1; 1059260311Spfg /* APPLE LOCAL end omit calls to empty destructors 5559195 */ 1060260311Spfg 1061260311Spfg 106290075Sobrien /* When adding a flag here, consider whether or not it ought to 106390075Sobrien apply to a template instance if it applies to the template. If 106490075Sobrien so, make sure to copy it in instantiate_class_template! */ 106518334Speter 106690075Sobrien /* There are some bits left to fill out a 32-bit word. Keep track 106790075Sobrien of this by updating the size of this bitfield whenever you add or 106890075Sobrien remove a flag. */ 1069260311Spfg /* APPLE LOCAL begin omit calls to empty destructors 5559195 */ 1070260311Spfg unsigned dummy : 10; 1071260311Spfg /* APPLE LOCAL end omit calls to empty destructors 5559195 */ 107290075Sobrien 107390075Sobrien tree primary_base; 1074169689Skan VEC(tree_pair_s,gc) *vcall_indices; 1075117395Skan tree vtables; 1076110611Skan tree typeinfo_var; 1077169689Skan VEC(tree,gc) *vbases; 1078117395Skan binding_table nested_udts; 1079117395Skan tree as_base; 1080169689Skan VEC(tree,gc) *pure_virtuals; 108190075Sobrien tree friend_classes; 1082169689Skan VEC(tree,gc) * GTY((reorder ("resort_type_method_vec"))) methods; 1083117395Skan tree key_method; 1084117395Skan tree decl_list; 108590075Sobrien tree template_info; 108652284Sobrien tree befriending_classes; 1087169689Skan /* In a RECORD_TYPE, information specific to Objective-C++, such 1088169689Skan as a list of adopted protocols or a pointer to a corresponding 1089169689Skan @interface. See objc/objc-act.h for details. */ 1090169689Skan tree objc_info; 109118334Speter}; 109218334Speter 1093117395Skanstruct lang_type_ptrmem GTY(()) 1094117395Skan{ 1095117395Skan struct lang_type_header h; 1096117395Skan tree record; 1097117395Skan}; 1098117395Skan 1099117395Skanstruct lang_type GTY(()) 1100117395Skan{ 1101169689Skan union lang_type_u 1102117395Skan { 1103169689Skan struct lang_type_header GTY((skip (""))) h; 1104117395Skan struct lang_type_class GTY((tag ("1"))) c; 1105117395Skan struct lang_type_ptrmem GTY((tag ("0"))) ptrmem; 1106117395Skan } GTY((desc ("%h.h.is_lang_type_class"))) u; 1107117395Skan}; 1108117395Skan 1109117395Skan#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) 1110117395Skan 1111132718Skan#define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \ 1112117395Skan({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \ 1113117395Skan if (! lt->u.h.is_lang_type_class) \ 1114117395Skan lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ 1115117395Skan <->u.c; }) 1116117395Skan 1117132718Skan#define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \ 1118117395Skan({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \ 1119117395Skan if (lt->u.h.is_lang_type_class) \ 1120117395Skan lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ 1121117395Skan <->u.ptrmem; }) 1122117395Skan 1123117395Skan#else 1124117395Skan 1125117395Skan#define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c) 1126117395Skan#define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem) 1127117395Skan 1128117395Skan#endif /* ENABLE_TREE_CHECKING */ 1129117395Skan 113018334Speter/* Fields used for storing information before the class is defined. 113118334Speter After the class is defined, these fields hold other information. */ 113218334Speter 1133169689Skan/* VEC(tree) of friends which were defined inline in this class 1134169689Skan definition. */ 113590075Sobrien#define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE) 113618334Speter 113790075Sobrien/* Nonzero for _CLASSTYPE means that operator delete is defined. */ 1138117395Skan#define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete) 113918334Speter#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1) 114018334Speter 114190075Sobrien/* Nonzero if `new NODE[x]' should cause the allocation of extra 114290075Sobrien storage to indicate how many array elements are in use. */ 114390075Sobrien#define TYPE_VEC_NEW_USES_COOKIE(NODE) \ 114490075Sobrien (CLASS_TYPE_P (NODE) \ 1145117395Skan && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie) 114618334Speter 114718334Speter/* Nonzero means that this _CLASSTYPE node defines ways of converting 114818334Speter itself to other types. */ 114990075Sobrien#define TYPE_HAS_CONVERSION(NODE) \ 1150117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion) 115118334Speter 1152169689Skan/* Nonzero means that NODE (a class type) has a default constructor -- 1153169689Skan but that it has not yet been declared. */ 1154169689Skan#define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \ 1155169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor) 1156169689Skan 1157169689Skan/* Nonzero means that NODE (a class type) has a copy constructor -- 1158169689Skan but that it has not yet been declared. */ 1159169689Skan#define CLASSTYPE_LAZY_COPY_CTOR(NODE) \ 1160169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor) 1161169689Skan 1162169689Skan/* Nonzero means that NODE (a class type) has an assignment operator 1163169689Skan -- but that it has not yet been declared. */ 1164169689Skan#define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \ 1165169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->lazy_assignment_op) 1166169689Skan 1167169689Skan/* Nonzero means that NODE (a class type) has a destructor -- but that 1168169689Skan it has not yet been declared. */ 1169169689Skan#define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \ 1170169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor) 1171169689Skan 117218334Speter/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */ 1173117395Skan#define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref) 1174169689Skan 1175169689Skan/* True iff the class type NODE has an "operator =" whose parameter 1176169689Skan has a parameter of type "const X&". */ 117790075Sobrien#define TYPE_HAS_CONST_ASSIGN_REF(NODE) \ 1178117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref) 117918334Speter 118018334Speter/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */ 1181117395Skan#define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref) 118290075Sobrien#define TYPE_HAS_CONST_INIT_REF(NODE) \ 1183117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref) 118418334Speter 118590075Sobrien/* Nonzero if this class defines an overloaded operator new. (An 118690075Sobrien operator new [] doesn't count.) */ 118790075Sobrien#define TYPE_HAS_NEW_OPERATOR(NODE) \ 1188117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->has_new) 118990075Sobrien 119090075Sobrien/* Nonzero if this class defines an overloaded operator new[]. */ 119190075Sobrien#define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \ 1192117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new) 119390075Sobrien 119418334Speter/* Nonzero means that this type is being defined. I.e., the left brace 119518334Speter starting the definition of this type has been seen. */ 1196117395Skan#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined) 119718334Speter 1198169689Skan/* Mark bits for repeated base checks. */ 1199169689Skan#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE)) 120018334Speter 1201169689Skan/* Nonzero if the class NODE has multiple paths to the same (virtual) 1202169689Skan base object. */ 1203169689Skan#define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \ 1204169689Skan (LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped) 120518334Speter 1206169689Skan/* Nonzero if the class NODE has multiple instances of the same base 1207169689Skan type. */ 1208169689Skan#define CLASSTYPE_REPEATED_BASE_P(NODE) \ 1209169689Skan (LANG_TYPE_CLASS_CHECK(NODE)->repeated_base) 1210169689Skan 1211117395Skan/* The member function with which the vtable will be emitted: 1212117395Skan the first noninline non-pure-virtual member function. NULL_TREE 1213117395Skan if there is no key function or if this is a class template */ 1214117395Skan#define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method) 1215117395Skan 121652284Sobrien/* Vector member functions defined in this class. Each element is 121752284Sobrien either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All 121852284Sobrien functions with the same name end up in the same slot. The first 121952284Sobrien two elements are for constructors, and destructors, respectively. 1220117395Skan All template conversion operators to innermost template dependent 1221117395Skan types are overloaded on the next slot, if they exist. Note, the 1222117395Skan names for these functions will not all be the same. The 1223117395Skan non-template conversion operators & templated conversions to 1224117395Skan non-innermost template types are next, followed by ordinary member 1225117395Skan functions. There may be empty entries at the end of the vector. 1226117395Skan The conversion operators are unsorted. The ordinary member 1227117395Skan functions are sorted, once the class is complete. */ 1228117395Skan#define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods) 122918334Speter 1230117395Skan/* For class templates, this is a TREE_LIST of all member data, 1231117395Skan functions, types, and friends in the order of declaration. 1232117395Skan The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend, 1233117395Skan and the RECORD_TYPE for the class template otherwise. */ 1234117395Skan#define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list) 1235117395Skan 123690075Sobrien/* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */ 123790075Sobrien#define CLASSTYPE_CONSTRUCTOR_SLOT 0 123818334Speter 123990075Sobrien/* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */ 124090075Sobrien#define CLASSTYPE_DESTRUCTOR_SLOT 1 124190075Sobrien 124290075Sobrien/* The first slot in the CLASSTYPE_METHOD_VEC where conversion 124390075Sobrien operators can appear. */ 124490075Sobrien#define CLASSTYPE_FIRST_CONVERSION_SLOT 2 124590075Sobrien 124690075Sobrien/* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These 124790075Sobrien are the constructors that take an in-charge parameter. */ 124890075Sobrien#define CLASSTYPE_CONSTRUCTORS(NODE) \ 1249169689Skan (VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT)) 125090075Sobrien 125190075Sobrien/* A FUNCTION_DECL for the destructor for NODE. These are the 1252169689Skan destructors that take an in-charge parameter. If 1253169689Skan CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL 1254169689Skan until the destructor is created with lazily_declare_fn. */ 125590075Sobrien#define CLASSTYPE_DESTRUCTORS(NODE) \ 1256169689Skan (CLASSTYPE_METHOD_VEC (NODE) \ 1257169689Skan ? VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT) \ 1258169689Skan : NULL_TREE) 125990075Sobrien 1260132718Skan/* A dictionary of the nested user-defined-types (class-types, or enums) 1261132718Skan found within this class. This table includes nested member class 1262132718Skan templates. */ 1263132718Skan#define CLASSTYPE_NESTED_UTDS(NODE) \ 1264117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts) 126518334Speter 126690075Sobrien/* Nonzero if NODE has a primary base class, i.e., a base class with 126790075Sobrien which it shares the virtual function table pointer. */ 126890075Sobrien#define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \ 126990075Sobrien (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE) 127018334Speter 127190075Sobrien/* If non-NULL, this is the binfo for the primary base class, i.e., 127290075Sobrien the base class which contains the virtual function table pointer 127390075Sobrien for this class. */ 127490075Sobrien#define CLASSTYPE_PRIMARY_BINFO(NODE) \ 1275117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->primary_base) 127618334Speter 1277169689Skan/* A vector of BINFOs for the direct and indirect virtual base classes 127890075Sobrien that this type uses in a post-order depth-first left-to-right 127990075Sobrien order. (In other words, these bases appear in the order that they 1280132718Skan should be initialized.) */ 1281117395Skan#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases) 128290075Sobrien 1283117395Skan/* The type corresponding to NODE when NODE is used as a base class, 1284117395Skan i.e., NODE without virtual base classes. */ 1285117395Skan 1286117395Skan#define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base) 1287117395Skan 1288169689Skan/* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */ 1289169689Skan 1290169689Skan#define IS_FAKE_BASE_TYPE(NODE) \ 1291169689Skan (TREE_CODE (NODE) == RECORD_TYPE \ 1292169689Skan && TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \ 1293169689Skan && CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE)) 1294169689Skan 129590075Sobrien/* These are the size and alignment of the type without its virtual 129690075Sobrien base classes, for when we use this type as a base itself. */ 1297117395Skan#define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE)) 1298117395Skan#define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE)) 1299117395Skan#define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE)) 1300117395Skan#define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE)) 130118334Speter 130290075Sobrien/* The alignment of NODE, without its virtual bases, in bytes. */ 130390075Sobrien#define CLASSTYPE_ALIGN_UNIT(NODE) \ 130490075Sobrien (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT) 130518334Speter 1306169689Skan/* True if this a Java interface type, declared with 1307117395Skan '__attribute__ ((java_interface))'. */ 1308169689Skan#define TYPE_JAVA_INTERFACE(NODE) \ 1309169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->java_interface) 131090075Sobrien 1311169689Skan/* A VEC(tree) of virtual functions which cannot be inherited by 131218334Speter derived classes. When deriving from this type, the derived 131318334Speter class must provide its own definition for each of these functions. */ 1314169689Skan#define CLASSTYPE_PURE_VIRTUALS(NODE) \ 1315169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals) 131618334Speter 131718334Speter/* Nonzero means that this type has an X() constructor. */ 131890075Sobrien#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \ 1319117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor) 132018334Speter 1321132718Skan/* Nonzero means that this type contains a mutable member. */ 1322117395Skan#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable) 132352284Sobrien#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE)) 132418334Speter 1325102780Skan/* Nonzero means that this class type is a non-POD class. */ 1326117395Skan#define CLASSTYPE_NON_POD_P(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class) 132752284Sobrien 1328102780Skan/* Nonzero means that this class contains pod types whose default 1329102780Skan initialization is not a zero initialization (namely, pointers to 1330102780Skan data members). */ 1331117395Skan#define CLASSTYPE_NON_ZERO_INIT_P(NODE) \ 1332117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init) 1333102780Skan 1334117395Skan/* Nonzero if this class is "empty" in the sense of the C++ ABI. */ 1335117395Skan#define CLASSTYPE_EMPTY_P(NODE) \ 1336117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->empty_p) 1337117395Skan 133890075Sobrien/* Nonzero if this class is "nearly empty", i.e., contains only a 133990075Sobrien virtual function table pointer. */ 134090075Sobrien#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \ 1341117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p) 134290075Sobrien 1343107590Sobrien/* Nonzero if this class contains an empty subobject. */ 1344107590Sobrien#define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \ 1345117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p) 1346107590Sobrien 134752284Sobrien/* A list of class types of which this type is a friend. The 134850397Sobrien TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the 134950397Sobrien case of a template friend. */ 135090075Sobrien#define CLASSTYPE_FRIEND_CLASSES(NODE) \ 1351117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes) 135218334Speter 135352284Sobrien/* A list of the classes which grant friendship to this class. */ 135452284Sobrien#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \ 1355117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes) 135618334Speter 135718334Speter/* Say whether this node was declared as a "class" or a "struct". */ 135890075Sobrien#define CLASSTYPE_DECLARED_CLASS(NODE) \ 1359117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->declared_class) 136018334Speter 1361107590Sobrien/* Nonzero if this class has const members 1362107590Sobrien which have no specified initialization. */ 1363107590Sobrien#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \ 1364107590Sobrien (TYPE_LANG_SPECIFIC (NODE) \ 1365117395Skan ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0) 1366107590Sobrien#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \ 1367117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE)) 136818334Speter 1369107590Sobrien/* Nonzero if this class has ref members 1370107590Sobrien which have no specified initialization. */ 1371107590Sobrien#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \ 1372107590Sobrien (TYPE_LANG_SPECIFIC (NODE) \ 1373117395Skan ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0) 1374107590Sobrien#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \ 1375117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE)) 137618334Speter 137718334Speter/* Nonzero if this class is included from a header file which employs 137818334Speter `#pragma interface', and it is not included in its implementation file. */ 137990075Sobrien#define CLASSTYPE_INTERFACE_ONLY(NODE) \ 1380117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->interface_only) 138118334Speter 138290075Sobrien/* True if we have already determined whether or not vtables, VTTs, 138390075Sobrien typeinfo, and other similar per-class data should be emitted in 138490075Sobrien this translation unit. This flag does not indicate whether or not 138590075Sobrien these items should be emitted; it only indicates that we know one 138690075Sobrien way or the other. */ 138790075Sobrien#define CLASSTYPE_INTERFACE_KNOWN(NODE) \ 1388117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0) 1389169689Skan/* The opposite of CLASSTYPE_INTERFACE_KNOWN. */ 139090075Sobrien#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ 1391117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown) 139218334Speter 139390075Sobrien#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \ 1394117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X)) 139590075Sobrien#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \ 1396117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1) 139790075Sobrien#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \ 1398117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0) 139990075Sobrien 140018334Speter/* Nonzero if a _DECL node requires us to output debug info for this class. */ 140190075Sobrien#define CLASSTYPE_DEBUG_REQUESTED(NODE) \ 1402117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested) 140318334Speter 140418334Speter/* Additional macros for inheritance information. */ 140518334Speter 140690075Sobrien/* Nonzero means that this class is on a path leading to a new vtable. */ 1407169689Skan#define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE) 140818334Speter 1409132718Skan/* Nonzero means B (a BINFO) has its own vtable. Any copies will not 1410132718Skan have this flag set. */ 1411169689Skan#define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B)) 141218334Speter 1413169689Skan/* Compare a BINFO_TYPE with another type for equality. For a binfo, 1414169689Skan this is functionally equivalent to using same_type_p, but 1415169689Skan measurably faster. At least one of the arguments must be a 1416169689Skan BINFO_TYPE. The other can be a BINFO_TYPE or a regular type. If 1417169689Skan BINFO_TYPE(T) ever stops being the main variant of the class the 1418169689Skan binfo is for, this macro must change. */ 1419169689Skan#define SAME_BINFO_TYPE_P(A, B) ((A) == (B)) 1420169689Skan 142190075Sobrien/* Any subobject that needs a new vtable must have a vptr and must not 142290075Sobrien be a non-virtual primary base (since it would then use the vtable from a 142390075Sobrien derived class and never become non-primary.) */ 1424132718Skan#define SET_BINFO_NEW_VTABLE_MARKED(B) \ 1425132718Skan (BINFO_NEW_VTABLE_MARKED (B) = 1, \ 1426169689Skan gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)), \ 1427169689Skan gcc_assert (TYPE_VFIELD (BINFO_TYPE (B)))) 142818334Speter 1429132718Skan/* Nonzero if this binfo is for a dependent base - one that should not 1430132718Skan be searched. */ 1431169689Skan#define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE) 1432132718Skan 143390075Sobrien/* Nonzero if this binfo has lost its primary base binfo (because that 143490075Sobrien is a nearly-empty virtual base that has been taken by some other 143590075Sobrien base in the complete hierarchy. */ 1436169689Skan#define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE) 143790075Sobrien 1438169689Skan/* Nonzero if this BINFO is a primary base class. */ 1439169689Skan#define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE) 144090075Sobrien 144152284Sobrien/* Used by various search routines. */ 144252284Sobrien#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE) 144318334Speter 1444169689Skan/* A VEC(tree_pair_s) of the vcall indices associated with the class 1445169689Skan NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual 1446169689Skan function. The VALUE is the index into the virtual table where the 1447169689Skan vcall offset for that function is stored, when NODE is a virtual 1448169689Skan base. */ 1449117395Skan#define CLASSTYPE_VCALL_INDICES(NODE) \ 1450117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices) 1451117395Skan 1452117395Skan/* The various vtables for the class NODE. The primary vtable will be 1453117395Skan first, followed by the construction vtables and VTT, if any. */ 1454117395Skan#define CLASSTYPE_VTABLES(NODE) \ 1455117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->vtables) 1456117395Skan 1457110611Skan/* The std::type_info variable representing this class, or NULL if no 1458110611Skan such variable has been created. This field is only set for the 1459110611Skan TYPE_MAIN_VARIANT of the class. */ 1460110611Skan#define CLASSTYPE_TYPEINFO_VAR(NODE) \ 1461117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var) 1462110611Skan 1463117395Skan/* Accessor macros for the BINFO_VIRTUALS list. */ 146418334Speter 146590075Sobrien/* The number of bytes by which to adjust the `this' pointer when 1466117395Skan calling this virtual function. Subtract this value from the this 1467117395Skan pointer. Always non-NULL, might be constant zero though. */ 146890075Sobrien#define BV_DELTA(NODE) (TREE_PURPOSE (NODE)) 146990075Sobrien 147090075Sobrien/* If non-NULL, the vtable index at which to find the vcall offset 1471117395Skan when calling this virtual function. Add the value at that vtable 1472117395Skan index to the this pointer. */ 147390075Sobrien#define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE)) 147490075Sobrien 147590075Sobrien/* The function to call. */ 147690075Sobrien#define BV_FN(NODE) (TREE_VALUE (NODE)) 147790075Sobrien 147818334Speter 147918334Speter/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that 148052284Sobrien this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE 148190075Sobrien will be NULL_TREE to indicate a throw specification of `()', or 148290075Sobrien no exceptions allowed. */ 1483169689Skan#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE) 148418334Speter 148552284Sobrien/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */ 148652284Sobrien#define TYPE_NOTHROW_P(NODE) \ 148752284Sobrien (TYPE_RAISES_EXCEPTIONS (NODE) \ 148852284Sobrien && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE) 148952284Sobrien 149050397Sobrien/* The binding level associated with the namespace. */ 149190075Sobrien#define NAMESPACE_LEVEL(NODE) \ 149290075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level) 149318334Speter 149452284Sobrien 149552284Sobrien/* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or 149690075Sobrien a lang_decl (which has lang_decl_flags as its initial prefix). 149790075Sobrien This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is 1498169689Skan the full lang_decl, and not just lang_decl_flags. Keep these 1499169689Skan checks in ascending code order. */ 1500169689Skan#define CAN_HAVE_FULL_LANG_DECL_P(NODE) \ 1501169689Skan (!(TREE_CODE (NODE) == FIELD_DECL \ 1502169689Skan || TREE_CODE (NODE) == VAR_DECL \ 1503169689Skan || TREE_CODE (NODE) == CONST_DECL \ 150490075Sobrien || TREE_CODE (NODE) == USING_DECL)) 150552284Sobrien 1506117395Skanstruct lang_decl_flags GTY(()) 150718334Speter{ 1508169689Skan ENUM_BITFIELD(languages) language : 4; 1509169689Skan unsigned global_ctor_p : 1; 1510169689Skan unsigned global_dtor_p : 1; 1511169689Skan unsigned anticipated_p : 1; 1512169689Skan unsigned template_conv_p : 1; 151390075Sobrien 151418334Speter unsigned operator_attr : 1; 151518334Speter unsigned constructor_attr : 1; 151690075Sobrien unsigned destructor_attr : 1; 151718334Speter unsigned friend_attr : 1; 151818334Speter unsigned static_function : 1; 151990075Sobrien unsigned pure_virtual : 1; 152090075Sobrien unsigned has_in_charge_parm_p : 1; 152190075Sobrien unsigned has_vtt_parm_p : 1; 152260967Sobrien 152390075Sobrien unsigned deferred : 1; 152418334Speter unsigned use_template : 2; 152518334Speter unsigned nonconverting : 1; 152618334Speter unsigned not_really_extern : 1; 152790075Sobrien unsigned initialized_in_class : 1; 1528117395Skan unsigned assignment_operator_p : 1; 1529169689Skan unsigned u1sel : 1; 153018334Speter 1531117395Skan unsigned u2sel : 1; 1532117395Skan unsigned can_be_full : 1; 1533169689Skan unsigned thunk_p : 1; 1534132718Skan unsigned this_thunk_p : 1; 1535169689Skan unsigned repo_available_p : 1; 1536169689Skan unsigned hidden_friend_p : 1; 1537169689Skan unsigned threadprivate_p : 1; 1538169689Skan /* One unused bit. */ 153990075Sobrien 1540117395Skan union lang_decl_u { 1541169689Skan /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is 1542169689Skan THUNK_ALIAS. 1543169689Skan In a FUNCTION_DECL for which DECL_THUNK_P does not hold, 1544132718Skan VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is 1545132718Skan DECL_TEMPLATE_INFO. */ 1546117395Skan tree GTY ((tag ("0"))) template_info; 154790075Sobrien 154890075Sobrien /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */ 1549117395Skan struct cp_binding_level * GTY ((tag ("1"))) level; 1550117395Skan } GTY ((desc ("%1.u1sel"))) u; 155190075Sobrien 1552117395Skan union lang_decl_u2 { 1553169689Skan /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is 1554169689Skan THUNK_VIRTUAL_OFFSET. 1555169689Skan Otherwise this is DECL_ACCESS. */ 1556117395Skan tree GTY ((tag ("0"))) access; 155790075Sobrien 155890075Sobrien /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */ 1559132718Skan int GTY ((tag ("1"))) discriminator; 1560117395Skan } GTY ((desc ("%1.u2sel"))) u2; 156118334Speter}; 156218334Speter 1563132718Skan/* sorted_fields is sorted based on a pointer, so we need to be able 1564132718Skan to resort it if pointers get rearranged. */ 1565132718Skan 1566117395Skanstruct lang_decl GTY(()) 156718334Speter{ 156818334Speter struct lang_decl_flags decl_flags; 156918334Speter 1570117395Skan union lang_decl_u4 1571117395Skan { 1572169689Skan struct full_lang_decl 1573117395Skan { 1574169689Skan /* In an overloaded operator, this is the value of 1575169689Skan DECL_OVERLOADED_OPERATOR_P. */ 1576169689Skan ENUM_BITFIELD (tree_code) operator_code : 8; 1577169689Skan 1578169689Skan unsigned u3sel : 1; 1579169689Skan unsigned pending_inline_p : 1; 1580169689Skan unsigned spare : 22; 1581169689Skan 1582132718Skan /* For a non-thunk function decl, this is a tree list of 1583169689Skan friendly classes. For a thunk function decl, it is the 1584169689Skan thunked to function decl. */ 1585117395Skan tree befriending_classes; 1586169689Skan 1587117395Skan /* For a non-virtual FUNCTION_DECL, this is 1588117395Skan DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which 1589132718Skan DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both 1590132718Skan this pointer and result pointer adjusting thunks are 1591132718Skan chained here. This pointer thunks to return pointer thunks 1592132718Skan will be chained on the return pointer thunk. */ 1593117395Skan tree context; 159490075Sobrien 1595169689Skan union lang_decl_u5 1596169689Skan { 1597169689Skan /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is 1598169689Skan DECL_CLONED_FUNCTION. */ 1599169689Skan tree GTY ((tag ("0"))) cloned_function; 160090075Sobrien 1601169689Skan /* In a FUNCTION_DECL for which THUNK_P holds this is the 1602169689Skan THUNK_FIXED_OFFSET. */ 1603169689Skan HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset; 1604169689Skan } GTY ((desc ("%0.decl_flags.thunk_p"))) u5; 160590075Sobrien 1606117395Skan union lang_decl_u3 1607117395Skan { 1608169689Skan struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields"))) 1609132718Skan sorted_fields; 1610169689Skan struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info; 1611169689Skan struct language_function * GTY ((tag ("1"))) 1612117395Skan saved_language_function; 1613117395Skan } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u; 1614117395Skan } GTY ((tag ("1"))) f; 1615117395Skan } GTY ((desc ("%1.decl_flags.can_be_full"))) u; 161618334Speter}; 161718334Speter 1618117395Skan#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007) 1619117395Skan 1620132718Skan#define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \ 1621117395Skan({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \ 1622117395Skan if (lt->decl_flags.u2sel != TF) \ 1623117395Skan lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \ 1624117395Skan <->decl_flags.u2; }) 1625117395Skan 1626117395Skan#else 1627117395Skan 1628117395Skan#define LANG_DECL_U2_CHECK(NODE, TF) \ 1629117395Skan (&DECL_LANG_SPECIFIC (NODE)->decl_flags.u2) 1630117395Skan 1631117395Skan#endif /* ENABLE_TREE_CHECKING */ 1632117395Skan 163390075Sobrien/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the 163490075Sobrien declaration. Some entities (like a member function in a local 163590075Sobrien class, or a local variable) do not have linkage at all, and this 163690075Sobrien macro should not be used in those cases. 1637169689Skan 163890075Sobrien Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was 163990075Sobrien created by language-independent code, and has C linkage. Most 164090075Sobrien VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but 164190075Sobrien we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */ 1642169689Skan#define DECL_LANGUAGE(NODE) \ 1643169689Skan (DECL_LANG_SPECIFIC (NODE) \ 164490075Sobrien ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \ 164590075Sobrien : (TREE_CODE (NODE) == FUNCTION_DECL \ 164690075Sobrien ? lang_c : lang_cplusplus)) 164718334Speter 164890075Sobrien/* Set the language linkage for NODE to LANGUAGE. */ 164990075Sobrien#define SET_DECL_LANGUAGE(NODE, LANGUAGE) \ 165090075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE)) 165190075Sobrien 165218334Speter/* For FUNCTION_DECLs: nonzero means that this function is a constructor. */ 165390075Sobrien#define DECL_CONSTRUCTOR_P(NODE) \ 165490075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr) 165550397Sobrien 165690075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete 165790075Sobrien object. */ 165890075Sobrien#define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \ 165990075Sobrien (DECL_CONSTRUCTOR_P (NODE) \ 166090075Sobrien && DECL_NAME (NODE) == complete_ctor_identifier) 166190075Sobrien 166290075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base 166390075Sobrien object. */ 166490075Sobrien#define DECL_BASE_CONSTRUCTOR_P(NODE) \ 166590075Sobrien (DECL_CONSTRUCTOR_P (NODE) \ 166690075Sobrien && DECL_NAME (NODE) == base_ctor_identifier) 166790075Sobrien 166890075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the 166990075Sobrien specialized in-charge constructor or the specialized not-in-charge 167090075Sobrien constructor. */ 167190075Sobrien#define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \ 167290075Sobrien (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE)) 167390075Sobrien 167490075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */ 167590075Sobrien#define DECL_COPY_CONSTRUCTOR_P(NODE) \ 167690075Sobrien (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0) 167790075Sobrien 167890075Sobrien/* Nonzero if NODE is a destructor. */ 167952284Sobrien#define DECL_DESTRUCTOR_P(NODE) \ 168090075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr) 168152284Sobrien 168290075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the 168390075Sobrien specialized in-charge constructor, in-charge deleting constructor, 1684169689Skan or the base destructor. */ 168590075Sobrien#define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \ 168690075Sobrien (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE)) 168752284Sobrien 168890075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete 168990075Sobrien object. */ 169090075Sobrien#define DECL_COMPLETE_DESTRUCTOR_P(NODE) \ 169190075Sobrien (DECL_DESTRUCTOR_P (NODE) \ 169290075Sobrien && DECL_NAME (NODE) == complete_dtor_identifier) 169360967Sobrien 169490075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base 169590075Sobrien object. */ 169690075Sobrien#define DECL_BASE_DESTRUCTOR_P(NODE) \ 169790075Sobrien (DECL_DESTRUCTOR_P (NODE) \ 169890075Sobrien && DECL_NAME (NODE) == base_dtor_identifier) 169918334Speter 170090075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete 170190075Sobrien object that deletes the object after it has been destroyed. */ 170290075Sobrien#define DECL_DELETING_DESTRUCTOR_P(NODE) \ 170390075Sobrien (DECL_DESTRUCTOR_P (NODE) \ 170490075Sobrien && DECL_NAME (NODE) == deleting_dtor_identifier) 170560967Sobrien 170690075Sobrien/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or 170790075Sobrien destructor. */ 1708169689Skan#define DECL_CLONED_FUNCTION_P(NODE) \ 1709169689Skan ((TREE_CODE (NODE) == FUNCTION_DECL \ 1710169689Skan || TREE_CODE (NODE) == TEMPLATE_DECL) \ 1711169689Skan && DECL_LANG_SPECIFIC (NODE) \ 1712169689Skan && !DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p \ 171390075Sobrien && DECL_CLONED_FUNCTION (NODE) != NULL_TREE) 171460967Sobrien 171590075Sobrien/* If DECL_CLONED_FUNCTION_P holds, this is the function that was 171690075Sobrien cloned. */ 171790075Sobrien#define DECL_CLONED_FUNCTION(NODE) \ 1718169689Skan (DECL_LANG_SPECIFIC (NON_THUNK_FUNCTION_CHECK(NODE))->u.f.u5.cloned_function) 171960967Sobrien 1720169689Skan/* Perform an action for each clone of FN, if FN is a function with 1721169689Skan clones. This macro should be used like: 1722169689Skan 1723169689Skan FOR_EACH_CLONE (clone, fn) 1724169689Skan { ... } 1725169689Skan 1726169689Skan */ 1727169689Skan#define FOR_EACH_CLONE(CLONE, FN) \ 1728169689Skan if (TREE_CODE (FN) == FUNCTION_DECL \ 1729169689Skan && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \ 1730169689Skan || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))) \ 1731169689Skan for (CLONE = TREE_CHAIN (FN); \ 1732169689Skan CLONE && DECL_CLONED_FUNCTION_P (CLONE); \ 1733169689Skan CLONE = TREE_CHAIN (CLONE)) 1734169689Skan 173590075Sobrien/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */ 173690075Sobrien#define DECL_DISCRIMINATOR_P(NODE) \ 173790075Sobrien (TREE_CODE (NODE) == VAR_DECL \ 173890075Sobrien && DECL_FUNCTION_SCOPE_P (NODE)) 173960967Sobrien 174090075Sobrien/* Discriminator for name mangling. */ 1741117395Skan#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator) 174260967Sobrien 1743117395Skan/* Nonzero if the VTT parm has been added to NODE. */ 174490075Sobrien#define DECL_HAS_VTT_PARM_P(NODE) \ 174590075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_vtt_parm_p) 174652284Sobrien 1747117395Skan/* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is 174890075Sobrien required. */ 174990075Sobrien#define DECL_NEEDS_VTT_PARM_P(NODE) \ 1750169689Skan (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE)) \ 175190075Sobrien && (DECL_BASE_CONSTRUCTOR_P (NODE) \ 175290075Sobrien || DECL_BASE_DESTRUCTOR_P (NODE))) 175352284Sobrien 1754117395Skan/* Nonzero if NODE is a user-defined conversion operator. */ 175590075Sobrien#define DECL_CONV_FN_P(NODE) \ 1756132718Skan (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE))) 175718334Speter 1758117395Skan/* If FN is a conversion operator, the type to which it converts. 1759117395Skan Otherwise, NULL_TREE. */ 1760117395Skan#define DECL_CONV_FN_TYPE(FN) \ 1761117395Skan (DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE) 1762117395Skan 1763117395Skan/* Nonzero if NODE, which is a TEMPLATE_DECL, is a template 1764117395Skan conversion operator to a type dependent on the innermost template 1765117395Skan args. */ 1766117395Skan#define DECL_TEMPLATE_CONV_FN_P(NODE) \ 1767117395Skan (DECL_LANG_SPECIFIC (NODE)->decl_flags.template_conv_p) 1768117395Skan 176990075Sobrien/* Set the overloaded operator code for NODE to CODE. */ 177090075Sobrien#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \ 1771117395Skan (DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE)) 177290075Sobrien 177390075Sobrien/* If NODE is an overloaded operator, then this returns the TREE_CODE 1774132718Skan associated with the overloaded operator. 177590075Sobrien DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine 177690075Sobrien whether or not NODE is an assignment operator. If NODE is not an 177790075Sobrien overloaded operator, ERROR_MARK is returned. Since the numerical 177890075Sobrien value of ERROR_MARK is zero, this macro can be used as a predicate 177990075Sobrien to test whether or not NODE is an overloaded operator. */ 178090075Sobrien#define DECL_OVERLOADED_OPERATOR_P(NODE) \ 178190075Sobrien (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \ 1782117395Skan ? DECL_LANG_SPECIFIC (NODE)->u.f.operator_code : ERROR_MARK) 178390075Sobrien 1784117395Skan/* Nonzero if NODE is an assignment operator. */ 178590075Sobrien#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \ 178690075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p) 178790075Sobrien 178890075Sobrien/* For FUNCTION_DECLs: nonzero means that this function is a 178990075Sobrien constructor or a destructor with an extra in-charge parameter to 179090075Sobrien control whether or not virtual bases are constructed. */ 179190075Sobrien#define DECL_HAS_IN_CHARGE_PARM_P(NODE) \ 179290075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p) 179390075Sobrien 1794169689Skan/* Nonzero if DECL is a declaration of __builtin_constant_p. */ 1795169689Skan#define DECL_IS_BUILTIN_CONSTANT_P(NODE) \ 1796169689Skan (TREE_CODE (NODE) == FUNCTION_DECL \ 1797169689Skan && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \ 1798169689Skan && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P) 179990075Sobrien 180018334Speter/* Nonzero for _DECL means that this decl appears in (or will appear 180118334Speter in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for 180218334Speter detecting circularity in case members are multiply defined. In the 180318334Speter case of a VAR_DECL, it is also used to determine how program storage 180418334Speter should be allocated. */ 180590075Sobrien#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE)) 180618334Speter 1807169689Skan/* Nonzero for a VAR_DECL means that the variable's initialization (if 1808169689Skan any) has been processed. (In general, DECL_INITIALIZED_P is 1809169689Skan !DECL_EXTERN, but static data members may be initialized even if 1810169689Skan not defined.) */ 1811117395Skan#define DECL_INITIALIZED_P(NODE) \ 1812117395Skan (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE))) 1813117395Skan 1814169689Skan/* Nonzero for a VAR_DECL iff an explicit initializer was provided. */ 1815169689Skan#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \ 1816169689Skan (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))) 1817169689Skan 1818132718Skan/* Nonzero for a VAR_DECL that was initialized with a 1819132718Skan constant-expression. */ 1820132718Skan#define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \ 1821132718Skan (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE))) 1822132718Skan 1823146895Skan/* Nonzero for a VAR_DECL that can be used in an integral constant 1824169689Skan expression. 1825146895Skan 1826146895Skan [expr.const] 1827146895Skan 1828146895Skan An integral constant-expression can only involve ... const 1829146895Skan variables of static or enumeration types initialized with 1830146895Skan constant expressions ... 1831169689Skan 1832146895Skan The standard does not require that the expression be non-volatile. 1833146895Skan G++ implements the proposed correction in DR 457. */ 1834146895Skan#define DECL_INTEGRAL_CONSTANT_VAR_P(NODE) \ 1835146895Skan (TREE_CODE (NODE) == VAR_DECL \ 1836146895Skan && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (NODE)) \ 1837146895Skan && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (NODE)) \ 1838146895Skan && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (NODE)) 1839146895Skan 184090075Sobrien/* Nonzero if the DECL was initialized in the class definition itself, 1841117395Skan rather than outside the class. This is used for both static member 1842132718Skan VAR_DECLS, and FUNTION_DECLS that are defined in the class. */ 184390075Sobrien#define DECL_INITIALIZED_IN_CLASS_P(DECL) \ 184490075Sobrien (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class) 184552284Sobrien 1846169689Skan/* Nonzero for DECL means that this decl is just a friend declaration, 1847169689Skan and should not be added to the list of members for this class. */ 184890075Sobrien#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr) 184918334Speter 185052284Sobrien/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */ 185152284Sobrien#define DECL_BEFRIENDING_CLASSES(NODE) \ 1852117395Skan (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes) 185352284Sobrien 185418334Speter/* Nonzero for FUNCTION_DECL means that this decl is a static 185518334Speter member function. */ 185690075Sobrien#define DECL_STATIC_FUNCTION_P(NODE) \ 185790075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function) 185818334Speter 185950397Sobrien/* Nonzero for FUNCTION_DECL means that this decl is a non-static 186050397Sobrien member function. */ 186150397Sobrien#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \ 186250397Sobrien (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE) 186350397Sobrien 186418334Speter/* Nonzero for FUNCTION_DECL means that this decl is a member function 186518334Speter (static or non-static). */ 186618334Speter#define DECL_FUNCTION_MEMBER_P(NODE) \ 186750397Sobrien (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE)) 186818334Speter 186918334Speter/* Nonzero for FUNCTION_DECL means that this member function 187018334Speter has `this' as const X *const. */ 187190075Sobrien#define DECL_CONST_MEMFUNC_P(NODE) \ 187290075Sobrien (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ 187390075Sobrien && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \ 187490075Sobrien (TYPE_ARG_TYPES (TREE_TYPE (NODE)))))) 187518334Speter 187618334Speter/* Nonzero for FUNCTION_DECL means that this member function 187718334Speter has `this' as volatile X *const. */ 187890075Sobrien#define DECL_VOLATILE_MEMFUNC_P(NODE) \ 187990075Sobrien (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \ 188090075Sobrien && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \ 188190075Sobrien (TYPE_ARG_TYPES (TREE_TYPE (NODE)))))) 188218334Speter 188352284Sobrien/* Nonzero for a DECL means that this member is a non-static member. */ 188490075Sobrien#define DECL_NONSTATIC_MEMBER_P(NODE) \ 188590075Sobrien ((TREE_CODE (NODE) == FUNCTION_DECL \ 188652284Sobrien && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \ 188752284Sobrien || TREE_CODE (NODE) == FIELD_DECL) 188852284Sobrien 188918334Speter/* Nonzero for _DECL means that this member object type 189018334Speter is mutable. */ 189190075Sobrien#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE)) 189218334Speter 189318334Speter/* Nonzero for _DECL means that this constructor is a non-converting 189418334Speter constructor. */ 189590075Sobrien#define DECL_NONCONVERTING_P(NODE) \ 189690075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting) 189718334Speter 189890075Sobrien/* Nonzero for FUNCTION_DECL means that this member function is a pure 189990075Sobrien virtual function. */ 190090075Sobrien#define DECL_PURE_VIRTUAL_P(NODE) \ 190190075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual) 190218334Speter 1903169689Skan/* True (in a FUNCTION_DECL) if NODE is a virtual function that is an 1904169689Skan invalid overrider for a function from a base class. Once we have 1905169689Skan complained about an invalid overrider we avoid complaining about it 1906169689Skan again. */ 1907169689Skan#define DECL_INVALID_OVERRIDER_P(NODE) \ 1908169689Skan (DECL_LANG_FLAG_4 (NODE)) 190950397Sobrien 1910132718Skan/* The thunks associated with NODE, a FUNCTION_DECL. */ 1911117395Skan#define DECL_THUNKS(NODE) \ 1912117395Skan (DECL_LANG_SPECIFIC (NODE)->u.f.context) 1913117395Skan 191490075Sobrien/* Nonzero if NODE is a thunk, rather than an ordinary function. */ 191590075Sobrien#define DECL_THUNK_P(NODE) \ 191690075Sobrien (TREE_CODE (NODE) == FUNCTION_DECL \ 1917169689Skan && DECL_LANG_SPECIFIC (NODE) \ 1918169689Skan && DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p) 191918334Speter 1920169689Skan/* Set DECL_THUNK_P for node. */ 1921169689Skan#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \ 1922169689Skan (DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p = 1, \ 1923169689Skan DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1, \ 1924169689Skan DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING)) 1925169689Skan 1926132718Skan/* Nonzero if NODE is a this pointer adjusting thunk. */ 1927132718Skan#define DECL_THIS_THUNK_P(NODE) \ 1928132718Skan (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p) 1929132718Skan 1930132718Skan/* Nonzero if NODE is a result pointer adjusting thunk. */ 1931132718Skan#define DECL_RESULT_THUNK_P(NODE) \ 1932132718Skan (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p) 1933132718Skan 193490075Sobrien/* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */ 193590075Sobrien#define DECL_NON_THUNK_FUNCTION_P(NODE) \ 193690075Sobrien (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE)) 193790075Sobrien 193890075Sobrien/* Nonzero if NODE is `extern "C"'. */ 193990075Sobrien#define DECL_EXTERN_C_P(NODE) \ 194090075Sobrien (DECL_LANGUAGE (NODE) == lang_c) 194190075Sobrien 194290075Sobrien/* Nonzero if NODE is an `extern "C"' function. */ 194390075Sobrien#define DECL_EXTERN_C_FUNCTION_P(NODE) \ 194490075Sobrien (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE)) 194590075Sobrien 1946169689Skan/* True iff DECL is an entity with vague linkage whose definition is 1947169689Skan available in this translation unit. */ 1948169689Skan#define DECL_REPO_AVAILABLE_P(NODE) \ 1949169689Skan (DECL_LANG_SPECIFIC (NODE)->decl_flags.repo_available_p) 195090075Sobrien 195190075Sobrien/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a 195290075Sobrien template function. */ 195390075Sobrien#define DECL_PRETTY_FUNCTION_P(NODE) \ 1954132718Skan (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))) 195590075Sobrien 195618334Speter/* The _TYPE context in which this _DECL appears. This field holds the 1957117395Skan class where a virtual function instance is actually defined. */ 195890075Sobrien#define DECL_CLASS_CONTEXT(NODE) \ 195990075Sobrien (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE) 196018334Speter 196190075Sobrien/* For a non-member friend function, the class (if any) in which this 196290075Sobrien friend was defined. For example, given: 196390075Sobrien 196490075Sobrien struct S { friend void f (); }; 196590075Sobrien 196690075Sobrien the DECL_FRIEND_CONTEXT for `f' will be `S'. */ 196790075Sobrien#define DECL_FRIEND_CONTEXT(NODE) \ 196890075Sobrien ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \ 1969117395Skan ? DECL_LANG_SPECIFIC (NODE)->u.f.context \ 197090075Sobrien : NULL_TREE) 197190075Sobrien 197290075Sobrien/* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */ 197390075Sobrien#define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \ 1974117395Skan (DECL_LANG_SPECIFIC (NODE)->u.f.context = (CONTEXT)) 197590075Sobrien 1976117395Skan/* NULL_TREE in DECL_CONTEXT represents the global namespace. */ 197750397Sobrien#define CP_DECL_CONTEXT(NODE) \ 197850397Sobrien (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace) 1979169689Skan#define CP_TYPE_CONTEXT(NODE) \ 1980169689Skan (TYPE_CONTEXT (NODE) ? TYPE_CONTEXT (NODE) : global_namespace) 198150397Sobrien#define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE)) 198218334Speter 198350397Sobrien/* 1 iff NODE has namespace scope, including the global namespace. */ 198490075Sobrien#define DECL_NAMESPACE_SCOPE_P(NODE) \ 198590075Sobrien (!DECL_TEMPLATE_PARM_P (NODE) \ 198690075Sobrien && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL) 198718334Speter 1988169689Skan#define TYPE_NAMESPACE_SCOPE_P(NODE) \ 1989169689Skan (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL) 1990169689Skan 199150397Sobrien/* 1 iff NODE is a class member. */ 199250397Sobrien#define DECL_CLASS_SCOPE_P(NODE) \ 199390075Sobrien (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE))) 199450397Sobrien 1995169689Skan#define TYPE_CLASS_SCOPE_P(NODE) \ 1996169689Skan (TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE))) 1997169689Skan 199852284Sobrien/* 1 iff NODE is function-local. */ 199952284Sobrien#define DECL_FUNCTION_SCOPE_P(NODE) \ 200052284Sobrien (DECL_CONTEXT (NODE) \ 200152284Sobrien && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL) 200290075Sobrien 2003169689Skan#define TYPE_FUNCTION_SCOPE_P(NODE) \ 2004169689Skan (TYPE_CONTEXT (NODE) \ 2005169689Skan && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL) 2006169689Skan 2007169689Skan/* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for 2008169689Skan both the primary typeinfo object and the associated NTBS name. */ 2009169689Skan#define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)) 2010169689Skan 2011132718Skan/* 1 iff VAR_DECL node NODE is virtual table or VTT. */ 2012132718Skan#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE)) 2013132718Skan 2014169689Skan/* Returns 1 iff VAR_DECL is a construction virtual table. 2015169689Skan DECL_VTABLE_OR_VTT_P will be true in this case and must be checked 2016169689Skan before using this macro. */ 2017169689Skan#define DECL_CONSTRUCTION_VTABLE_P(NODE) \ 2018169689Skan TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE)) 2019169689Skan 202090075Sobrien/* 1 iff NODE is function-local, but for types. */ 202190075Sobrien#define LOCAL_CLASS_P(NODE) \ 202290075Sobrien (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE) 202390075Sobrien 202450397Sobrien/* For a NAMESPACE_DECL: the list of using namespace directives 202550397Sobrien The PURPOSE is the used namespace, the value is the namespace 2026117395Skan that is the common ancestor. */ 202790075Sobrien#define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE)) 202850397Sobrien 202950397Sobrien/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users 2030117395Skan of a namespace, to record the transitive closure of using namespace. */ 203190075Sobrien#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE)) 203250397Sobrien 2033132718Skan/* In a NAMESPACE_DECL, the list of namespaces which have associated 2034132718Skan themselves with this one. */ 2035132718Skan#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \ 2036169689Skan (NAMESPACE_DECL_CHECK (NODE)->decl_non_common.saved_tree) 2037132718Skan 203850397Sobrien/* In a NAMESPACE_DECL, points to the original namespace if this is 203950397Sobrien a namespace alias. */ 204090075Sobrien#define DECL_NAMESPACE_ALIAS(NODE) \ 204190075Sobrien DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE)) 204250397Sobrien#define ORIGINAL_NAMESPACE(NODE) \ 204350397Sobrien (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE)) 204450397Sobrien 2045117395Skan/* Nonzero if NODE is the std namespace. */ 204690075Sobrien#define DECL_NAMESPACE_STD_P(NODE) \ 204790075Sobrien (TREE_CODE (NODE) == NAMESPACE_DECL \ 204890075Sobrien && CP_DECL_CONTEXT (NODE) == global_namespace \ 204990075Sobrien && DECL_NAME (NODE) == std_identifier) 205090075Sobrien 205190075Sobrien/* In a TREE_LIST concatenating using directives, indicate indirect 205250397Sobrien directives */ 205390075Sobrien#define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0) 205450397Sobrien 2055169689Skanextern tree decl_shadowed_for_var_lookup (tree); 2056169689Skanextern void decl_shadowed_for_var_insert (tree, tree); 2057169689Skan 2058169689Skan/* Non zero if this is a using decl for a dependent scope. */ 2059169689Skan#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE)) 2060169689Skan 2061169689Skan/* The scope named in a using decl. */ 2062169689Skan#define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE)) 2063169689Skan 2064169689Skan/* The decls named by a using decl. */ 2065169689Skan#define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE)) 2066169689Skan 2067169689Skan/* In a VAR_DECL, true if we have a shadowed local variable 2068169689Skan in the shadowed var table for this VAR_DECL. */ 2069169689Skan#define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \ 2070169689Skan (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p) 2071169689Skan 207218334Speter/* In a VAR_DECL for a variable declared in a for statement, 207350397Sobrien this is the shadowed (local) variable. */ 2074169689Skan#define DECL_SHADOWED_FOR_VAR(NODE) \ 2075169689Skan (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL) 207618334Speter 2077169689Skan#define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \ 2078169689Skan (decl_shadowed_for_var_insert (NODE, VAL)) 2079169689Skan 208090075Sobrien/* In a FUNCTION_DECL, this is nonzero if this function was defined in 208190075Sobrien the class definition. We have saved away the text of the function, 208290075Sobrien but have not yet processed it. */ 208390075Sobrien#define DECL_PENDING_INLINE_P(NODE) \ 2084117395Skan (DECL_LANG_SPECIFIC (NODE)->u.f.pending_inline_p) 208518334Speter 208690075Sobrien/* If DECL_PENDING_INLINE_P holds, this is the saved text of the 208790075Sobrien function. */ 208890075Sobrien#define DECL_PENDING_INLINE_INFO(NODE) \ 2089117395Skan (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info) 209018334Speter 2091117395Skan/* For a TYPE_DECL: if this structure has many fields, we'll sort them 2092117395Skan and put them into a TREE_VEC. */ 209390075Sobrien#define DECL_SORTED_FIELDS(NODE) \ 2094117395Skan (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields) 209518334Speter 209690075Sobrien/* True if on the deferred_fns (see decl2.c) list. */ 209790075Sobrien#define DECL_DEFERRED_FN(DECL) \ 209890075Sobrien (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred) 209918334Speter 2100169689Skan/* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or 2101169689Skan TEMPLATE_DECL, the entity is either a template specialization (if 2102169689Skan DECL_USE_TEMPLATE is non-zero) or the abstract instance of the 2103169689Skan template itself. 2104169689Skan 2105169689Skan In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose 2106169689Skan TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a 2107169689Skan specialization or abstract instance. The TREE_VALUE is the 2108169689Skan template arguments used to specialize the template. 2109169689Skan 2110169689Skan Consider: 2111169689Skan 2112169689Skan template <typename T> struct S { friend void f(T) {} }; 2113169689Skan 2114169689Skan In this case, S<int>::f is, from the point of view of the compiler, 2115169689Skan an instantiation of a template -- but, from the point of view of 2116169689Skan the language, each instantiation of S results in a wholly unrelated 2117169689Skan global function f. In this case, DECL_TEMPLATE_INFO for S<int>::f 2118169689Skan will be non-NULL, but DECL_USE_TEMPLATE will be zero. */ 211990075Sobrien#define DECL_TEMPLATE_INFO(NODE) \ 212090075Sobrien (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \ 212190075Sobrien ->decl_flags.u.template_info) 212218334Speter 2123171825Skan/* For a VAR_DECL, indicates that the variable is actually a 2124171825Skan non-static data member of anonymous union that has been promoted to 2125171825Skan variable status. */ 2126171825Skan#define DECL_ANON_UNION_VAR_P(NODE) \ 2127117395Skan (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))) 2128117395Skan 212952284Sobrien/* Template information for a RECORD_TYPE or UNION_TYPE. */ 213090075Sobrien#define CLASSTYPE_TEMPLATE_INFO(NODE) \ 2131169689Skan (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info) 213252284Sobrien 213352284Sobrien/* Template information for an ENUMERAL_TYPE. Although an enumeration may 213452284Sobrien not be a primary template, it may be declared within the scope of a 213552284Sobrien primary template and the enumeration constants may depend on 213652284Sobrien non-type template parameters. */ 2137169689Skan#define ENUM_TEMPLATE_INFO(NODE) \ 2138169689Skan (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE))) 213952284Sobrien 214052284Sobrien/* Template information for a template template parameter. */ 214190075Sobrien#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \ 2142117395Skan (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \ 214390075Sobrien ->template_info) 214452284Sobrien 214552284Sobrien/* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */ 214652284Sobrien#define TYPE_TEMPLATE_INFO(NODE) \ 214752284Sobrien (TREE_CODE (NODE) == ENUMERAL_TYPE \ 214890075Sobrien ? ENUM_TEMPLATE_INFO (NODE) : \ 214990075Sobrien (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \ 215090075Sobrien ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \ 215190075Sobrien (TYPE_LANG_SPECIFIC (NODE) \ 215290075Sobrien ? CLASSTYPE_TEMPLATE_INFO (NODE) \ 215390075Sobrien : NULL_TREE))) 215452284Sobrien 215552284Sobrien/* Set the template information for an ENUMERAL_, RECORD_, or 215652284Sobrien UNION_TYPE to VAL. */ 215790075Sobrien#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \ 215890075Sobrien (TREE_CODE (NODE) == ENUMERAL_TYPE \ 215990075Sobrien ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \ 216090075Sobrien : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL))) 216152284Sobrien 216250397Sobrien#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE)) 216350397Sobrien#define TI_ARGS(NODE) (TREE_VALUE (NODE)) 216450397Sobrien#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE) 216552284Sobrien 216690075Sobrien/* We use TREE_VECs to hold template arguments. If there is only one 216790075Sobrien level of template arguments, then the TREE_VEC contains the 216890075Sobrien arguments directly. If there is more than one level of template 216990075Sobrien arguments, then each entry in the TREE_VEC is itself a TREE_VEC, 217090075Sobrien containing the template arguments for a single level. The first 217190075Sobrien entry in the outer TREE_VEC is the outermost level of template 217290075Sobrien parameters; the last is the innermost. 217390075Sobrien 217490075Sobrien It is incorrect to ever form a template argument vector containing 217590075Sobrien only one level of arguments, but which is a TREE_VEC containing as 217690075Sobrien its only entry the TREE_VEC for that level. */ 217790075Sobrien 2178117395Skan/* Nonzero if the template arguments is actually a vector of vectors, 217990075Sobrien rather than just a vector. */ 2180169689Skan#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \ 2181132718Skan (NODE && TREE_VEC_ELT (NODE, 0) \ 218290075Sobrien && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC) 218390075Sobrien 218490075Sobrien/* The depth of a template argument vector. When called directly by 218590075Sobrien the parser, we use a TREE_LIST rather than a TREE_VEC to represent 218690075Sobrien template arguments. In fact, we may even see NULL_TREE if there 218790075Sobrien are no template arguments. In both of those cases, there is only 218890075Sobrien one level of template arguments. */ 218990075Sobrien#define TMPL_ARGS_DEPTH(NODE) \ 219090075Sobrien (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1) 219190075Sobrien 2192117395Skan/* The LEVELth level of the template ARGS. The outermost level of 219390075Sobrien args is level 1, not level 0. */ 219490075Sobrien#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \ 219590075Sobrien (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \ 219690075Sobrien ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS)) 219790075Sobrien 219890075Sobrien/* Set the LEVELth level of the template ARGS to VAL. This macro does 219990075Sobrien not work with single-level argument vectors. */ 220090075Sobrien#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \ 220190075Sobrien (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL)) 220290075Sobrien 220390075Sobrien/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */ 220490075Sobrien#define TMPL_ARG(ARGS, LEVEL, IDX) \ 220590075Sobrien (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX)) 220690075Sobrien 220790075Sobrien/* Given a single level of template arguments in NODE, return the 220890075Sobrien number of arguments. */ 220990075Sobrien#define NUM_TMPL_ARGS(NODE) \ 2210132718Skan (TREE_VEC_LENGTH (NODE)) 221190075Sobrien 221290075Sobrien/* Returns the innermost level of template arguments in ARGS. */ 221390075Sobrien#define INNERMOST_TEMPLATE_ARGS(NODE) \ 221490075Sobrien (get_innermost_template_args ((NODE), 1)) 221590075Sobrien 221690075Sobrien/* The number of levels of template parameters given by NODE. */ 221790075Sobrien#define TMPL_PARMS_DEPTH(NODE) \ 221890075Sobrien ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE))) 221990075Sobrien 222052284Sobrien/* The TEMPLATE_DECL instantiated or specialized by NODE. This 222152284Sobrien TEMPLATE_DECL will be the immediate parent, not the most general 222252284Sobrien template. For example, in: 222352284Sobrien 222452284Sobrien template <class T> struct S { template <class U> void f(U); } 222552284Sobrien 222652284Sobrien the FUNCTION_DECL for S<int>::f<double> will have, as its 222790075Sobrien DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'. 222852284Sobrien 222952284Sobrien As a special case, for a member friend template of a template 2230132718Skan class, this value will not be a TEMPLATE_DECL, but rather an 2231132718Skan IDENTIFIER_NODE or OVERLOAD indicating the name of the template and 2232132718Skan any explicit template arguments provided. For example, in: 223352284Sobrien 223452284Sobrien template <class T> struct S { friend void f<int>(int, double); } 223552284Sobrien 2236132718Skan the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the 223790075Sobrien DECL_TI_ARGS will be {int}. */ 223850397Sobrien#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE)) 223952284Sobrien 224052284Sobrien/* The template arguments used to obtain this decl from the most 224152284Sobrien general form of DECL_TI_TEMPLATE. For the example given for 224252284Sobrien DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These 224352284Sobrien are always the full set of arguments required to instantiate this 224452284Sobrien declaration from the most general template specialized here. */ 2245169689Skan#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE)) 2246169689Skan 2247169689Skan/* The TEMPLATE_DECL associated with NODE, a class type. Even if NODE 2248169689Skan will be generated from a partial specialization, the TEMPLATE_DECL 2249169689Skan referred to here will be the original template. For example, 2250169689Skan given: 2251169689Skan 2252169689Skan template <typename T> struct S {}; 2253169689Skan template <typename T> struct S<T*> {}; 2254169689Skan 2255169689Skan the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>. */ 225650397Sobrien#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE)) 225750397Sobrien#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE)) 225852284Sobrien 2259132718Skan/* For a template instantiation TYPE, returns the TYPE corresponding 2260132718Skan to the primary template. Otherwise returns TYPE itself. */ 2261169689Skan#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \ 2262169689Skan ((CLASSTYPE_USE_TEMPLATE ((TYPE)) \ 2263169689Skan && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \ 2264169689Skan ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \ 2265169689Skan (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \ 2266132718Skan : (TYPE)) 2267132718Skan 2268169689Skan/* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs. */ 226952284Sobrien#define TYPE_TI_TEMPLATE(NODE) \ 227052284Sobrien (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE))) 227152284Sobrien 227290075Sobrien/* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */ 227352284Sobrien#define TYPE_TI_ARGS(NODE) \ 227452284Sobrien (TI_ARGS (TYPE_TEMPLATE_INFO (NODE))) 227552284Sobrien 227690075Sobrien#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE) 227718334Speter 2278169689Skan/* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the 2279169689Skan sense of [temp.mem]. */ 2280169689Skan#define DECL_MEMBER_TEMPLATE_P(NODE) \ 2281169689Skan (DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE))) 2282169689Skan 228352284Sobrien/* Nonzero if the NODE corresponds to the template parameters for a 228452284Sobrien member template, whose inline definition is being processed after 228552284Sobrien the class definition is complete. */ 228650397Sobrien#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE) 228750397Sobrien 228890075Sobrien/* In a FUNCTION_DECL, the saved language-specific per-function data. */ 2289117395Skan#define DECL_SAVED_FUNCTION_DATA(NODE) \ 2290117395Skan (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \ 2291117395Skan ->u.f.u.saved_language_function) 229290075Sobrien 2293169689Skan/* Indicates an indirect_expr is for converting a reference. */ 2294169689Skan#define REFERENCE_REF_P(NODE) \ 2295169689Skan TREE_LANG_FLAG_0 (INDIRECT_REF_CHECK (NODE)) 229650397Sobrien 2297169689Skan#define NEW_EXPR_USE_GLOBAL(NODE) \ 2298169689Skan TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE)) 2299169689Skan#define DELETE_EXPR_USE_GLOBAL(NODE) \ 2300169689Skan TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE)) 2301169689Skan#define DELETE_EXPR_USE_VEC(NODE) \ 2302169689Skan TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE)) 2303169689Skan 2304132718Skan/* Indicates that this is a non-dependent COMPOUND_EXPR which will 2305132718Skan resolve to a function call. */ 2306169689Skan#define COMPOUND_EXPR_OVERLOADED(NODE) \ 2307169689Skan TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE)) 2308132718Skan 2309132718Skan/* In a CALL_EXPR appearing in a template, true if Koenig lookup 2310132718Skan should be performed at instantiation time. */ 2311169689Skan#define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE)) 2312132718Skan 2313169689Skan/* Indicates whether a string literal has been parenthesized. Such 2314169689Skan usages are disallowed in certain circumstances. */ 2315169689Skan 2316169689Skan#define PAREN_STRING_LITERAL_P(NODE) \ 2317169689Skan TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE)) 2318169689Skan 231990075Sobrien/* Nonzero if this AGGR_INIT_EXPR provides for initialization via a 232090075Sobrien constructor call, rather than an ordinary function call. */ 232190075Sobrien#define AGGR_INIT_VIA_CTOR_P(NODE) \ 232290075Sobrien TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE)) 232390075Sobrien 232450397Sobrien/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a 232550397Sobrien TEMPLATE_DECL. This macro determines whether or not a given class 232650397Sobrien type is really a template type, as opposed to an instantiation or 232750397Sobrien specialization of one. */ 232850397Sobrien#define CLASSTYPE_IS_TEMPLATE(NODE) \ 232950397Sobrien (CLASSTYPE_TEMPLATE_INFO (NODE) \ 233050397Sobrien && !CLASSTYPE_USE_TEMPLATE (NODE) \ 233150397Sobrien && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE))) 233250397Sobrien 233352284Sobrien/* The name used by the user to name the typename type. Typically, 233452284Sobrien this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the 233552284Sobrien corresponding TYPE_DECL. However, this may also be a 233652284Sobrien TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */ 2337169689Skan#define TYPENAME_TYPE_FULLNAME(NODE) (TYPENAME_TYPE_CHECK (NODE))->type.values 233850397Sobrien 2339169689Skan/* True if a TYPENAME_TYPE was declared as an "enum". */ 2340169689Skan#define TYPENAME_IS_ENUM_P(NODE) \ 2341169689Skan (TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE))) 2342169689Skan 2343169689Skan/* True if a TYPENAME_TYPE was declared as a "class", "struct", or 2344169689Skan "union". */ 2345169689Skan#define TYPENAME_IS_CLASS_P(NODE) \ 2346169689Skan (TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE))) 2347169689Skan 234850397Sobrien/* Nonzero in INTEGER_CST means that this int is negative by dint of 234918334Speter using a twos-complement negated operand. */ 235090075Sobrien#define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE)) 235118334Speter 235290075Sobrien/* [class.virtual] 235318334Speter 235490075Sobrien A class that declares or inherits a virtual function is called a 235590075Sobrien polymorphic class. */ 235690075Sobrien#define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE)) 235718334Speter 235890075Sobrien/* Nonzero if this class has a virtual function table pointer. */ 235990075Sobrien#define TYPE_CONTAINS_VPTR_P(NODE) \ 2360169689Skan (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE)) 236118334Speter 236218334Speter/* This flag is true of a local VAR_DECL if it was declared in a for 236350397Sobrien statement, but we are no longer in the scope of the for. */ 236490075Sobrien#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE)) 236518334Speter 236618334Speter/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL 236718334Speter if we already emitted a warning about using it. */ 236890075Sobrien#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)) 236918334Speter 237090075Sobrien/* Nonzero if NODE is a FUNCTION_DECL (for a function with global 237190075Sobrien scope) declared in a local scope. */ 237290075Sobrien#define DECL_LOCAL_FUNCTION_P(NODE) \ 237390075Sobrien DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE)) 237418334Speter 2375169689Skan/* Nonzero if NODE is a DECL which we know about but which has not 2376169689Skan been explicitly declared, such as a built-in function or a friend 2377169689Skan declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P 2378169689Skan will be set. */ 237990075Sobrien#define DECL_ANTICIPATED(NODE) \ 2380169689Skan (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.anticipated_p) 238190075Sobrien 2382169689Skan/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend 2383169689Skan within a class but has not been declared in the surrounding scope. 2384169689Skan The function is invisible except via argument dependent lookup. */ 2385169689Skan#define DECL_HIDDEN_FRIEND_P(NODE) \ 2386169689Skan (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.hidden_friend_p) 2387169689Skan 2388169689Skan/* Nonzero if DECL has been declared threadprivate by 2389169689Skan #pragma omp threadprivate. */ 2390169689Skan#define CP_DECL_THREADPRIVATE_P(DECL) \ 2391169689Skan (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->decl_flags.threadprivate_p) 2392169689Skan 239318334Speter/* Record whether a typedef for type `int' was actually `signed int'. */ 239490075Sobrien#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP) 239518334Speter 2396117395Skan/* Returns nonzero if DECL has external linkage, as specified by the 239790075Sobrien language standard. (This predicate may hold even when the 239890075Sobrien corresponding entity is not actually given external linkage in the 239990075Sobrien object file; see decl_linkage for details.) */ 240090075Sobrien#define DECL_EXTERNAL_LINKAGE_P(DECL) \ 240190075Sobrien (decl_linkage (DECL) == lk_external) 240252284Sobrien 2403169689Skan/* Keep these codes in ascending code order. */ 240418334Speter 2405169689Skan#define INTEGRAL_CODE_P(CODE) \ 2406169689Skan ((CODE) == ENUMERAL_TYPE \ 2407169689Skan || (CODE) == BOOLEAN_TYPE \ 2408169689Skan || (CODE) == INTEGER_TYPE) 2409169689Skan 241090075Sobrien/* [basic.fundamental] 241118334Speter 241290075Sobrien Types bool, char, wchar_t, and the signed and unsigned integer types 241390075Sobrien are collectively called integral types. 241490075Sobrien 241590075Sobrien Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration 2416169689Skan types as well, which is incorrect in C++. Keep these checks in 2417169689Skan ascending code order. */ 241890075Sobrien#define CP_INTEGRAL_TYPE_P(TYPE) \ 241990075Sobrien (TREE_CODE (TYPE) == BOOLEAN_TYPE \ 242090075Sobrien || TREE_CODE (TYPE) == INTEGER_TYPE) 242190075Sobrien 2422169689Skan/* Returns true if TYPE is an integral or enumeration name. Keep 2423169689Skan these checks in ascending code order. */ 2424117395Skan#define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \ 2425169689Skan (TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE)) 2426117395Skan 242790075Sobrien/* [basic.fundamental] 242890075Sobrien 242990075Sobrien Integral and floating types are collectively called arithmetic 2430171825Skan types. 2431171825Skan 2432171825Skan As a GNU extension, we also accept complex types. 2433171825Skan 2434171825Skan Keep these checks in ascending code order. */ 243590075Sobrien#define ARITHMETIC_TYPE_P(TYPE) \ 2436171825Skan (CP_INTEGRAL_TYPE_P (TYPE) \ 2437171825Skan || TREE_CODE (TYPE) == REAL_TYPE \ 2438171825Skan || TREE_CODE (TYPE) == COMPLEX_TYPE) 243990075Sobrien 2440117395Skan/* [basic.types] 2441117395Skan 2442117395Skan Arithmetic types, enumeration types, pointer types, and 2443169689Skan pointer-to-member types, are collectively called scalar types. 2444171825Skan 2445169689Skan Keep these checks in ascending code order. */ 2446117395Skan#define SCALAR_TYPE_P(TYPE) \ 2447169689Skan (TYPE_PTRMEM_P (TYPE) \ 2448117395Skan || TREE_CODE (TYPE) == ENUMERAL_TYPE \ 2449169689Skan || ARITHMETIC_TYPE_P (TYPE) \ 2450117395Skan || TYPE_PTR_P (TYPE) \ 2451260311Spfg /* APPLE LOCAL blocks 6040305 */ \ 2452260311Spfg || TREE_CODE (TYPE) == BLOCK_POINTER_TYPE \ 2453169689Skan || TYPE_PTRMEMFUNC_P (TYPE)) 2454117395Skan 2455117395Skan/* [dcl.init.aggr] 2456117395Skan 2457117395Skan An aggregate is an array or a class with no user-declared 2458117395Skan constructors, no private or protected non-static data members, no 2459132718Skan base classes, and no virtual functions. 2460132718Skan 2461169689Skan As an extension, we also treat vectors as aggregates. Keep these 2462169689Skan checks in ascending code order. */ 2463169689Skan#define CP_AGGREGATE_TYPE_P(TYPE) \ 2464169689Skan (TREE_CODE (TYPE) == VECTOR_TYPE \ 2465169689Skan ||TREE_CODE (TYPE) == ARRAY_TYPE \ 2466169689Skan || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE))) 2467117395Skan 2468117395Skan/* Nonzero for a class type means that the class type has a 2469117395Skan user-declared constructor. */ 247090075Sobrien#define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE)) 247118334Speter 247218334Speter/* When appearing in an INDIRECT_REF, it means that the tree structure 247318334Speter underneath is actually a call to a constructor. This is needed 247418334Speter when the constructor must initialize local storage (which can 247518334Speter be automatically destroyed), rather than allowing it to allocate 247618334Speter space from the heap. 247718334Speter 247818334Speter When appearing in a SAVE_EXPR, it means that underneath 247918334Speter is a call to a constructor. 248018334Speter 2481169689Skan When appearing in a CONSTRUCTOR, the expression is a 2482169689Skan compound literal. 248318334Speter 248418334Speter When appearing in a FIELD_DECL, it means that this field 248518334Speter has been duly initialized in its constructor. */ 248690075Sobrien#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE)) 248718334Speter 2488169689Skan/* True if NODE is a brace-enclosed initializer. */ 2489169689Skan#define BRACE_ENCLOSED_INITIALIZER_P(NODE) \ 2490169689Skan (TREE_CODE (NODE) == CONSTRUCTOR && !TREE_TYPE (NODE)) 249118334Speter 2492169689Skan/* True if NODE is a compound-literal, i.e., a brace-enclosed 2493169689Skan initializer cast to a particular type. */ 2494169689Skan#define COMPOUND_LITERAL_P(NODE) \ 2495169689Skan (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE)) 249618334Speter 2497169689Skan#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \ 2498169689Skan && VEC_empty (constructor_elt, \ 2499169689Skan CONSTRUCTOR_ELTS (NODE)) \ 2500169689Skan && !TREE_HAS_CONSTRUCTOR (NODE)) 2501169689Skan 250218334Speter/* Nonzero means that an object of this type can not be initialized using 250318334Speter an initializer list. */ 250418334Speter#define CLASSTYPE_NON_AGGREGATE(NODE) \ 2505117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate) 250618334Speter#define TYPE_NON_AGGREGATE_CLASS(NODE) \ 250718334Speter (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE)) 250818334Speter 250918334Speter/* Nonzero if there is a user-defined X::op=(x&) for this class. */ 2510117395Skan#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref) 2511117395Skan#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref) 251218334Speter 251390075Sobrien/* Nonzero if TYPE has a trivial destructor. From [class.dtor]: 251418334Speter 251590075Sobrien A destructor is trivial if it is an implicitly declared 251690075Sobrien destructor and if: 251790075Sobrien 251890075Sobrien - all of the direct base classes of its class have trivial 2519169689Skan destructors, 252090075Sobrien 252190075Sobrien - for all of the non-static data members of its class that are 2522169689Skan of class type (or array thereof), each such class has a 252390075Sobrien trivial destructor. */ 252490075Sobrien#define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \ 252590075Sobrien (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE)) 252690075Sobrien 252790075Sobrien/* Nonzero for _TYPE node means that this type does not have a trivial 252890075Sobrien destructor. Therefore, destroying an object of this type will 252990075Sobrien involve a call to a destructor. This can apply to objects of 253090075Sobrien ARRAY_TYPE is the type of the elements needs a destructor. */ 253190075Sobrien#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \ 253290075Sobrien (TYPE_LANG_FLAG_4 (NODE)) 253390075Sobrien 2534260311Spfg/* APPLE LOCAL begin omit calls to empty destructors 5559195 */ 2535260311Spfg/* One if the body of the destructor of class type NODE has been shown to do 2536260311Spfg nothing, else zero. */ 2537260311Spfg#define CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_nontrivial_destructor_body) 2538260311Spfg 2539260311Spfg/* One if destructor of this type must be called by its base classes because 2540260311Spfg one of its base classes' destructors must be called. */ 2541260311Spfg#define CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->destructor_nontrivial_because_of_base) 2542260311Spfg 2543260311Spfg/* One if the values of CLASSTYPE_DESTRUCTOR_NONTRIVIAL_BECAUSE_OF_BASE 2544260311Spfg and CLASSTYPE_HAS_NONTRIVIAL_DESTRUCTOR_BODY are final. */ 2545260311Spfg#define CLASSTYPE_DESTRUCTOR_TRIVIALITY_FINAL(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->destructor_triviality_final) 2546260311Spfg/* APPLE LOCAL end omit calls to empty destructors 5559195 */ 2547260311Spfg 254890075Sobrien/* Nonzero for class type means that copy initialization of this type can use 254918334Speter a bitwise copy. */ 255018334Speter#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \ 255118334Speter (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE)) 255218334Speter 255318334Speter/* Nonzero for class type means that assignment of this type can use 255418334Speter a bitwise copy. */ 255518334Speter#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \ 255618334Speter (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE)) 255718334Speter 2558132718Skan/* Returns true if NODE is a pointer-to-data-member. */ 2559132718Skan#define TYPE_PTRMEM_P(NODE) \ 2560132718Skan (TREE_CODE (NODE) == OFFSET_TYPE) 2561169689Skan/* Returns true if NODE is a pointer. */ 2562132718Skan#define TYPE_PTR_P(NODE) \ 2563132718Skan (TREE_CODE (NODE) == POINTER_TYPE) 2564169689Skan 2565169689Skan/* Returns true if NODE is an object type: 2566169689Skan 2567169689Skan [basic.types] 2568169689Skan 2569169689Skan An object type is a (possibly cv-qualified) type that is not a 2570169689Skan function type, not a reference type, and not a void type. 2571169689Skan 2572169689Skan Keep these checks in ascending order, for speed. */ 2573169689Skan#define TYPE_OBJ_P(NODE) \ 2574169689Skan (TREE_CODE (NODE) != REFERENCE_TYPE \ 2575169689Skan && TREE_CODE (NODE) != VOID_TYPE \ 2576169689Skan && TREE_CODE (NODE) != FUNCTION_TYPE \ 2577169689Skan && TREE_CODE (NODE) != METHOD_TYPE) 2578169689Skan 2579169689Skan/* Returns true if NODE is a pointer to an object. Keep these checks 2580169689Skan in ascending tree code order. */ 2581169689Skan#define TYPE_PTROB_P(NODE) \ 2582169689Skan (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE))) 2583169689Skan 2584169689Skan/* Returns true if NODE is a reference to an object. Keep these checks 2585169689Skan in ascending tree code order. */ 2586169689Skan#define TYPE_REF_OBJ_P(NODE) \ 2587169689Skan (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE))) 2588169689Skan 2589169689Skan/* Returns true if NODE is a pointer to an object, or a pointer to 2590169689Skan void. Keep these checks in ascending tree code order. */ 2591169689Skan#define TYPE_PTROBV_P(NODE) \ 2592169689Skan (TYPE_PTR_P (NODE) \ 2593169689Skan && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \ 2594169689Skan || TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)) 2595169689Skan 2596169689Skan/* Returns true if NODE is a pointer to function. */ 259750397Sobrien#define TYPE_PTRFN_P(NODE) \ 259850397Sobrien (TREE_CODE (NODE) == POINTER_TYPE \ 259950397Sobrien && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) 2600169689Skan 2601169689Skan/* Returns true if NODE is a reference to function. */ 260290075Sobrien#define TYPE_REFFN_P(NODE) \ 260390075Sobrien (TREE_CODE (NODE) == REFERENCE_TYPE \ 260490075Sobrien && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE) 260550397Sobrien 260618334Speter/* Nonzero for _TYPE node means that this type is a pointer to member 260750397Sobrien function type. */ 260890075Sobrien#define TYPE_PTRMEMFUNC_P(NODE) \ 260990075Sobrien (TREE_CODE (NODE) == RECORD_TYPE \ 261090075Sobrien && TYPE_LANG_SPECIFIC (NODE) \ 261190075Sobrien && TYPE_PTRMEMFUNC_FLAG (NODE)) 261290075Sobrien 261352284Sobrien#define TYPE_PTRMEMFUNC_FLAG(NODE) \ 2614117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag) 261552284Sobrien 2616132718Skan/* Returns true if NODE is a pointer-to-member. */ 2617132718Skan#define TYPE_PTR_TO_MEMBER_P(NODE) \ 2618132718Skan (TYPE_PTRMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE)) 2619132718Skan 262090075Sobrien/* Indicates when overload resolution may resolve to a pointer to 262190075Sobrien member function. [expr.unary.op]/3 */ 2622169689Skan#define PTRMEM_OK_P(NODE) \ 2623169689Skan TREE_LANG_FLAG_0 (TREE_CHECK2 ((NODE), ADDR_EXPR, OFFSET_REF)) 262490075Sobrien 262518334Speter/* Get the POINTER_TYPE to the METHOD_TYPE associated with this 262618334Speter pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true, 262750397Sobrien before using this macro. */ 262890075Sobrien#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \ 262990075Sobrien (TREE_TYPE (TYPE_FIELDS (NODE))) 263050397Sobrien 263150397Sobrien/* Returns `A' for a type like `int (A::*)(double)' */ 263250397Sobrien#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \ 263350397Sobrien TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) 263450397Sobrien 263550397Sobrien/* These are use to manipulate the canonical RECORD_TYPE from the 263650397Sobrien hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */ 263790075Sobrien#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \ 2638117395Skan (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL) 2639117395Skan#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \ 2640117395Skan do { \ 2641117395Skan if (TYPE_LANG_SPECIFIC (NODE) == NULL) \ 2642117395Skan { \ 2643169689Skan TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \ 2644169689Skan (struct lang_type, sizeof (struct lang_type_ptrmem)); \ 2645117395Skan TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \ 2646117395Skan } \ 2647117395Skan TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \ 2648117395Skan } while (0) 264918334Speter 265090075Sobrien/* For a pointer-to-member type of the form `T X::*', this is `X'. 265190075Sobrien For a type like `void (X::*)() const', this type is `X', not `const 265290075Sobrien X'. To get at the `const X' you have to look at the 265390075Sobrien TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have 265490075Sobrien type `const X*'. */ 265590075Sobrien#define TYPE_PTRMEM_CLASS_TYPE(NODE) \ 265690075Sobrien (TYPE_PTRMEM_P (NODE) \ 2657132718Skan ? TYPE_OFFSET_BASETYPE (NODE) \ 265890075Sobrien : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE)) 265990075Sobrien 266090075Sobrien/* For a pointer-to-member type of the form `T X::*', this is `T'. */ 266190075Sobrien#define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \ 266290075Sobrien (TYPE_PTRMEM_P (NODE) \ 2663132718Skan ? TREE_TYPE (NODE) \ 266490075Sobrien : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE))) 266590075Sobrien 266652284Sobrien/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for 266752284Sobrien `X'. */ 266890075Sobrien#define PTRMEM_CST_CLASS(NODE) \ 266990075Sobrien TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE))) 267052284Sobrien 267190075Sobrien/* For a pointer-to-member constant `X::Y' this is the _DECL for 267252284Sobrien `Y'. */ 267390075Sobrien#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member) 267452284Sobrien 2675169689Skan/* The expression in question for a TYPEOF_TYPE. */ 2676169689Skan#define TYPEOF_TYPE_EXPR(NODE) (TYPEOF_TYPE_CHECK (NODE))->type.values 2677169689Skan 267818334Speter/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was 267990075Sobrien specified in its declaration. This can also be set for an 268090075Sobrien erroneously declared PARM_DECL. */ 268190075Sobrien#define DECL_THIS_EXTERN(NODE) \ 268290075Sobrien DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE)) 268318334Speter 268418334Speter/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was 268590075Sobrien specified in its declaration. This can also be set for an 268690075Sobrien erroneously declared PARM_DECL. */ 268790075Sobrien#define DECL_THIS_STATIC(NODE) \ 268890075Sobrien DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE)) 268918334Speter 2690169689Skan/* Nonzero for FIELD_DECL node means that this field is a base class 2691169689Skan of the parent object, as opposed to a member field. */ 2692169689Skan#define DECL_FIELD_IS_BASE(NODE) \ 2693169689Skan DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE)) 2694169689Skan 269590075Sobrien/* Nonzero if TYPE is an anonymous union or struct type. We have to use a 269690075Sobrien flag for this because "A union for which objects or pointers are 269790075Sobrien declared is not an anonymous union" [class.union]. */ 269890075Sobrien#define ANON_AGGR_TYPE_P(NODE) \ 2699117395Skan (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr) 270090075Sobrien#define SET_ANON_AGGR_TYPE_P(NODE) \ 2701117395Skan (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1) 270218334Speter 270390075Sobrien/* Nonzero if TYPE is an anonymous union type. */ 270490075Sobrien#define ANON_UNION_TYPE_P(NODE) \ 270590075Sobrien (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE)) 270618334Speter 270718334Speter#define UNKNOWN_TYPE LANG_TYPE 270818334Speter 270918334Speter/* Define fields and accessors for nodes representing declared names. */ 271018334Speter 2711117395Skan#define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous) 271218334Speter 271318334Speter/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */ 271450397Sobrien 271550397Sobrien/* The format of each node in the DECL_FRIENDLIST is as follows: 271650397Sobrien 271750397Sobrien The TREE_PURPOSE will be the name of a function, i.e., an 2718132718Skan IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose 2719132718Skan TREE_VALUEs are friends with the given name. */ 272018334Speter#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE)) 272152284Sobrien#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST)) 272252284Sobrien#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST)) 272318334Speter 272452284Sobrien/* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of 272552284Sobrien each node is a type; the TREE_VALUE is the access granted for this 272652284Sobrien DECL in that type. The DECL_ACCESS is set by access declarations. 272752284Sobrien For example, if a member that would normally be public in a 272852284Sobrien derived class is made protected, then the derived class and the 272952284Sobrien protected_access_node will appear in the DECL_ACCESS for the node. */ 2730117395Skan#define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access) 273118334Speter 273290075Sobrien/* Nonzero if the FUNCTION_DECL is a global constructor. */ 273390075Sobrien#define DECL_GLOBAL_CTOR_P(NODE) \ 273490075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p) 273518334Speter 273690075Sobrien/* Nonzero if the FUNCTION_DECL is a global destructor. */ 273790075Sobrien#define DECL_GLOBAL_DTOR_P(NODE) \ 273890075Sobrien (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p) 273990075Sobrien 274050397Sobrien/* Accessor macros for C++ template decl nodes. */ 274118334Speter 274250397Sobrien/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node 274390075Sobrien is a INT_CST whose TREE_INT_CST_LOW indicates the level of the 274452284Sobrien template parameters, with 1 being the outermost set of template 274552284Sobrien parameters. The TREE_VALUE is a vector, whose elements are the 274652284Sobrien template parameters at each level. Each element in the vector is a 274752284Sobrien TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a 274852284Sobrien non-type parameter), or a TYPE_DECL (if the parameter is a type 274952284Sobrien parameter). The TREE_PURPOSE is the default value, if any. The 2750132718Skan TEMPLATE_PARM_INDEX for the parameter is available as the 275152284Sobrien DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a 275252284Sobrien TYPE_DECL). */ 2753169689Skan#define DECL_TEMPLATE_PARMS(NODE) DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments 275450397Sobrien#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \ 275550397Sobrien INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE)) 275650397Sobrien#define DECL_NTPARMS(NODE) \ 275750397Sobrien TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE)) 275818334Speter/* For function, method, class-data templates. */ 275990075Sobrien#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE) 276052284Sobrien/* For a static member variable template, the 276152284Sobrien DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and 276252284Sobrien implicitly generated instantiations of the variable. There are no 276352284Sobrien partial instantiations of static member variables, so all of these 276452284Sobrien will be full instantiations. 276552284Sobrien 276652284Sobrien For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds 276752284Sobrien all instantiations and specializations of the class type, including 276852284Sobrien partial instantiations and partial specializations. 276952284Sobrien 277052284Sobrien In both cases, the TREE_PURPOSE of each node contains the arguments 277152284Sobrien used; the TREE_VALUE contains the generated variable. The template 277252284Sobrien arguments are always complete. For example, given: 277352284Sobrien 277452284Sobrien template <class T> struct S1 { 2775169689Skan template <class U> struct S2 {}; 277652284Sobrien template <class U> struct S2<U*> {}; 277752284Sobrien }; 277852284Sobrien 277952284Sobrien the record for the partial specialization will contain, as its 278052284Sobrien argument list, { {T}, {U*} }, and will be on the 278152284Sobrien DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template 278252284Sobrien <class U> struct S1<T>::S2'. 278352284Sobrien 278452284Sobrien This list is not used for function templates. */ 278590075Sobrien#define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE) 278652284Sobrien/* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists 278752284Sobrien contains all instantiations and specializations of the function, 278852284Sobrien including partial instantiations. For a partial instantiation 278952284Sobrien which is a specialization, this list holds only full 279052284Sobrien specializations of the template that are instantiations of the 279152284Sobrien partial instantiation. For example, given: 279252284Sobrien 279352284Sobrien template <class T> struct S { 2794169689Skan template <class U> void f(U); 279590075Sobrien template <> void f(T); 279652284Sobrien }; 279752284Sobrien 279852284Sobrien the `S<int>::f<int>(int)' function will appear on the 279952284Sobrien DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T> 280052284Sobrien template <class U> void S<T>::f(U)' and `template <class T> void 280152284Sobrien S<int>::f(T)'. In the latter case, however, it will have only the 280252284Sobrien innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE 280352284Sobrien for the function declaration will point at the specialization, not 280452284Sobrien the fully general template. 280552284Sobrien 280652284Sobrien For a class template, this list contains the partial 280752284Sobrien specializations of this template. (Full specializations are not 2808169689Skan recorded on this list.) The TREE_PURPOSE holds the arguments used 2809169689Skan in the partial specialization (e.g., for `template <class T> struct 2810169689Skan S<T*, int>' this will be `T*'.) The arguments will also include 2811169689Skan any outer template arguments. The TREE_VALUE holds the innermost 2812169689Skan template parameters for the specialization (e.g., `T' in the 2813169689Skan example above.) The TREE_TYPE is the _TYPE node for the partial 2814169689Skan specialization. 281552284Sobrien 281652284Sobrien This list is not used for static variable templates. */ 281790075Sobrien#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE) 281818334Speter 2819169689Skan/* Nonzero for a DECL which is actually a template parameter. Keep 2820169689Skan these checks in ascending tree code order. */ 282190075Sobrien#define DECL_TEMPLATE_PARM_P(NODE) \ 282290075Sobrien (DECL_LANG_FLAG_0 (NODE) \ 282390075Sobrien && (TREE_CODE (NODE) == CONST_DECL \ 282490075Sobrien || TREE_CODE (NODE) == PARM_DECL \ 282590075Sobrien || TREE_CODE (NODE) == TYPE_DECL \ 282690075Sobrien || TREE_CODE (NODE) == TEMPLATE_DECL)) 282752284Sobrien 282890075Sobrien/* Mark NODE as a template parameter. */ 282990075Sobrien#define SET_DECL_TEMPLATE_PARM_P(NODE) \ 283090075Sobrien (DECL_LANG_FLAG_0 (NODE) = 1) 283190075Sobrien 283290075Sobrien/* Nonzero if NODE is a template template parameter. */ 283350397Sobrien#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \ 283452284Sobrien (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE)) 283550397Sobrien 2836132718Skan/* Nonzero if NODE is a TEMPLATE_DECL representing an 2837132718Skan UNBOUND_CLASS_TEMPLATE tree node. */ 2838132718Skan#define DECL_UNBOUND_CLASS_TEMPLATE_P(NODE) \ 2839132718Skan (TREE_CODE (NODE) == TEMPLATE_DECL && !DECL_TEMPLATE_RESULT (NODE)) 2840132718Skan 284150397Sobrien#define DECL_FUNCTION_TEMPLATE_P(NODE) \ 284250397Sobrien (TREE_CODE (NODE) == TEMPLATE_DECL \ 2843132718Skan && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \ 284450397Sobrien && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL) 284550397Sobrien 284650397Sobrien/* Nonzero for a DECL that represents a template class. */ 284750397Sobrien#define DECL_CLASS_TEMPLATE_P(NODE) \ 284850397Sobrien (TREE_CODE (NODE) == TEMPLATE_DECL \ 2849132718Skan && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \ 285050397Sobrien && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \ 285150397Sobrien && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE)) 285250397Sobrien 285350397Sobrien/* Nonzero if NODE which declares a type. */ 285450397Sobrien#define DECL_DECLARES_TYPE_P(NODE) \ 285550397Sobrien (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE)) 285650397Sobrien 285790075Sobrien/* Nonzero if NODE is the typedef implicitly generated for a type when 2858119256Skan the type is declared. In C++, `struct S {};' is roughly 2859119256Skan equivalent to `struct S {}; typedef struct S S;' in C. 2860119256Skan DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this 2861119256Skan example. In C++, there is a second implicit typedef for each 2862119256Skan class, in the scope of `S' itself, so that you can say `S::S'. 2863119256Skan DECL_SELF_REFERENCE_P will hold for that second typedef. */ 286490075Sobrien#define DECL_IMPLICIT_TYPEDEF_P(NODE) \ 286590075Sobrien (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE)) 286690075Sobrien#define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \ 286790075Sobrien (DECL_LANG_FLAG_2 (NODE) = 1) 2868119256Skan#define DECL_SELF_REFERENCE_P(NODE) \ 2869119256Skan (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE)) 2870119256Skan#define SET_DECL_SELF_REFERENCE_P(NODE) \ 2871119256Skan (DECL_LANG_FLAG_4 (NODE) = 1) 287290075Sobrien 287350397Sobrien/* A `primary' template is one that has its own template header. A 287450397Sobrien member function of a class template is a template, but not primary. 287550397Sobrien A member template is primary. Friend templates are primary, too. */ 287650397Sobrien 287750397Sobrien/* Returns the primary template corresponding to these parameters. */ 287850397Sobrien#define DECL_PRIMARY_TEMPLATE(NODE) \ 287950397Sobrien (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE))) 288050397Sobrien 2881117395Skan/* Returns nonzero if NODE is a primary template. */ 288290075Sobrien#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE)) 288350397Sobrien 2884169689Skan/* Non-zero iff NODE is a specialization of a template. The value 2885169689Skan indicates the type of specializations: 288650397Sobrien 2887169689Skan 1=implicit instantiation 2888169689Skan 2889169689Skan 2=partial or explicit specialization, e.g.: 2890169689Skan 2891169689Skan template <> int min<int> (int, int), 2892169689Skan 2893169689Skan 3=explicit instantiation, e.g.: 2894169689Skan 2895169689Skan template int min<int> (int, int); 2896169689Skan 2897169689Skan Note that NODE will be marked as a specialization even if the 2898169689Skan template it is instantiating is not a primary template. For 2899169689Skan example, given: 2900169689Skan 2901169689Skan template <typename T> struct O { 2902169689Skan void f(); 2903169689Skan struct I {}; 2904169689Skan }; 2905169689Skan 2906169689Skan both O<int>::f and O<int>::I will be marked as instantiations. 2907169689Skan 2908169689Skan If DECL_USE_TEMPLATE is non-zero, then DECL_TEMPLATE_INFO will also 2909169689Skan be non-NULL. */ 291090075Sobrien#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template) 291118334Speter 2912169689Skan/* Like DECL_USE_TEMPLATE, but for class types. */ 2913169689Skan#define CLASSTYPE_USE_TEMPLATE(NODE) \ 2914169689Skan (LANG_TYPE_CLASS_CHECK (NODE)->use_template) 2915169689Skan 2916169689Skan/* True if NODE is a specialization of a primary template. */ 2917169689Skan#define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \ 2918169689Skan (CLASS_TYPE_P (NODE) \ 2919169689Skan && CLASSTYPE_USE_TEMPLATE (NODE) \ 2920169689Skan && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (arg))) 2921169689Skan 292218334Speter#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1) 292318334Speter#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \ 292418334Speter (CLASSTYPE_USE_TEMPLATE (NODE) & 1) 292518334Speter 292618334Speter#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2) 292718334Speter#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2) 2928169689Skan 2929169689Skan/* Returns true for an explicit or partial specialization of a class 2930169689Skan template. */ 293118334Speter#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \ 293218334Speter (CLASSTYPE_USE_TEMPLATE (NODE) == 2) 293318334Speter#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \ 293418334Speter (CLASSTYPE_USE_TEMPLATE (NODE) = 2) 293518334Speter 293618334Speter#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1) 293718334Speter#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1) 293818334Speter#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ 293990075Sobrien (CLASSTYPE_USE_TEMPLATE (NODE) == 1) 294018334Speter#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \ 294190075Sobrien (CLASSTYPE_USE_TEMPLATE (NODE) = 1) 294218334Speter 294318334Speter#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3) 294418334Speter#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3) 294518334Speter#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ 294690075Sobrien (CLASSTYPE_USE_TEMPLATE (NODE) == 3) 294718334Speter#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \ 294890075Sobrien (CLASSTYPE_USE_TEMPLATE (NODE) = 3) 294918334Speter 2950117395Skan/* Nonzero if DECL is a friend function which is an instantiation 295152284Sobrien from the point of view of the compiler, but not from the point of 295252284Sobrien view of the language. For example given: 295352284Sobrien template <class T> struct S { friend void f(T) {}; }; 295452284Sobrien the declaration of `void f(int)' generated when S<int> is 295552284Sobrien instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be 295652284Sobrien a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */ 295752284Sobrien#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \ 295852284Sobrien (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL)) 295952284Sobrien 2960117395Skan/* Nonzero iff we are currently processing a declaration for an 296152284Sobrien entity with its own template parameter list, and which is not a 296252284Sobrien full specialization. */ 296352284Sobrien#define PROCESSING_REAL_TEMPLATE_DECL_P() \ 2964119256Skan (processing_template_decl > template_class_depth (current_scope ())) 296552284Sobrien 296652284Sobrien/* Nonzero if this VAR_DECL or FUNCTION_DECL has already been 296752284Sobrien instantiated, i.e. its definition has been generated from the 2968169689Skan pattern given in the template. */ 296990075Sobrien#define DECL_TEMPLATE_INSTANTIATED(NODE) \ 297090075Sobrien DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE)) 297152284Sobrien 297218334Speter/* We know what we're doing with this decl now. */ 297318334Speter#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE) 297418334Speter 297518334Speter/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted, 297618334Speter so that assemble_external will work properly. So we have this flag to 297718334Speter tell us whether the decl is really not external. */ 297818334Speter#define DECL_NOT_REALLY_EXTERN(NODE) \ 297918334Speter (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern) 298018334Speter 298150397Sobrien#define DECL_REALLY_EXTERN(NODE) \ 298250397Sobrien (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE)) 298318334Speter 298490075Sobrien/* A thunk is a stub function. 298518334Speter 298690075Sobrien A thunk is an alternate entry point for an ordinary FUNCTION_DECL. 298790075Sobrien The address of the ordinary FUNCTION_DECL is given by the 298890075Sobrien DECL_INITIAL, which is always an ADDR_EXPR whose operand is a 2989132718Skan FUNCTION_DECL. The job of the thunk is to either adjust the this 2990132718Skan pointer before transferring control to the FUNCTION_DECL, or call 2991132718Skan FUNCTION_DECL and then adjust the result value. Note, the result 2992132718Skan pointer adjusting thunk must perform a call to the thunked 2993132718Skan function, (or be implemented via passing some invisible parameter 2994132718Skan to the thunked function, which is modified to perform the 2995132718Skan adjustment just before returning). 2996169689Skan 299790075Sobrien A thunk may perform either, or both, of the following operations: 299850397Sobrien 2999132718Skan o Adjust the this or result pointer by a constant offset. 3000132718Skan o Adjust the this or result pointer by looking up a vcall or vbase offset 300190075Sobrien in the vtable. 300250397Sobrien 3003132718Skan A this pointer adjusting thunk converts from a base to a derived 3004132718Skan class, and hence adds the offsets. A result pointer adjusting thunk 3005132718Skan converts from a derived class to a base, and hence subtracts the 3006132718Skan offsets. If both operations are performed, then the constant 3007132718Skan adjustment is performed first for this pointer adjustment and last 3008132718Skan for the result pointer adjustment. 300990075Sobrien 3010132718Skan The constant adjustment is given by THUNK_FIXED_OFFSET. If the 3011132718Skan vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is 3012132718Skan used. For this pointer adjusting thunks, it is the vcall offset 3013132718Skan into the vtable. For result pointer adjusting thunks it is the 3014132718Skan binfo of the virtual base to convert to. Use that binfo's vbase 3015132718Skan offset. 301690075Sobrien 3017132718Skan It is possible to have equivalent covariant thunks. These are 3018132718Skan distinct virtual covariant thunks whose vbase offsets happen to 3019132718Skan have the same value. THUNK_ALIAS is used to pick one as the 3020132718Skan canonical thunk, which will get all the this pointer adjusting 3021132718Skan thunks attached to it. */ 3022132718Skan 302390075Sobrien/* An integer indicating how many bytes should be subtracted from the 3024132718Skan this or result pointer when this function is called. */ 3025132718Skan#define THUNK_FIXED_OFFSET(DECL) \ 3026169689Skan (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.f.u5.fixed_offset) 302790075Sobrien 3028132718Skan/* A tree indicating how to perform the virtual adjustment. For a this 3029132718Skan adjusting thunk it is the number of bytes to be added to the vtable 3030132718Skan to find the vcall offset. For a result adjusting thunk, it is the 3031132718Skan binfo of the relevant virtual base. If NULL, then there is no 3032132718Skan virtual adjust. (The vptr is always located at offset zero from 3033132718Skan the this or result pointer.) (If the covariant type is within the 3034132718Skan class hierarchy being laid out, the vbase index is not yet known 3035132718Skan at the point we need to create the thunks, hence the need to use 3036132718Skan binfos.) */ 303790075Sobrien 3038132718Skan#define THUNK_VIRTUAL_OFFSET(DECL) \ 3039169689Skan (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access) 3040132718Skan 3041132718Skan/* A thunk which is equivalent to another thunk. */ 3042132718Skan#define THUNK_ALIAS(DECL) \ 3043169689Skan (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.template_info) 3044132718Skan 3045146895Skan/* For thunk NODE, this is the FUNCTION_DECL thunked to. It is 3046146895Skan possible for the target to be a thunk too. */ 3047132718Skan#define THUNK_TARGET(NODE) \ 3048132718Skan (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes) 3049132718Skan 3050169689Skan/* True for a SCOPE_REF iff the "template" keyword was used to 3051169689Skan indicate that the qualified name denotes a template. */ 3052169689Skan#define QUALIFIED_NAME_IS_TEMPLATE(NODE) \ 3053169689Skan (TREE_LANG_FLAG_0 (SCOPE_REF_CHECK (NODE))) 3054169689Skan 3055169689Skan/* True for an OMP_ATOMIC that has dependent parameters. These are stored 3056169689Skan as bare LHS/RHS, and not as ADDR/RHS, as in the generic statement. */ 3057169689Skan#define OMP_ATOMIC_DEPENDENT_P(NODE) \ 3058169689Skan (TREE_LANG_FLAG_0 (OMP_ATOMIC_CHECK (NODE))) 3059169689Skan 3060169689Skan/* Used to store the operation code when OMP_ATOMIC_DEPENDENT_P is set. */ 3061169689Skan#define OMP_ATOMIC_CODE(NODE) \ 3062169689Skan (OMP_ATOMIC_CHECK (NODE)->exp.complexity) 3063169689Skan 3064169689Skan/* Used while gimplifying continue statements bound to OMP_FOR nodes. */ 3065169689Skan#define OMP_FOR_GIMPLIFYING_P(NODE) \ 3066169689Skan (TREE_LANG_FLAG_0 (OMP_FOR_CHECK (NODE))) 3067169689Skan 3068169689Skan/* A language-specific token attached to the OpenMP data clauses to 3069169689Skan hold code (or code fragments) related to ctors, dtors, and op=. 3070169689Skan See semantics.c for details. */ 3071169689Skan#define CP_OMP_CLAUSE_INFO(NODE) \ 3072169689Skan TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \ 3073169689Skan OMP_CLAUSE_COPYPRIVATE)) 3074169689Skan 307550397Sobrien/* These macros provide convenient access to the various _STMT nodes 307650397Sobrien created when parsing template declarations. */ 3077169689Skan#define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0) 3078169689Skan#define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1) 307950397Sobrien 3080169689Skan#define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0) 3081169689Skan#define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1) 308290075Sobrien 308390075Sobrien#define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0) 308490075Sobrien 308590075Sobrien/* Nonzero if this try block is a function try block. */ 3086169689Skan#define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE)) 3087169689Skan#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0) 3088169689Skan#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1) 308990075Sobrien#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE)) 309090075Sobrien 3091169689Skan/* CLEANUP_STMT accessors. The statement(s) covered, the cleanup to run 3092169689Skan and the VAR_DECL for which this cleanup exists. */ 3093169689Skan#define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0) 3094169689Skan#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1) 3095169689Skan#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2) 309690075Sobrien 3097169689Skan/* IF_STMT accessors. These give access to the condition of the if 3098169689Skan statement, the then block of the if statement, and the else block 3099169689Skan of the if statement if it exists. */ 3100169689Skan#define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0) 3101169689Skan#define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1) 3102169689Skan#define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2) 310390075Sobrien 3104169689Skan/* WHILE_STMT accessors. These give access to the condition of the 3105169689Skan while statement and the body of the while statement, respectively. */ 3106169689Skan#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0) 3107169689Skan#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1) 3108260014Spfg/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 3109260014Spfg#define WHILE_ATTRIBUTES(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 2) 311090075Sobrien 3111260014Spfg/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ 3112169689Skan/* DO_STMT accessors. These give access to the condition of the do 3113169689Skan statement and the body of the do statement, respectively. */ 3114169689Skan#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0) 3115169689Skan#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1) 3116260014Spfg/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 3117260014Spfg#define DO_ATTRIBUTES(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 2) 3118260014Spfg/* APPLE LOCAL begin C* language */ 3119260014Spfg/* Used as a flag to indicate synthesized inner do-while loop of a 3120260014Spfg foreach statement. Used for generation of break/continue statement 3121260014Spfg of the loop. */ 3122260014Spfg#define DO_FOREACH(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 3) 3123260014Spfg/* APPLE LOCAL end C* language */ 3124169689Skan 3125260014Spfg/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ 3126169689Skan/* FOR_STMT accessors. These give access to the init statement, 3127169689Skan condition, update expression, and body of the for statement, 3128169689Skan respectively. */ 3129169689Skan#define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0) 3130169689Skan#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1) 3131169689Skan#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2) 3132169689Skan#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3) 3133260014Spfg/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 3134260014Spfg#define FOR_ATTRIBUTES(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4) 3135169689Skan 3136260014Spfg/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ 3137169689Skan#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0) 3138169689Skan#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1) 3139169689Skan#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2) 3140169689Skan 3141169689Skan/* STMT_EXPR accessor. */ 3142169689Skan#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0) 3143169689Skan 3144169689Skan/* EXPR_STMT accessor. This gives the expression associated with an 3145169689Skan expression statement. */ 3146169689Skan#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0) 3147169689Skan 3148169689Skan/* True if this TARGET_EXPR was created by build_cplus_new, and so we can 3149169689Skan discard it if it isn't useful. */ 3150169689Skan#define TARGET_EXPR_IMPLICIT_P(NODE) \ 3151169689Skan TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE)) 3152169689Skan 315318334Speter/* An enumeration of the kind of tags that C++ accepts. */ 3154169689Skanenum tag_types { 3155132718Skan none_type = 0, /* Not a tag type. */ 3156132718Skan record_type, /* "struct" types. */ 3157132718Skan class_type, /* "class" types. */ 3158132718Skan union_type, /* "union" types. */ 3159132718Skan enum_type, /* "enum" types. */ 3160132718Skan typename_type /* "typename" types. */ 3161132718Skan}; 316218334Speter 316390075Sobrien/* The various kinds of lvalues we distinguish. */ 316490075Sobrientypedef enum cp_lvalue_kind { 316590075Sobrien clk_none = 0, /* Things that are not an lvalue. */ 316690075Sobrien clk_ordinary = 1, /* An ordinary lvalue. */ 316790075Sobrien clk_class = 2, /* An rvalue of class-type. */ 316890075Sobrien clk_bitfield = 4, /* An lvalue for a bit-field. */ 3169132718Skan clk_packed = 8 /* An lvalue for a packed field. */ 317090075Sobrien} cp_lvalue_kind; 317118334Speter 317290075Sobrien/* Various kinds of template specialization, instantiation, etc. */ 317390075Sobrientypedef enum tmpl_spec_kind { 3174169689Skan tsk_none, /* Not a template at all. */ 317590075Sobrien tsk_invalid_member_spec, /* An explicit member template 317690075Sobrien specialization, but the enclosing 317790075Sobrien classes have not all been explicitly 317890075Sobrien specialized. */ 317990075Sobrien tsk_invalid_expl_inst, /* An explicit instantiation containing 318090075Sobrien template parameter lists. */ 3181169689Skan tsk_excessive_parms, /* A template declaration with too many 318290075Sobrien template parameter lists. */ 318390075Sobrien tsk_insufficient_parms, /* A template declaration with too few 318490075Sobrien parameter lists. */ 3185169689Skan tsk_template, /* A template declaration. */ 3186169689Skan tsk_expl_spec, /* An explicit specialization. */ 3187169689Skan tsk_expl_inst /* An explicit instantiation. */ 318890075Sobrien} tmpl_spec_kind; 318918334Speter 319090075Sobrien/* The various kinds of access. BINFO_ACCESS depends on these being 319190075Sobrien two bit quantities. The numerical values are important; they are 319290075Sobrien used to initialize RTTI data structures, so changing them changes 319390075Sobrien the ABI. */ 319490075Sobrientypedef enum access_kind { 3195169689Skan ak_none = 0, /* Inaccessible. */ 3196169689Skan ak_public = 1, /* Accessible, as a `public' thing. */ 3197169689Skan ak_protected = 2, /* Accessible, as a `protected' thing. */ 3198169689Skan ak_private = 3 /* Accessible, as a `private' thing. */ 319990075Sobrien} access_kind; 320090075Sobrien 320190075Sobrien/* The various kinds of special functions. If you add to this list, 320290075Sobrien you should update special_function_p as well. */ 320390075Sobrientypedef enum special_function_kind { 3204169689Skan sfk_none = 0, /* Not a special function. This enumeral 320590075Sobrien must have value zero; see 320690075Sobrien special_function_p. */ 3207169689Skan sfk_constructor, /* A constructor. */ 320890075Sobrien sfk_copy_constructor, /* A copy constructor. */ 320990075Sobrien sfk_assignment_operator, /* An assignment operator. */ 3210169689Skan sfk_destructor, /* A destructor. */ 321190075Sobrien sfk_complete_destructor, /* A destructor for complete objects. */ 321290075Sobrien sfk_base_destructor, /* A destructor for base subobjects. */ 321390075Sobrien sfk_deleting_destructor, /* A destructor for complete objects that 321490075Sobrien deletes the object after it has been 321590075Sobrien destroyed. */ 3216169689Skan sfk_conversion /* A conversion operator. */ 321790075Sobrien} special_function_kind; 321890075Sobrien 3219169689Skan/* The various kinds of linkage. From [basic.link], 3220169689Skan 322190075Sobrien A name is said to have linkage when it might denote the same 322290075Sobrien object, reference, function, type, template, namespace or value 322390075Sobrien as a name introduced in another scope: 322490075Sobrien 322590075Sobrien -- When a name has external linkage, the entity it denotes can 3226169689Skan be referred to from scopes of other translation units or from 322790075Sobrien other scopes of the same translation unit. 322890075Sobrien 322990075Sobrien -- When a name has internal linkage, the entity it denotes can 3230169689Skan be referred to by names from other scopes in the same 323190075Sobrien translation unit. 323290075Sobrien 323390075Sobrien -- When a name has no linkage, the entity it denotes cannot be 3234169689Skan referred to by names from other scopes. */ 323590075Sobrien 323690075Sobrientypedef enum linkage_kind { 3237169689Skan lk_none, /* No linkage. */ 3238169689Skan lk_internal, /* Internal linkage. */ 3239169689Skan lk_external /* External linkage. */ 324090075Sobrien} linkage_kind; 324190075Sobrien 324296263Sobrien/* Bitmask flags to control type substitution. */ 324396263Sobrientypedef enum tsubst_flags_t { 3244169689Skan tf_none = 0, /* nothing special */ 3245169689Skan tf_error = 1 << 0, /* give error messages */ 3246169689Skan tf_warning = 1 << 1, /* give warnings too */ 3247169689Skan tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */ 3248132718Skan tf_keep_type_decl = 1 << 3, /* retain typedef type decls 324996263Sobrien (make_typename_type use) */ 3250169689Skan tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal 3251132718Skan instantiate_type use) */ 3252132718Skan tf_user = 1 << 5, /* found template must be a user template 3253132718Skan (lookup_template_class use) */ 3254169689Skan tf_conv = 1 << 6, /* We are determining what kind of 3255132718Skan conversion might be permissible, 3256132718Skan not actually performing the 3257132718Skan conversion. */ 3258169689Skan /* Convenient substitution flags combinations. */ 3259169689Skan tf_warning_or_error = tf_warning | tf_error 326096263Sobrien} tsubst_flags_t; 326190075Sobrien 3262117395Skan/* The kind of checking we can do looking in a class hierarchy. */ 326390075Sobrientypedef enum base_access { 3264169689Skan ba_any = 0, /* Do not check access, allow an ambiguous base, 326590075Sobrien prefer a non-virtual base */ 3266169689Skan ba_unique = 1 << 0, /* Must be a unique base. */ 3267169689Skan ba_check_bit = 1 << 1, /* Check access. */ 3268169689Skan ba_check = ba_unique | ba_check_bit, 3269169689Skan ba_ignore_scope = 1 << 2, /* Ignore access allowed by local scope. */ 3270169689Skan ba_quiet = 1 << 3 /* Do not issue error messages. */ 327190075Sobrien} base_access; 327290075Sobrien 3273132718Skan/* The various kinds of access check during parsing. */ 3274132718Skantypedef enum deferring_kind { 3275132718Skan dk_no_deferred = 0, /* Check access immediately */ 3276132718Skan dk_deferred = 1, /* Deferred check */ 3277132718Skan dk_no_check = 2 /* No access check */ 3278132718Skan} deferring_kind; 3279132718Skan 328090075Sobrien/* The kind of base we can find, looking in a class hierarchy. 3281117395Skan Values <0 indicate we failed. */ 328290075Sobrientypedef enum base_kind { 328390075Sobrien bk_inaccessible = -3, /* The base is inaccessible */ 3284169689Skan bk_ambig = -2, /* The base is ambiguous */ 3285169689Skan bk_not_base = -1, /* It is not a base */ 3286169689Skan bk_same_type = 0, /* It is the same type */ 3287169689Skan bk_proper_base = 1, /* It is a proper base */ 3288169689Skan bk_via_virtual = 2 /* It is a proper base, but via a virtual 328990075Sobrien path. This might not be the canonical 3290117395Skan binfo. */ 329190075Sobrien} base_kind; 329290075Sobrien 329318334Speter/* Node for "pointer to (virtual) function". 329450397Sobrien This may be distinct from ptr_type_node so gdb can distinguish them. */ 329590075Sobrien#define vfunc_ptr_type_node vtable_entry_type 329618334Speter 329718334Speter 329818334Speter/* For building calls to `delete'. */ 3299117395Skanextern GTY(()) tree integer_two_node; 3300117395Skanextern GTY(()) tree integer_three_node; 330118334Speter 330290075Sobrien/* The number of function bodies which we are currently processing. 330390075Sobrien (Zero if we are at namespace scope, one inside the body of a 330490075Sobrien function, two inside the body of a function in a local class, etc.) */ 330590075Sobrienextern int function_depth; 330652284Sobrien 330718334Speter/* in pt.c */ 330818334Speter 330990075Sobrien/* These values are used for the `STRICT' parameter to type_unification and 331050397Sobrien fn_type_unification. Their meanings are described with the 331150397Sobrien documentation for fn_type_unification. */ 331218334Speter 331350397Sobrientypedef enum unification_kind_t { 331450397Sobrien DEDUCE_CALL, 331550397Sobrien DEDUCE_CONV, 3316169689Skan DEDUCE_EXACT 331750397Sobrien} unification_kind_t; 331818334Speter 3319169689Skan/* Macros for operating on a template instantiation level node. */ 332050397Sobrien 3321169689Skan#define TINST_DECL(NODE) \ 3322169689Skan (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->decl) 3323169689Skan#define TINST_LOCATION(NODE) \ 3324169689Skan (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->locus) 3325169689Skan#define TINST_IN_SYSTEM_HEADER_P(NODE) \ 3326169689Skan (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->in_system_header_p) 332718334Speter 332818334Speter/* in class.c */ 332952284Sobrien 333050397Sobrienextern int current_class_depth; 333118334Speter 333290075Sobrien/* An array of all local classes present in this translation unit, in 333390075Sobrien declaration order. */ 3334169689Skanextern GTY(()) VEC(tree,gc) *local_classes; 333518334Speter 333618334Speter/* Here's where we control how name mangling takes place. */ 333718334Speter 333818334Speter/* Cannot use '$' up front, because this confuses gdb 333918334Speter (names beginning with '$' are gdb-local identifiers). 334018334Speter 334118334Speter Note that all forms in which the '$' is significant are long enough 334218334Speter for direct indexing (meaning that if we know there is a '$' 334318334Speter at a particular location, we can index into the string at 334418334Speter any other location that provides distinguishing characters). */ 334518334Speter 334618334Speter/* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler 334718334Speter doesn't allow '$' in symbol names. */ 334818334Speter#ifndef NO_DOLLAR_IN_LABEL 334918334Speter 335018334Speter#define JOINER '$' 335118334Speter 335218334Speter#define AUTO_TEMP_NAME "_$tmp_" 335318334Speter#define VFIELD_BASE "$vf" 335418334Speter#define VFIELD_NAME "_vptr$" 335518334Speter#define VFIELD_NAME_FORMAT "_vptr$%s" 335618334Speter#define ANON_AGGRNAME_FORMAT "$_%d" 335718334Speter 335818334Speter#else /* NO_DOLLAR_IN_LABEL */ 335918334Speter 336018334Speter#ifndef NO_DOT_IN_LABEL 336118334Speter 336218334Speter#define JOINER '.' 336318334Speter 336418334Speter#define AUTO_TEMP_NAME "_.tmp_" 336518334Speter#define VFIELD_BASE ".vf" 336618334Speter#define VFIELD_NAME "_vptr." 336718334Speter#define VFIELD_NAME_FORMAT "_vptr.%s" 336818334Speter 336918334Speter#define ANON_AGGRNAME_FORMAT "._%d" 337018334Speter 337118334Speter#else /* NO_DOT_IN_LABEL */ 337218334Speter 337318334Speter#define IN_CHARGE_NAME "__in_chrg" 337418334Speter#define AUTO_TEMP_NAME "__tmp_" 337518334Speter#define TEMP_NAME_P(ID_NODE) \ 337618334Speter (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \ 337718334Speter sizeof (AUTO_TEMP_NAME) - 1)) 337818334Speter#define VTABLE_NAME "__vt_" 337918334Speter#define VTABLE_NAME_P(ID_NODE) \ 338018334Speter (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \ 338118334Speter sizeof (VTABLE_NAME) - 1)) 338218334Speter#define VFIELD_BASE "__vfb" 338318334Speter#define VFIELD_NAME "__vptr_" 338418334Speter#define VFIELD_NAME_P(ID_NODE) \ 338518334Speter (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \ 338618334Speter sizeof (VFIELD_NAME) - 1)) 338790075Sobrien#define VFIELD_NAME_FORMAT "__vptr_%s" 338818334Speter 338918334Speter#define ANON_AGGRNAME_PREFIX "__anon_" 339018334Speter#define ANON_AGGRNAME_P(ID_NODE) \ 339118334Speter (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \ 339218334Speter sizeof (ANON_AGGRNAME_PREFIX) - 1)) 339318334Speter#define ANON_AGGRNAME_FORMAT "__anon_%d" 339418334Speter 339518334Speter#endif /* NO_DOT_IN_LABEL */ 339618334Speter#endif /* NO_DOLLAR_IN_LABEL */ 339718334Speter 339818334Speter#define THIS_NAME "this" 339918334Speter 340018334Speter#define IN_CHARGE_NAME "__in_chrg" 340118334Speter 340218334Speter#define VTBL_PTR_TYPE "__vtbl_ptr_type" 340318334Speter#define VTABLE_DELTA_NAME "__delta" 340418334Speter#define VTABLE_PFN_NAME "__pfn" 340518334Speter 340618334Speter#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) 340718334Speter 340818334Speter#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \ 340918334Speter && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \ 341018334Speter && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) 341118334Speter 341290075Sobrien#define TEMP_NAME_P(ID_NODE) \ 341390075Sobrien (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) 341490075Sobrien#define VFIELD_NAME_P(ID_NODE) \ 341590075Sobrien (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) 341618334Speter 341718334Speter/* For anonymous aggregate types, we need some sort of name to 341818334Speter hold on to. In practice, this should not appear, but it should 341918334Speter not be harmful if it does. */ 342018334Speter#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \ 342118334Speter && IDENTIFIER_POINTER (ID_NODE)[1] == '_') 342218334Speter#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */ 342350397Sobrien 342418334Speter 342590075Sobrien/* Nonzero if we're done parsing and into end-of-file activities. */ 342618334Speter 342790075Sobrienextern int at_eof; 342818334Speter 3429117395Skan/* A list of namespace-scope objects which have constructors or 3430117395Skan destructors which reside in the global scope. The decl is stored 3431117395Skan in the TREE_VALUE slot and the initializer is stored in the 3432117395Skan TREE_PURPOSE slot. */ 3433117395Skanextern GTY(()) tree static_aggregates; 3434117395Skan 343590075Sobrien/* Functions called along with real static constructors and destructors. */ 343650397Sobrien 3437117395Skanextern GTY(()) tree static_ctors; 3438117395Skanextern GTY(()) tree static_dtors; 343950397Sobrien 344018334Speterenum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG }; 344118334Speter 3442169689Skan/* These are uses as bits in flags passed to various functions to 3443169689Skan control their behavior. Despite the LOOKUP_ prefix, many of these 3444169689Skan do not control name lookup. ??? Functions using these flags should 3445169689Skan probably be modified to accept explicit boolean flags for the 3446169689Skan behaviors relevant to them. */ 3447169689Skan/* Check for access violations. */ 3448132718Skan#define LOOKUP_PROTECT (1 << 0) 3449169689Skan/* Complain if no suitable member function matching the arguments is 3450169689Skan found. */ 3451132718Skan#define LOOKUP_COMPLAIN (1 << 1) 3452132718Skan#define LOOKUP_NORMAL (LOOKUP_PROTECT | LOOKUP_COMPLAIN) 3453169689Skan/* Even if the function found by lookup is a virtual function, it 3454169689Skan should be called directly. */ 3455132718Skan#define LOOKUP_NONVIRTUAL (1 << 2) 3456169689Skan/* Non-converting (i.e., "explicit") constructors are not tried. */ 3457169689Skan#define LOOKUP_ONLYCONVERTING (1 << 3) 3458169689Skan/* If a temporary is created, it should be created so that it lives 3459169689Skan as long as the current variable bindings; otherwise it only lives 3460169689Skan until the end of the complete-expression. It also forces 3461169689Skan direct-initialization in cases where other parts of the compiler 3462169689Skan have already generated a temporary, such as reference 3463169689Skan initialization and the catch parameter. */ 3464169689Skan#define DIRECT_BIND (1 << 4) 3465169689Skan/* User-defined conversions are not permitted. (Built-in conversions 3466169689Skan are permitted.) */ 3467169689Skan#define LOOKUP_NO_CONVERSION (1 << 5) 3468169689Skan/* The user has explicitly called a destructor. (Therefore, we do 3469169689Skan not need to check that the object is non-NULL before calling the 3470169689Skan destructor.) */ 3471169689Skan#define LOOKUP_DESTRUCTOR (1 << 6) 3472169689Skan/* Do not permit references to bind to temporaries. */ 3473169689Skan#define LOOKUP_NO_TEMP_BIND (1 << 7) 3474169689Skan/* Do not accept objects, and possibly namespaces. */ 3475169689Skan#define LOOKUP_PREFER_TYPES (1 << 8) 3476169689Skan/* Do not accept objects, and possibly types. */ 3477169689Skan#define LOOKUP_PREFER_NAMESPACES (1 << 9) 3478169689Skan/* Accept types or namespaces. */ 3479132718Skan#define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES) 3480169689Skan/* We are checking that a constructor can be called -- but we do not 3481169689Skan actually plan to call it. */ 3482169689Skan#define LOOKUP_CONSTRUCTOR_CALLABLE (1 << 10) 3483169689Skan/* Return friend declarations and un-declared builtin functions. 3484169689Skan (Normally, these entities are registered in the symbol table, but 3485169689Skan not found by lookup.) */ 3486169689Skan#define LOOKUP_HIDDEN (LOOKUP_CONSTRUCTOR_CALLABLE << 1) 348718334Speter 348890075Sobrien#define LOOKUP_NAMESPACES_ONLY(F) \ 348990075Sobrien (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES)) 349090075Sobrien#define LOOKUP_TYPES_ONLY(F) \ 349190075Sobrien (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES)) 349290075Sobrien#define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH) 349350397Sobrien 349490075Sobrien 349518334Speter/* These flags are used by the conversion code. 349618334Speter CONV_IMPLICIT : Perform implicit conversions (standard and user-defined). 349718334Speter CONV_STATIC : Perform the explicit conversions for static_cast. 349818334Speter CONV_CONST : Perform the explicit conversions for const_cast. 349918334Speter CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast. 350018334Speter CONV_PRIVATE : Perform upcasts to private bases. 350118334Speter CONV_FORCE_TEMP : Require a new temporary when converting to the same 350290075Sobrien aggregate type. */ 350318334Speter 350418334Speter#define CONV_IMPLICIT 1 350518334Speter#define CONV_STATIC 2 350618334Speter#define CONV_CONST 4 350718334Speter#define CONV_REINTERPRET 8 350818334Speter#define CONV_PRIVATE 16 350950397Sobrien/* #define CONV_NONCONVERTING 32 */ 351018334Speter#define CONV_FORCE_TEMP 64 351118334Speter#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \ 351218334Speter | CONV_REINTERPRET) 351318334Speter#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \ 351418334Speter | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP) 351518334Speter 351618334Speter/* Used by build_expr_type_conversion to indicate which types are 351718334Speter acceptable as arguments to the expression under consideration. */ 351818334Speter 351918334Speter#define WANT_INT 1 /* integer types, including bool */ 352018334Speter#define WANT_FLOAT 2 /* floating point types */ 352118334Speter#define WANT_ENUM 4 /* enumerated types */ 352218334Speter#define WANT_POINTER 8 /* pointer types */ 352318334Speter#define WANT_NULL 16 /* null pointer constant */ 3524169689Skan#define WANT_VECTOR 32 /* vector types */ 3525169689Skan#define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR) 352618334Speter 352752284Sobrien/* Used with comptypes, and related functions, to guide type 352852284Sobrien comparison. */ 352918334Speter 3530169689Skan#define COMPARE_STRICT 0 /* Just check if the types are the 353152284Sobrien same. */ 3532169689Skan#define COMPARE_BASE 1 /* Check to see if the second type is 3533132718Skan derived from the first. */ 3534169689Skan#define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in 3535132718Skan reverse. */ 3536132718Skan#define COMPARE_REDECLARATION 4 /* The comparison is being done when 353752284Sobrien another declaration of an existing 353852284Sobrien entity is seen. */ 353952284Sobrien 354052284Sobrien/* Used with push_overloaded_decl. */ 3541169689Skan#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope, 354252284Sobrien regardless of the current scope. */ 3543169689Skan#define PUSH_LOCAL 1 /* Push the DECL into the current 354452284Sobrien scope. */ 3545169689Skan#define PUSH_USING 2 /* We are pushing this DECL as the 354652284Sobrien result of a using declaration. */ 354752284Sobrien 354890075Sobrien/* Used with start function. */ 3549169689Skan#define SF_DEFAULT 0 /* No flags. */ 3550169689Skan#define SF_PRE_PARSED 1 /* The function declaration has 355190075Sobrien already been parsed. */ 355290075Sobrien#define SF_INCLASS_INLINE 2 /* The function is an inline, defined 355390075Sobrien in the class body. */ 355452284Sobrien 355552284Sobrien/* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2 355652284Sobrien is derived from TYPE1, or if TYPE2 is a pointer (reference) to a 355752284Sobrien class derived from the type pointed to (referred to) by TYPE1. */ 355890075Sobrien#define same_or_base_type_p(TYPE1, TYPE2) \ 355990075Sobrien comptypes ((TYPE1), (TYPE2), COMPARE_BASE) 356052284Sobrien 356150397Sobrien/* These macros are used to access a TEMPLATE_PARM_INDEX. */ 356290075Sobrien#define TEMPLATE_PARM_INDEX_CAST(NODE) \ 356390075Sobrien ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE)) 356490075Sobrien#define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index) 356590075Sobrien#define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level) 356650397Sobrien#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE)) 356790075Sobrien#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level) 356890075Sobrien#define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl) 356918334Speter 357090075Sobrien/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM, 357190075Sobrien TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */ 3572169689Skan#define TEMPLATE_TYPE_PARM_INDEX(NODE) \ 3573169689Skan (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, TEMPLATE_TEMPLATE_PARM, \ 3574169689Skan BOUND_TEMPLATE_TEMPLATE_PARM))->type.values 357550397Sobrien#define TEMPLATE_TYPE_IDX(NODE) \ 357650397Sobrien (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE))) 357750397Sobrien#define TEMPLATE_TYPE_LEVEL(NODE) \ 357850397Sobrien (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE))) 357950397Sobrien#define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \ 358050397Sobrien (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE))) 358150397Sobrien#define TEMPLATE_TYPE_DECL(NODE) \ 358250397Sobrien (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE))) 358350397Sobrien 358490075Sobrien/* These constants can used as bit flags in the process of tree formatting. 358590075Sobrien 358690075Sobrien TFF_PLAIN_IDENTIFIER: unqualified part of a name. 358790075Sobrien TFF_SCOPE: include the class and namespace scope of the name. 358890075Sobrien TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name. 358990075Sobrien TFF_DECL_SPECIFIERS: print decl-specifiers. 359090075Sobrien TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with 359190075Sobrien a class-key (resp. `enum'). 359290075Sobrien TFF_RETURN_TYPE: include function return type. 359390075Sobrien TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values. 359490075Sobrien TFF_EXCEPTION_SPECIFICATION: show function exception specification. 359590075Sobrien TFF_TEMPLATE_HEADER: show the template<...> header in a 359690075Sobrien template-declaration. 359790075Sobrien TFF_TEMPLATE_NAME: show only template-name. 3598132718Skan TFF_EXPR_IN_PARENS: parenthesize expressions. 3599132718Skan TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments. */ 360090075Sobrien 3601169689Skan#define TFF_PLAIN_IDENTIFIER (0) 3602169689Skan#define TFF_SCOPE (1) 3603169689Skan#define TFF_CHASE_TYPEDEF (1 << 1) 3604169689Skan#define TFF_DECL_SPECIFIERS (1 << 2) 3605169689Skan#define TFF_CLASS_KEY_OR_ENUM (1 << 3) 3606169689Skan#define TFF_RETURN_TYPE (1 << 4) 3607169689Skan#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5) 3608169689Skan#define TFF_EXCEPTION_SPECIFICATION (1 << 6) 3609169689Skan#define TFF_TEMPLATE_HEADER (1 << 7) 3610169689Skan#define TFF_TEMPLATE_NAME (1 << 8) 3611169689Skan#define TFF_EXPR_IN_PARENS (1 << 9) 3612169689Skan#define TFF_NO_FUNCTION_ARGUMENTS (1 << 10) 361390075Sobrien 361490075Sobrien/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM 361590075Sobrien node. */ 361690075Sobrien#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \ 361790075Sobrien ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \ 361890075Sobrien ? TYPE_TI_TEMPLATE (NODE) \ 361990075Sobrien : TYPE_NAME (NODE)) 362090075Sobrien 362118334Speter/* in lex.c */ 362290075Sobrien 3623132718Skanextern void init_reswords (void); 362490075Sobrien 362518334Speter/* Indexed by TREE_CODE, these tables give C-looking names to 362618334Speter operators represented by TREE_CODES. For example, 362718334Speter opname_tab[(int) MINUS_EXPR] == "-". */ 362890075Sobrienextern const char **opname_tab, **assignop_tab; 362990075Sobrien 3630132718Skantypedef struct operator_name_info_t GTY(()) 363190075Sobrien{ 363290075Sobrien /* The IDENTIFIER_NODE for the operator. */ 363390075Sobrien tree identifier; 363490075Sobrien /* The name of the operator. */ 363590075Sobrien const char *name; 363690075Sobrien /* The mangled name of the operator. */ 363790075Sobrien const char *mangled_name; 3638117395Skan /* The arity of the operator. */ 3639117395Skan int arity; 364090075Sobrien} operator_name_info_t; 364190075Sobrien 364290075Sobrien/* A mapping from tree codes to operator name information. */ 3643132718Skanextern GTY(()) operator_name_info_t operator_name_info 3644132718Skan [(int) LAST_CPLUS_TREE_CODE]; 364590075Sobrien/* Similar, but for assignment operators. */ 3646132718Skanextern GTY(()) operator_name_info_t assignment_operator_name_info 3647132718Skan [(int) LAST_CPLUS_TREE_CODE]; 364890075Sobrien 3649169689Skan/* A type-qualifier, or bitmask therefore, using the TYPE_QUAL 3650169689Skan constants. */ 3651169689Skan 3652169689Skantypedef int cp_cv_quals; 3653169689Skan 3654169689Skan/* A storage class. */ 3655169689Skan 3656169689Skantypedef enum cp_storage_class { 3657169689Skan /* sc_none must be zero so that zeroing a cp_decl_specifier_seq 3658169689Skan sets the storage_class field to sc_none. */ 3659169689Skan sc_none = 0, 3660169689Skan sc_auto, 3661169689Skan sc_register, 3662169689Skan sc_static, 3663169689Skan sc_extern, 3664169689Skan sc_mutable 3665169689Skan} cp_storage_class; 3666169689Skan 3667169689Skan/* An individual decl-specifier. */ 3668169689Skan 3669169689Skantypedef enum cp_decl_spec { 3670169689Skan ds_first, 3671169689Skan ds_signed = ds_first, 3672169689Skan ds_unsigned, 3673169689Skan ds_short, 3674169689Skan ds_long, 3675169689Skan ds_const, 3676169689Skan ds_volatile, 3677169689Skan ds_restrict, 3678169689Skan ds_inline, 3679169689Skan ds_virtual, 3680169689Skan ds_explicit, 3681169689Skan ds_friend, 3682169689Skan ds_typedef, 3683169689Skan ds_complex, 3684169689Skan ds_thread, 3685169689Skan ds_last 3686169689Skan} cp_decl_spec; 3687169689Skan 3688169689Skan/* A decl-specifier-seq. */ 3689169689Skan 3690169689Skantypedef struct cp_decl_specifier_seq { 3691169689Skan /* The number of times each of the keywords has been seen. */ 3692169689Skan unsigned specs[(int) ds_last]; 3693169689Skan /* The primary type, if any, given by the decl-specifier-seq. 3694169689Skan Modifiers, like "short", "const", and "unsigned" are not 3695169689Skan reflected here. This field will be a TYPE, unless a typedef-name 3696169689Skan was used, in which case it will be a TYPE_DECL. */ 3697169689Skan tree type; 3698169689Skan /* The attributes, if any, provided with the specifier sequence. */ 3699169689Skan tree attributes; 3700169689Skan /* If non-NULL, a built-in type that the user attempted to redefine 3701169689Skan to some other type. */ 3702169689Skan tree redefined_builtin_type; 3703169689Skan /* The storage class specified -- or sc_none if no storage class was 3704169689Skan explicitly specified. */ 3705169689Skan cp_storage_class storage_class; 3706169689Skan /* True iff TYPE_SPEC indicates a user-defined type. */ 3707169689Skan BOOL_BITFIELD user_defined_type_p : 1; 3708169689Skan /* True iff multiple types were (erroneously) specified for this 3709169689Skan decl-specifier-seq. */ 3710169689Skan BOOL_BITFIELD multiple_types_p : 1; 3711169689Skan /* True iff multiple storage classes were (erroneously) specified 3712169689Skan for this decl-specifier-seq or a combination of a storage class 3713169689Skan with a typedef specifier. */ 3714169689Skan BOOL_BITFIELD conflicting_specifiers_p : 1; 3715169689Skan /* True iff at least one decl-specifier was found. */ 3716169689Skan BOOL_BITFIELD any_specifiers_p : 1; 3717169689Skan /* True iff "int" was explicitly provided. */ 3718169689Skan BOOL_BITFIELD explicit_int_p : 1; 3719169689Skan /* True iff "char" was explicitly provided. */ 3720169689Skan BOOL_BITFIELD explicit_char_p : 1; 3721169689Skan} cp_decl_specifier_seq; 3722169689Skan 3723169689Skan/* The various kinds of declarators. */ 3724169689Skan 3725169689Skantypedef enum cp_declarator_kind { 3726169689Skan cdk_id, 3727169689Skan cdk_function, 3728169689Skan cdk_array, 3729169689Skan cdk_pointer, 3730169689Skan cdk_reference, 3731169689Skan cdk_ptrmem, 3732260311Spfg /* APPLE LOCAL blocks 6040305 (ch) */ 3733260311Spfg cdk_block_pointer, 3734169689Skan cdk_error 3735169689Skan} cp_declarator_kind; 3736169689Skan 3737169689Skan/* A declarator. */ 3738169689Skan 3739169689Skantypedef struct cp_declarator cp_declarator; 3740169689Skan 3741169689Skantypedef struct cp_parameter_declarator cp_parameter_declarator; 3742169689Skan 3743169689Skan/* A parameter, before it has been semantically analyzed. */ 3744169689Skanstruct cp_parameter_declarator { 3745169689Skan /* The next parameter, or NULL_TREE if none. */ 3746169689Skan cp_parameter_declarator *next; 3747169689Skan /* The decl-specifiers-seq for the parameter. */ 3748169689Skan cp_decl_specifier_seq decl_specifiers; 3749169689Skan /* The declarator for the parameter. */ 3750169689Skan cp_declarator *declarator; 3751169689Skan /* The default-argument expression, or NULL_TREE, if none. */ 3752169689Skan tree default_argument; 3753169689Skan /* True iff this is the first parameter in the list and the 3754169689Skan parameter sequence ends with an ellipsis. */ 3755169689Skan bool ellipsis_p; 3756169689Skan}; 3757169689Skan 3758169689Skan/* A declarator. */ 3759169689Skanstruct cp_declarator { 3760169689Skan /* The kind of declarator. */ 3761169689Skan cp_declarator_kind kind; 3762169689Skan /* Attributes that apply to this declarator. */ 3763169689Skan tree attributes; 3764169689Skan /* For all but cdk_id and cdk_error, the contained declarator. For 3765169689Skan cdk_id and cdk_error, guaranteed to be NULL. */ 3766169689Skan cp_declarator *declarator; 3767169689Skan location_t id_loc; /* Currently only set for cdk_id. */ 3768169689Skan union { 3769169689Skan /* For identifiers. */ 3770169689Skan struct { 3771169689Skan /* If non-NULL, the qualifying scope (a NAMESPACE_DECL or 3772169689Skan *_TYPE) for this identifier. */ 3773169689Skan tree qualifying_scope; 3774169689Skan /* The unqualified name of the entity -- an IDENTIFIER_NODE, 3775169689Skan BIT_NOT_EXPR, or TEMPLATE_ID_EXPR. */ 3776169689Skan tree unqualified_name; 3777169689Skan /* If this is the name of a function, what kind of special 3778169689Skan function (if any). */ 3779169689Skan special_function_kind sfk; 3780169689Skan } id; 3781169689Skan /* For functions. */ 3782169689Skan struct { 3783169689Skan /* The parameters to the function. */ 3784169689Skan cp_parameter_declarator *parameters; 3785169689Skan /* The cv-qualifiers for the function. */ 3786169689Skan cp_cv_quals qualifiers; 3787169689Skan /* The exception-specification for the function. */ 3788169689Skan tree exception_specification; 3789169689Skan } function; 3790169689Skan /* For arrays. */ 3791169689Skan struct { 3792169689Skan /* The bounds to the array. */ 3793169689Skan tree bounds; 3794169689Skan } array; 3795259660Spfg /* For cdk_pointer, cdk_reference, and cdk_ptrmem. */ 3796169689Skan struct { 3797169689Skan /* The cv-qualifiers for the pointer. */ 3798169689Skan cp_cv_quals qualifiers; 3799169689Skan /* For cdk_ptrmem, the class type containing the member. */ 3800169689Skan tree class_type; 3801169689Skan } pointer; 3802260311Spfg /* APPLE LOCAL begin blocks 6040305 (ch) */ 3803260311Spfg /* For cdk_block_pointer. */ 3804260311Spfg struct { 3805260311Spfg /* The cv-qualifiers for the pointer. */ 3806260311Spfg cp_cv_quals qualifiers; 3807260311Spfg } block_pointer; 3808260311Spfg /* APPLE LOCAL end blocks 6040305 (ch) */ 3809169689Skan } u; 3810169689Skan}; 3811169689Skan 3812169689Skan/* A parameter list indicating for a function with no parameters, 3813169689Skan e.g "int f(void)". */ 3814169689Skanextern cp_parameter_declarator *no_parameters; 3815169689Skan 381618334Speter/* in call.c */ 3817169689Skanextern bool check_dtor_name (tree, tree); 381818334Speter 3819132718Skanextern tree build_vfield_ref (tree, tree); 3820132718Skanextern tree build_conditional_expr (tree, tree, tree); 3821169689Skanextern tree build_addr_func (tree); 3822169689Skanextern tree build_call (tree, tree); 3823169689Skanextern bool null_ptr_cst_p (tree); 3824169689Skanextern bool sufficient_parms_p (tree); 3825169689Skanextern tree type_decays_to (tree); 3826169689Skanextern tree build_user_type_conversion (tree, tree, int); 3827169689Skanextern tree build_new_function_call (tree, tree, bool); 3828169689Skanextern tree build_operator_new_call (tree, tree, tree *, tree *, 3829169689Skan tree *); 3830169689Skanextern tree build_new_method_call (tree, tree, tree, tree, int, 3831169689Skan tree *); 3832169689Skanextern tree build_special_member_call (tree, tree, tree, tree, int); 3833169689Skanextern tree build_new_op (enum tree_code, int, tree, tree, tree, bool *); 3834169689Skanextern tree build_op_delete_call (enum tree_code, tree, tree, bool, tree, tree); 3835169689Skanextern bool can_convert (tree, tree); 3836169689Skanextern bool can_convert_arg (tree, tree, tree, int); 3837169689Skanextern bool can_convert_arg_bad (tree, tree, tree); 3838169689Skanextern bool enforce_access (tree, tree, tree); 3839169689Skanextern tree convert_default_arg (tree, tree, tree, int); 3840169689Skanextern tree convert_arg_to_ellipsis (tree); 3841169689Skanextern tree build_x_va_arg (tree, tree); 3842169689Skanextern tree cxx_type_promotes_to (tree); 3843169689Skanextern tree type_passed_as (tree); 3844169689Skanextern tree convert_for_arg_passing (tree, tree); 3845169689Skanextern bool is_properly_derived_from (tree, tree); 3846169689Skanextern tree initialize_reference (tree, tree, tree, tree *); 3847169689Skanextern tree make_temporary_var_for_ref_to_temp (tree, tree); 3848169689Skanextern tree strip_top_quals (tree); 3849169689Skanextern tree perform_implicit_conversion (tree, tree); 3850169689Skanextern tree perform_direct_initialization_if_possible (tree, tree, bool); 3851169689Skanextern tree in_charge_arg_for_name (tree); 3852169689Skanextern tree build_cxx_call (tree, tree); 3853169689Skan#ifdef ENABLE_CHECKING 3854169689Skanextern void validate_conversion_obstack (void); 3855169689Skan#endif /* ENABLE_CHECKING */ 385618334Speter 385718334Speter/* in class.c */ 3858169689Skanextern tree build_base_path (enum tree_code, tree, 3859169689Skan tree, int); 3860169689Skanextern tree convert_to_base (tree, tree, bool, bool); 3861169689Skanextern tree convert_to_base_statically (tree, tree); 3862132718Skanextern tree build_vtbl_ref (tree, tree); 3863132718Skanextern tree build_vfn_ref (tree, tree); 3864169689Skanextern tree get_vtable_decl (tree, int); 3865169689Skanextern void resort_type_method_vec (void *, void *, 3866169689Skan gt_pointer_operator, void *); 3867169689Skanextern bool add_method (tree, tree, tree); 3868169689Skanextern bool currently_open_class (tree); 3869132718Skanextern tree currently_open_derived_class (tree); 3870132718Skanextern tree finish_struct (tree, tree); 3871132718Skanextern void finish_struct_1 (tree); 3872132718Skanextern int resolves_to_fixed_type_p (tree, int *); 3873132718Skanextern void init_class_processing (void); 3874132718Skanextern int is_empty_class (tree); 3875132718Skanextern void pushclass (tree); 3876132718Skanextern void popclass (void); 3877132718Skanextern void push_nested_class (tree); 3878132718Skanextern void pop_nested_class (void); 3879132718Skanextern int current_lang_depth (void); 3880132718Skanextern void push_lang_context (tree); 3881132718Skanextern void pop_lang_context (void); 3882132718Skanextern tree instantiate_type (tree, tree, tsubst_flags_t); 3883169689Skanextern void print_class_statistics (void); 3884132718Skanextern void cxx_print_statistics (void); 3885169689Skanextern void cxx_print_xnode (FILE *, tree, int); 3886169689Skanextern void cxx_print_decl (FILE *, tree, int); 3887169689Skanextern void cxx_print_type (FILE *, tree, int); 3888169689Skanextern void cxx_print_identifier (FILE *, tree, int); 3889132718Skanextern void cxx_print_error_function (struct diagnostic_context *, 3890132718Skan const char *); 3891132718Skanextern void build_self_reference (void); 3892132718Skanextern int same_signature_p (tree, tree); 3893132718Skanextern void maybe_add_class_template_decl_list (tree, tree, int); 3894169689Skanextern void unreverse_member_declarations (tree); 3895169689Skanextern void invalidate_class_lookup_cache (void); 3896169689Skanextern void maybe_note_name_used_in_class (tree, tree); 3897169689Skanextern void note_name_declared_in_class (tree, tree); 3898169689Skanextern tree get_vtbl_decl_for_binfo (tree); 3899132718Skanextern void debug_class (tree); 3900169689Skanextern void debug_thunks (tree); 3901169689Skanextern tree cp_fold_obj_type_ref (tree, tree); 3902169689Skanextern void set_linkage_according_to_type (tree, tree); 3903169689Skanextern void determine_key_method (tree); 3904169689Skanextern void check_for_override (tree, tree); 3905169689Skanextern void push_class_stack (void); 3906169689Skanextern void pop_class_stack (void); 390718334Speter 390818334Speter/* in cvt.c */ 3909169689Skanextern tree convert_to_reference (tree, tree, int, int, tree); 3910169689Skanextern tree convert_from_reference (tree); 3911169689Skanextern tree force_rvalue (tree); 3912169689Skanextern tree ocp_convert (tree, tree, int, int); 3913169689Skanextern tree cp_convert (tree, tree); 3914169689Skanextern tree convert_to_void (tree, const char */*implicit context*/); 3915169689Skanextern tree convert_force (tree, tree, int); 3916169689Skanextern tree build_expr_type_conversion (int, tree, bool); 3917169689Skanextern tree type_promotes_to (tree); 3918169689Skanextern tree perform_qualification_conversions (tree, tree); 3919169689Skanextern void clone_function_decl (tree, int); 3920132718Skanextern void adjust_clone_args (tree); 392118334Speter 392218334Speter/* decl.c */ 3923169689Skanextern tree poplevel (int, int, int); 3924132718Skanextern void insert_block (tree); 3925132718Skanextern tree pushdecl (tree); 3926169689Skanextern tree pushdecl_maybe_friend (tree, bool); 3927132718Skanextern void cxx_init_decl_processing (void); 3928169689Skanenum cp_tree_node_structure_enum cp_tree_node_structure 3929169689Skan (union lang_tree_node *); 3930132718Skanextern bool cxx_mark_addressable (tree); 3931132718Skanextern void cxx_push_function_context (struct function *); 3932132718Skanextern void cxx_pop_function_context (struct function *); 3933169689Skanextern void maybe_push_cleanup_level (tree); 3934169689Skanextern void finish_scope (void); 3935132718Skanextern void push_switch (tree); 3936132718Skanextern void pop_switch (void); 3937169689Skanextern tree pushtag (tree, tree, tag_scope); 3938132718Skanextern tree make_anon_name (void); 3939132718Skanextern int decls_match (tree, tree); 3940169689Skanextern tree duplicate_decls (tree, tree, bool); 3941169689Skanextern tree pushdecl_top_level_maybe_friend (tree, bool); 3942169689Skanextern tree pushdecl_top_level_and_finish (tree, tree); 3943169689Skanextern tree declare_local_label (tree); 3944132718Skanextern tree define_label (location_t, tree); 3945132718Skanextern void check_goto (tree); 3946169689Skanextern bool check_omp_return (void); 3947169689Skanextern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t); 3948169689Skanextern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t); 3949169689Skanextern tree check_for_out_of_scope_variable (tree); 3950132718Skanextern tree build_library_fn (tree, tree); 3951132718Skanextern tree build_library_fn_ptr (const char *, tree); 3952132718Skanextern tree build_cp_library_fn_ptr (const char *, tree); 3953132718Skanextern tree push_library_fn (tree, tree); 3954132718Skanextern tree push_void_library_fn (tree, tree); 3955132718Skanextern tree push_throw_library_fn (tree, tree); 3956169689Skanextern tree check_tag_decl (cp_decl_specifier_seq *); 3957169689Skanextern tree shadow_tag (cp_decl_specifier_seq *); 3958169689Skanextern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *); 3959260311Spfg/* APPLE LOCAL 6339747 */ 3960260311Spfgextern tree grokblockdecl (cp_decl_specifier_seq *, const cp_declarator *); 3961169689Skanextern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *); 3962169689Skanextern void start_decl_1 (tree, bool); 3963169689Skanextern void cp_finish_decl (tree, tree, bool, tree, int); 3964132718Skanextern void finish_decl (tree, tree, tree); 3965169689Skanextern int cp_complete_array_type (tree *, tree, bool); 3966132718Skanextern tree build_ptrmemfunc_type (tree); 3967169689Skanextern tree build_ptrmem_type (tree, tree); 396818334Speter/* the grokdeclarator prototype is in decl.h */ 3969169689Skanextern tree build_this_parm (tree, cp_cv_quals); 3970132718Skanextern int copy_fn_p (tree); 3971169689Skanextern tree get_scope_of_declarator (const cp_declarator *); 3972132718Skanextern void grok_special_member_properties (tree); 3973132718Skanextern int grok_ctor_properties (tree, tree); 3974161651Skanextern bool grok_op_properties (tree, bool); 3975169689Skanextern tree xref_tag (enum tag_types, tree, tag_scope, bool); 3976169689Skanextern tree xref_tag_from_type (tree, tree, tag_scope); 3977169689Skanextern bool xref_basetypes (tree, tree); 3978132718Skanextern tree start_enum (tree); 3979132718Skanextern void finish_enum (tree); 3980132718Skanextern void build_enumerator (tree, tree, tree); 3981169689Skanextern void start_preparsed_function (tree, tree, int); 3982169689Skanextern int start_function (cp_decl_specifier_seq *, const cp_declarator *, tree); 3983132718Skanextern tree begin_function_body (void); 3984132718Skanextern void finish_function_body (tree); 3985132718Skanextern tree finish_function (int); 3986169689Skanextern tree start_method (cp_decl_specifier_seq *, const cp_declarator *, tree); 3987132718Skanextern tree finish_method (tree); 3988169689Skanextern void maybe_register_incomplete_var (tree); 3989132718Skanextern void complete_vars (tree); 3990132718Skanextern void finish_stmt (void); 3991132718Skanextern void print_other_binding_stack (struct cp_binding_level *); 3992169689Skanextern void revert_static_member_fn (tree); 3993169689Skanextern void fixup_anonymous_aggr (tree); 3994169689Skanextern int check_static_variable_definition (tree, tree); 3995132718Skanextern tree compute_array_index_type (tree, tree); 3996169689Skanextern tree check_default_argument (tree, tree); 3997169689Skantypedef int (*walk_namespaces_fn) (tree, void *); 3998169689Skanextern int walk_namespaces (walk_namespaces_fn, 3999169689Skan void *); 4000169689Skanextern int wrapup_globals_for_namespace (tree, void *); 4001169689Skanextern tree create_implicit_typedef (tree, tree); 4002169689Skanextern tree maybe_push_decl (tree); 4003132718Skanextern tree force_target_expr (tree, tree); 4004169689Skanextern tree build_target_expr_with_type (tree, tree); 4005169689Skanextern int local_variable_p (tree); 4006169689Skanextern int nonstatic_local_decl_p (tree); 4007169689Skanextern tree register_dtor_fn (tree); 4008169689Skanextern tmpl_spec_kind current_tmpl_spec_kind (int); 4009132718Skanextern tree cp_fname_init (const char *, tree *); 4010169689Skanextern tree builtin_function (const char *name, tree type, 4011169689Skan int code, 4012169689Skan enum built_in_class cl, 4013169689Skan const char *libname, 4014169689Skan tree attrs); 4015169689Skanextern tree check_elaborated_type_specifier (enum tag_types, tree, bool); 4016169689Skanextern void warn_extern_redeclared_static (tree, tree); 4017169689Skanextern const char *cxx_comdat_group (tree); 4018169689Skanextern bool cp_missing_noreturn_ok_p (tree); 4019169689Skanextern void initialize_artificial_var (tree, tree); 4020169689Skanextern tree check_var_type (tree, tree); 4021169689Skanextern tree reshape_init (tree, tree); 4022132718Skan 402318334Speter/* in decl2.c */ 4024169689Skanextern bool check_java_method (tree); 4025169689Skanextern tree build_memfn_type (tree, tree, cp_cv_quals); 4026169689Skanextern void maybe_retrofit_in_chrg (tree); 4027169689Skanextern void maybe_make_one_only (tree); 4028169689Skanextern void grokclassfn (tree, tree, 4029169689Skan enum overload_flags); 4030169689Skanextern tree grok_array_decl (tree, tree); 4031169689Skanextern tree delete_sanity (tree, tree, bool, int); 4032169689Skanextern tree check_classfn (tree, tree, tree); 4033169689Skanextern void check_member_template (tree); 4034169689Skanextern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *, 4035169689Skan tree, bool, tree, tree); 4036169689Skanextern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *, 4037169689Skan tree); 4038169689Skanextern void cplus_decl_attributes (tree *, tree, int); 4039169689Skanextern void finish_anon_union (tree); 4040169689Skanextern void cp_finish_file (void); 4041169689Skanextern tree coerce_new_type (tree); 4042169689Skanextern tree coerce_delete_type (tree); 4043169689Skanextern void comdat_linkage (tree); 4044169689Skanextern void determine_visibility (tree); 4045169689Skanextern void constrain_class_visibility (tree); 4046169689Skanextern void update_member_visibility (tree); 4047169689Skanextern void import_export_decl (tree); 4048132718Skanextern tree build_cleanup (tree); 4049169689Skanextern tree build_offset_ref_call_from_tree (tree, tree); 4050169689Skanextern void check_default_args (tree); 4051169689Skanextern void mark_used (tree); 4052169689Skanextern void finish_static_data_member_decl (tree, tree, bool, tree, int); 4053169689Skanextern tree cp_build_parm_decl (tree, tree); 4054169689Skanextern tree get_guard (tree); 4055169689Skanextern tree get_guard_cond (tree); 4056169689Skanextern tree set_guard (tree); 4057169689Skanextern tree cxx_callgraph_analyze_expr (tree *, int *, tree); 4058169689Skanextern void mark_needed (tree); 4059169689Skanextern bool decl_needed_p (tree); 4060169689Skanextern void note_vague_linkage_fn (tree); 4061169689Skanextern tree build_artificial_parm (tree, tree); 406218334Speter 406350397Sobrien/* in error.c */ 4064132718Skanextern void init_error (void); 4065132718Skanextern const char *type_as_string (tree, int); 4066132718Skanextern const char *decl_as_string (tree, int); 4067132718Skanextern const char *expr_as_string (tree, int); 4068132718Skanextern const char *lang_decl_name (tree, int); 4069169689Skanextern const char *language_to_string (enum languages); 4070169689Skanextern const char *class_key_or_enum_as_string (tree); 4071169689Skanextern void print_instantiation_context (void); 407250397Sobrien 407318334Speter/* in except.c */ 4074132718Skanextern void init_exception_processing (void); 4075132718Skanextern tree expand_start_catch_block (tree); 4076132718Skanextern void expand_end_catch_block (void); 4077132718Skanextern tree build_exc_ptr (void); 4078132718Skanextern tree build_throw (tree); 4079132718Skanextern int nothrow_libfn_p (tree); 4080132718Skanextern void check_handlers (tree); 4081132718Skanextern void choose_personality_routine (enum languages); 4082132718Skanextern tree eh_type_info (tree); 408318334Speter 408418334Speter/* in expr.c */ 4085132718Skanextern rtx cxx_expand_expr (tree, rtx, 4086132718Skan enum machine_mode, 4087132718Skan int, rtx *); 4088169689Skanextern tree cplus_expand_constant (tree); 408918334Speter 409050397Sobrien/* friend.c */ 4091132718Skanextern int is_friend (tree, tree); 4092132718Skanextern void make_friend_class (tree, tree, bool); 4093169689Skanextern void add_friend (tree, tree, bool); 4094169689Skanextern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool); 409518334Speter 409618334Speter/* in init.c */ 4097117395Skanextern tree expand_member_init (tree); 4098117395Skanextern void emit_mem_initializers (tree); 4099132718Skanextern tree build_aggr_init (tree, tree, int); 4100132718Skanextern int is_aggr_type (tree, int); 4101132718Skanextern tree get_type_value (tree); 4102169689Skanextern tree build_zero_init (tree, tree, bool); 4103132718Skanextern tree build_offset_ref (tree, tree, bool); 4104169689Skanextern tree build_new (tree, tree, tree, tree, int); 4105169689Skanextern tree build_vec_init (tree, tree, tree, bool, int); 4106169689Skanextern tree build_delete (tree, tree, 4107169689Skan special_function_kind, 4108169689Skan int, int); 4109132718Skanextern void push_base_cleanups (void); 4110169689Skanextern tree build_vec_delete (tree, tree, 4111169689Skan special_function_kind, int); 4112169689Skanextern tree create_temporary_var (tree); 4113169689Skanextern void initialize_vtbl_ptrs (tree); 4114169689Skanextern tree build_java_class_ref (tree); 4115169689Skanextern tree integral_constant_value (tree); 411618334Speter 411718334Speter/* in lex.c */ 4118132718Skanextern void cxx_dup_lang_specific_decl (tree); 4119132718Skanextern void yyungetc (int, int); 412090075Sobrien 4121169689Skanextern tree unqualified_name_lookup_error (tree); 4122169689Skanextern tree unqualified_fn_lookup_error (tree); 4123132718Skanextern tree build_lang_decl (enum tree_code, tree, tree); 4124132718Skanextern void retrofit_lang_decl (tree); 4125169689Skanextern tree copy_decl (tree); 4126169689Skanextern tree copy_type (tree); 4127132718Skanextern tree cxx_make_type (enum tree_code); 4128132718Skanextern tree make_aggr_type (enum tree_code); 4129132718Skanextern void yyerror (const char *); 4130132718Skanextern void yyhook (int); 4131132718Skanextern bool cxx_init (void); 4132169689Skanextern void cxx_finish (void); 4133220150Smmextern bool in_main_input_context (void); 413490075Sobrien 413518334Speter/* in method.c */ 4136169689Skanextern void init_method (void); 4137169689Skanextern tree make_thunk (tree, bool, tree, tree); 4138169689Skanextern void finish_thunk (tree); 4139169689Skanextern void use_thunk (tree, bool); 4140169689Skanextern void synthesize_method (tree); 4141169689Skanextern tree lazily_declare_fn (special_function_kind, 4142169689Skan tree); 4143169689Skanextern tree skip_artificial_parms_for (tree, tree); 4144169689Skanextern tree make_alias_for (tree, tree); 414518334Speter 414690075Sobrien/* In optimize.c */ 4147169689Skanextern bool maybe_clone_body (tree); 414860967Sobrien 414918334Speter/* in pt.c */ 4150132718Skanextern void check_template_shadow (tree); 4151169689Skanextern tree get_innermost_template_args (tree, int); 4152132718Skanextern void maybe_begin_member_template_processing (tree); 4153132718Skanextern void maybe_end_member_template_processing (void); 4154169689Skanextern tree finish_member_template_decl (tree); 4155132718Skanextern void begin_template_parm_list (void); 4156169689Skanextern bool begin_specialization (void); 4157169689Skanextern void reset_specialization (void); 4158169689Skanextern void end_specialization (void); 4159169689Skanextern void begin_explicit_instantiation (void); 4160169689Skanextern void end_explicit_instantiation (void); 4161169689Skanextern tree check_explicit_specialization (tree, tree, int, int); 4162169689Skanextern tree process_template_parm (tree, tree, bool); 4163132718Skanextern tree end_template_parm_list (tree); 4164132718Skanextern void end_template_decl (void); 4165132718Skanextern tree push_template_decl (tree); 4166169689Skanextern tree push_template_decl_real (tree, bool); 4167169689Skanextern bool redeclare_class_template (tree, tree); 4168169689Skanextern tree lookup_template_class (tree, tree, tree, tree, 4169169689Skan int, tsubst_flags_t); 4170169689Skanextern tree lookup_template_function (tree, tree); 4171132718Skanextern int uses_template_parms (tree); 4172132718Skanextern int uses_template_parms_level (tree, int); 4173132718Skanextern tree instantiate_class_template (tree); 4174132718Skanextern tree instantiate_template (tree, tree, tsubst_flags_t); 4175169689Skanextern int fn_type_unification (tree, tree, tree, tree, 4176169689Skan tree, unification_kind_t, int); 4177132718Skanextern void mark_decl_instantiated (tree, int); 4178169689Skanextern int more_specialized_fn (tree, tree, int); 4179117395Skanextern void do_decl_instantiation (tree, tree); 4180132718Skanextern void do_type_instantiation (tree, tree, tsubst_flags_t); 4181169689Skanextern tree instantiate_decl (tree, int, bool); 4182169689Skanextern int comp_template_parms (tree, tree); 4183169689Skanextern int template_class_depth (tree); 4184169689Skanextern int is_specialization_of (tree, tree); 4185169689Skanextern bool is_specialization_of_friend (tree, tree); 4186169689Skanextern int comp_template_args (tree, tree); 4187169689Skanextern tree maybe_process_partial_specialization (tree); 4188169689Skanextern tree most_specialized_instantiation (tree); 4189169689Skanextern void print_candidates (tree); 4190169689Skanextern void instantiate_pending_templates (int); 4191169689Skanextern tree tsubst_default_argument (tree, tree, tree); 4192169689Skanextern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t, 4193169689Skan tree, bool, bool); 4194132718Skanextern tree most_general_template (tree); 4195132718Skanextern tree get_mostly_instantiated_function_type (tree); 4196169689Skanextern int problematic_instantiation_changed (void); 4197132718Skanextern void record_last_problematic_instantiation (void); 4198169689Skanextern tree current_instantiation (void); 4199132718Skanextern tree maybe_get_template_decl_from_type_decl (tree); 420050397Sobrienextern int processing_template_parmlist; 4201169689Skanextern bool dependent_type_p (tree); 4202132718Skanextern bool any_dependent_template_arguments_p (tree); 4203169689Skanextern bool dependent_template_p (tree); 4204169689Skanextern bool dependent_template_id_p (tree, tree); 4205169689Skanextern bool type_dependent_expression_p (tree); 4206132718Skanextern bool any_type_dependent_arguments_p (tree); 4207169689Skanextern bool value_dependent_expression_p (tree); 4208171825Skanextern bool any_value_dependent_elements_p (tree); 4209169689Skanextern tree resolve_typename_type (tree, bool); 4210169689Skanextern tree template_for_substitution (tree); 4211169689Skanextern tree build_non_dependent_expr (tree); 4212169689Skanextern tree build_non_dependent_args (tree); 4213169689Skanextern bool reregister_specialization (tree, tree, tree); 4214169689Skanextern tree fold_non_dependent_expr (tree); 4215169689Skanextern bool explicit_class_specialization_p (tree); 4216220150Smmextern tree outermost_tinst_level (void); 421750397Sobrien 421850397Sobrien/* in repo.c */ 4219169689Skanextern void init_repo (void); 4220169689Skanextern int repo_emit_p (tree); 4221169689Skanextern bool repo_export_class_p (tree); 4222169689Skanextern void finish_repo (void); 422350397Sobrien 422450397Sobrien/* in rtti.c */ 4225169689Skan/* A vector of all tinfo decls that haven't been emitted yet. */ 4226169689Skanextern GTY(()) VEC(tree,gc) *unemitted_tinfo_decls; 422750397Sobrien 4228169689Skanextern void init_rtti_processing (void); 4229169689Skanextern tree build_typeid (tree); 4230169689Skanextern tree get_tinfo_decl (tree); 4231169689Skanextern tree get_typeid (tree); 4232169689Skanextern tree build_dynamic_cast (tree, tree); 4233169689Skanextern void emit_support_tinfos (void); 4234169689Skanextern bool emit_tinfo_decl (tree); 4235132718Skan 423618334Speter/* in search.c */ 4237169689Skanextern bool accessible_base_p (tree, tree, bool); 4238169689Skanextern tree lookup_base (tree, tree, base_access, 4239169689Skan base_kind *); 4240169689Skanextern tree dcast_base_hint (tree, tree); 4241169689Skanextern int accessible_p (tree, tree, bool); 4242169689Skanextern tree lookup_field_1 (tree, tree, bool); 4243132718Skanextern tree lookup_field (tree, tree, int, bool); 4244169689Skanextern int lookup_fnfields_1 (tree, tree); 4245169689Skanextern int class_method_index_for_fn (tree, tree); 4246132718Skanextern tree lookup_fnfields (tree, tree, int); 4247132718Skanextern tree lookup_member (tree, tree, int, bool); 4248132718Skanextern int look_for_overrides (tree, tree); 4249169689Skanextern void get_pure_virtuals (tree); 4250132718Skanextern void maybe_suppress_debug_info (tree); 4251132718Skanextern void note_debug_info_needed (tree); 4252132718Skanextern void print_search_statistics (void); 4253132718Skanextern void reinit_search_statistics (void); 4254132718Skanextern tree current_scope (void); 4255169689Skanextern int at_function_scope_p (void); 4256169689Skanextern bool at_class_scope_p (void); 4257169689Skanextern bool at_namespace_scope_p (void); 4258132718Skanextern tree context_for_name_lookup (tree); 4259132718Skanextern tree lookup_conversions (tree); 4260132718Skanextern tree binfo_from_vbase (tree); 4261169689Skanextern tree binfo_for_vbase (tree, tree); 4262132718Skanextern tree look_for_overrides_here (tree, tree); 4263169689Skan#define dfs_skip_bases ((tree)1) 4264169689Skanextern tree dfs_walk_all (tree, tree (*) (tree, void *), 4265169689Skan tree (*) (tree, void *), void *); 4266169689Skanextern tree dfs_walk_once (tree, tree (*) (tree, void *), 4267169689Skan tree (*) (tree, void *), void *); 4268169689Skanextern tree binfo_via_virtual (tree, tree); 4269169689Skanextern tree build_baselink (tree, tree, tree, tree); 4270117395Skanextern tree adjust_result_of_qualified_name_lookup 4271169689Skan (tree, tree, tree); 4272132718Skanextern tree copied_binfo (tree, tree); 4273132718Skanextern tree original_binfo (tree, tree); 4274169689Skanextern int shared_member_p (tree); 4275132718Skan 4276169689Skan 4277169689Skan/* The representation of a deferred access check. */ 4278169689Skan 4279169689Skantypedef struct deferred_access_check GTY(()) 4280169689Skan{ 4281169689Skan /* The base class in which the declaration is referenced. */ 4282169689Skan tree binfo; 4283169689Skan /* The declaration whose access must be checked. */ 4284169689Skan tree decl; 4285169689Skan /* The declaration that should be used in the error message. */ 4286169689Skan tree diag_decl; 4287169689Skan} deferred_access_check; 4288169689SkanDEF_VEC_O(deferred_access_check); 4289169689SkanDEF_VEC_ALLOC_O(deferred_access_check,gc); 4290169689Skan 429150397Sobrien/* in semantics.c */ 4292132718Skanextern void push_deferring_access_checks (deferring_kind); 4293132718Skanextern void resume_deferring_access_checks (void); 4294132718Skanextern void stop_deferring_access_checks (void); 4295132718Skanextern void pop_deferring_access_checks (void); 4296169689Skanextern VEC (deferred_access_check,gc)* get_deferred_access_checks (void); 4297169689Skanextern void pop_to_parent_deferring_access_checks (void); 4298169689Skanextern void perform_access_checks (VEC (deferred_access_check,gc)*); 4299132718Skanextern void perform_deferred_access_checks (void); 4300169689Skanextern void perform_or_defer_access_check (tree, tree, tree); 4301169689Skanextern int stmts_are_full_exprs_p (void); 4302169689Skanextern void init_cp_semantics (void); 4303169689Skanextern tree do_poplevel (tree); 4304169689Skanextern void add_decl_expr (tree); 4305169689Skanextern tree finish_expr_stmt (tree); 4306169689Skanextern tree begin_if_stmt (void); 4307169689Skanextern void finish_if_stmt_cond (tree, tree); 4308169689Skanextern tree finish_then_clause (tree); 4309169689Skanextern void begin_else_clause (tree); 4310169689Skanextern void finish_else_clause (tree); 4311169689Skanextern void finish_if_stmt (tree); 4312260014Spfg/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 4313260014Spfgextern tree begin_while_stmt (tree); 4314260014Spfg/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ 4315169689Skanextern void finish_while_stmt_cond (tree, tree); 4316169689Skanextern void finish_while_stmt (tree); 4317260014Spfg/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 4318260014Spfgextern tree begin_do_stmt (tree); 4319260014Spfg/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ 4320169689Skanextern void finish_do_body (tree); 4321169689Skanextern void finish_do_stmt (tree, tree); 4322169689Skanextern tree finish_return_stmt (tree); 4323260014Spfg/* APPLE LOCAL begin for-fsf-4_4 3274130 5295549 */ \ 4324260014Spfgextern tree begin_for_stmt (tree); 4325260014Spfg/* APPLE LOCAL end for-fsf-4_4 3274130 5295549 */ \ 4326169689Skanextern void finish_for_init_stmt (tree); 4327169689Skanextern void finish_for_cond (tree, tree); 4328169689Skanextern void finish_for_expr (tree, tree); 4329169689Skanextern void finish_for_stmt (tree); 4330169689Skanextern tree finish_break_stmt (void); 4331169689Skanextern tree finish_continue_stmt (void); 4332169689Skanextern tree begin_switch_stmt (void); 4333169689Skanextern void finish_switch_cond (tree, tree); 4334169689Skanextern void finish_switch_stmt (tree); 4335169689Skanextern tree finish_case_label (tree, tree); 4336169689Skanextern tree finish_goto_stmt (tree); 4337169689Skanextern tree begin_try_block (void); 4338169689Skanextern void finish_try_block (tree); 4339132718Skanextern tree begin_eh_spec_block (void); 4340132718Skanextern void finish_eh_spec_block (tree, tree); 4341169689Skanextern void finish_handler_sequence (tree); 4342169689Skanextern tree begin_function_try_block (tree *); 4343169689Skanextern void finish_function_try_block (tree); 4344169689Skanextern void finish_function_handler_sequence (tree, tree); 4345169689Skanextern void finish_cleanup_try_block (tree); 4346169689Skanextern tree begin_handler (void); 4347169689Skanextern void finish_handler_parms (tree, tree); 4348169689Skanextern void finish_handler (tree); 4349169689Skanextern void finish_cleanup (tree, tree); 4350169689Skan 4351169689Skanenum { 4352169689Skan BCS_NO_SCOPE = 1, 4353169689Skan BCS_TRY_BLOCK = 2, 4354169689Skan BCS_FN_BODY = 4 4355169689Skan}; 4356169689Skanextern tree begin_compound_stmt (unsigned int); 4357169689Skan 4358169689Skanextern void finish_compound_stmt (tree); 4359169689Skanextern tree finish_asm_stmt (int, tree, tree, tree, tree); 4360169689Skanextern tree finish_label_stmt (tree); 4361169689Skanextern void finish_label_decl (tree); 4362169689Skanextern tree finish_parenthesized_expr (tree); 4363132718Skanextern tree finish_non_static_data_member (tree, tree, tree); 4364169689Skanextern tree begin_stmt_expr (void); 4365169689Skanextern tree finish_stmt_expr_expr (tree, tree); 4366169689Skanextern tree finish_stmt_expr (tree, bool); 4367169689Skanextern tree perform_koenig_lookup (tree, tree); 4368169689Skanextern tree finish_call_expr (tree, tree, bool, bool); 4369169689Skanextern tree finish_increment_expr (tree, enum tree_code); 4370169689Skanextern tree finish_this_expr (void); 4371132718Skanextern tree finish_pseudo_destructor_expr (tree, tree, tree); 4372169689Skanextern tree finish_unary_op_expr (enum tree_code, tree); 4373169689Skanextern tree finish_compound_literal (tree, VEC(constructor_elt,gc) *); 4374169689Skanextern tree finish_fname (tree); 4375169689Skanextern void finish_translation_unit (void); 4376169689Skanextern tree finish_template_type_parm (tree, tree); 4377132718Skanextern tree finish_template_template_parm (tree, tree); 4378169689Skanextern tree begin_class_definition (tree, tree); 4379169689Skanextern void finish_template_decl (tree); 4380169689Skanextern tree finish_template_type (tree, tree, int); 4381169689Skanextern tree finish_base_specifier (tree, tree, bool); 4382169689Skanextern void finish_member_declaration (tree); 4383169689Skanextern void qualified_name_lookup_error (tree, tree, tree); 4384169689Skanextern void check_template_keyword (tree); 4385169689Skanextern tree finish_id_expression (tree, tree, tree, 4386169689Skan cp_id_kind *, 4387169689Skan bool, bool, bool *, 4388169689Skan bool, bool, bool, bool, 4389132718Skan const char **); 4390132718Skanextern tree finish_typeof (tree); 4391169689Skanextern tree finish_offsetof (tree); 4392169689Skanextern void finish_decl_cleanup (tree, tree); 4393169689Skanextern void finish_eh_cleanup (tree); 4394169689Skanextern void expand_body (tree); 4395169689Skanextern void finish_mem_initializers (tree); 4396117395Skanextern tree check_template_template_default_arg (tree); 4397132718Skanextern void expand_or_defer_fn (tree); 4398132718Skanextern void check_accessibility_of_qualified_id (tree, tree, tree); 4399169689Skanextern tree finish_qualified_id_expr (tree, tree, bool, bool, 4400169689Skan bool, bool); 4401132718Skanextern void simplify_aggr_init_expr (tree *); 4402169689Skanextern void finalize_nrv (tree *, tree, tree); 4403169689Skanextern void note_decl_for_pch (tree); 4404169689Skanextern tree finish_omp_clauses (tree); 4405169689Skanextern void finish_omp_threadprivate (tree); 4406169689Skanextern tree begin_omp_structured_block (void); 4407169689Skanextern tree finish_omp_structured_block (tree); 4408169689Skanextern tree begin_omp_parallel (void); 4409169689Skanextern tree finish_omp_parallel (tree, tree); 4410169689Skanextern tree finish_omp_for (location_t, tree, tree, 4411169689Skan tree, tree, tree, tree); 4412169689Skanextern void finish_omp_atomic (enum tree_code, tree, tree); 4413169689Skanextern void finish_omp_barrier (void); 4414169689Skanextern void finish_omp_flush (void); 4415169689Skanextern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree); 4416169689Skanextern tree cxx_omp_clause_default_ctor (tree, tree); 4417169689Skanextern tree cxx_omp_clause_copy_ctor (tree, tree, tree); 4418169689Skanextern tree cxx_omp_clause_assign_op (tree, tree, tree); 4419169689Skanextern tree cxx_omp_clause_dtor (tree, tree); 4420169689Skanextern bool cxx_omp_privatize_by_reference (tree); 4421169689Skanextern tree baselink_for_fns (tree); 442250397Sobrien 442318334Speter/* in tree.c */ 4424132718Skanextern void lang_check_failed (const char *, int, 4425169689Skan const char *) ATTRIBUTE_NORETURN; 4426132718Skanextern tree stabilize_expr (tree, tree *); 4427132718Skanextern void stabilize_call (tree, tree *); 4428132718Skanextern bool stabilize_init (tree, tree *); 4429169689Skanextern tree add_stmt_to_compound (tree, tree); 4430132718Skanextern tree cxx_maybe_build_cleanup (tree); 4431169689Skanextern void init_tree (void); 4432132718Skanextern int pod_type_p (tree); 4433258206Spfgextern bool class_tmpl_impl_spec_p (tree); 4434132718Skanextern int zero_init_p (tree); 4435169689Skanextern tree canonical_type_variant (tree); 4436169689Skanextern tree copy_binfo (tree, tree, tree, 4437169689Skan tree *, int); 4438132718Skanextern int member_p (tree); 4439169689Skanextern cp_lvalue_kind real_lvalue_p (tree); 4440169689Skanextern bool builtin_valid_in_constant_expr_p (tree); 4441132718Skanextern tree build_min (enum tree_code, tree, ...); 4442132718Skanextern tree build_min_nt (enum tree_code, ...); 4443132718Skanextern tree build_min_non_dep (enum tree_code, tree, ...); 4444132718Skanextern tree build_cplus_new (tree, tree); 4445132718Skanextern tree get_target_expr (tree); 4446132718Skanextern tree build_cplus_array_type (tree, tree); 4447132718Skanextern tree hash_tree_cons (tree, tree, tree); 4448132718Skanextern tree hash_tree_chain (tree, tree); 4449169689Skanextern tree build_qualified_name (tree, tree, tree, bool); 4450132718Skanextern int is_overloaded_fn (tree); 4451132718Skanextern tree get_first_fn (tree); 4452169689Skanextern tree ovl_cons (tree, tree); 4453169689Skanextern tree build_overload (tree, tree); 4454132718Skanextern const char *cxx_printable_name (tree, int); 4455132718Skanextern tree build_exception_variant (tree, tree); 4456132718Skanextern tree bind_template_template_parm (tree, tree); 4457132718Skanextern tree array_type_nelts_total (tree); 4458132718Skanextern tree array_type_nelts_top (tree); 4459132718Skanextern tree break_out_target_exprs (tree); 4460132718Skanextern tree get_type_decl (tree); 4461132718Skanextern tree decl_namespace_context (tree); 4462169689Skanextern bool decl_anon_ns_mem_p (tree); 4463132718Skanextern tree lvalue_type (tree); 4464132718Skanextern tree error_type (tree); 4465132718Skanextern int varargs_function_p (tree); 4466169689Skanextern bool really_overloaded_fn (tree); 4467132718Skanextern bool cp_tree_equal (tree, tree); 4468169689Skanextern tree no_linkage_check (tree, bool); 4469132718Skanextern void debug_binfo (tree); 4470132718Skanextern tree build_dummy_object (tree); 4471132718Skanextern tree maybe_dummy_object (tree, tree *); 4472132718Skanextern int is_dummy_object (tree); 4473117395Skanextern const struct attribute_spec cxx_attribute_table[]; 4474169689Skanextern tree make_ptrmem_cst (tree, tree); 4475132718Skanextern tree cp_build_type_attribute_variant (tree, tree); 4476169689Skanextern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t); 447790075Sobrien#define cp_build_qualified_type(TYPE, QUALS) \ 4478169689Skan cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error) 4479132718Skanextern special_function_kind special_function_p (tree); 4480169689Skanextern int count_trees (tree); 4481169689Skanextern int char_type_p (tree); 4482169689Skanextern void verify_stmt_tree (tree); 4483169689Skanextern linkage_kind decl_linkage (tree); 4484132718Skanextern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, 4485169689Skan void*, struct pointer_set_t*); 4486169689Skanextern int cp_cannot_inline_tree_fn (tree*); 4487169689Skanextern tree cp_add_pending_fn_decls (void*,tree); 4488169689Skanextern int cp_auto_var_in_fn_p (tree,tree); 4489169689Skanextern tree fold_if_not_in_template (tree); 4490169689Skanextern tree rvalue (tree); 4491169689Skanextern tree convert_bitfield_to_declared_type (tree); 4492169689Skanextern tree cp_save_expr (tree); 4493169689Skanextern bool cast_valid_in_integral_constant_expression_p (tree); 449452284Sobrien 449518334Speter/* in typeck.c */ 4496132718Skanextern int string_conv_p (tree, tree, int); 4497132718Skanextern tree cp_truthvalue_conversion (tree); 4498132718Skanextern tree condition_conversion (tree); 4499132718Skanextern tree require_complete_type (tree); 4500132718Skanextern tree complete_type (tree); 4501169689Skanextern tree complete_type_or_else (tree, tree); 4502132718Skanextern int type_unknown_p (tree); 4503132718Skanextern bool comp_except_specs (tree, tree, bool); 4504132718Skanextern bool comptypes (tree, tree, int); 4505132718Skanextern bool compparms (tree, tree); 4506169689Skanextern int comp_cv_qualification (tree, tree); 4507169689Skanextern int comp_cv_qual_signature (tree, tree); 4508169689Skanextern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code); 4509169689Skanextern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool); 4510117395Skan#define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false) 4511132718Skanextern tree inline_conversion (tree); 4512169689Skanextern tree is_bitfield_expr_with_lowered_type (tree); 4513169689Skanextern tree unlowered_expr_type (tree); 4514132718Skanextern tree decay_conversion (tree); 4515117395Skanextern tree build_class_member_access_expr (tree, tree, tree, bool); 4516169689Skanextern tree finish_class_member_access_expr (tree, tree, bool); 4517132718Skanextern tree build_x_indirect_ref (tree, const char *); 4518132718Skanextern tree build_indirect_ref (tree, const char *); 4519132718Skanextern tree build_array_ref (tree, tree); 4520132718Skanextern tree get_member_function_from_ptrfunc (tree *, tree); 4521258081Spfgextern tree build_x_binary_op (enum tree_code, tree, 4522258081Spfg enum tree_code, tree, 4523258081Spfg enum tree_code, bool *); 4524132718Skanextern tree build_x_unary_op (enum tree_code, tree); 4525132718Skanextern tree unary_complex_lvalue (enum tree_code, tree); 4526132718Skanextern tree build_x_conditional_expr (tree, tree, tree); 4527169689Skanextern tree build_x_compound_expr_from_list (tree, const char *); 4528132718Skanextern tree build_x_compound_expr (tree, tree); 4529132718Skanextern tree build_compound_expr (tree, tree); 4530132718Skanextern tree build_static_cast (tree, tree); 4531132718Skanextern tree build_reinterpret_cast (tree, tree); 4532132718Skanextern tree build_const_cast (tree, tree); 4533132718Skanextern tree build_c_cast (tree, tree); 4534132718Skanextern tree build_x_modify_expr (tree, enum tree_code, tree); 4535132718Skanextern tree build_modify_expr (tree, enum tree_code, tree); 4536169689Skanextern tree convert_for_initialization (tree, tree, tree, int, 4537169689Skan const char *, tree, int); 4538132718Skanextern int comp_ptr_ttypes (tree, tree); 4539169689Skanextern bool comp_ptr_ttypes_const (tree, tree); 4540132718Skanextern int ptr_reasonably_similar (tree, tree); 4541169689Skanextern tree build_ptrmemfunc (tree, tree, int, bool); 4542169689Skanextern int cp_type_quals (tree); 4543169689Skanextern bool cp_type_readonly (tree); 4544169689Skanextern bool cp_has_mutable_p (tree); 4545169689Skanextern bool at_least_as_qualified_p (tree, tree); 4546169689Skanextern void cp_apply_type_quals_to_decl (int, tree); 4547169689Skanextern tree build_ptrmemfunc1 (tree, tree, tree); 4548169689Skanextern void expand_ptrmemfunc_cst (tree, tree *, tree *); 4549132718Skanextern tree type_after_usual_arithmetic_conversions (tree, tree); 4550169689Skanextern tree composite_pointer_type (tree, tree, tree, tree, 4551169689Skan const char*); 4552132718Skanextern tree merge_types (tree, tree); 4553169689Skanextern tree check_return_expr (tree, bool *); 455490075Sobrien#define cp_build_binary_op(code, arg1, arg2) \ 455590075Sobrien build_binary_op(code, arg1, arg2, 1) 4556117395Skan#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true) 4557169689Skanextern tree build_ptrmemfunc_access_expr (tree, tree); 4558169689Skanextern tree build_address (tree); 4559169689Skanextern tree build_nop (tree, tree); 4560169689Skanextern tree non_reference (tree); 4561169689Skanextern tree lookup_anon_field (tree, tree); 4562169689Skanextern bool invalid_nonstatic_memfn_p (tree); 4563169689Skanextern tree convert_member_func_to_ptr (tree, tree); 4564169689Skanextern tree convert_ptrmem (tree, tree, bool, bool); 4565169689Skanextern int lvalue_or_else (tree, enum lvalue_use); 4566169689Skanextern int lvalue_p (tree); 456718334Speter 456818334Speter/* in typeck2.c */ 4569132718Skanextern void require_complete_eh_spec_types (tree, tree); 4570132718Skanextern void cxx_incomplete_type_diagnostic (tree, tree, int); 4571117395Skan#undef cxx_incomplete_type_error 4572132718Skanextern void cxx_incomplete_type_error (tree, tree); 4573117395Skan#define cxx_incomplete_type_error(V,T) \ 4574117395Skan (cxx_incomplete_type_diagnostic ((V), (T), 0)) 4575132718Skanextern tree error_not_base_type (tree, tree); 4576132718Skanextern tree binfo_or_else (tree, tree); 4577132718Skanextern void readonly_error (tree, const char *, int); 4578169689Skanextern void complete_type_check_abstract (tree); 4579132718Skanextern int abstract_virtuals_error (tree, tree); 458018334Speter 4581132718Skanextern tree store_init_value (tree, tree); 4582169689Skanextern tree digest_init (tree, tree); 4583132718Skanextern tree build_scoped_ref (tree, tree, tree *); 4584132718Skanextern tree build_x_arrow (tree); 4585132718Skanextern tree build_m_component_ref (tree, tree); 4586132718Skanextern tree build_functional_cast (tree, tree); 4587169689Skanextern tree add_exception_specifier (tree, tree, int); 4588169689Skanextern tree merge_exception_specifiers (tree, tree); 458990075Sobrien 459090075Sobrien/* in mangle.c */ 4591169689Skanextern void init_mangle (void); 4592169689Skanextern void mangle_decl (tree); 4593169689Skanextern const char *mangle_type_string (tree); 4594169689Skanextern tree mangle_typeinfo_for_type (tree); 4595169689Skanextern tree mangle_typeinfo_string_for_type (tree); 4596169689Skanextern tree mangle_vtbl_for_type (tree); 4597169689Skanextern tree mangle_vtt_for_type (tree); 4598169689Skanextern tree mangle_ctor_vtbl_for_type (tree, tree); 4599169689Skanextern tree mangle_thunk (tree, int, tree, tree); 4600169689Skanextern tree mangle_conv_op_name_for_type (tree); 4601169689Skanextern tree mangle_guard_variable (tree); 4602169689Skanextern tree mangle_ref_init_variable (tree); 460390075Sobrien 460490075Sobrien/* in dump.c */ 4605169689Skanextern bool cp_dump_tree (void *, tree); 460690075Sobrien 4607169689Skan/* In cp/cp-objcp-common.c. */ 4608169689Skan 4609169689Skanextern HOST_WIDE_INT cxx_get_alias_set (tree); 4610169689Skanextern bool cxx_warn_unused_global_decl (tree); 4611169689Skanextern tree cp_expr_size (tree); 4612169689Skanextern size_t cp_tree_size (enum tree_code); 4613169689Skanextern bool cp_var_mod_type_p (tree, tree); 4614169689Skanextern void cxx_initialize_diagnostics (struct diagnostic_context *); 4615169689Skanextern int cxx_types_compatible_p (tree, tree); 4616169689Skanextern void init_shadowed_var_for_decl (void); 4617169689Skanextern tree cxx_staticp (tree); 4618169689Skan 4619169689Skan/* in cp-gimplify.c */ 4620169689Skanextern int cp_gimplify_expr (tree *, tree *, tree *); 4621169689Skanextern void cp_genericize (tree); 4622169689Skan 462318334Speter/* -- end of C++ */ 462418334Speter 4625132718Skan/* In order for the format checking to accept the C++ frontend 4626132718Skan diagnostic framework extensions, you must include this file before 4627169689Skan toplev.h, not after. We override the definition of GCC_DIAG_STYLE 4628169689Skan in c-common.h. */ 4629169689Skan#undef GCC_DIAG_STYLE 4630132718Skan#define GCC_DIAG_STYLE __gcc_cxxdiag__ 4631169689Skan#if GCC_VERSION >= 4001 4632132718Skan#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m) 4633132718Skan#else 4634132718Skan#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m) 4635132718Skan#endif 4636169689Skanextern void cp_cpp_error (cpp_reader *, int, 4637169689Skan const char *, va_list *) 4638169689Skan ATTRIBUTE_GCC_CXXDIAG(3,0); 4639260311Spfg/* APPLE LOCAL radar 5741070 */ 4640260311Spfgextern tree c_return_interface_record_type (tree); 4641132718Skan 4642260311Spfg/* APPLE LOCAL begin blocks 6040305 (cg) */ 4643260311Spfgextern cp_declarator* make_block_pointer_declarator (tree, cp_cv_quals, 4644260311Spfg cp_declarator *); 4645260311Spfg/* APPLE LOCAL end blocks 6040305 (cg) */ 464690075Sobrien#endif /* ! GCC_CP_TREE_H */ 4647