1 /* Definitions for C++ parsing and type checking.
2 Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GNU CC.
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
25 #include "splay-tree.h"
33 /* Usage of TREE_LANG_FLAG_?:
34 0: BINFO_MARKED (BINFO nodes).
35 IDENTIFIER_MARKED (IDENTIFIER_NODEs)
36 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
37 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
38 LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
39 TREE_INDIRECT_USING (in NAMESPACE_DECL).
40 LOCAL_BINDING_P (in CPLUS_BINDING)
41 ICS_USER_FLAG (in _CONV)
42 CLEANUP_P (in TRY_BLOCK)
43 AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
44 CTOR_BEGIN_P (in CTOR_STMT)
45 BV_USE_VCALL_INDEX_P (in the BINFO_VIRTUALS TREE_LIST)
46 PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
47 1: IDENTIFIER_VIRTUAL_P.
48 TI_PENDING_TEMPLATE_FLAG.
49 TEMPLATE_PARMS_FOR_INLINE.
50 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
51 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
52 TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
53 INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
54 BASELINK_P (in TREE_LIST)
55 ICS_ELLIPSIS_FLAG (in _CONV)
56 BINFO_ACCESS (in BINFO)
57 BV_GENERATE_THUNK_WITH_VTABLE_P (in TREE_LIST)
58 2: IDENTIFIER_OPNAME_P.
59 TYPE_POLYMORHPIC_P (in _TYPE)
60 ICS_THIS_FLAG (in _CONV)
61 BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
62 BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P (in BINFO)
63 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
64 BINFO_VTABLE_PATH_MARKED.
65 BINFO_PUSHDECLS_MARKED.
66 (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
67 ICS_BAD_FLAG (in _CONV)
68 FN_TRY_BLOCK_P (in TRY_BLOCK)
69 IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
70 4: BINFO_NEW_VTABLE_MARKED.
71 TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
73 NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
74 IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
75 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
76 6: BINFO_ACCESS (in BINFO)
78 Usage of TYPE_LANG_FLAG_?:
79 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
80 1: TYPE_HAS_CONSTRUCTOR.
81 2: TYPE_HAS_DESTRUCTOR.
83 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
87 Usage of DECL_LANG_FLAG_?:
88 0: DECL_ERROR_REPORTED (in VAR_DECL).
89 DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
90 DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
91 DECL_MUTABLE_P (in FIELD_DECL)
92 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
93 DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
94 DECL_C_BITFIELD (in FIELD_DECL)
95 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
96 DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
98 4: DECL_MAYBE_TEMPLATE.
99 5: DECL_INTERFACE_KNOWN.
100 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
101 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
102 DECL_THUNK_P (in a member FUNCTION_DECL)
104 Usage of language-independent fields in a language-dependent manner:
107 This field is BINFO_INDIRECT_PRIMARY_P in a BINFO.
110 This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
111 forth as a substitute for the mark bits provided in `lang_type'.
112 At present, only the six low-order bits are used.
115 For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
116 For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME.
117 For a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM,
118 this is TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
121 For a binfo, this is a TREE_LIST. The BV_DELTA of each node
122 gives the amount by which to adjust the `this' pointer when
123 calling the function. If the method is an overriden version of a
124 base class method, then it is assumed that, prior to adjustment,
125 the this pointer points to an object of the base class.
127 The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
128 index of the vcall offset for this entry. If
129 BV_USE_VCALL_INDEX_P then the corresponding vtable entry should
130 use a virtual thunk, as opposed to an ordinary thunk.
132 The BV_FN is the declaration for the virtual function itself.
133 When CLASSTYPE_COM_INTERFACE_P does not hold, the first entry
134 does not have a BV_FN; it is just an offset.
136 The BV_OVERRIDING_BASE is the binfo for the final overrider for
137 this function. (This binfo's BINFO_TYPE will always be the same
138 as the DECL_CLASS_CONTEXT for the function.)
141 Sometimes this is a VAR_DECL. Under the new ABI, it is instead
142 an expression with POINTER_TYPE pointing that gives the value
143 to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
144 to extract the VAR_DECL for the complete vtable; that macro works
148 For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
151 This field is NULL for a non-virtual function. For a virtual
152 function, it is eventually set to an INTEGER_CST indicating the
153 index in the vtable at which this function can be found. When
154 a virtual function is declared, but before it is known what
155 function is overriden, this field is the error_mark_node.
157 Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
158 the virtual function this one overrides, and whose TREE_CHAIN is
159 the old DECL_VINDEX. */
161 /* Language-specific tree checkers. */
163 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
165 #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
166 ({ const tree __t = NODE; \
167 enum tree_code __c = TREE_CODE(__t); \
168 if (__c != VAR_DECL && __c != FUNCTION_DECL) \
169 tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
173 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
174 ({ const tree __t = NODE; \
175 enum tree_code __c = TREE_CODE(__t); \
176 if (__c != VAR_DECL \
177 && __c != FUNCTION_DECL \
178 && __c != PARM_DECL) \
179 tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
183 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
184 ({ const tree __t = NODE; \
185 enum tree_code __c = TREE_CODE(__t); \
186 if (__c != VAR_DECL \
187 && __c != FUNCTION_DECL \
188 && __c != TYPE_DECL \
189 && __c != TEMPLATE_DECL) \
190 tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
194 #define RECORD_OR_UNION_TYPE_CHECK(NODE) \
195 ({ const tree __t = NODE; \
196 enum tree_code __c = TREE_CODE(__t); \
197 if (__c != RECORD_TYPE && __c != UNION_TYPE) \
198 tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \
202 #else /* not ENABLE_TREE_CHECKING, or not gcc */
204 #define VAR_OR_FUNCTION_DECL_CHECK(NODE) NODE
205 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) NODE
206 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) NODE
207 #define RECORD_OR_UNION_TYPE_CHECK(NODE) NODE
214 /* Nonzero to enable experimental ABI changes. */
216 extern int flag_new_abi;
218 /* Nonzero to use __cxa_atexit, rather than atexit, to register
219 destructors for local statics and global objects. */
221 extern int flag_use_cxa_atexit;
223 /* Nonzero to not ignore namespace std. */
225 extern int flag_honor_std;
227 /* Nonzero means generate 'rtti' that give run-time type information. */
229 extern int flag_rtti;
231 /* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
234 extern int flag_huge_objects;
236 /* Nonzero if virtual base class offsets are stored in the virtual
237 function table. Zero if, instead, a pointer to the virtual base is
238 stored in the object itself. */
239 #define vbase_offsets_in_vtable_p() (flag_new_abi)
241 /* Nonzero if displacements to the `this' pointer to use when calling
242 virtual functions in a virtual base class are present in the
244 #define vcall_offsets_in_vtable_p() (flag_new_abi)
246 /* Nonzero if a derived class that needs a vptr should always get one,
247 even if a non-primary base class already has one. For example,
250 struct S { int i; virtual void f(); };
251 struct T : virtual public S {};
253 one could either reuse the vptr in `S' for `T', or create a new
254 vptr for `T'. If this flag is nonzero we choose the latter
255 alternative; otherwise, we choose the former. */
256 #define vptrs_present_everywhere_p() (flag_new_abi)
258 /* Nonzero if the vtable for a derived class should contain the
259 virtual functions from the primary base and all virtual functions
260 present in the class itself. Zero if, instead, it should contain
261 only those virtual functions from the primary base together with
262 the functions declared in the derived class (but not in any base
264 #define all_overridden_vfuns_in_vtables_p() (flag_new_abi)
266 /* Nonzero if we use access type_info objects directly, and use the
267 cross-vendor layout for them. Zero if we use an accessor function
268 to get the type_info object address. */
269 #define new_abi_rtti_p() (flag_new_abi)
271 /* Nonzero if primary and secondary vtables are combined into a single
273 #define merge_primary_and_secondary_vtables_p() (flag_new_abi)
276 /* Language-dependent contents of an identifier. */
278 struct lang_identifier
280 struct tree_identifier ignore;
281 tree namespace_bindings;
284 tree class_template_info;
289 /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
290 keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
291 and C_RID_YYCODE is the token number wanted by Yacc. */
293 #define C_IS_RESERVED_WORD(id) TREE_LANG_FLAG_5 (id)
294 #define C_RID_CODE(id) \
295 (((struct lang_identifier *) (id))->rid_code)
297 extern const short rid_to_yy[RID_MAX];
298 #define C_RID_YYCODE(id) \
299 rid_to_yy[((struct lang_identifier *) (id))->rid_code]
301 #define LANG_IDENTIFIER_CAST(NODE) \
302 ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
306 tree label_value, implicit_decl;
319 struct tree_common common;
322 HOST_WIDE_INT orig_level;
324 } template_parm_index;
326 typedef struct ptrmem_cst
328 struct tree_common common;
329 /* This isn't used, but the middle-end expects all constants to have
335 /* Nonzero if this binding is for a local scope, as opposed to a class
336 or namespace scope. */
337 #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE)
339 /* Nonzero if BINDING_VALUE is from a base class of the class which is
340 currently being defined. */
341 #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE)
343 /* For a binding between a name and an entity at a non-local scope,
344 defines the scope where the binding is declared. (Either a class
345 _TYPE node, or a NAMESPACE_DECL.) This macro should be used only
346 for namespace-level bindings; on the IDENTIFIER_BINDING list
347 BINDING_LEVEL is used instead. */
348 #define BINDING_SCOPE(NODE) (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->scope.scope)
350 /* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */
351 #define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 ((NODE))
353 /* This is the declaration bound to the name. Possible values:
354 variable, overloaded function, namespace, template, enumerator. */
355 #define BINDING_VALUE(NODE) (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->value)
357 /* If name is bound to a type, this is the type (struct, union, enum). */
358 #define BINDING_TYPE(NODE) TREE_TYPE(NODE)
360 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
361 namespace_binding (NODE, global_namespace)
362 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
363 set_namespace_binding (NODE, global_namespace, VAL)
364 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
365 namespace_binding (NODE, current_namespace)
366 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
367 set_namespace_binding (NODE, current_namespace, VAL)
369 #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
370 #define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
371 #define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
373 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
375 #define same_type_p(type1, type2) \
376 comptypes ((type1), (type2), COMPARE_STRICT)
378 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring
379 top-level qualifiers. */
380 #define same_type_ignoring_top_level_qualifiers_p(type1, type2) \
381 same_type_p (TYPE_MAIN_VARIANT (type1), TYPE_MAIN_VARIANT (type2))
383 /* Non-zero if we are presently building a statement tree, rather
384 than expanding each statement as we encounter it. */
385 #define building_stmt_tree() (last_tree != NULL_TREE)
387 /* Returns non-zero iff NODE is a declaration for the global function
389 #define DECL_MAIN_P(NODE) \
390 (DECL_EXTERN_C_FUNCTION_P (NODE) \
391 && DECL_NAME (NODE) != NULL_TREE \
392 && MAIN_NAME_P (DECL_NAME (NODE)))
397 struct tree_common common;
400 struct binding_level *level;
405 /* The overloaded FUNCTION_DECL. */
406 #define OVL_FUNCTION(NODE) (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
407 #define OVL_CHAIN(NODE) TREE_CHAIN(NODE)
408 /* Polymorphic access to FUNCTION and CHAIN. */
409 #define OVL_CURRENT(NODE) \
410 ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
411 #define OVL_NEXT(NODE) \
412 ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
413 /* If set, this was imported in a using declaration.
414 This is not to confuse with being used somewhere, which
415 is not important for this node. */
416 #define OVL_USED(NODE) TREE_USED(NODE)
420 struct tree_common common;
424 /* A `baselink' is a TREE_LIST whose TREE_PURPOSE is a BINFO
425 indicating a particular base class, and whose TREE_VALUE is a
426 (possibly overloaded) function from that base class. */
427 #define BASELINK_P(NODE) \
428 (TREE_CODE (NODE) == TREE_LIST && TREE_LANG_FLAG_1 (NODE))
429 #define SET_BASELINK_P(NODE) \
430 (TREE_LANG_FLAG_1 (NODE) = 1)
432 #define WRAPPER_PTR(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.ptr)
433 #define WRAPPER_INT(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->u.i)
437 struct tree_common common;
444 #define SRCLOC_FILE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->filename)
445 #define SRCLOC_LINE(NODE) (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->linenum)
448 struct tree_common common;
449 const char *filename;
453 /* Macros for access to language-specific slots in an identifier. */
455 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
456 (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
457 #define IDENTIFIER_TEMPLATE(NODE) \
458 (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
460 /* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the
461 identifier. It's TREE_CHAIN is the next outermost binding. Each
462 BINDING_VALUE is a DECL for the associated declaration. Thus,
463 name lookup consists simply of pulling off the node at the front
464 of the list (modulo oddities for looking up the names of types,
465 and such.) You can use BINDING_SCOPE or BINDING_LEVEL to
466 determine the scope that bound the name. */
467 #define IDENTIFIER_BINDING(NODE) \
468 (LANG_IDENTIFIER_CAST (NODE)->bindings)
470 /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
471 NULL_TREE if there is no binding. */
472 #define IDENTIFIER_VALUE(NODE) \
473 (IDENTIFIER_BINDING (NODE) \
474 ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
477 /* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
478 class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
479 just a pointer to the BINDING_VALUE of one of the bindings in the
480 IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
481 IDENTIFIER_BINDING. */
482 #define IDENTIFIER_CLASS_VALUE(NODE) \
483 (LANG_IDENTIFIER_CAST (NODE)->class_value)
485 /* TREE_TYPE only indicates on local and class scope the current
486 type. For namespace scope, the presence of a type in any namespace
487 is indicated with global_type_node, and the real type behind must
488 be found through lookup. */
489 #define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
490 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
491 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
492 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
494 #define LANG_ID_FIELD(NAME,NODE) \
495 (LANG_IDENTIFIER_CAST (NODE)->x \
496 ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)
498 #define SET_LANG_ID(NODE,VALUE,NAME) \
499 (LANG_IDENTIFIER_CAST (NODE)->x == 0 \
500 ? LANG_IDENTIFIER_CAST (NODE)->x \
501 = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
502 LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE))
504 #define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)
505 #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
506 SET_LANG_ID(NODE, VALUE, label_value)
508 #define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)
509 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
510 SET_LANG_ID(NODE, VALUE, implicit_decl)
512 #define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)
513 #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
514 SET_LANG_ID(NODE, VALUE, error_locus)
517 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
519 /* Nonzero if this identifier is the prefix for a mangled C++ operator
521 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
523 /* Nonzero if this identifier is the name of a type-conversion
525 #define IDENTIFIER_TYPENAME_P(NODE) \
526 (TREE_LANG_FLAG_4 (NODE))
528 /* Nonzero if this identifier is the name of a constructor or
530 #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
531 TREE_LANG_FLAG_3 (NODE)
533 /* Nonzero means reject anything that ISO standard C++ forbids. */
536 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
537 #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
539 /* Record in each node resulting from a binary operator
540 what operator was specified for it. */
541 #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
543 /* Store a value in that field. */
544 #define C_SET_EXP_ORIGINAL_CODE(exp, code) \
545 (TREE_COMPLEXITY (exp) = (int)(code))
547 /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
548 next exception handler. */
549 extern tree exception_throw_decl;
554 CPTI_JAVA_SHORT_TYPE,
557 CPTI_JAVA_FLOAT_TYPE,
558 CPTI_JAVA_DOUBLE_TYPE,
560 CPTI_JAVA_BOOLEAN_TYPE,
563 CPTI_VTABLE_ENTRY_TYPE,
565 CPTI_VTABLE_INDEX_TYPE,
575 CPTI_CLASS_DESC_TYPE,
576 CPTI_SI_CLASS_DESC_TYPE,
577 CPTI_VMI_CLASS_DESC_TYPE,
592 CPTI_TINFO_DECL_TYPE,
595 CPTI_GLOBAL_DELETE_FNDECL,
600 CPTI_ACCESS_PROTECTED,
602 CPTI_ACCESS_DEFAULT_VIRTUAL,
603 CPTI_ACCESS_PUBLIC_VIRTUAL,
604 CPTI_ACCESS_PROTECTED_VIRTUAL,
605 CPTI_ACCESS_PRIVATE_VIRTUAL,
607 CPTI_CTOR_IDENTIFIER,
608 CPTI_COMPLETE_CTOR_IDENTIFIER,
609 CPTI_BASE_CTOR_IDENTIFIER,
610 CPTI_DTOR_IDENTIFIER,
611 CPTI_COMPLETE_DTOR_IDENTIFIER,
612 CPTI_BASE_DTOR_IDENTIFIER,
613 CPTI_DELETING_DTOR_IDENTIFIER,
614 CPTI_DELTA2_IDENTIFIER,
615 CPTI_DELTA_IDENTIFIER,
616 CPTI_IN_CHARGE_IDENTIFIER,
617 CPTI_VTT_PARM_IDENTIFIER,
618 CPTI_INDEX_IDENTIFIER,
619 CPTI_NELTS_IDENTIFIER,
620 CPTI_THIS_IDENTIFIER,
622 CPTI_PFN_OR_DELTA2_IDENTIFIER,
623 CPTI_VPTR_IDENTIFIER,
624 CPTI_PUSH_EXCEPTION_IDENTIFIER,
628 CPTI_LANG_NAME_CPLUSPLUS,
631 CPTI_EMPTY_EXCEPT_SPEC,
643 extern tree cp_global_trees[CPTI_MAX];
645 #define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
646 #define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
647 #define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
648 #define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
649 #define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
650 #define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
651 #define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
652 #define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
654 #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
655 #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
656 /* The type used to represent an offset by which to adjust the `this'
657 pointer in pointer-to-member types and, when not using vtable
658 thunks, in vtables. */
659 #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
660 /* The type used to represent an index into the vtable. */
661 #define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
663 #define ti_desc_type_node cp_global_trees[CPTI_TI_DESC_TYPE]
664 #define bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
665 #define ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
666 #define ary_desc_type_node cp_global_trees[CPTI_ARY_DESC_TYPE]
667 #define func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
668 #define enum_desc_type_node cp_global_trees[CPTI_ENUM_DESC_TYPE]
669 #define class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
670 #define si_class_desc_type_node cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
671 #define vmi_class_desc_type_node cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
672 #define ptm_desc_type_node cp_global_trees[CPTI_PTM_DESC_TYPE]
673 #define base_desc_type_node cp_global_trees[CPTI_BASE_DESC_TYPE]
675 #define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
676 #define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
677 #define union_type_node cp_global_trees[CPTI_UNION_TYPE]
678 #define enum_type_node cp_global_trees[CPTI_ENUM_TYPE]
679 #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
680 #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
681 #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
682 #define std_node cp_global_trees[CPTI_STD]
683 #define abi_node cp_global_trees[CPTI_ABI]
684 #define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
685 #define tinfo_decl_id cp_global_trees[CPTI_TINFO_DECL_ID]
686 #define tinfo_decl_type cp_global_trees[CPTI_TINFO_DECL_TYPE]
687 #define tinfo_var_id cp_global_trees[CPTI_TINFO_VAR_ID]
688 #define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
689 #define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
690 #define current_aggr cp_global_trees[CPTI_AGGR_TAG]
692 /* Define the sets of attributes that member functions and baseclasses
693 can have. These are sensible combinations of {public,private,protected}
694 cross {virtual,non-virtual}. */
696 #define access_default_node cp_global_trees[CPTI_ACCESS_DEFAULT]
697 #define access_public_node cp_global_trees[CPTI_ACCESS_PUBLIC]
698 #define access_protected_node cp_global_trees[CPTI_ACCESS_PROTECTED]
699 #define access_private_node cp_global_trees[CPTI_ACCESS_PRIVATE]
700 #define access_default_virtual_node cp_global_trees[CPTI_ACCESS_DEFAULT_VIRTUAL]
701 #define access_public_virtual_node cp_global_trees[CPTI_ACCESS_PUBLIC_VIRTUAL]
702 #define access_protected_virtual_node cp_global_trees[CPTI_ACCESS_PROTECTED_VIRTUAL]
703 #define access_private_virtual_node cp_global_trees[CPTI_ACCESS_PRIVATE_VIRTUAL]
705 /* We cache these tree nodes so as to call get_identifier less
708 /* The name of a constructor that takes an in-charge parameter to
709 decide whether or not to construct virtual base classes. */
710 #define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
711 /* The name of a constructor that constructs virtual base classes. */
712 #define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
713 /* The name of a constructor that does not construct virtual base classes. */
714 #define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
715 /* The name of a destructor that takes an in-charge parameter to
716 decide whether or not to destroy virtual base classes and whether
717 or not to delete the object. */
718 #define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
719 /* The name of a destructor that destroys virtual base classes. */
720 #define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
721 /* The name of a destructor that does not destroy virtual base
723 #define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
724 /* The name of a destructor that destroys virtual base classes, and
725 then deletes the entire object. */
726 #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
728 #define delta2_identifier cp_global_trees[CPTI_DELTA2_IDENTIFIER]
729 #define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
730 #define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
732 /* The name of the parameter that contains a pointer to the VTT to use
733 for this subobject constructor or destructor. */
734 #define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
736 #define index_identifier cp_global_trees[CPTI_INDEX_IDENTIFIER]
737 #define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
738 #define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
739 #define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
740 #define pfn_or_delta2_identifier cp_global_trees[CPTI_PFN_OR_DELTA2_IDENTIFIER]
741 #define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
742 /* The name of the function to call to push an exception onto the
744 #define cp_push_exception_identifier cp_global_trees[CPTI_PUSH_EXCEPTION_IDENTIFIER]
745 /* The name of the std namespace. */
746 #define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
748 #define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
749 #define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
750 #define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
752 /* Exception specifier used for throw(). */
753 #define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
755 /* The node for `__null'. */
756 #define null_node cp_global_trees[CPTI_NULL]
758 /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
759 #define jclass_node cp_global_trees[CPTI_JCLASS]
761 /* A node for `(int) -1'. */
762 #define minus_one_node cp_global_trees[CPTI_MINUS_ONE]
764 /* The declaration for `std::terminate'. */
765 #define terminate_node cp_global_trees[CPTI_TERMINATE]
767 /* A pointer to `std::atexit'. */
768 #define atexit_node cp_global_trees[CPTI_ATEXIT]
770 /* A pointer to `__dso_handle'. */
771 #define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
773 /* The declaration of the dynamic_cast runtime. */
774 #define dynamic_cast_node cp_global_trees[CPTI_DCAST]
776 /* The type of a destructor. */
777 #define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
779 /* The type of the vtt parameter passed to subobject constructors and
781 #define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
790 tree access_specifier;
792 varray_type lang_base;
796 tree x_previous_class_type;
797 tree x_previous_class_values;
802 HOST_WIDE_INT x_processing_template_decl;
803 int x_processing_specialization;
804 int x_processing_explicit_instantiation;
805 int need_pop_function_context;
807 struct stmt_tree_s x_stmt_tree;
809 struct binding_level *class_bindings;
810 struct binding_level *bindings;
812 struct saved_scope *prev;
815 /* The current open namespace. */
817 #define current_namespace scope_chain->old_namespace
819 /* IDENTIFIER_NODE: name of current class */
821 #define current_class_name scope_chain->class_name
823 /* _TYPE: the type of the current class */
825 #define current_class_type scope_chain->class_type
827 /* When parsing a class definition, the access specifier most recently
828 given by the user, or, if no access specifier was given, the
829 default value appropriate for the kind of class (i.e., struct,
832 #define current_access_specifier scope_chain->access_specifier
834 /* Pointer to the top of the language name stack. */
836 #define current_lang_stack scope_chain->lang_stack
837 #define current_lang_base scope_chain->lang_base
838 #define current_lang_name scope_chain->lang_name
840 /* Parsing a function declarator leaves a list of parameter names
841 or a chain or parameter decls here. */
843 #define current_template_parms scope_chain->template_parms
845 #define processing_template_decl scope_chain->x_processing_template_decl
846 #define processing_specialization scope_chain->x_processing_specialization
847 #define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
849 /* _TYPE: the previous type that was a class */
851 #define previous_class_type scope_chain->x_previous_class_type
853 /* This is a copy of the class_shadowed list of the previous class
854 binding contour when at global scope. It's used to reset
855 IDENTIFIER_CLASS_VALUEs when entering another class scope (i.e. a
858 #define previous_class_values scope_chain->x_previous_class_values
860 /* A list of the declarations with incomplete type at namespace scope. */
862 #define namespace_scope_incomplete scope_chain->incomplete
864 /* A list of private types mentioned, for deferred access checking. */
866 #define type_lookups scope_chain->lookups
868 extern struct saved_scope *scope_chain;
870 /* Global state pertinent to the current function. */
872 struct cp_language_function
874 struct language_function base;
878 tree x_current_class_ptr;
879 tree x_current_class_ref;
880 tree x_eh_spec_try_block;
881 tree x_in_charge_parm;
883 tree *x_vcalls_possible_p;
887 int in_function_try_handler;
891 struct named_label_use_list *x_named_label_uses;
892 struct named_label_list *x_named_labels;
893 struct binding_level *bindings;
895 const char *cannot_inline;
898 /* The current C++-specific per-function global variables. */
900 #define cp_function_chain \
901 ((struct cp_language_function *) (cfun->language))
903 /* In a destructor, the point at which all derived class destroying
904 has been done, just before any base class destroying will be done. */
906 #define dtor_label cp_function_chain->x_dtor_label
908 /* In a constructor, the point at which we are ready to return
909 the pointer to the initialized object. */
911 #define ctor_label cp_function_chain->x_ctor_label
913 /* When we're processing a member function, current_class_ptr is the
914 PARM_DECL for the `this' pointer. The current_class_ref is an
915 expression for `*this'. */
917 #define current_class_ptr \
918 (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE)
919 #define current_class_ref \
920 (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
922 /* The TRY_BLOCK for the exception-specifiers for the current
925 #define current_eh_spec_try_block cp_function_chain->x_eh_spec_try_block
927 /* The `__in_chrg' parameter for the current function. Only used for
930 #define current_in_charge_parm cp_function_chain->x_in_charge_parm
932 /* In destructors, this is a pointer to a condition in an
933 if-statement. If the pointed-to value is boolean_true_node, then
934 there may be virtual function calls in this destructor. */
936 #define current_vcalls_possible_p cp_function_chain->x_vcalls_possible_p
938 /* Set to 0 at beginning of a function definition, set to 1 if
939 a return statement that specifies a return value is seen. */
941 #define current_function_returns_value cp_function_chain->returns_value
943 /* Set to 0 at beginning of a function definition, set to 1 if
944 a return statement with no argument is seen. */
946 #define current_function_returns_null cp_function_chain->returns_null
948 /* Nonzero if we have already generated code to initialize virtual
949 function tables in this function. */
951 #define vtbls_set_up_p cp_function_chain->vtbls_set_up_p
953 /* Non-zero if we should generate RTL for functions that we process.
954 When this is zero, we just accumulate tree structure, without
955 interacting with the back end. */
957 #define expanding_p cp_function_chain->x_expanding_p
959 /* Non-zero if we are in the semantic analysis phase for the current
962 #define doing_semantic_analysis_p() (!expanding_p)
964 #define in_function_try_handler cp_function_chain->in_function_try_handler
966 /* Nonzero if __FUNCTION__ and its ilk have been declared in this
969 #define function_name_declared_p \
970 (cp_function_chain->base.x_function_name_declared_p)
972 extern tree current_function_return_value;
973 extern tree global_namespace;
975 #define ansi_opname(CODE) \
976 (operator_name_info[(int) (CODE)].identifier)
977 #define ansi_assopname(CODE) \
978 (assignment_operator_name_info[(int) (CODE)].identifier)
980 /* Nonzero means `$' can be in an identifier. */
982 extern int dollars_in_ident;
984 /* Nonzero means allow type mismatches in conditional expressions;
985 just make their values `void'. */
987 extern int flag_cond_mismatch;
989 /* Nonzero means don't recognize the keyword `asm'. */
991 extern int flag_no_asm;
993 /* Nonzero means don't recognize any extended keywords. */
995 extern int flag_no_gnu_keywords;
997 /* Nonzero means recognize the named operators from C++98. */
999 extern int flag_operator_names;
1001 /* For cross referencing. */
1003 extern int flag_gnu_xref;
1005 /* For environments where you can use GNU binutils (as, ld in particular). */
1007 extern int flag_gnu_binutils;
1009 /* Nonzero means warn about implicit declarations. */
1011 extern int warn_implicit;
1013 /* Nonzero means warn about usage of long long when `-pedantic'. */
1015 extern int warn_long_long;
1017 /* Nonzero means warn when all ctors or dtors are private, and the class
1020 extern int warn_ctor_dtor_privacy;
1022 /* Nonzero means warn about function definitions that default the return type
1023 or that use a null return and have a return-type other than void. */
1025 extern int warn_return_type;
1027 /* If non-NULL, dump the tree structure for the entire translation
1028 unit to this file. */
1030 extern const char *flag_dump_translation_unit;
1032 /* Nonzero means warn about deprecated conversion from string constant to
1035 extern int warn_write_strings;
1037 /* Nonzero means warn about sizeof(function) or addition/subtraction
1038 of function pointers. */
1040 extern int warn_pointer_arith;
1042 /* Nonzero means warn about multiple (redundant) decls for the same single
1043 variable or function. */
1045 extern int warn_redundant_decls;
1047 /* Warn if initializer is not completely bracketed. */
1049 extern int warn_missing_braces;
1051 /* Warn about comparison of signed and unsigned values. */
1053 extern int warn_sign_compare;
1055 /* Warn about testing equality of floating point numbers. */
1057 extern int warn_float_equal;
1059 /* Warn about a subscript that has type char. */
1061 extern int warn_char_subscripts;
1063 /* Nonzero means warn about pointer casts that can drop a type qualifier
1064 from the pointer target type. */
1066 extern int warn_cast_qual;
1068 /* Nonzero means warn about non virtual destructors in classes that have
1069 virtual functions. */
1071 extern int warn_nonvdtor;
1073 /* Non-zero means warn when we convert a pointer to member function
1074 into a pointer to (void or function). */
1076 extern int warn_pmf2ptr;
1078 /* Nonzero means warn about violation of some Effective C++ style rules. */
1080 extern int warn_ecpp;
1082 /* Nonzero means warn where overload resolution chooses a promotion from
1083 unsigned to signed over a conversion to an unsigned of the same size. */
1085 extern int warn_sign_promo;
1087 /* Non-zero means warn when a function is declared extern and later inline. */
1089 extern int warn_extern_inline;
1091 /* Non-zero means warn when an old-style cast is used. */
1093 extern int warn_old_style_cast;
1095 /* Non-zero means warn when the compiler will reorder code. */
1097 extern int warn_reorder;
1099 /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
1101 extern int flag_signed_bitfields;
1103 /* True for more efficient but incompatible (not fully tested)
1104 vtable implementation (using thunks).
1105 0 is old behavior; 1 is new behavior. */
1106 extern int flag_vtable_thunks;
1108 /* INTERFACE_ONLY nonzero means that we are in an "interface"
1109 section of the compiler. INTERFACE_UNKNOWN nonzero means
1110 we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
1111 is zero and INTERFACE_ONLY is zero, it means that we are responsible
1112 for exporting definitions that others might need. */
1113 extern int interface_only, interface_unknown;
1115 /* Nonzero means we should attempt to elide constructors when possible. */
1117 extern int flag_elide_constructors;
1119 /* Nonzero means enable obscure standard features and disable GNU
1120 extensions that might cause standard-compliant code to be
1123 extern int flag_ansi;
1125 /* Nonzero means that member functions defined in class scope are
1126 inline by default. */
1128 extern int flag_default_inline;
1130 /* The name-mangling scheme to use. Versions of gcc before 2.8 use
1132 extern int name_mangling_version;
1134 /* Nonzero if wchar_t should be `unsigned short' instead of whatever it
1135 would normally be, for use with WINE. */
1136 extern int flag_short_wchar;
1138 /* Nonzero if squashed mangling is to be performed.
1139 This uses the B and K codes to reference previously seen class types
1140 and class qualifiers. */
1141 extern int flag_do_squangling;
1143 /* Nonzero means generate separate instantiation control files and juggle
1144 them at link time. */
1145 extern int flag_use_repository;
1147 /* Nonzero if we want to issue diagnostics that the standard says are not
1149 extern int flag_optional_diags;
1151 /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
1152 extern int flag_vtable_gc;
1154 /* Nonzero means make the default pedwarns warnings instead of errors.
1155 The value of this flag is ignored if -pedantic is specified. */
1156 extern int flag_permissive;
1158 /* Nonzero means to implement standard semantics for exception
1159 specifications, calling unexpected if an exception is thrown that
1160 doesn't match the specification. Zero means to treat them as
1161 assertions and optimize accordingly, but not check them. */
1162 extern int flag_enforce_eh_specs;
1164 /* Nonzero if we want to obey access control semantics. */
1166 extern int flag_access_control;
1168 /* Nonzero if we want to check the return value of new and avoid calling
1169 constructors if it is a null pointer. */
1171 extern int flag_check_new;
1173 /* If this variable is defined to a non-NULL value, it will be called
1174 after the file has been completely parsed. The argument will be
1175 the GLOBAL_NAMESPACE. */
1177 extern void (*back_end_hook) PARAMS ((tree));
1180 /* C++ language-specific tree codes. */
1181 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
1182 enum cplus_tree_code {
1183 CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
1184 #include "cp-tree.def"
1185 LAST_CPLUS_TREE_CODE
1189 enum languages { lang_c, lang_cplusplus, lang_java };
1191 /* Macros to make error reporting functions' lives easier. */
1192 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
1193 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
1194 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
1196 #define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
1197 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
1199 /* The _DECL for this _TYPE. */
1200 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
1202 /* Nonzero if T is a class (or struct or union) type. Also nonzero
1203 for template type parameters, typename types, and instantiated
1204 template template parameters. Despite its name,
1205 this macro has nothing to do with the definition of aggregate given
1206 in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
1207 #define IS_AGGR_TYPE(t) \
1208 (TREE_CODE (t) == TEMPLATE_TYPE_PARM \
1209 || TREE_CODE (t) == TYPENAME_TYPE \
1210 || TREE_CODE (t) == TYPEOF_TYPE \
1211 || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM \
1212 || TYPE_LANG_FLAG_5 (t))
1214 /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
1216 #define SET_IS_AGGR_TYPE(T, VAL) \
1217 (TYPE_LANG_FLAG_5 (T) = (VAL))
1219 /* Nonzero if T is a class type. Zero for template type parameters,
1220 typename types, and so forth. */
1221 #define CLASS_TYPE_P(t) \
1222 (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t))
1224 #define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
1225 #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
1226 (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
1227 && IS_AGGR_TYPE (TYPE1) && IS_AGGR_TYPE (TYPE2))
1228 #define IS_OVERLOAD_TYPE(t) \
1229 (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
1231 /* In a *_TYPE, nonzero means a built-in type. */
1232 #define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
1234 /* True if this a "Java" type, defined in 'extern "Java"'. */
1235 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
1237 /* The type qualifiers for this type, including the qualifiers on the
1238 elements for an array type. */
1239 #define CP_TYPE_QUALS(NODE) \
1240 ((TREE_CODE (NODE) != ARRAY_TYPE) \
1241 ? TYPE_QUALS (NODE) : cp_type_quals (NODE))
1243 /* Nonzero if this type is const-qualified. */
1244 #define CP_TYPE_CONST_P(NODE) \
1245 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0)
1247 /* Nonzero if this type is volatile-qualified. */
1248 #define CP_TYPE_VOLATILE_P(NODE) \
1249 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0)
1251 /* Nonzero if this type is restrict-qualified. */
1252 #define CP_TYPE_RESTRICT_P(NODE) \
1253 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0)
1255 /* Nonzero if this type is const-qualified, but not
1256 volatile-qualified. Other qualifiers are ignored. This macro is
1257 used to test whether or not it is OK to bind an rvalue to a
1259 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
1260 ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
1263 /* Virtual function addresses can be gotten from a virtual function
1264 table entry using this macro. */
1265 #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
1266 (!flag_vtable_thunks ? \
1267 TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
1268 : !DECL_THUNK_P (TREE_OPERAND ((ENTRY), 0)) \
1270 : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
1272 #define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
1273 #define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
1274 (((CODE) == TREE_CODE (NODE) \
1275 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
1276 || IS_AGGR_TYPE (NODE))
1278 /* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can
1279 be an ambiguous base class of TYPE, and this macro will be false. */
1280 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
1281 #define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
1282 #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
1283 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 2, (tree *)0) >= 0)
1284 #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
1286 /* This structure provides additional information above and beyond
1287 what is provide in the ordinary tree_type. In the past, we used it
1288 for the types of class types, template parameters types, typename
1289 types, and so forth. However, there can be many (tens to hundreds
1290 of thousands) of template parameter types in a compilation, and
1291 there's no need for this additional information in that case.
1292 Therefore, we now use this data structure only for class types.
1294 In the past, it was thought that there would be relatively few
1295 class types. However, in the presence of heavy use of templates,
1296 many (i.e., thousands) of classes can easily be generated.
1297 Therefore, we should endeavor to keep the size of this structure to
1301 unsigned char align;
1303 unsigned has_type_conversion : 1;
1304 unsigned has_init_ref : 1;
1305 unsigned has_default_ctor : 1;
1306 unsigned uses_multiple_inheritance : 1;
1307 unsigned const_needs_init : 1;
1308 unsigned ref_needs_init : 1;
1309 unsigned has_const_assign_ref : 1;
1310 unsigned anon_aggr : 1;
1312 unsigned has_mutable : 1;
1313 unsigned com_interface : 1;
1314 unsigned non_pod_class : 1;
1315 unsigned nearly_empty_p : 1;
1316 unsigned vtable_needs_writing : 1;
1317 unsigned has_assign_ref : 1;
1318 unsigned has_new : 1;
1319 unsigned has_array_new : 1;
1321 unsigned gets_delete : 2;
1322 unsigned has_call_overloaded : 1;
1323 unsigned has_array_ref_overloaded : 1;
1324 unsigned has_arrow_overloaded : 1;
1325 unsigned interface_only : 1;
1326 unsigned interface_unknown : 1;
1327 unsigned needs_virtual_reinit : 1;
1330 unsigned vec_delete_takes_size : 1;
1331 unsigned declared_class : 1;
1333 unsigned being_defined : 1;
1334 unsigned redefined : 1;
1335 unsigned debug_requested : 1;
1336 unsigned use_template : 2;
1337 unsigned got_semicolon : 1;
1338 unsigned ptrmemfunc_flag : 1;
1339 unsigned was_anonymous : 1;
1341 unsigned has_real_assign_ref : 1;
1342 unsigned has_const_init_ref : 1;
1343 unsigned has_complex_init_ref : 1;
1344 unsigned has_complex_assign_ref : 1;
1345 unsigned has_abstract_assign_ref : 1;
1346 unsigned non_aggregate : 1;
1347 unsigned is_partial_instantiation : 1;
1348 unsigned user_align : 1;
1350 /* When adding a flag here, consider whether or not it ought to
1351 apply to a template instance if it applies to the template. If
1352 so, make sure to copy it in instantiate_class_template! */
1354 /* There are some bits left to fill out a 32-bit word. Keep track
1355 of this by updating the size of this bitfield whenever you add or
1368 tree friend_classes;
1372 tree befriending_classes;
1375 /* Indicates whether or not (and how) a template was expanded for this class.
1376 0=no information yet/non-template class
1377 1=implicit template instantiation
1378 2=explicit template specialization
1379 3=explicit template instantiation */
1380 #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->use_template)
1382 /* Fields used for storing information before the class is defined.
1383 After the class is defined, these fields hold other information. */
1385 /* List of friends which were defined inline in this class definition. */
1386 #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
1388 /* Nonzero for _CLASSTYPE means that operator delete is defined. */
1389 #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->gets_delete)
1390 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
1392 /* Nonzero for _CLASSTYPE means that operator vec delete is defined and
1393 takes the optional size_t argument. */
1394 #define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
1395 (TYPE_LANG_SPECIFIC(NODE)->vec_delete_takes_size)
1397 /* Nonzero if `new NODE[x]' should cause the allocation of extra
1398 storage to indicate how many array elements are in use. The old
1399 ABI had a bug in that we always allocate the extra storage if NODE
1400 has a two-argument array operator delete. */
1401 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
1402 (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE) \
1403 || (TYPE_LANG_SPECIFIC (NODE) \
1404 && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
1406 /* Nonzero means that this _CLASSTYPE node defines ways of converting
1407 itself to other types. */
1408 #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_type_conversion)
1410 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
1411 #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_assign_ref)
1412 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_const_assign_ref)
1414 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
1415 #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_init_ref)
1416 #define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_const_init_ref)
1418 /* Nonzero if this class defines an overloaded operator new. (An
1419 operator new [] doesn't count.) */
1420 #define TYPE_HAS_NEW_OPERATOR(NODE) \
1421 (TYPE_LANG_SPECIFIC (NODE)->has_new)
1423 /* Nonzero if this class defines an overloaded operator new[]. */
1424 #define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
1425 (TYPE_LANG_SPECIFIC (NODE)->has_array_new)
1427 /* Nonzero means that this type is being defined. I.e., the left brace
1428 starting the definition of this type has been seen. */
1429 #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->being_defined)
1430 /* Nonzero means that this type has been redefined. In this case, if
1431 convenient, don't reprocess any methods that appear in its redefinition. */
1432 #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->redefined)
1434 /* The is the basetype that contains NODE's rtti. */
1435 #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
1437 /* Nonzero means that this _CLASSTYPE node overloads operator(). */
1438 #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_call_overloaded)
1440 /* Nonzero means that this _CLASSTYPE node overloads operator[]. */
1441 #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_array_ref_overloaded)
1443 /* Nonzero means that this _CLASSTYPE node overloads operator->. */
1444 #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_arrow_overloaded)
1446 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
1447 multiple inheritance. If this is 0 for the root of a type
1448 hierarchy, then we can use more efficient search techniques. */
1449 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->uses_multiple_inheritance)
1451 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
1452 virtual base classes. If this is 0 for the root of a type
1453 hierarchy, then we can use more efficient search techniques. */
1454 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
1456 /* Vector member functions defined in this class. Each element is
1457 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
1458 functions with the same name end up in the same slot. The first
1459 two elements are for constructors, and destructors, respectively.
1460 Any conversion operators are next, followed by ordinary member
1461 functions. There may be empty entries at the end of the vector. */
1462 #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
1464 /* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
1465 #define CLASSTYPE_CONSTRUCTOR_SLOT 0
1467 /* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
1468 #define CLASSTYPE_DESTRUCTOR_SLOT 1
1470 /* The first slot in the CLASSTYPE_METHOD_VEC where conversion
1471 operators can appear. */
1472 #define CLASSTYPE_FIRST_CONVERSION_SLOT 2
1474 /* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
1475 are the constructors that take an in-charge parameter. */
1476 #define CLASSTYPE_CONSTRUCTORS(NODE) \
1477 (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT))
1479 /* A FUNCTION_DECL for the destructor for NODE. These are te
1480 destructors that take an in-charge parameter. */
1481 #define CLASSTYPE_DESTRUCTORS(NODE) \
1482 (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT))
1484 /* Mark bits for depth-first and breath-first searches. */
1486 /* Get the value of the Nth mark bit. */
1487 #define CLASSTYPE_MARKED_N(NODE, N) \
1488 (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->marks \
1489 : ((unsigned) TYPE_ALIAS_SET (NODE))) & (1 << N)) != 0)
1491 /* Set the Nth mark bit. */
1492 #define SET_CLASSTYPE_MARKED_N(NODE, N) \
1493 (CLASS_TYPE_P (NODE) \
1494 ? (void) (TYPE_LANG_SPECIFIC (NODE)->marks |= (1 << (N))) \
1495 : (void) (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
1497 /* Clear the Nth mark bit. */
1498 #define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
1499 (CLASS_TYPE_P (NODE) \
1500 ? (void) (TYPE_LANG_SPECIFIC (NODE)->marks &= ~(1 << (N))) \
1501 : (void) (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
1503 /* Get the value of the mark bits. */
1504 #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0)
1505 #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1)
1506 #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2)
1507 #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3)
1508 #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4)
1509 #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5)
1511 /* Macros to modify the above flags */
1512 #define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N(NODE, 0)
1513 #define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 0)
1514 #define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N(NODE, 1)
1515 #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1)
1516 #define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N(NODE, 2)
1517 #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2)
1518 #define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N(NODE, 3)
1519 #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3)
1520 #define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N(NODE, 4)
1521 #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4)
1522 #define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N(NODE, 5)
1523 #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5)
1525 /* A list of the nested tag-types (class, struct, union, or enum)
1526 found within this class. The TREE_PURPOSE of each node is the name
1527 of the type; the TREE_VALUE is the type itself. This list includes
1528 nested member class templates. */
1529 #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
1531 /* Nonzero if NODE has a primary base class, i.e., a base class with
1532 which it shares the virtual function table pointer. */
1533 #define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
1534 (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
1536 /* If non-NULL, this is the binfo for the primary base class, i.e.,
1537 the base class which contains the virtual function table pointer
1539 #define CLASSTYPE_PRIMARY_BINFO(NODE) \
1540 (TYPE_LANG_SPECIFIC (NODE)->primary_base)
1542 /* The number of virtual functions present in this class' virtual
1544 #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
1546 /* A chain of BINFOs for the direct and indirect virtual base classes
1547 that this type uses in a post-order depth-first left-to-right
1548 order. (In other words, these bases appear in the order that they
1549 should be initialized.) If a virtual base is primary, then the
1550 primary copy will appear on this list. Thus, the BINFOs on this
1551 list are all "real"; they are the same BINFOs that will be
1552 encountered when using dfs_unmarked_real_bases_queue_p and related
1554 #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
1556 /* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the
1557 binfo_for_vbase. C is the most derived class for the hierarchy
1558 containing BINFO. */
1559 #define CANONICAL_BINFO(BINFO, C) \
1560 (TREE_VIA_VIRTUAL (BINFO) \
1561 ? binfo_for_vbase (BINFO_TYPE (BINFO), C) \
1564 /* Number of direct baseclasses of NODE. */
1565 #define CLASSTYPE_N_BASECLASSES(NODE) \
1566 (BINFO_N_BASETYPES (TYPE_BINFO (NODE)))
1568 /* These are the size and alignment of the type without its virtual
1569 base classes, for when we use this type as a base itself. */
1570 #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
1571 #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
1572 #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
1573 #define CLASSTYPE_USER_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->user_align)
1575 /* The alignment of NODE, without its virtual bases, in bytes. */
1576 #define CLASSTYPE_ALIGN_UNIT(NODE) \
1577 (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
1579 /* A cons list of virtual functions which cannot be inherited by
1580 derived classes. When deriving from this type, the derived
1581 class must provide its own definition for each of these functions. */
1582 #define CLASSTYPE_PURE_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->pure_virtuals)
1584 /* Nonzero means that this aggr type has been `closed' by a semicolon. */
1585 #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->got_semicolon)
1587 /* Nonzero means that the main virtual function table pointer needs to be
1588 set because base constructors have placed the wrong value there.
1589 If this is zero, it means that they placed the right value there,
1590 and there is no need to change it. */
1591 #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->needs_virtual_reinit)
1593 /* Nonzero means that if this type has virtual functions, that
1594 the virtual function table will be written out. */
1595 #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtable_needs_writing)
1597 /* Nonzero means that this type has an X() constructor. */
1598 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_default_ctor)
1600 /* Nonzero means that this type contains a mutable member */
1601 #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_mutable)
1602 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1604 /* Nonzero means that this class type is a non-POD class. */
1605 #define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_pod_class)
1607 /* Nonzero if this class is "nearly empty", i.e., contains only a
1608 virtual function table pointer. */
1609 #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
1610 (TYPE_LANG_SPECIFIC (NODE)->nearly_empty_p)
1612 /* Nonzero means that this type is meant for communication via COM. */
1613 #define CLASSTYPE_COM_INTERFACE(NODE) \
1614 (TYPE_LANG_SPECIFIC(NODE)->com_interface)
1616 /* A list of class types of which this type is a friend. The
1617 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1618 case of a template friend. */
1619 #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
1621 /* A list of the classes which grant friendship to this class. */
1622 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1623 (TYPE_LANG_SPECIFIC (NODE)->befriending_classes)
1625 /* Say whether this node was declared as a "class" or a "struct". */
1626 #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->declared_class)
1628 /* Nonzero if this class has const members which have no specified initialization. */
1629 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->const_needs_init)
1631 /* Nonzero if this class has ref members which have no specified initialization. */
1632 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->ref_needs_init)
1634 /* Nonzero if this class is included from a header file which employs
1635 `#pragma interface', and it is not included in its implementation file. */
1636 #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_only)
1638 /* Same as above, but for classes whose purpose we do not know. */
1639 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown)
1640 #define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown == 0)
1641 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = !!(X))
1642 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = 1)
1643 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->interface_unknown = 0)
1645 /* Nonzero if a _DECL node requires us to output debug info for this class. */
1646 #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->debug_requested)
1648 /* Additional macros for inheritance information. */
1650 /* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
1651 gcc/tree.h. In particular if D is derived from B then the BINFO
1652 for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
1653 D. In tree.h, this pointer is described as pointing in other
1654 direction. There is a different BINFO for each path to a virtual
1655 base; BINFOs for virtual bases are not shared.
1657 We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
1658 inheritance is indicated by the absence of the other two flags, not
1659 by TREE_VIA_PRIVATE, which is unused. */
1661 /* Nonzero means marked by DFS or BFS search, including searches
1662 by `get_binfo' and `get_base_distance'. */
1663 #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
1664 /* Macros needed because of C compilers that don't allow conditional
1665 expressions to be lvalues. Grr! */
1666 #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
1667 #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
1669 /* Nonzero means that this class is on a path leading to a new vtable. */
1670 #define BINFO_VTABLE_PATH_MARKED(NODE) \
1671 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
1672 #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
1673 #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
1675 /* Nonzero means B (a BINFO) has its own vtable. Under the old ABI,
1676 secondary vtables are sometimes shared. Any copies will not have
1679 B is part of the hierarchy dominated by C. */
1680 #define BINFO_NEW_VTABLE_MARKED(B, C) \
1681 (TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C)))
1683 /* Any subobject that needs a new vtable must have a vptr and must not
1684 be a primary base (since it would then use the vtable from a
1686 #define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
1687 (BINFO_NEW_VTABLE_MARKED (B, C) = 1, \
1688 my_friendly_assert (!BINFO_PRIMARY_MARKED_P (B), 20000517), \
1689 my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
1692 /* Nonzero means this class has done dfs_pushdecls. */
1693 #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
1694 #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
1695 #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
1697 /* Nonzero if this BINFO is a primary base class.
1699 In the TYPE_BINFO hierarchy, this flag is never set for a base
1700 class of a non-primary virtual base. This flag is only valid for
1701 paths (given by BINFO_INHERITANCE_CHAIN) that really exist in the
1703 #define BINFO_PRIMARY_MARKED_P(NODE) \
1704 (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
1706 /* The index in the VTT where this subobject's sub-VTT can be found.
1707 NULL_TREE if there is no sub-VTT. */
1708 #define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT ((NODE), 8)
1710 /* The index in the VTT where the vptr for this subobject can be
1711 found. NULL_TREE if there is no secondary vptr in the VTT. */
1712 #define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT ((NODE), 9)
1714 /* The binfo of which NODE is a primary base. (This is different from
1715 BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is
1716 sometimes a primary base for a class for which it is not an
1718 #define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT ((NODE), 10)
1720 /* Nonzero if this binfo declares a virtual function which is
1721 overridden along a virtual path. */
1722 #define BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P(NODE) TREE_LANG_FLAG_2 (NODE)
1724 /* Nonzero if this binfo is an indirect primary base, i.e. a virtual
1725 base that is a primary base of some of other class in the
1727 #define BINFO_INDIRECT_PRIMARY_P(NODE) TREE_USED (NODE)
1729 /* Used by various search routines. */
1730 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1732 /* Accessor macros for the vfield slots in structures. */
1734 /* The virtual function pointer fields that this type contains. For a
1735 vfield defined just for this class, or from a primary base, the
1736 TREE_PURPOSE is NULL. Otherwise, the TREE_PURPOSE is the BINFO for
1737 the class containing the vfield. The TREE_VALUE is the class where
1738 the vfield was first defined. */
1739 #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
1741 /* Get the assoc info that caused this vfield to exist. */
1742 #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1744 /* Get that same information as a _TYPE. */
1745 #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1747 /* Get the value of the top-most type dominating the non-`normal' vfields. */
1748 #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
1750 /* The number of bytes by which to adjust the `this' pointer when
1751 calling this virtual function. */
1752 #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
1754 /* If non-NULL, the vtable index at which to find the vcall offset
1755 when calling this virtual function. */
1756 #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
1758 /* The function to call. */
1759 #define BV_FN(NODE) (TREE_VALUE (NODE))
1761 /* Nonzero if we should use a virtual thunk for this entry. */
1762 #define BV_USE_VCALL_INDEX_P(NODE) \
1763 (TREE_LANG_FLAG_0 (NODE))
1765 /* Nonzero if we should generate this thunk when the vtable that
1766 references it is emitted, rather than with the final overrider. */
1767 #define BV_GENERATE_THUNK_WITH_VTABLE_P(NODE) \
1768 (TREE_LANG_FLAG_1 (NODE))
1770 /* The most derived class. */
1773 /* Nonzero for TREE_LIST node means that this list of things
1774 is a list of parameters, as opposed to a list of expressions. */
1775 #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
1777 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1778 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
1779 will be NULL_TREE to indicate a throw specification of `()', or
1780 no exceptions allowed. */
1781 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
1783 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
1784 #define TYPE_NOTHROW_P(NODE) \
1785 (TYPE_RAISES_EXCEPTIONS (NODE) \
1786 && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
1788 /* The binding level associated with the namespace. */
1789 #define NAMESPACE_LEVEL(NODE) \
1790 (DECL_LANG_SPECIFIC(NODE)->decl_flags.u.level)
1793 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
1794 a lang_decl (which has lang_decl_flags as its initial prefix).
1795 This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
1796 the full lang_decl, and not just lang_decl_flags. */
1797 #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
1798 (!(TREE_CODE ((NODE)) == VAR_DECL \
1799 || TREE_CODE ((NODE)) == CONST_DECL \
1800 || TREE_CODE ((NODE)) == FIELD_DECL \
1801 || TREE_CODE ((NODE)) == USING_DECL))
1803 struct lang_decl_flags
1805 struct c_lang_decl base;
1807 ENUM_BITFIELD(languages) language : 8;
1809 unsigned operator_attr : 1;
1810 unsigned constructor_attr : 1;
1811 unsigned destructor_attr : 1;
1812 unsigned friend_attr : 1;
1813 unsigned static_function : 1;
1814 unsigned pure_virtual : 1;
1815 unsigned has_in_charge_parm_p : 1;
1816 unsigned uninlinable : 1;
1818 unsigned deferred : 1;
1819 unsigned use_template : 2;
1820 unsigned nonconverting : 1;
1821 unsigned declared_inline : 1;
1822 unsigned not_really_extern : 1;
1823 unsigned needs_final_overrider : 1;
1824 unsigned defined_in_class : 1;
1826 unsigned pending_inline_p : 1;
1827 unsigned global_ctor_p : 1;
1828 unsigned global_dtor_p : 1;
1829 unsigned tinfo_fn_p : 1;
1830 unsigned assignment_operator_p : 1;
1831 unsigned anticipated_p : 1;
1832 unsigned generate_with_vtable_p : 1;
1836 /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
1837 is DECL_TEMPLATE_INFO. */
1840 /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
1841 struct binding_level *level;
1845 /* This is DECL_ACCESS. */
1848 /* In a namespace-scope FUNCTION_DECL, this is
1849 GLOBAL_INIT_PRIORITY. */
1852 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
1853 THUNK_VCALL_OFFSET. */
1858 struct unparsed_text;
1862 struct lang_decl_flags decl_flags;
1864 tree befriending_classes;
1866 /* For a virtual FUNCTION_DECL, this is DECL_VIRTUAL_CONTEXT. For a
1867 non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT. */
1870 /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
1871 tree cloned_function;
1876 struct unparsed_text *pending_inline_info;
1877 struct cp_language_function *saved_language_function;
1881 /* In an overloaded operator, this is the value of
1882 DECL_OVERLOADED_OPERATOR_P. */
1883 enum tree_code operator_code;
1884 /* In a maybe-in-charge constructor or destructor, this is
1890 #define DEFARG_POINTER(NODE) (DEFAULT_ARG_CHECK(NODE)->identifier.pointer)
1892 /* Non-zero if NODE is a _DECL with TREE_READONLY set. */
1893 #define TREE_READONLY_DECL_P(NODE) \
1894 (TREE_READONLY (NODE) && DECL_P (NODE))
1896 /* DECL_NEEDED_P holds of a declaration when we need to emit its
1897 definition. This is true when the back-end tells us that
1898 the symbol has been referenced in the generated code. If, however,
1899 we are not generating code, then it is also true when a symbol has
1900 just been used somewhere, even if it's not really needed. We need
1901 anything that isn't comdat, but we don't know for sure whether or
1902 not something is comdat until end-of-file. */
1903 #define DECL_NEEDED_P(DECL) \
1904 ((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \
1905 || (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME ((DECL)))) \
1906 || (flag_syntax_only && TREE_USED ((DECL))))
1908 /* Non-zero iff DECL is memory-based. The DECL_RTL of
1909 certain const variables might be a CONST_INT, or a REG
1910 in some cases. We cannot use `memory_operand' as a test
1911 here because on most RISC machines, a variable's address
1912 is not, by itself, a legitimate address. */
1913 #define DECL_IN_MEMORY_P(NODE) \
1914 (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
1916 /* For FUNCTION_DECLs: return the language in which this decl
1918 #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
1920 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
1921 #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
1923 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
1925 #define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
1926 (DECL_CONSTRUCTOR_P (NODE) \
1927 && DECL_NAME (NODE) == complete_ctor_identifier)
1929 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
1931 #define DECL_BASE_CONSTRUCTOR_P(NODE) \
1932 (DECL_CONSTRUCTOR_P (NODE) \
1933 && DECL_NAME (NODE) == base_ctor_identifier)
1935 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
1936 specialized in-charge constructor or the specialized not-in-charge
1938 #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
1939 (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
1941 /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
1942 #define DECL_COPY_CONSTRUCTOR_P(NODE) \
1943 (DECL_CONSTRUCTOR_P (NODE) && copy_args_p (NODE))
1945 /* Nonzero if NODE is a destructor. */
1946 #define DECL_DESTRUCTOR_P(NODE) \
1947 (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr)
1949 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
1950 specialized in-charge constructor, in-charge deleting constructor,
1951 or the the base destructor. */
1952 #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
1953 (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
1955 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
1957 #define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
1958 (DECL_DESTRUCTOR_P (NODE) \
1959 && DECL_NAME (NODE) == complete_dtor_identifier)
1961 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
1963 #define DECL_BASE_DESTRUCTOR_P(NODE) \
1964 (DECL_DESTRUCTOR_P (NODE) \
1965 && DECL_NAME (NODE) == base_dtor_identifier)
1967 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
1968 object that deletes the object after it has been destroyed. */
1969 #define DECL_DELETING_DESTRUCTOR_P(NODE) \
1970 (DECL_DESTRUCTOR_P (NODE) \
1971 && DECL_NAME (NODE) == deleting_dtor_identifier)
1973 /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
1975 #define DECL_CLONED_FUNCTION_P(NODE) \
1976 (DECL_LANG_SPECIFIC (NODE) \
1977 && DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
1979 /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
1981 #define DECL_CLONED_FUNCTION(NODE) \
1982 (DECL_LANG_SPECIFIC (NODE)->cloned_function)
1984 /* In a maybe-in-charge constructor or destructor, this is the VTT
1985 parameter. It's not actually on the DECL_ARGUMENTS list. */
1986 #define DECL_VTT_PARM(NODE) \
1987 (DECL_LANG_SPECIFIC (NODE)->u2.vtt_parm)
1989 /* If there's a DECL_VTT_PARM, this is a magic variable that indicates
1990 whether or not the VTT parm should be used. In a subobject
1991 constructor, `true' is substituted for this value; in a complete
1992 object constructor, `false' is substituted instead. */
1993 #define DECL_USE_VTT_PARM(NODE) \
1994 (TREE_CHAIN (DECL_VTT_PARM (NODE)))
1996 /* Non-zero if NODE is a FUNCTION_DECL for which a VTT parameter is
1998 #define DECL_NEEDS_VTT_PARM_P(NODE) \
1999 (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (NODE)) \
2000 && (DECL_BASE_CONSTRUCTOR_P (NODE) \
2001 || DECL_BASE_DESTRUCTOR_P (NODE)))
2003 /* Non-zero if NODE is a user-defined conversion operator. */
2004 #define DECL_CONV_FN_P(NODE) \
2005 (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
2007 /* Set the overloaded operator code for NODE to CODE. */
2008 #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
2009 (DECL_LANG_SPECIFIC (NODE)->u2.operator_code = (CODE))
2011 /* If NODE is an overloaded operator, then this returns the TREE_CODE
2012 associcated with the overloaded operator.
2013 DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
2014 whether or not NODE is an assignment operator. If NODE is not an
2015 overloaded operator, ERROR_MARK is returned. Since the numerical
2016 value of ERROR_MARK is zero, this macro can be used as a predicate
2017 to test whether or not NODE is an overloaded operator. */
2018 #define DECL_OVERLOADED_OPERATOR_P(NODE) \
2019 (IDENTIFIER_OPNAME_P (DECL_NAME ((NODE))) \
2020 ? DECL_LANG_SPECIFIC (NODE)->u2.operator_code : ERROR_MARK)
2022 /* Non-zero if NODE is an assignment operator. */
2023 #define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
2024 (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p)
2026 /* For FUNCTION_DECLs: nonzero means that this function is a
2027 constructor or a destructor with an extra in-charge parameter to
2028 control whether or not virtual bases are constructed. */
2029 #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
2030 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p)
2032 /* Non-zero for a FUNCTION_DECL that declares a type-info function.
2033 This only happens in the old abi. */
2034 #define DECL_TINFO_FN_P(NODE) \
2035 (TREE_CODE (NODE) == FUNCTION_DECL \
2036 && DECL_ARTIFICIAL (NODE) \
2037 && DECL_LANG_SPECIFIC(NODE)->decl_flags.tinfo_fn_p)
2039 /* Mark NODE as a type-info function. */
2040 #define SET_DECL_TINFO_FN_P(NODE) \
2041 (DECL_LANG_SPECIFIC((NODE))->decl_flags.tinfo_fn_p = 1)
2043 /* Nonzero if NODE is an overloaded `operator delete[]' function. */
2044 #define DECL_ARRAY_DELETE_OPERATOR_P(NODE) \
2045 (DECL_OVERLOADED_OPERATOR_P (NODE) == VEC_DELETE_EXPR)
2047 /* Nonzero for _DECL means that this decl appears in (or will appear
2048 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
2049 detecting circularity in case members are multiply defined. In the
2050 case of a VAR_DECL, it is also used to determine how program storage
2051 should be allocated. */
2052 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
2054 /* Nonzero if the DECL was defined in the class definition itself,
2055 rather than outside the class. */
2056 #define DECL_DEFINED_IN_CLASS_P(DECL) \
2057 (DECL_LANG_SPECIFIC (DECL)->decl_flags.defined_in_class)
2059 /* Nonzero for FUNCTION_DECL means that this decl is just a
2060 friend declaration, and should not be added to the list of
2061 member functions for this class. */
2062 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
2064 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
2065 #define DECL_BEFRIENDING_CLASSES(NODE) \
2066 (DECL_LANG_SPECIFIC(NODE)->befriending_classes)
2068 /* Nonzero for FUNCTION_DECL means that this decl is a static
2070 #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
2072 /* Nonzero for a class member means that it is shared between all objects
2074 #define SHARED_MEMBER_P(NODE) \
2075 (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
2076 || TREE_CODE (NODE) == CONST_DECL)
2078 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
2080 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
2081 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
2083 /* Nonzero for FUNCTION_DECL means that this decl is a member function
2084 (static or non-static). */
2085 #define DECL_FUNCTION_MEMBER_P(NODE) \
2086 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
2088 /* Nonzero for FUNCTION_DECL means that this member function
2089 has `this' as const X *const. */
2090 #define DECL_CONST_MEMFUNC_P(NODE) \
2091 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
2092 && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
2093 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2095 /* Nonzero for FUNCTION_DECL means that this member function
2096 has `this' as volatile X *const. */
2097 #define DECL_VOLATILE_MEMFUNC_P(NODE) \
2098 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
2099 && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
2100 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2102 /* Nonzero for a DECL means that this member is a non-static member. */
2103 #define DECL_NONSTATIC_MEMBER_P(NODE) \
2104 ((TREE_CODE (NODE) == FUNCTION_DECL \
2105 && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
2106 || TREE_CODE (NODE) == FIELD_DECL)
2108 /* Nonzero for _DECL means that this member object type
2110 #define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
2112 /* Nonzero for _DECL means that this constructor is a non-converting
2114 #define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
2116 /* Nonzero for FUNCTION_DECL means that this member function is a pure
2117 virtual function. */
2118 #define DECL_PURE_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.pure_virtual)
2120 /* Nonzero for FUNCTION_DECL means that this member function
2121 must be overridden by derived classes. */
2122 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
2124 /* Nonzero if NODE is a thunk, rather than an ordinary function. */
2125 #define DECL_THUNK_P(NODE) \
2126 (TREE_CODE (NODE) == FUNCTION_DECL \
2127 && DECL_LANG_FLAG_7 (NODE))
2129 /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
2130 #define DECL_NON_THUNK_FUNCTION_P(NODE) \
2131 (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
2133 /* Nonzero if NODE is `extern "C"'. */
2134 #define DECL_EXTERN_C_P(NODE) \
2135 (DECL_LANGUAGE (NODE) == lang_c)
2137 /* Nonzero if NODE is an `extern "C"' function. */
2138 #define DECL_EXTERN_C_FUNCTION_P(NODE) \
2139 (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
2141 /* Set DECL_THUNK_P for node. */
2142 #define SET_DECL_THUNK_P(NODE) \
2143 (DECL_LANG_FLAG_7 (NODE) = 1)
2145 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
2146 template function. */
2147 #define DECL_PRETTY_FUNCTION_P(NODE) \
2148 (TREE_LANG_FLAG_0 (NODE))
2150 /* The _TYPE context in which this _DECL appears. This field holds the
2151 class where a virtual function instance is actually defined. */
2152 #define DECL_CLASS_CONTEXT(NODE) \
2153 (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
2155 /* For a non-member friend function, the class (if any) in which this
2156 friend was defined. For example, given:
2158 struct S { friend void f (); };
2160 the DECL_FRIEND_CONTEXT for `f' will be `S'. */
2161 #define DECL_FRIEND_CONTEXT(NODE) \
2162 ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
2163 ? DECL_LANG_SPECIFIC (NODE)->context \
2166 /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
2167 #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
2168 (DECL_LANG_SPECIFIC (NODE)->context = (CONTEXT))
2170 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
2171 #define CP_DECL_CONTEXT(NODE) \
2172 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
2173 #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
2175 /* For a virtual function, the base where we find its vtable entry.
2176 For a non-virtual function, the base where it is defined. */
2177 #define DECL_VIRTUAL_CONTEXT(NODE) \
2178 (DECL_LANG_SPECIFIC (NODE)->context)
2180 /* 1 iff NODE has namespace scope, including the global namespace. */
2181 #define DECL_NAMESPACE_SCOPE_P(NODE) \
2182 (!DECL_TEMPLATE_PARM_P (NODE) \
2183 && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
2185 /* 1 iff NODE is a class member. */
2186 #define DECL_CLASS_SCOPE_P(NODE) \
2187 (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
2189 /* 1 iff NODE is function-local. */
2190 #define DECL_FUNCTION_SCOPE_P(NODE) \
2191 (DECL_CONTEXT (NODE) \
2192 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
2194 /* 1 iff NODE is function-local, but for types. */
2195 #define LOCAL_CLASS_P(NODE) \
2196 (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
2198 /* For a NAMESPACE_DECL: the list of using namespace directives
2199 The PURPOSE is the used namespace, the value is the namespace
2200 that is the common ancestor. */
2201 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
2203 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
2204 of a namespace, to record the transitive closure of using namespace. */
2205 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
2207 /* In a NAMESPACE_DECL, points to the original namespace if this is
2208 a namespace alias. */
2209 #define DECL_NAMESPACE_ALIAS(NODE) \
2210 DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
2211 #define ORIGINAL_NAMESPACE(NODE) \
2212 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
2214 /* Non-zero if NODE is the std namespace. */
2215 #define DECL_NAMESPACE_STD_P(NODE) \
2216 (TREE_CODE (NODE) == NAMESPACE_DECL \
2217 && CP_DECL_CONTEXT (NODE) == global_namespace \
2218 && DECL_NAME (NODE) == std_identifier)
2220 /* In a non-local VAR_DECL with static storage duration, this is the
2221 initialization priority. If this value is zero, the NODE will be
2222 initialized at the DEFAULT_INIT_PRIORITY. */
2223 #define DECL_INIT_PRIORITY(NODE) (VAR_DECL_CHECK (NODE)->decl.u2.i)
2225 /* In a TREE_LIST concatenating using directives, indicate indirect
2227 #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
2229 /* In a VAR_DECL for a variable declared in a for statement,
2230 this is the shadowed (local) variable. */
2231 #define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT_FLD(VAR_DECL_CHECK (NODE))
2233 /* In a FUNCTION_DECL, this is nonzero if this function was defined in
2234 the class definition. We have saved away the text of the function,
2235 but have not yet processed it. */
2236 #define DECL_PENDING_INLINE_P(NODE) \
2237 (DECL_LANG_SPECIFIC (NODE)->decl_flags.pending_inline_p)
2239 /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
2241 #define DECL_PENDING_INLINE_INFO(NODE) \
2242 (DECL_LANG_SPECIFIC(NODE)->u.pending_inline_info)
2244 /* For a TYPE_DECL: if this function has many fields, we'll sort them
2245 and put them into a TREE_VEC. */
2246 #define DECL_SORTED_FIELDS(NODE) \
2247 (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.sorted_fields)
2249 /* True if on the deferred_fns (see decl2.c) list. */
2250 #define DECL_DEFERRED_FN(DECL) \
2251 (DECL_LANG_SPECIFIC(DECL)->decl_flags.deferred)
2253 /* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL:
2254 template-specific information. */
2255 #define DECL_TEMPLATE_INFO(NODE) \
2256 (DECL_LANG_SPECIFIC(VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE))->decl_flags.u.template_info)
2258 /* Template information for a RECORD_TYPE or UNION_TYPE. */
2259 #define CLASSTYPE_TEMPLATE_INFO(NODE) \
2260 (TYPE_LANG_SPECIFIC(RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
2262 /* Template information for an ENUMERAL_TYPE. Although an enumeration may
2263 not be a primary template, it may be declared within the scope of a
2264 primary template and the enumeration constants may depend on
2265 non-type template parameters. */
2266 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
2268 /* Template information for a bound template template parameter. */
2269 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
2271 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2272 #define TYPE_TEMPLATE_INFO(NODE) \
2273 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2274 ? ENUM_TEMPLATE_INFO (NODE) : \
2275 (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
2276 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
2277 (TYPE_LANG_SPECIFIC (NODE) \
2278 ? CLASSTYPE_TEMPLATE_INFO (NODE) \
2281 /* Set the template information for an ENUMERAL_, RECORD_, or
2282 UNION_TYPE to VAL. */
2283 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
2284 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2285 ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \
2286 : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
2288 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
2289 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
2290 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
2292 /* We use TREE_VECs to hold template arguments. If there is only one
2293 level of template arguments, then the TREE_VEC contains the
2294 arguments directly. If there is more than one level of template
2295 arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
2296 containing the template arguments for a single level. The first
2297 entry in the outer TREE_VEC is the outermost level of template
2298 parameters; the last is the innermost.
2300 It is incorrect to ever form a template argument vector containing
2301 only one level of arguments, but which is a TREE_VEC containing as
2302 its only entry the TREE_VEC for that level. */
2304 /* Non-zero if the template arguments is actually a vector of vectors,
2305 rather than just a vector. */
2306 #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
2307 (NODE != NULL_TREE \
2308 && TREE_CODE (NODE) == TREE_VEC \
2309 && TREE_VEC_LENGTH (NODE) > 0 \
2310 && TREE_VEC_ELT (NODE, 0) != NULL_TREE \
2311 && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
2313 /* The depth of a template argument vector. When called directly by
2314 the parser, we use a TREE_LIST rather than a TREE_VEC to represent
2315 template arguments. In fact, we may even see NULL_TREE if there
2316 are no template arguments. In both of those cases, there is only
2317 one level of template arguments. */
2318 #define TMPL_ARGS_DEPTH(NODE) \
2319 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
2321 /* The LEVELth level of the template ARGS. The outermost level of of
2322 args is level 1, not level 0. */
2323 #define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
2324 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
2325 ? TREE_VEC_ELT ((ARGS), (LEVEL) - 1) : ARGS)
2327 /* Set the LEVELth level of the template ARGS to VAL. This macro does
2328 not work with single-level argument vectors. */
2329 #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
2330 (TREE_VEC_ELT ((ARGS), (LEVEL) - 1) = (VAL))
2332 /* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
2333 #define TMPL_ARG(ARGS, LEVEL, IDX) \
2334 (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
2336 /* Set the IDXth element in the LEVELth level of ARGS to VAL. This
2337 macro does not work with single-level argument vectors. */
2338 #define SET_TMPL_ARG(ARGS, LEVEL, IDX, VAL) \
2339 (TREE_VEC_ELT (TREE_VEC_ELT ((ARGS), (LEVEL) - 1), (IDX)) = (VAL))
2341 /* Given a single level of template arguments in NODE, return the
2342 number of arguments. */
2343 #define NUM_TMPL_ARGS(NODE) \
2344 ((NODE) == NULL_TREE ? 0 \
2345 : (TREE_CODE (NODE) == TREE_VEC \
2346 ? TREE_VEC_LENGTH (NODE) : list_length (NODE)))
2348 /* Returns the innermost level of template arguments in ARGS. */
2349 #define INNERMOST_TEMPLATE_ARGS(NODE) \
2350 (get_innermost_template_args ((NODE), 1))
2352 /* The number of levels of template parameters given by NODE. */
2353 #define TMPL_PARMS_DEPTH(NODE) \
2354 (TREE_INT_CST_HIGH (TREE_PURPOSE (NODE)))
2356 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
2357 TEMPLATE_DECL will be the immediate parent, not the most general
2358 template. For example, in:
2360 template <class T> struct S { template <class U> void f(U); }
2362 the FUNCTION_DECL for S<int>::f<double> will have, as its
2363 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
2365 As a special case, for a member friend template of a template
2366 class, this value will not be a TEMPLATE_DECL, but rather a
2367 LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
2368 and any explicit template arguments provided. For example, in:
2370 template <class T> struct S { friend void f<int>(int, double); }
2372 the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
2373 DECL_TI_ARGS will be {int}. */
2374 #define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
2376 /* The template arguments used to obtain this decl from the most
2377 general form of DECL_TI_TEMPLATE. For the example given for
2378 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
2379 are always the full set of arguments required to instantiate this
2380 declaration from the most general template specialized here. */
2381 #define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
2382 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
2383 #define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
2384 #define ENUM_TI_TEMPLATE(NODE) \
2385 TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
2386 #define ENUM_TI_ARGS(NODE) \
2387 TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
2389 /* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2390 #define TYPE_TI_TEMPLATE(NODE) \
2391 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
2393 /* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2394 #define TYPE_TI_ARGS(NODE) \
2395 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
2397 #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE)
2399 /* Nonzero if the NODE corresponds to the template parameters for a
2400 member template, whose inline definition is being processed after
2401 the class definition is complete. */
2402 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
2404 /* In a FUNCTION_DECL, the saved language-specific per-function data. */
2405 #define DECL_SAVED_FUNCTION_DATA(NODE) \
2406 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->u.saved_language_function)
2408 #define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
2409 #define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
2410 #define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
2411 #define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
2413 /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
2414 constructor call, rather than an ordinary function call. */
2415 #define AGGR_INIT_VIA_CTOR_P(NODE) \
2416 TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
2418 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
2419 TEMPLATE_DECL. This macro determines whether or not a given class
2420 type is really a template type, as opposed to an instantiation or
2421 specialization of one. */
2422 #define CLASSTYPE_IS_TEMPLATE(NODE) \
2423 (CLASSTYPE_TEMPLATE_INFO (NODE) \
2424 && !CLASSTYPE_USE_TEMPLATE (NODE) \
2425 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
2427 /* The name used by the user to name the typename type. Typically,
2428 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
2429 corresponding TYPE_DECL. However, this may also be a
2430 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
2431 #define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE)
2433 /* Nonzero if NODE is an implicit typename. */
2434 #define IMPLICIT_TYPENAME_P(NODE) \
2435 (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
2437 /* Nonzero if NODE is a TYPE_DECL that should not be visible because
2438 it is from a dependent base class. */
2439 #define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE) \
2440 (TREE_CODE (NODE) == TYPE_DECL \
2441 && DECL_ARTIFICIAL (NODE) \
2442 && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
2444 /* Nonzero in INTEGER_CST means that this int is negative by dint of
2445 using a twos-complement negated operand. */
2446 #define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
2448 /* Nonzero in any kind of _TYPE where conversions to base-classes may
2449 involve pointer arithmetic. If this is zero, then converting to
2450 a base-class never requires changing the value of the pointer. */
2451 #define TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P(NODE) (TREE_LANG_FLAG_1 (NODE))
2455 A class that declares or inherits a virtual function is called a
2456 polymorphic class. */
2457 #define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
2459 /* Nonzero if this class has a virtual function table pointer. */
2460 #define TYPE_CONTAINS_VPTR_P(NODE) \
2461 (TYPE_POLYMORPHIC_P (NODE) \
2462 || (vbase_offsets_in_vtable_p () \
2463 && TYPE_USES_VIRTUAL_BASECLASSES (NODE)))
2465 extern int flag_new_for_scope;
2467 /* This flag is true of a local VAR_DECL if it was declared in a for
2468 statement, but we are no longer in the scope of the for. */
2469 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
2471 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
2472 if we already emitted a warning about using it. */
2473 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
2475 /* Nonzero if NODE is a FUNCTION_DECL (for a function with global
2476 scope) declared in a local scope. */
2477 #define DECL_LOCAL_FUNCTION_P(NODE) \
2478 DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
2480 /* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have
2481 not yet seen a prototype for that function. */
2482 #define DECL_ANTICIPATED(NODE) \
2483 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))->decl_flags.anticipated_p)
2485 /* Record whether a typedef for type `int' was actually `signed int'. */
2486 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
2488 /* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */
2489 #define DECL_C_BIT_FIELD(NODE) \
2490 (DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) == 1)
2491 #define SET_DECL_C_BIT_FIELD(NODE) \
2492 (DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) = 1)
2493 #define CLEAR_DECL_C_BIT_FIELD(NODE) \
2494 (DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE)) = 0)
2496 /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */
2497 #define DECL_UNINLINABLE(NODE) \
2498 (DECL_LANG_SPECIFIC (NODE)->decl_flags.uninlinable)
2500 #define INTEGRAL_CODE_P(CODE) \
2501 (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
2503 /* [basic.fundamental]
2505 Types bool, char, wchar_t, and the signed and unsigned integer types
2506 are collectively called integral types.
2508 Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
2509 types as well, which is incorrect in C++. */
2510 #define CP_INTEGRAL_TYPE_P(TYPE) \
2511 (TREE_CODE ((TYPE)) == BOOLEAN_TYPE \
2512 || TREE_CODE ((TYPE)) == INTEGER_TYPE)
2514 /* [basic.fundamental]
2516 Integral and floating types are collectively called arithmetic
2518 #define ARITHMETIC_TYPE_P(TYPE) \
2519 (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
2521 /* Nonzero for _TYPE means that the _TYPE defines
2522 at least one constructor. */
2523 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
2525 /* When appearing in an INDIRECT_REF, it means that the tree structure
2526 underneath is actually a call to a constructor. This is needed
2527 when the constructor must initialize local storage (which can
2528 be automatically destroyed), rather than allowing it to allocate
2529 space from the heap.
2531 When appearing in a SAVE_EXPR, it means that underneath
2532 is a call to a constructor.
2534 When appearing in a CONSTRUCTOR, it means that it was
2535 a GNU C constructor expression.
2537 When appearing in a FIELD_DECL, it means that this field
2538 has been duly initialized in its constructor. */
2539 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
2541 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
2542 && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
2543 && ! TREE_HAS_CONSTRUCTOR (NODE))
2545 /* Nonzero for _TYPE means that the _TYPE defines a destructor. */
2546 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
2548 /* Nonzero means that an object of this type can not be initialized using
2549 an initializer list. */
2550 #define CLASSTYPE_NON_AGGREGATE(NODE) \
2551 (TYPE_LANG_SPECIFIC (NODE)->non_aggregate)
2552 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
2553 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
2555 /* Nonzero if there is a user-defined X::op=(x&) for this class. */
2556 #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_real_assign_ref)
2557 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_assign_ref)
2558 #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_abstract_assign_ref)
2559 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->has_complex_init_ref)
2561 /* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
2563 A destructor is trivial if it is an implicitly declared
2566 - all of the direct base classes of its class have trivial
2569 - for all of the non-static data members of its class that are
2570 of class type (or array thereof), each such class has a
2571 trivial destructor. */
2572 #define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
2573 (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
2575 /* Nonzero for _TYPE node means that this type does not have a trivial
2576 destructor. Therefore, destroying an object of this type will
2577 involve a call to a destructor. This can apply to objects of
2578 ARRAY_TYPE is the type of the elements needs a destructor. */
2579 #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
2580 (TYPE_LANG_FLAG_4(NODE))
2582 /* Nonzero for class type means that initialization of this type can use
2584 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
2585 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
2587 /* Nonzero for class type means that assignment of this type can use
2589 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
2590 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
2592 #define TYPE_PTRMEM_P(NODE) \
2593 (TREE_CODE (NODE) == POINTER_TYPE \
2594 && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
2595 #define TYPE_PTR_P(NODE) \
2596 (TREE_CODE (NODE) == POINTER_TYPE \
2597 && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
2598 #define TYPE_PTROB_P(NODE) \
2599 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
2600 && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
2601 #define TYPE_PTROBV_P(NODE) \
2602 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
2603 #define TYPE_PTRFN_P(NODE) \
2604 (TREE_CODE (NODE) == POINTER_TYPE \
2605 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2607 /* Nonzero for _TYPE node means that this type is a pointer to member
2609 #define TYPE_PTRMEMFUNC_P(NODE) \
2610 (TREE_CODE(NODE) == RECORD_TYPE \
2611 && TYPE_LANG_SPECIFIC(NODE) \
2612 && TYPE_PTRMEMFUNC_FLAG (NODE))
2614 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
2615 (TYPE_LANG_SPECIFIC(NODE)->ptrmemfunc_flag)
2617 /* Indicates when overload resolution may resolve to a pointer to
2618 member function. [expr.unary.op]/3 */
2619 #define PTRMEM_OK_P(NODE) TREE_LANG_FLAG_0 (NODE)
2621 /* A pointer-to-function member type looks like:
2632 where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
2633 pointer to member. The fields are used as follows:
2635 If __INDEX is -1, then the function to call is non-virtual, and
2636 is located at the address given by __PFN.
2638 If __INDEX is zero, then this a NULL pointer-to-member.
2640 Otherwise, the function to call is virtual. Then, __DELTA2 gives
2641 the offset from an instance of the object to the virtual function
2642 table, and __INDEX - 1 is the index into the vtable to use to
2645 The value to use for the THIS parameter is the address of the
2646 object plus __DELTA.
2659 struct S : public B1, B2 {};
2661 the pointer-to-member for `&S::f' looks like:
2663 { 4, -1, { &f__2B2 } };
2665 The `4' means that given an `S*' you have to add 4 bytes to get to
2666 the address of the `B2*'. Then, the -1 indicates that this is a
2667 non-virtual function. Of course, `&f__2B2' is the name of that
2670 (Of course, the exact values may differ depending on the mangling
2671 scheme, sizes of types, and such.).
2673 Under the new ABI, we do:
2680 (We don't need DELTA2, because the vtable is always the first thing
2681 in the object.) If the function is virtual, then PFN is one plus
2682 twice the index into the vtable; otherwise, it is just a pointer to
2685 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
2686 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
2687 before using this macro. */
2688 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
2690 ? (TREE_TYPE (TYPE_FIELDS (NODE))) \
2691 : (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE))))))))
2693 /* Returns `A' for a type like `int (A::*)(double)' */
2694 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
2695 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
2697 /* These are use to manipulate the canonical RECORD_TYPE from the
2698 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
2699 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
2700 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
2701 /* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
2702 #define DELTA2_FROM_PTRMEMFUNC(NODE) delta2_from_ptrmemfunc ((NODE))
2703 #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
2705 /* For a pointer-to-member type of the form `T X::*', this is `X'. */
2706 #define TYPE_PTRMEM_CLASS_TYPE(NODE) \
2707 (TYPE_PTRMEM_P ((NODE)) \
2708 ? TYPE_OFFSET_BASETYPE (TREE_TYPE ((NODE))) \
2709 : TYPE_PTRMEMFUNC_OBJECT_TYPE ((NODE)))
2711 /* For a pointer-to-member type of the form `T X::*', this is `T'. */
2712 #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
2713 (TYPE_PTRMEM_P ((NODE)) \
2714 ? TREE_TYPE (TREE_TYPE (NODE)) \
2715 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE ((NODE))))
2717 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
2719 #define PTRMEM_CST_CLASS(NODE) \
2720 TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
2722 /* For a pointer-to-member constant `X::Y' this is the _DECL for
2724 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
2726 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
2727 specified in its declaration. This can also be set for an
2728 erroneously declared PARM_DECL. */
2729 #define DECL_THIS_EXTERN(NODE) \
2730 DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
2732 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
2733 specified in its declaration. This can also be set for an
2734 erroneously declared PARM_DECL. */
2735 #define DECL_THIS_STATIC(NODE) \
2736 DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
2738 /* Nonzero if TYPE is an anonymous union or struct type. We have to use a
2739 flag for this because "A union for which objects or pointers are
2740 declared is not an anonymous union" [class.union]. */
2741 #define ANON_AGGR_TYPE_P(NODE) \
2742 (CLASS_TYPE_P (NODE) && TYPE_LANG_SPECIFIC (NODE)->anon_aggr)
2743 #define SET_ANON_AGGR_TYPE_P(NODE) \
2744 (TYPE_LANG_SPECIFIC (NODE)->anon_aggr = 1)
2746 /* Nonzero if TYPE is an anonymous union type. */
2747 #define ANON_UNION_TYPE_P(NODE) \
2748 (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
2750 #define UNKNOWN_TYPE LANG_TYPE
2752 /* Define fields and accessors for nodes representing declared names. */
2754 #define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->was_anonymous)
2756 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
2758 /* The format of each node in the DECL_FRIENDLIST is as follows:
2760 The TREE_PURPOSE will be the name of a function, i.e., an
2761 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the
2762 list of functions with that name which are friends. The
2763 TREE_PURPOSE of each node in this sublist will be error_mark_node,
2764 if the function was declared a friend individually, in which case
2765 the TREE_VALUE will be the function_decl. If, however, all
2766 functions with a given name in a class were declared to be friends,
2767 the TREE_PUROSE will be the class type, and the TREE_VALUE will be
2769 #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
2770 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
2771 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
2773 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
2774 each node is a type; the TREE_VALUE is the access granted for this
2775 DECL in that type. The DECL_ACCESS is set by access declarations.
2776 For example, if a member that would normally be public in a
2777 derived class is made protected, then the derived class and the
2778 protected_access_node will appear in the DECL_ACCESS for the node. */
2779 #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.u2.access)
2781 /* Nonzero if the FUNCTION_DECL is a global constructor. */
2782 #define DECL_GLOBAL_CTOR_P(NODE) \
2783 (DECL_LANG_SPECIFIC ((NODE))->decl_flags.global_ctor_p)
2785 /* Nonzero if the FUNCTION_DECL is a global destructor. */
2786 #define DECL_GLOBAL_DTOR_P(NODE) \
2787 (DECL_LANG_SPECIFIC ((NODE))->decl_flags.global_dtor_p)
2789 /* If DECL_GLOBAL_CTOR_P or DECL_GLOBAL_DTOR_P holds, this macro
2790 returns the initialization priority for the function. Constructors
2791 with lower numbers should be run first. Destructors should be run
2792 in the reverse order of constructors. */
2793 #define GLOBAL_INIT_PRIORITY(NODE) \
2794 (DECL_LANG_SPECIFIC ((NODE))->decl_flags.u2.init_priority)
2796 /* Accessor macros for C++ template decl nodes. */
2798 /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
2799 is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
2800 template parameters, with 1 being the outermost set of template
2801 parameters. The TREE_VALUE is a vector, whose elements are the
2802 template parameters at each level. Each element in the vector is a
2803 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
2804 non-type parameter), or a TYPE_DECL (if the parameter is a type
2805 parameter). The TREE_PURPOSE is the default value, if any. The
2806 TEMPLATE_PARM_INDEX for the parameter is avilable as the
2807 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
2809 #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
2810 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
2811 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
2812 #define DECL_NTPARMS(NODE) \
2813 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
2814 /* For function, method, class-data templates. */
2815 #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD(NODE)
2816 /* For a static member variable template, the
2817 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
2818 implicitly generated instantiations of the variable. There are no
2819 partial instantiations of static member variables, so all of these
2820 will be full instantiations.
2822 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
2823 all instantiations and specializations of the class type, including
2824 partial instantiations and partial specializations.
2826 In both cases, the TREE_PURPOSE of each node contains the arguments
2827 used; the TREE_VALUE contains the generated variable. The template
2828 arguments are always complete. For example, given:
2830 template <class T> struct S1 {
2831 template <class U> struct S2 {};
2832 template <class U> struct S2<U*> {};
2835 the record for the partial specialization will contain, as its
2836 argument list, { {T}, {U*} }, and will be on the
2837 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
2838 <class U> struct S1<T>::S2'.
2840 This list is not used for function templates. */
2841 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
2842 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
2843 contains all instantiations and specializations of the function,
2844 including partial instantiations. For a partial instantiation
2845 which is a specialization, this list holds only full
2846 specializations of the template that are instantiations of the
2847 partial instantiation. For example, given:
2849 template <class T> struct S {
2850 template <class U> void f(U);
2851 template <> void f(T);
2854 the `S<int>::f<int>(int)' function will appear on the
2855 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
2856 template <class U> void S<T>::f(U)' and `template <class T> void
2857 S<int>::f(T)'. In the latter case, however, it will have only the
2858 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
2859 for the function declaration will point at the specialization, not
2860 the fully general template.
2862 For a class template, this list contains the partial
2863 specializations of this template. (Full specializations are not
2864 recorded on this list.) The TREE_PURPOSE holds the innermost
2865 arguments used in the partial specialization (e.g., for `template
2866 <class T> struct S<T*, int>' this will be `T*'.) The TREE_VALUE
2867 holds the innermost template parameters for the specialization
2868 (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node
2869 for the partial specialization.
2871 This list is not used for static variable templates. */
2872 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE)
2874 /* Nonzero for a DECL which is actually a template parameter. */
2875 #define DECL_TEMPLATE_PARM_P(NODE) \
2876 (DECL_LANG_FLAG_0 (NODE) \
2877 && (TREE_CODE (NODE) == CONST_DECL \
2878 || TREE_CODE (NODE) == TYPE_DECL \
2879 || TREE_CODE (NODE) == TEMPLATE_DECL))
2881 /* Mark NODE as a template parameter. */
2882 #define SET_DECL_TEMPLATE_PARM_P(NODE) \
2883 (DECL_LANG_FLAG_0 (NODE) = 1)
2885 /* Nonzero if NODE is a template template parameter. */
2886 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
2887 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
2889 #define DECL_FUNCTION_TEMPLATE_P(NODE) \
2890 (TREE_CODE (NODE) == TEMPLATE_DECL \
2891 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
2893 /* Nonzero for a DECL that represents a template class. */
2894 #define DECL_CLASS_TEMPLATE_P(NODE) \
2895 (TREE_CODE (NODE) == TEMPLATE_DECL \
2896 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
2897 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
2899 /* Nonzero if NODE which declares a type. */
2900 #define DECL_DECLARES_TYPE_P(NODE) \
2901 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
2903 /* Nonzero if NODE is the typedef implicitly generated for a type when
2904 the type is declared. (In C++, `struct S {};' is roughly equivalent
2905 to `struct S {}; typedef struct S S;' in C. This macro will hold
2906 for the typedef indicated in this example. Note that in C++, there
2907 is a second implicit typedef for each class, in the scope of `S'
2908 itself, so that you can say `S::S'. This macro does *not* hold for
2910 #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
2911 (TREE_CODE ((NODE)) == TYPE_DECL && DECL_LANG_FLAG_2 ((NODE)))
2912 #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
2913 (DECL_LANG_FLAG_2 ((NODE)) = 1)
2915 /* A `primary' template is one that has its own template header. A
2916 member function of a class template is a template, but not primary.
2917 A member template is primary. Friend templates are primary, too. */
2919 /* Returns the primary template corresponding to these parameters. */
2920 #define DECL_PRIMARY_TEMPLATE(NODE) \
2921 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
2923 /* Returns non-zero if NODE is a primary template. */
2924 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
2926 #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
2927 (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
2929 /* Indicates whether or not (and how) a template was expanded for this
2930 FUNCTION_DECL or VAR_DECL.
2931 0=normal declaration, e.g. int min (int, int);
2932 1=implicit template instantiation
2933 2=explicit template specialization, e.g. int min<int> (int, int);
2934 3=explicit template instantiation, e.g. template int min<int> (int, int); */
2935 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
2937 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
2938 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
2939 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
2941 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
2942 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
2943 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2944 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
2945 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2946 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
2948 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
2949 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
2950 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2951 (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
2952 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2953 (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
2955 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
2956 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
2957 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2958 (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
2959 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2960 (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
2962 /* Non-zero if DECL is a friend function which is an instantiation
2963 from the point of view of the compiler, but not from the point of
2964 view of the language. For example given:
2965 template <class T> struct S { friend void f(T) {}; };
2966 the declaration of `void f(int)' generated when S<int> is
2967 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
2968 a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
2969 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
2970 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
2972 /* Non-zero if TYPE is a partial instantiation of a template class,
2973 i.e., an instantiation whose instantiation arguments involve
2975 #define PARTIAL_INSTANTIATION_P(TYPE) \
2976 (TYPE_LANG_SPECIFIC (TYPE)->is_partial_instantiation)
2978 /* Non-zero iff we are currently processing a declaration for an
2979 entity with its own template parameter list, and which is not a
2980 full specialization. */
2981 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
2982 (processing_template_decl > template_class_depth (current_class_type))
2984 /* This function may be a guiding decl for a template. */
2985 #define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
2987 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
2988 instantiated, i.e. its definition has been generated from the
2989 pattern given in the the template. */
2990 #define DECL_TEMPLATE_INSTANTIATED(NODE) \
2991 DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
2993 /* We know what we're doing with this decl now. */
2994 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
2996 /* This function was declared inline. This flag controls the linkage
2997 semantics of 'inline'; whether or not the function is inlined is
2998 controlled by DECL_INLINE. */
2999 #define DECL_THIS_INLINE(NODE) \
3000 (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
3002 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
3003 so that assemble_external will work properly. So we have this flag to
3004 tell us whether the decl is really not external. */
3005 #define DECL_NOT_REALLY_EXTERN(NODE) \
3006 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
3008 #define DECL_REALLY_EXTERN(NODE) \
3009 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
3011 /* A thunk is a stub function.
3013 A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
3014 The address of the ordinary FUNCTION_DECL is given by the
3015 DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
3016 FUNCTION_DECL. The job of the thunk is to adjust the `this'
3017 pointer before transferring control to the FUNCTION_DECL.
3019 A thunk may perform either, or both, of the following operations:
3021 o Adjust the `this' pointer by a constant offset.
3022 o Adjust the `this' pointer by looking up a vcall-offset
3025 If both operations are performed, then the constant adjument to
3026 `this' is performed first.
3028 The constant adjustment is given by THUNK_DELTA. If the
3029 vcall-offset is required, the index into the vtable is given by
3030 THUNK_VCALL_OFFSET. */
3032 /* An integer indicating how many bytes should be subtracted from the
3033 `this' pointer when this function is called. */
3034 #define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i)
3036 /* A tree indicating how many bytes should be subtracted from the
3037 vtable for the `this' pointer to find the vcall offset. (The vptr
3038 is always located at offset zero from the f `this' pointer.) If
3039 NULL, then there is no vcall offset. */
3040 #define THUNK_VCALL_OFFSET(DECL) \
3041 (DECL_LANG_SPECIFIC (DECL)->decl_flags.u2.vcall_offset)
3043 /* Nonzero if this thunk should be generated with the vtable that
3045 #define THUNK_GENERATE_WITH_VTABLE_P(DECL) \
3046 (DECL_LANG_SPECIFIC (DECL)->decl_flags.generate_with_vtable_p)
3048 /* These macros provide convenient access to the various _STMT nodes
3049 created when parsing template declarations. */
3050 #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
3051 #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
3053 /* Nonzero if this try block is a function try block. */
3054 #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
3055 #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
3056 #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
3057 #define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (SUBOBJECT_CHECK (NODE), 0)
3058 #define START_CATCH_TYPE(NODE) TREE_TYPE (START_CATCH_STMT_CHECK (NODE))
3061 /* Nonzero if this CTOR_STMT is for the beginning of a constructor. */
3062 #define CTOR_BEGIN_P(NODE) \
3063 (TREE_LANG_FLAG_0 (CTOR_STMT_CHECK (NODE)))
3065 /* Nonzero if this CTOR_STMT is for the end of a constructor. */
3066 #define CTOR_END_P(NODE) \
3067 (!CTOR_BEGIN_P (NODE))
3069 /* The parameters for a call-declarator. */
3070 #define CALL_DECLARATOR_PARMS(NODE) \
3071 (TREE_PURPOSE (TREE_OPERAND ((NODE), 1)))
3073 /* The cv-qualifiers for a call-declarator. */
3074 #define CALL_DECLARATOR_QUALS(NODE) \
3075 (TREE_VALUE (TREE_OPERAND ((NODE), 1)))
3077 /* The exception-specification for a call-declarator. */
3078 #define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \
3079 (TREE_TYPE ((NODE)))
3081 /* An enumeration of the kind of tags that C++ accepts. */
3082 enum tag_types { record_type, class_type, union_type, enum_type };
3084 /* The various kinds of lvalues we distinguish. */
3085 typedef enum cp_lvalue_kind {
3086 clk_none = 0, /* Things that are not an lvalue. */
3087 clk_ordinary = 1, /* An ordinary lvalue. */
3088 clk_class = 2, /* An rvalue of class-type. */
3089 clk_bitfield = 4, /* An lvalue for a bit-field. */
3092 /* The kinds of scopes we recognize. */
3093 typedef enum scope_kind {
3094 sk_template_parms, /* A scope for template parameters. */
3095 sk_template_spec /* A scope corresponding to a template
3096 specialization. There is never anything in
3100 /* Various kinds of template specialization, instantiation, etc. */
3101 typedef enum tmpl_spec_kind {
3102 tsk_none, /* Not a template at all. */
3103 tsk_invalid_member_spec, /* An explicit member template
3104 specialization, but the enclosing
3105 classes have not all been explicitly
3107 tsk_invalid_expl_inst, /* An explicit instantiation containing
3108 template parameter lists. */
3109 tsk_excessive_parms, /* A template declaration with too many
3110 template parameter lists. */
3111 tsk_insufficient_parms, /* A template declaration with too few
3113 tsk_template, /* A template declaration. */
3114 tsk_expl_spec, /* An explicit specialization. */
3115 tsk_expl_inst /* An explicit instantiation. */
3118 /* The various kinds of access. BINFO_ACCESS depends on these being
3119 two bit quantities. The numerical values are important; they are
3120 used to initialize RTTI data structures, so changing them changes
3122 typedef enum access_kind {
3123 ak_none = 0, /* Inaccessible. */
3124 ak_public = 1, /* Accessible, as a `public' thing. */
3125 ak_protected = 2, /* Accessible, as a `protected' thing. */
3126 ak_private = 3 /* Accessible, as a `private' thing. */
3129 /* The various kinds of special functions. If you add to this list,
3130 you should update special_function_p as well. */
3131 typedef enum special_function_kind {
3132 sfk_none = 0, /* Not a special function. This enumeral
3133 must have value zero; see
3134 special_function_p. */
3135 sfk_constructor, /* A constructor. */
3136 sfk_copy_constructor, /* A copy constructor. */
3137 sfk_assignment_operator, /* An assignment operator. */
3138 sfk_destructor, /* A destructor. */
3139 sfk_complete_destructor, /* A destructor for complete objects. */
3140 sfk_base_destructor, /* A destructor for base subobjects. */
3141 sfk_deleting_destructor, /* A destructor for complete objects that
3142 deletes the object after it has been
3144 sfk_conversion /* A conversion operator. */
3145 } special_function_kind;
3147 /* Bitmask flags to pass to instantiate_type. */
3148 typedef enum instantiate_type_flags {
3149 itf_none = 0, /* nothing special */
3150 itf_complain = 1 << 0, /* complain about errors */
3151 itf_no_attributes = 1 << 1, /* ignore attributes on comparisons */
3152 itf_ptrmem_ok = 1 << 2, /* pointers to member ok (internal use) */
3153 } instantiate_type_flags;
3155 /* Non-zero means that if a label exists, and no other identifier
3156 applies, use the value of the label. */
3157 extern int flag_labels_ok;
3159 /* Nonzero means allow Microsoft extensions without a pedwarn. */
3160 extern int flag_ms_extensions;
3162 /* Non-zero means warn in function declared in derived class has the
3163 same name as a virtual in the base class, but fails to match the
3164 type signature of any virtual function in the base class. */
3165 extern int warn_overloaded_virtual;
3167 /* Nonzero means warn about use of multicharacter literals. */
3168 extern int warn_multichar;
3170 /* Non-zero means warn if a non-templatized friend function is
3171 declared in a templatized class. This behavior is warned about with
3172 flag_guiding_decls in do_friend. */
3173 extern int warn_nontemplate_friend;
3176 extern void declare_function_name PARAMS ((void));
3177 extern void decl_attributes PARAMS ((tree, tree, tree));
3178 extern void init_function_format_info PARAMS ((void));
3179 extern void record_function_format PARAMS ((tree, tree, int, int, int));
3180 extern void check_function_format PARAMS ((int *, tree, tree, tree));
3181 /* Print an error message for invalid operands to arith operation CODE.
3182 NOP_EXPR is used as a special case (see truthvalue_conversion). */
3183 extern void binary_op_error PARAMS ((enum tree_code));
3184 extern tree canonical_type_variant PARAMS ((tree));
3185 extern void c_expand_expr_stmt PARAMS ((tree));
3186 /* Validate the expression after `case' and apply default promotions. */
3187 extern tree check_case_value PARAMS ((tree));
3188 /* Concatenate a list of STRING_CST nodes into one STRING_CST. */
3189 extern tree combine_strings PARAMS ((tree));
3190 extern void constant_expression_warning PARAMS ((tree));
3191 extern tree convert_and_check PARAMS ((tree, tree));
3192 extern void overflow_warning PARAMS ((tree));
3193 extern void unsigned_conversion_warning PARAMS ((tree, tree));
3194 extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
3196 /* Read the rest of the current #-directive line. */
3198 extern char *get_directive_line PARAMS ((void));
3199 #define GET_DIRECTIVE_LINE() get_directive_line ()
3201 extern char *get_directive_line PARAMS ((FILE *));
3202 #define GET_DIRECTIVE_LINE() get_directive_line (finput)
3204 /* Subroutine of build_binary_op, used for comparison operations.
3205 See if the operands have both been converted from subword integer types
3206 and, if so, perhaps change them both back to their original type. */
3207 extern tree shorten_compare PARAMS ((tree *, tree *, tree *, enum tree_code *));
3208 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
3209 or validate its data type for an `if' or `while' statement or ?..: exp. */
3210 extern tree truthvalue_conversion PARAMS ((tree));
3211 extern tree type_for_mode PARAMS ((enum machine_mode, int));
3212 extern tree type_for_size PARAMS ((unsigned, int));
3215 /* A node that is a list (length 1) of error_mark_nodes. */
3216 extern tree error_mark_list;
3218 /* A list of virtual function tables we must make sure to write out. */
3219 extern tree pending_vtables;
3221 /* Node for "pointer to (virtual) function".
3222 This may be distinct from ptr_type_node so gdb can distinguish them. */
3223 #define vfunc_ptr_type_node \
3224 (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
3227 /* For building calls to `delete'. */
3228 extern tree integer_two_node, integer_three_node;
3230 extern tree anonymous_namespace_name;
3232 /* The number of function bodies which we are currently processing.
3233 (Zero if we are at namespace scope, one inside the body of a
3234 function, two inside the body of a function in a local class, etc.) */
3235 extern int function_depth;
3239 /* These values are used for the `STRICT' parameter to type_unfication and
3240 fn_type_unification. Their meanings are described with the
3241 documentation for fn_type_unification. */
3243 typedef enum unification_kind_t {
3247 } unification_kind_t;
3249 /* Macros for operating on a template instantation level node, represented
3250 by an EXPR_WITH_FILE_LOCATION. */
3252 #define TINST_DECL(NODE) EXPR_WFL_NODE (NODE)
3253 #define TINST_LINE(NODE) EXPR_WFL_LINENO (NODE)
3254 #define TINST_FILE(NODE) EXPR_WFL_FILENAME (NODE)
3258 extern int current_class_depth;
3260 /* Points to the name of that function. May not be the DECL_NAME
3261 of CURRENT_FUNCTION_DECL due to overloading */
3262 extern tree original_function_name;
3264 /* An array of all local classes present in this translation unit, in
3265 declaration order. */
3266 extern varray_type local_classes;
3268 /* Here's where we control how name mangling takes place. */
3270 #define OPERATOR_ASSIGN_FORMAT "__a%s"
3271 #define OPERATOR_FORMAT "__%s"
3272 #define OPERATOR_TYPENAME_FORMAT "__op"
3274 /* Cannot use '$' up front, because this confuses gdb
3275 (names beginning with '$' are gdb-local identifiers).
3277 Note that all forms in which the '$' is significant are long enough
3278 for direct indexing (meaning that if we know there is a '$'
3279 at a particular location, we can index into the string at
3280 any other location that provides distinguishing characters). */
3282 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
3283 doesn't allow '$' in symbol names. */
3284 #ifndef NO_DOLLAR_IN_LABEL
3288 #define VPTR_NAME "$v"
3289 #define THROW_NAME "$eh_throw"
3290 #define DESTRUCTOR_DECL_PREFIX "_$_"
3291 #define AUTO_VTABLE_NAME "__vtbl$me__"
3292 #define AUTO_TEMP_NAME "_$tmp_"
3293 #define AUTO_TEMP_FORMAT "_$tmp_%d"
3294 #define VTABLE_BASE "$vb"
3295 #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt$")
3296 #define VFIELD_BASE "$vf"
3297 #define VFIELD_NAME "_vptr$"
3298 #define VFIELD_NAME_FORMAT "_vptr$%s"
3299 #define VBASE_NAME "_vb$"
3300 #define VBASE_NAME_FORMAT "_vb$%s"
3301 #define STATIC_NAME_FORMAT "_%s$%s"
3302 #define ANON_AGGRNAME_FORMAT "$_%d"
3304 #else /* NO_DOLLAR_IN_LABEL */
3306 #ifndef NO_DOT_IN_LABEL
3310 #define VPTR_NAME ".v"
3311 #define THROW_NAME ".eh_throw"
3312 #define DESTRUCTOR_DECL_PREFIX "_._"
3313 #define AUTO_VTABLE_NAME "__vtbl.me__"
3314 #define AUTO_TEMP_NAME "_.tmp_"
3315 #define AUTO_TEMP_FORMAT "_.tmp_%d"
3316 #define VTABLE_BASE ".vb"
3317 #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt.")
3318 #define VFIELD_BASE ".vf"
3319 #define VFIELD_NAME "_vptr."
3320 #define VFIELD_NAME_FORMAT "_vptr.%s"
3321 #define VBASE_NAME "_vb."
3322 #define VBASE_NAME_FORMAT "_vb.%s"
3323 #define STATIC_NAME_FORMAT "_%s.%s"
3325 #define ANON_AGGRNAME_FORMAT "._%d"
3327 #else /* NO_DOT_IN_LABEL */
3329 #define VPTR_NAME "__vptr"
3330 #define VPTR_NAME_P(ID_NODE) \
3331 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
3332 #define THROW_NAME "__eh_throw"
3333 #define DESTRUCTOR_DECL_PREFIX "__destr_"
3334 #define DESTRUCTOR_NAME_P(ID_NODE) \
3335 (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
3336 sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
3337 #define IN_CHARGE_NAME "__in_chrg"
3338 #define AUTO_VTABLE_NAME "__vtbl_me__"
3339 #define AUTO_TEMP_NAME "__tmp_"
3340 #define TEMP_NAME_P(ID_NODE) \
3341 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
3342 sizeof (AUTO_TEMP_NAME) - 1))
3343 #define AUTO_TEMP_FORMAT "__tmp_%d"
3344 #define VTABLE_BASE "__vtb"
3345 #define VTABLE_NAME "__vt_"
3346 #define VTABLE_NAME_PREFIX (flag_vtable_thunks ? "__vt_" : "_vt_")
3347 #define VTABLE_NAME_P(ID_NODE) \
3348 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
3349 sizeof (VTABLE_NAME) - 1))
3350 #define VFIELD_BASE "__vfb"
3351 #define VFIELD_NAME "__vptr_"
3352 #define VFIELD_NAME_P(ID_NODE) \
3353 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
3354 sizeof (VFIELD_NAME) - 1))
3355 #define VFIELD_NAME_FORMAT "_vptr_%s"
3356 #define VBASE_NAME "__vb_"
3357 #define VBASE_NAME_P(ID_NODE) \
3358 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
3359 sizeof (VBASE_NAME) - 1))
3360 #define VBASE_NAME_FORMAT "__vb_%s"
3361 #define STATIC_NAME_FORMAT "__static_%s_%s"
3363 #define ANON_AGGRNAME_PREFIX "__anon_"
3364 #define ANON_AGGRNAME_P(ID_NODE) \
3365 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
3366 sizeof (ANON_AGGRNAME_PREFIX) - 1))
3367 #define ANON_AGGRNAME_FORMAT "__anon_%d"
3368 #define ANON_PARMNAME_FORMAT "__%d"
3369 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
3370 && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
3371 && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
3373 #endif /* NO_DOT_IN_LABEL */
3374 #endif /* NO_DOLLAR_IN_LABEL */
3376 #define THIS_NAME "this"
3377 #define DESTRUCTOR_NAME_FORMAT "~%s"
3378 #define FILE_FUNCTION_PREFIX_LEN 9
3379 #define CTOR_NAME "__ct"
3380 #define DTOR_NAME "__dt"
3382 #define IN_CHARGE_NAME "__in_chrg"
3384 #define VTBL_PTR_TYPE "__vtbl_ptr_type"
3385 #define VTABLE_DELTA_NAME "__delta"
3386 #define VTABLE_INDEX_NAME "__index"
3387 #define VTABLE_PFN_NAME "__pfn"
3388 #define VTABLE_DELTA2_NAME "__delta2"
3390 #define EXCEPTION_CLEANUP_NAME "exception cleanup"
3392 /* The name used as a prefix for VTTs. When the new ABI mangling
3393 scheme is implemented, this should be removed. */
3395 #define VTT_NAME_PREFIX "__vtt_"
3397 /* The name used as a prefix for construction vtables. */
3399 #define CTOR_VTBL_NAME_PREFIX "__ctorvt_"
3401 #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
3403 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
3405 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3406 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
3407 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
3408 && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
3410 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
3411 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
3412 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
3414 #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
3415 && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
3416 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
3418 #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
3419 #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
3421 /* For anonymous aggregate types, we need some sort of name to
3422 hold on to. In practice, this should not appear, but it should
3423 not be harmful if it does. */
3424 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3425 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
3426 #define ANON_PARMNAME_FORMAT "_%d"
3427 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
3428 && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
3429 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
3431 /* Store the vbase pointer field name for type TYPE into pointer BUF. */
3432 #define FORMAT_VBASE_NAME(BUF,TYPE) do { \
3433 char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \
3434 + sizeof (VBASE_NAME) + 1); \
3435 sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \
3439 /* Returns non-zero iff NODE is a declaration for the global function
3441 #define DECL_MAIN_P(NODE) \
3442 (DECL_EXTERN_C_FUNCTION_P (NODE) \
3443 && DECL_NAME (NODE) != NULL_TREE \
3444 && MAIN_NAME_P (DECL_NAME (NODE)))
3447 /* Things for handling inline functions. */
3449 /* Negative values means we know `this' to be of static type. */
3451 extern int flag_this_is_variable;
3453 /* Nonzero means do emit exported implementations of functions even if
3454 they can be inlined. */
3456 extern int flag_implement_inlines;
3458 /* Nonzero means templates obey #pragma interface and implementation. */
3460 extern int flag_external_templates;
3462 /* Nonzero means templates are emitted where they are instantiated. */
3464 extern int flag_alt_external_templates;
3466 /* Nonzero means implicit template instantiations are emitted. */
3468 extern int flag_implicit_templates;
3470 /* Nonzero if we want to emit defined symbols with common-like linkage as
3471 weak symbols where possible, in order to conform to C++ semantics.
3472 Otherwise, emit them as local symbols. */
3474 extern int flag_weak;
3476 /* Nonzero if we should expand functions calls inline at the tree
3477 level, rather than at the RTL level. */
3479 extern int flag_inline_trees;
3481 /* Nonzero if we're done parsing and into end-of-file activities. */
3485 /* Functions called along with real static constructors and destructors. */
3487 extern tree static_ctors;
3488 extern tree static_dtors;
3490 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
3492 /* Some macros for char-based bitfields. */
3493 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
3494 #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
3495 #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
3497 /* These are uses as bits in flags passed to build_method_call
3498 to control its error reporting behavior.