1 /* Definitions for C++ parsing and type checking.
2 Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com)
6 This file is part of GCC.
8 GCC 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 GCC 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 GCC; see the file COPYING. If not, write to
20 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
29 #include "splay-tree.h"
33 #include "name-lookup.h"
34 struct diagnostic_context;
36 /* Usage of TREE_LANG_FLAG_?:
37 0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
38 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
39 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
40 COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
41 TREE_INDIRECT_USING (in NAMESPACE_DECL).
42 CLEANUP_P (in TRY_BLOCK)
43 AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
44 PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
45 PAREN_STRING_LITERAL (in STRING_CST)
46 DECL_PRETTY_FUNCTION_P (in VAR_DECL)
47 KOENIG_LOOKUP_P (in CALL_EXPR)
48 STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST).
49 EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT)
50 STMT_EXPR_NO_SCOPE (in STMT_EXPR)
51 BIND_EXPR_TRY_BLOCK (in BIND_EXPR)
52 TYPENAME_IS_ENUM_P (in TYPENAME_TYPE)
53 REFERENCE_REF_P (in INDIRECT_EXPR)
54 QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
55 OMP_ATOMIC_DEPENDENT_P (in OMP_ATOMIC)
56 OMP_FOR_GIMPLIFYING_P (in OMP_FOR)
57 BASELINK_QUALIFIED_P (in BASELINK)
58 TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
59 TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
60 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
61 TI_PENDING_TEMPLATE_FLAG.
62 TEMPLATE_PARMS_FOR_INLINE.
63 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
64 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
65 ICS_ELLIPSIS_FLAG (in _CONV)
66 DECL_INITIALIZED_P (in VAR_DECL)
67 TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
68 STMT_IS_FULL_EXPR_P (in _STMT)
69 2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
70 ICS_THIS_FLAG (in _CONV)
71 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
72 STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
73 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
74 ICS_BAD_FLAG (in _CONV)
75 FN_TRY_BLOCK_P (in TRY_BLOCK)
76 IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
77 BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
78 DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL)
79 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
81 IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
82 DECL_TINFO_P (in VAR_DECL)
83 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
84 DECL_VTABLE_OR_VTT_P (in VAR_DECL)
85 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE)
86 DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL)
87 TYPE_MARKED_P (in _TYPE)
89 Usage of TYPE_LANG_FLAG_?:
91 1: TYPE_HAS_CONSTRUCTOR.
94 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
96 6: TYPE_DEPENDENT_P_VALID
98 Usage of DECL_LANG_FLAG_?:
99 0: DECL_ERROR_REPORTED (in VAR_DECL).
100 DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
101 DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
102 DECL_MUTABLE_P (in FIELD_DECL)
103 DECL_DEPENDENT_P (in USING_DECL)
104 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
105 DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
106 DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
107 FUNCTION_PARAMETER_PACK_P (in PARM_DECL)
108 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
109 DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
111 4: DECL_C_BIT_FIELD (in a FIELD_DECL)
112 DECL_VAR_MARKED_P (in a VAR_DECL)
113 DECL_SELF_REFERENCE_P (in a TYPE_DECL)
114 DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL)
115 5: DECL_INTERFACE_KNOWN.
116 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
117 DECL_FIELD_IS_BASE (in FIELD_DECL)
118 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
119 DECL_THUNK_P (in a member FUNCTION_DECL)
121 Usage of language-independent fields in a language-dependent manner:
124 This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
125 forth as a substitute for the mark bits provided in `lang_type'.
126 At present, only the six low-order bits are used.
129 For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
130 For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
133 For a binfo, this is a TREE_LIST. There is an entry for each
134 virtual function declared either in BINFO or its direct and
135 indirect primary bases.
137 The BV_DELTA of each node gives the amount by which to adjust the
138 `this' pointer when calling the function. If the method is an
139 overridden version of a base class method, then it is assumed
140 that, prior to adjustment, the this pointer points to an object
143 The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
144 index of the vcall offset for this entry.
146 The BV_FN is the declaration for the virtual function itself.
149 This is an expression with POINTER_TYPE that gives the value
150 to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
151 to extract the VAR_DECL for the complete vtable.
154 For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
157 This field is NULL for a non-virtual function. For a virtual
158 function, it is eventually set to an INTEGER_CST indicating the
159 index in the vtable at which this function can be found. When
160 a virtual function is declared, but before it is known what
161 function is overridden, this field is the error_mark_node.
163 Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
164 the virtual function this one overrides, and whose TREE_CHAIN is
165 the old DECL_VINDEX. */
167 /* Language-specific tree checkers. */
169 #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
170 TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL)
172 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
173 TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL)
175 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
176 TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
178 #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
179 TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
181 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
182 #define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \
183 ({ const tree __t = (NODE); \
184 if (TREE_CODE (__t) != FUNCTION_DECL && \
185 TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \
186 && __t->decl_common.lang_specific->decl_flags.thunk_p) \
187 tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
189 #define THUNK_FUNCTION_CHECK(NODE) __extension__ \
190 ({ const tree __t = (NODE); \
191 if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
192 || !__t->decl_common.lang_specific->decl_flags.thunk_p) \
193 tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
196 #define NON_THUNK_FUNCTION_CHECK(NODE) (NODE)
197 #define THUNK_FUNCTION_CHECK(NODE) (NODE)
200 /* Language-dependent contents of an identifier. */
202 struct lang_identifier GTY(())
204 struct c_common_identifier c_common;
205 cxx_binding *namespace_bindings;
206 cxx_binding *bindings;
207 tree class_template_info;
211 /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
212 keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
213 and C_RID_YYCODE is the token number wanted by Yacc. */
215 #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
217 #define LANG_IDENTIFIER_CAST(NODE) \
218 ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
220 struct template_parm_index_s GTY(())
222 struct tree_common common;
228 typedef struct template_parm_index_s template_parm_index;
230 struct tinst_level_s GTY(())
232 struct tree_common common;
235 int in_system_header_p;
237 typedef struct tinst_level_s * tinst_level_t;
239 struct ptrmem_cst GTY(())
241 struct tree_common common;
242 /* This isn't used, but the middle-end expects all constants to have
247 typedef struct ptrmem_cst * ptrmem_cst_t;
249 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
250 namespace_binding ((NODE), global_namespace)
251 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
252 set_namespace_binding ((NODE), global_namespace, (VAL))
253 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
254 namespace_binding ((NODE), current_namespace)
255 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
256 set_namespace_binding ((NODE), current_namespace, (VAL))
258 #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
260 #define BIND_EXPR_TRY_BLOCK(NODE) \
261 TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE))
263 /* Used to mark the block around the member initializers and cleanups. */
264 #define BIND_EXPR_BODY_BLOCK(NODE) \
265 TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
266 #define FUNCTION_NEEDS_BODY_BLOCK(NODE) \
267 (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE))
269 #define STATEMENT_LIST_NO_SCOPE(NODE) \
270 TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
271 #define STATEMENT_LIST_TRY_BLOCK(NODE) \
272 TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
274 /* Nonzero if this statement should be considered a full-expression,
275 i.e., if temporaries created during this statement should have
276 their destructors run at the end of this statement. */
277 #define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
279 /* Marks the result of a statement expression. */
280 #define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
281 TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
283 /* Nonzero if this statement-expression does not have an associated scope. */
284 #define STMT_EXPR_NO_SCOPE(NODE) \
285 TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
287 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
289 #define same_type_p(TYPE1, TYPE2) \
290 comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
292 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring
293 top-level qualifiers. */
294 #define same_type_ignoring_top_level_qualifiers_p(TYPE1, TYPE2) \
295 same_type_p (TYPE_MAIN_VARIANT (TYPE1), TYPE_MAIN_VARIANT (TYPE2))
297 /* Nonzero if we are presently building a statement tree, rather
298 than expanding each statement as we encounter it. */
299 #define building_stmt_tree() (cur_stmt_list != NULL_TREE)
301 /* Returns nonzero iff NODE is a declaration for the global function
303 #define DECL_MAIN_P(NODE) \
304 (DECL_EXTERN_C_FUNCTION_P (NODE) \
305 && DECL_NAME (NODE) != NULL_TREE \
306 && MAIN_NAME_P (DECL_NAME (NODE)))
308 /* The overloaded FUNCTION_DECL. */
309 #define OVL_FUNCTION(NODE) \
310 (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
311 #define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
312 /* Polymorphic access to FUNCTION and CHAIN. */
313 #define OVL_CURRENT(NODE) \
314 ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
315 #define OVL_NEXT(NODE) \
316 ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
317 /* If set, this was imported in a using declaration.
318 This is not to confuse with being used somewhere, which
319 is not important for this node. */
320 #define OVL_USED(NODE) TREE_USED (NODE)
322 struct tree_overload GTY(())
324 struct tree_common common;
328 /* Returns true iff NODE is a BASELINK. */
329 #define BASELINK_P(NODE) \
330 (TREE_CODE (NODE) == BASELINK)
331 /* The BINFO indicating the base from which the BASELINK_FUNCTIONS came. */
332 #define BASELINK_BINFO(NODE) \
333 (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
334 /* The functions referred to by the BASELINK; either a FUNCTION_DECL,
335 a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */
336 #define BASELINK_FUNCTIONS(NODE) \
337 (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
338 /* The BINFO in which the search for the functions indicated by this baselink
339 began. This base is used to determine the accessibility of functions
340 selected by overload resolution. */
341 #define BASELINK_ACCESS_BINFO(NODE) \
342 (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
343 /* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
344 to which the conversion should occur. This value is important if
345 the BASELINK_FUNCTIONS include a template conversion operator --
346 the BASELINK_OPTYPE can be used to determine what type the user
348 #define BASELINK_OPTYPE(NODE) \
349 (TREE_CHAIN (BASELINK_CHECK (NODE)))
350 /* Nonzero if this baselink was from a qualified lookup. */
351 #define BASELINK_QUALIFIED_P(NODE) \
352 TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE))
354 struct tree_baselink GTY(())
356 struct tree_common common;
362 /* The different kinds of ids that we encounter. */
364 typedef enum cp_id_kind
366 /* Not an id at all. */
368 /* An unqualified-id that is not a template-id. */
369 CP_ID_KIND_UNQUALIFIED,
370 /* An unqualified-id that is a dependent name. */
371 CP_ID_KIND_UNQUALIFIED_DEPENDENT,
372 /* An unqualified template-id. */
373 CP_ID_KIND_TEMPLATE_ID,
374 /* A qualified-id. */
378 /* Macros for access to language-specific slots in an identifier. */
380 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
381 (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
382 #define IDENTIFIER_TEMPLATE(NODE) \
383 (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
385 /* The IDENTIFIER_BINDING is the innermost cxx_binding for the
386 identifier. It's PREVIOUS is the next outermost binding. Each
387 VALUE field is a DECL for the associated declaration. Thus,
388 name lookup consists simply of pulling off the node at the front
389 of the list (modulo oddities for looking up the names of types,
390 and such.) You can use SCOPE field to determine the scope
391 that bound the name. */
392 #define IDENTIFIER_BINDING(NODE) \
393 (LANG_IDENTIFIER_CAST (NODE)->bindings)
395 /* TREE_TYPE only indicates on local and class scope the current
396 type. For namespace scope, the presence of a type in any namespace
397 is indicated with global_type_node, and the real type behind must
398 be found through lookup. */
399 #define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
400 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
401 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
402 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
404 #define IDENTIFIER_LABEL_VALUE(NODE) \
405 (LANG_IDENTIFIER_CAST (NODE)->label_value)
406 #define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
407 IDENTIFIER_LABEL_VALUE (NODE) = (VALUE)
409 /* Nonzero if this identifier is used as a virtual function name somewhere
410 (optimizes searches). */
411 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
413 /* Nonzero if this identifier is the prefix for a mangled C++ operator
415 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
417 /* Nonzero if this identifier is the name of a type-conversion
419 #define IDENTIFIER_TYPENAME_P(NODE) \
420 TREE_LANG_FLAG_4 (NODE)
422 /* Nonzero if this identifier is the name of a constructor or
424 #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
425 TREE_LANG_FLAG_3 (NODE)
427 /* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague
428 linkage which the prelinker has assigned to this translation
430 #define IDENTIFIER_REPO_CHOSEN(NAME) \
431 (TREE_LANG_FLAG_6 (NAME))
433 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
434 #define C_TYPE_FIELDS_READONLY(TYPE) \
435 (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
437 /* The tokens stored in the default argument. */
439 #define DEFARG_TOKENS(NODE) \
440 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
441 #define DEFARG_INSTANTIATIONS(NODE) \
442 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations)
444 struct tree_default_arg GTY (())
446 struct tree_common common;
447 struct cp_token_cache *tokens;
448 VEC(tree,gc) *instantiations;
451 /* The condition associated with the static assertion. This must be
452 an integral constant expression. */
453 #define STATIC_ASSERT_CONDITION(NODE) \
454 (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->condition)
456 /* The message associated with the static assertion. This must be a
457 string constant, which will be emitted as an error message when the
458 static assert condition is false. */
459 #define STATIC_ASSERT_MESSAGE(NODE) \
460 (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->message)
462 /* Source location information for a static assertion. */
463 #define STATIC_ASSERT_SOURCE_LOCATION(NODE) \
464 (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location)
466 struct tree_static_assert GTY (())
468 struct tree_common common;
474 struct tree_argument_pack_select GTY (())
476 struct tree_common common;
481 enum cp_tree_node_structure_enum {
493 TS_CP_ARGUMENT_PACK_SELECT,
497 /* The resulting tree type. */
498 union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
499 chain_next ("(GIMPLE_STMT_P (&%h.generic) ? (union lang_tree_node *) 0 : (union lang_tree_node *)TREE_CHAIN (&%h.generic))")))
501 union tree_node GTY ((tag ("TS_CP_GENERIC"),
502 desc ("tree_node_structure (&%h)"))) generic;
503 struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
504 struct tinst_level_s GTY ((tag ("TS_CP_TINST_LEVEL"))) tinst_level;
505 struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
506 struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
507 struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
508 struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
509 struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
510 struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT")))
512 struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT")))
513 argument_pack_select;
520 CPTI_JAVA_SHORT_TYPE,
523 CPTI_JAVA_FLOAT_TYPE,
524 CPTI_JAVA_DOUBLE_TYPE,
526 CPTI_JAVA_BOOLEAN_TYPE,
529 CPTI_VTABLE_ENTRY_TYPE,
531 CPTI_VTABLE_INDEX_TYPE,
541 CPTI_CONST_TYPE_INFO_TYPE,
542 CPTI_TYPE_INFO_PTR_TYPE,
544 CPTI_GLOBAL_DELETE_FNDECL,
547 CPTI_CTOR_IDENTIFIER,
548 CPTI_COMPLETE_CTOR_IDENTIFIER,
549 CPTI_BASE_CTOR_IDENTIFIER,
550 CPTI_DTOR_IDENTIFIER,
551 CPTI_COMPLETE_DTOR_IDENTIFIER,
552 CPTI_BASE_DTOR_IDENTIFIER,
553 CPTI_DELETING_DTOR_IDENTIFIER,
554 CPTI_DELTA_IDENTIFIER,
555 CPTI_IN_CHARGE_IDENTIFIER,
556 CPTI_VTT_PARM_IDENTIFIER,
557 CPTI_NELTS_IDENTIFIER,
558 CPTI_THIS_IDENTIFIER,
560 CPTI_VPTR_IDENTIFIER,
564 CPTI_LANG_NAME_CPLUSPLUS,
567 CPTI_EMPTY_EXCEPT_SPEC,
570 CPTI_CALL_UNEXPECTED,
580 extern GTY(()) tree cp_global_trees[CPTI_MAX];
582 #define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
583 #define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
584 #define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
585 #define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
586 #define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
587 #define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
588 #define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
589 #define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
591 #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
592 #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
593 /* The type used to represent an offset by which to adjust the `this'
594 pointer in pointer-to-member types. */
595 #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
596 /* The type used to represent an index into the vtable. */
597 #define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
599 #define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
600 #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
601 #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
602 #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
603 #define std_node cp_global_trees[CPTI_STD]
604 #define abi_node cp_global_trees[CPTI_ABI]
605 #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
606 #define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
607 #define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
608 #define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
609 #define current_aggr cp_global_trees[CPTI_AGGR_TAG]
611 /* We cache these tree nodes so as to call get_identifier less
614 /* The name of a constructor that takes an in-charge parameter to
615 decide whether or not to construct virtual base classes. */
616 #define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
617 /* The name of a constructor that constructs virtual base classes. */
618 #define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
619 /* The name of a constructor that does not construct virtual base classes. */
620 #define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
621 /* The name of a destructor that takes an in-charge parameter to
622 decide whether or not to destroy virtual base classes and whether
623 or not to delete the object. */
624 #define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
625 /* The name of a destructor that destroys virtual base classes. */
626 #define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
627 /* The name of a destructor that does not destroy virtual base
629 #define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
630 /* The name of a destructor that destroys virtual base classes, and
631 then deletes the entire object. */
632 #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
633 #define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
634 #define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
635 /* The name of the parameter that contains a pointer to the VTT to use
636 for this subobject constructor or destructor. */
637 #define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
638 #define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
639 #define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
640 #define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
641 #define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
642 /* The name of the std namespace. */
643 #define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
644 #define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
645 #define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
646 #define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
648 /* Exception specifier used for throw(). */
649 #define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
651 /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
652 #define jclass_node cp_global_trees[CPTI_JCLASS]
654 /* The declaration for `std::terminate'. */
655 #define terminate_node cp_global_trees[CPTI_TERMINATE]
657 /* The declaration for "__cxa_call_unexpected". */
658 #define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED]
660 /* A pointer to `std::atexit'. */
661 #define atexit_node cp_global_trees[CPTI_ATEXIT]
663 /* A pointer to `__dso_handle'. */
664 #define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
666 /* The declaration of the dynamic_cast runtime. */
667 #define dynamic_cast_node cp_global_trees[CPTI_DCAST]
669 /* The type of a destructor. */
670 #define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
672 /* The type of the vtt parameter passed to subobject constructors and
674 #define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
676 /* A TREE_LIST of the dynamic classes whose vtables may have to be
677 emitted in this translation unit. */
679 #define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES]
681 /* Node to indicate default access. This must be distinct from the
682 access nodes in tree.h. */
684 #define access_default_node null_node
688 struct saved_scope GTY(())
690 VEC(cxx_saved_binding,gc) *old_bindings;
695 tree access_specifier;
697 VEC(tree,gc) *lang_base;
700 struct cp_binding_level *x_previous_class_level;
703 int x_processing_template_decl;
704 int x_processing_specialization;
705 BOOL_BITFIELD x_processing_explicit_instantiation : 1;
706 BOOL_BITFIELD need_pop_function_context : 1;
707 BOOL_BITFIELD skip_evaluation : 1;
709 struct stmt_tree_s x_stmt_tree;
711 struct cp_binding_level *class_bindings;
712 struct cp_binding_level *bindings;
714 struct saved_scope *prev;
717 /* The current open namespace. */
719 #define current_namespace scope_chain->old_namespace
721 /* The stack for namespaces of current declarations. */
723 #define decl_namespace_list scope_chain->decl_ns_list
725 /* IDENTIFIER_NODE: name of current class */
727 #define current_class_name scope_chain->class_name
729 /* _TYPE: the type of the current class */
731 #define current_class_type scope_chain->class_type
733 /* When parsing a class definition, the access specifier most recently
734 given by the user, or, if no access specifier was given, the
735 default value appropriate for the kind of class (i.e., struct,
738 #define current_access_specifier scope_chain->access_specifier
740 /* Pointer to the top of the language name stack. */
742 #define current_lang_base scope_chain->lang_base
743 #define current_lang_name scope_chain->lang_name
745 /* Parsing a function declarator leaves a list of parameter names
746 or a chain or parameter decls here. */
748 #define current_template_parms scope_chain->template_parms
750 #define processing_template_decl scope_chain->x_processing_template_decl
751 #define processing_specialization scope_chain->x_processing_specialization
752 #define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
754 /* The cached class binding level, from the most recently exited
755 class, or NULL if none. */
757 #define previous_class_level scope_chain->x_previous_class_level
759 /* A list of private types mentioned, for deferred access checking. */
761 extern GTY(()) struct saved_scope *scope_chain;
763 struct cxx_int_tree_map GTY(())
769 extern unsigned int cxx_int_tree_map_hash (const void *);
770 extern int cxx_int_tree_map_eq (const void *, const void *);
772 /* Global state pertinent to the current function. */
774 struct language_function GTY(())
776 struct c_language_function base;
779 tree x_current_class_ptr;
780 tree x_current_class_ref;
781 tree x_eh_spec_block;
782 tree x_in_charge_parm;
786 BOOL_BITFIELD returns_value : 1;
787 BOOL_BITFIELD returns_null : 1;
788 BOOL_BITFIELD returns_abnormally : 1;
789 BOOL_BITFIELD in_function_try_handler : 1;
790 BOOL_BITFIELD in_base_initializer : 1;
792 /* True if this function can throw an exception. */
793 BOOL_BITFIELD can_throw : 1;
795 htab_t GTY((param_is(struct named_label_entry))) x_named_labels;
796 struct cp_binding_level *bindings;
797 VEC(tree,gc) *x_local_names;
798 htab_t GTY((param_is (struct cxx_int_tree_map))) extern_decl_map;
801 /* The current C++-specific per-function global variables. */
803 #define cp_function_chain (cfun->language)
805 /* In a constructor destructor, the point at which all derived class
806 destroying/construction has been has been done. Ie. just before a
807 constructor returns, or before any base class destroying will be done
810 #define cdtor_label cp_function_chain->x_cdtor_label
812 /* When we're processing a member function, current_class_ptr is the
813 PARM_DECL for the `this' pointer. The current_class_ref is an
814 expression for `*this'. */
816 #define current_class_ptr \
817 (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE)
818 #define current_class_ref \
819 (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
821 /* The EH_SPEC_BLOCK for the exception-specifiers for the current
824 #define current_eh_spec_block cp_function_chain->x_eh_spec_block
826 /* The `__in_chrg' parameter for the current function. Only used for
827 constructors and destructors. */
829 #define current_in_charge_parm cp_function_chain->x_in_charge_parm
831 /* The `__vtt_parm' parameter for the current function. Only used for
832 constructors and destructors. */
834 #define current_vtt_parm cp_function_chain->x_vtt_parm
836 /* Set to 0 at beginning of a function definition, set to 1 if
837 a return statement that specifies a return value is seen. */
839 #define current_function_returns_value cp_function_chain->returns_value
841 /* Set to 0 at beginning of a function definition, set to 1 if
842 a return statement with no argument is seen. */
844 #define current_function_returns_null cp_function_chain->returns_null
846 /* Set to 0 at beginning of a function definition, set to 1 if
847 a call to a noreturn function is seen. */
849 #define current_function_returns_abnormally \
850 cp_function_chain->returns_abnormally
852 /* Nonzero if we are processing a base initializer. Zero elsewhere. */
853 #define in_base_initializer cp_function_chain->in_base_initializer
855 #define in_function_try_handler cp_function_chain->in_function_try_handler
857 /* Expression always returned from function, or error_mark_node
858 otherwise, for use by the automatic named return value optimization. */
860 #define current_function_return_value \
861 (cp_function_chain->x_return_value)
863 /* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
864 new" or "operator delete". */
865 #define NEW_DELETE_OPNAME_P(NAME) \
866 ((NAME) == ansi_opname (NEW_EXPR) \
867 || (NAME) == ansi_opname (VEC_NEW_EXPR) \
868 || (NAME) == ansi_opname (DELETE_EXPR) \
869 || (NAME) == ansi_opname (VEC_DELETE_EXPR))
871 #define ansi_opname(CODE) \
872 (operator_name_info[(int) (CODE)].identifier)
873 #define ansi_assopname(CODE) \
874 (assignment_operator_name_info[(int) (CODE)].identifier)
876 /* True if NODE is an erroneous expression. */
878 #define error_operand_p(NODE) \
879 ((NODE) == error_mark_node \
880 || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
882 /* C++ language-specific tree codes. */
883 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
884 enum cplus_tree_code {
885 CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
886 #include "cp-tree.def"
891 /* TRUE if a tree code represents a statement. */
892 extern bool statement_code_p[MAX_TREE_CODES];
894 #define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
896 enum languages { lang_c, lang_cplusplus, lang_java };
898 /* Macros to make error reporting functions' lives easier. */
899 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
900 #define TYPE_LINKAGE_IDENTIFIER(NODE) \
901 (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
902 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
903 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
905 /* Nonzero if NODE has no name for linkage purposes. */
906 #define TYPE_ANONYMOUS_P(NODE) \
907 (TAGGED_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
909 /* The _DECL for this _TYPE. */
910 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
912 /* Nonzero if T is a class (or struct or union) type. Also nonzero
913 for template type parameters, typename types, and instantiated
914 template template parameters. Despite its name,
915 this macro has nothing to do with the definition of aggregate given
916 in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. Keep
917 these checks in ascending code order. */
918 #define IS_AGGR_TYPE(T) \
919 (TREE_CODE (T) == TEMPLATE_TYPE_PARM \
920 || TREE_CODE (T) == TYPENAME_TYPE \
921 || TREE_CODE (T) == TYPEOF_TYPE \
922 || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \
923 || TYPE_LANG_FLAG_5 (T))
925 /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
927 #define SET_IS_AGGR_TYPE(T, VAL) \
928 (TYPE_LANG_FLAG_5 (T) = (VAL))
930 /* Nonzero if T is a class type. Zero for template type parameters,
931 typename types, and so forth. */
932 #define CLASS_TYPE_P(T) \
933 (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
935 /* Keep these checks in ascending code order. */
936 #define IS_AGGR_TYPE_CODE(T) \
937 ((T) == RECORD_TYPE || (T) == UNION_TYPE)
938 #define TAGGED_TYPE_P(T) \
939 (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
940 #define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
942 /* True if this a "Java" type, defined in 'extern "Java"'. */
943 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
945 /* True if this type is dependent. This predicate is only valid if
946 TYPE_DEPENDENT_P_VALID is true. */
947 #define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
949 /* True if dependent_type_p has been called for this type, with the
950 result that TYPE_DEPENDENT_P is valid. */
951 #define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
953 /* Nonzero if this type is const-qualified. */
954 #define CP_TYPE_CONST_P(NODE) \
955 ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
957 /* Nonzero if this type is volatile-qualified. */
958 #define CP_TYPE_VOLATILE_P(NODE) \
959 ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
961 /* Nonzero if this type is restrict-qualified. */
962 #define CP_TYPE_RESTRICT_P(NODE) \
963 ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
965 /* Nonzero if this type is const-qualified, but not
966 volatile-qualified. Other qualifiers are ignored. This macro is
967 used to test whether or not it is OK to bind an rvalue to a
969 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
970 ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
973 #define FUNCTION_ARG_CHAIN(NODE) \
974 TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
976 /* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
977 which refers to a user-written parameter. */
978 #define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
979 skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
981 /* Similarly, but for DECL_ARGUMENTS. */
982 #define FUNCTION_FIRST_USER_PARM(NODE) \
983 skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
985 #define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \
986 (((CODE) == TREE_CODE (NODE) \
987 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
988 || IS_AGGR_TYPE (NODE))
990 /* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
992 #define DERIVED_FROM_P(PARENT, TYPE) \
993 (lookup_base ((TYPE), (PARENT), ba_any, NULL) != NULL_TREE)
994 /* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
996 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
997 (lookup_base ((TYPE), (PARENT), ba_unique | ba_quiet, NULL) != NULL_TREE)
998 /* Nonzero iff TYPE is publicly & uniquely derived from PARENT. */
999 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
1000 (lookup_base ((TYPE), (PARENT), ba_ignore_scope | ba_check | ba_quiet, \
1003 /* Gives the visibility specification for a class type. */
1004 #define CLASSTYPE_VISIBILITY(TYPE) \
1005 DECL_VISIBILITY (TYPE_NAME (TYPE))
1006 #define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \
1007 DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE))
1009 typedef struct tree_pair_s GTY (())
1014 typedef tree_pair_s *tree_pair_p;
1015 DEF_VEC_O (tree_pair_s);
1016 DEF_VEC_ALLOC_O (tree_pair_s,gc);
1018 /* This is a few header flags for 'struct lang_type'. Actually,
1019 all but the first are used only for lang_type_class; they
1020 are put in this structure to save space. */
1021 struct lang_type_header GTY(())
1023 BOOL_BITFIELD is_lang_type_class : 1;
1025 BOOL_BITFIELD has_type_conversion : 1;
1026 BOOL_BITFIELD has_init_ref : 1;
1027 BOOL_BITFIELD has_default_ctor : 1;
1028 BOOL_BITFIELD const_needs_init : 1;
1029 BOOL_BITFIELD ref_needs_init : 1;
1030 BOOL_BITFIELD has_const_assign_ref : 1;
1032 BOOL_BITFIELD spare : 1;
1035 /* This structure provides additional information above and beyond
1036 what is provide in the ordinary tree_type. In the past, we used it
1037 for the types of class types, template parameters types, typename
1038 types, and so forth. However, there can be many (tens to hundreds
1039 of thousands) of template parameter types in a compilation, and
1040 there's no need for this additional information in that case.
1041 Therefore, we now use this data structure only for class types.
1043 In the past, it was thought that there would be relatively few
1044 class types. However, in the presence of heavy use of templates,
1045 many (i.e., thousands) of classes can easily be generated.
1046 Therefore, we should endeavor to keep the size of this structure to
1048 struct lang_type_class GTY(())
1050 struct lang_type_header h;
1052 unsigned char align;
1054 unsigned has_mutable : 1;
1055 unsigned com_interface : 1;
1056 unsigned non_pod_class : 1;
1057 unsigned nearly_empty_p : 1;
1058 unsigned user_align : 1;
1059 unsigned has_assign_ref : 1;
1060 unsigned has_new : 1;
1061 unsigned has_array_new : 1;
1063 unsigned gets_delete : 2;
1064 unsigned interface_only : 1;
1065 unsigned interface_unknown : 1;
1066 unsigned contains_empty_class_p : 1;
1067 unsigned anon_aggr : 1;
1068 unsigned non_zero_init : 1;
1069 unsigned empty_p : 1;
1071 unsigned vec_new_uses_cookie : 1;
1072 unsigned declared_class : 1;
1073 unsigned diamond_shaped : 1;
1074 unsigned repeated_base : 1;
1075 unsigned being_defined : 1;
1076 unsigned java_interface : 1;
1077 unsigned debug_requested : 1;
1078 unsigned fields_readonly : 1;
1080 unsigned use_template : 2;
1081 unsigned ptrmemfunc_flag : 1;
1082 unsigned was_anonymous : 1;
1083 unsigned lazy_default_ctor : 1;
1084 unsigned lazy_copy_ctor : 1;
1085 unsigned lazy_assignment_op : 1;
1086 unsigned lazy_destructor : 1;
1088 unsigned has_const_init_ref : 1;
1089 unsigned has_complex_init_ref : 1;
1090 unsigned has_complex_assign_ref : 1;
1091 unsigned non_aggregate : 1;
1093 /* When adding a flag here, consider whether or not it ought to
1094 apply to a template instance if it applies to the template. If
1095 so, make sure to copy it in instantiate_class_template! */
1097 /* There are some bits left to fill out a 32-bit word. Keep track
1098 of this by updating the size of this bitfield whenever you add or
1100 unsigned dummy : 12;
1103 VEC(tree_pair_s,gc) *vcall_indices;
1106 VEC(tree,gc) *vbases;
1107 binding_table nested_udts;
1109 VEC(tree,gc) *pure_virtuals;
1110 tree friend_classes;
1111 VEC(tree,gc) * GTY((reorder ("resort_type_method_vec"))) methods;
1115 tree befriending_classes;
1116 /* In a RECORD_TYPE, information specific to Objective-C++, such
1117 as a list of adopted protocols or a pointer to a corresponding
1118 @interface. See objc/objc-act.h for details. */
1122 struct lang_type_ptrmem GTY(())
1124 struct lang_type_header h;
1128 struct lang_type GTY(())
1132 struct lang_type_header GTY((skip (""))) h;
1133 struct lang_type_class GTY((tag ("1"))) c;
1134 struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
1135 } GTY((desc ("%h.h.is_lang_type_class"))) u;
1138 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
1140 #define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \
1141 ({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
1142 if (! lt->u.h.is_lang_type_class) \
1143 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1146 #define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \
1147 ({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
1148 if (lt->u.h.is_lang_type_class) \
1149 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1154 #define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
1155 #define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
1157 #endif /* ENABLE_TREE_CHECKING */
1159 /* Fields used for storing information before the class is defined.
1160 After the class is defined, these fields hold other information. */
1162 /* VEC(tree) of friends which were defined inline in this class
1164 #define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE)
1166 /* Nonzero for _CLASSTYPE means that operator delete is defined. */
1167 #define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
1168 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
1170 /* Nonzero if `new NODE[x]' should cause the allocation of extra
1171 storage to indicate how many array elements are in use. */
1172 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
1173 (CLASS_TYPE_P (NODE) \
1174 && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
1176 /* Nonzero means that this _CLASSTYPE node defines ways of converting
1177 itself to other types. */
1178 #define TYPE_HAS_CONVERSION(NODE) \
1179 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
1181 /* Nonzero means that NODE (a class type) has a default constructor --
1182 but that it has not yet been declared. */
1183 #define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \
1184 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor)
1186 /* Nonzero means that NODE (a class type) has a copy constructor --
1187 but that it has not yet been declared. */
1188 #define CLASSTYPE_LAZY_COPY_CTOR(NODE) \
1189 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor)
1191 /* Nonzero means that NODE (a class type) has an assignment operator
1192 -- but that it has not yet been declared. */
1193 #define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \
1194 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_assignment_op)
1196 /* Nonzero means that NODE (a class type) has a destructor -- but that
1197 it has not yet been declared. */
1198 #define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
1199 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
1201 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
1202 #define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref)
1204 /* True iff the class type NODE has an "operator =" whose parameter
1205 has a parameter of type "const X&". */
1206 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) \
1207 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref)
1209 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
1210 #define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref)
1211 #define TYPE_HAS_CONST_INIT_REF(NODE) \
1212 (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref)
1214 /* Nonzero if this class defines an overloaded operator new. (An
1215 operator new [] doesn't count.) */
1216 #define TYPE_HAS_NEW_OPERATOR(NODE) \
1217 (LANG_TYPE_CLASS_CHECK (NODE)->has_new)
1219 /* Nonzero if this class defines an overloaded operator new[]. */
1220 #define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
1221 (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
1223 /* Nonzero means that this type is being defined. I.e., the left brace
1224 starting the definition of this type has been seen. */
1225 #define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
1227 /* Mark bits for repeated base checks. */
1228 #define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
1230 /* Nonzero if the class NODE has multiple paths to the same (virtual)
1232 #define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \
1233 (LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped)
1235 /* Nonzero if the class NODE has multiple instances of the same base
1237 #define CLASSTYPE_REPEATED_BASE_P(NODE) \
1238 (LANG_TYPE_CLASS_CHECK(NODE)->repeated_base)
1240 /* The member function with which the vtable will be emitted:
1241 the first noninline non-pure-virtual member function. NULL_TREE
1242 if there is no key function or if this is a class template */
1243 #define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method)
1245 /* Vector member functions defined in this class. Each element is
1246 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
1247 functions with the same name end up in the same slot. The first
1248 two elements are for constructors, and destructors, respectively.
1249 All template conversion operators to innermost template dependent
1250 types are overloaded on the next slot, if they exist. Note, the
1251 names for these functions will not all be the same. The
1252 non-template conversion operators & templated conversions to
1253 non-innermost template types are next, followed by ordinary member
1254 functions. There may be empty entries at the end of the vector.
1255 The conversion operators are unsorted. The ordinary member
1256 functions are sorted, once the class is complete. */
1257 #define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
1259 /* For class templates, this is a TREE_LIST of all member data,
1260 functions, types, and friends in the order of declaration.
1261 The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
1262 and the RECORD_TYPE for the class template otherwise. */
1263 #define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
1265 /* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
1266 #define CLASSTYPE_CONSTRUCTOR_SLOT 0
1268 /* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
1269 #define CLASSTYPE_DESTRUCTOR_SLOT 1
1271 /* The first slot in the CLASSTYPE_METHOD_VEC where conversion
1272 operators can appear. */
1273 #define CLASSTYPE_FIRST_CONVERSION_SLOT 2
1275 /* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
1276 are the constructors that take an in-charge parameter. */
1277 #define CLASSTYPE_CONSTRUCTORS(NODE) \
1278 (VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT))
1280 /* A FUNCTION_DECL for the destructor for NODE. These are the
1281 destructors that take an in-charge parameter. If
1282 CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL
1283 until the destructor is created with lazily_declare_fn. */
1284 #define CLASSTYPE_DESTRUCTORS(NODE) \
1285 (CLASSTYPE_METHOD_VEC (NODE) \
1286 ? VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT) \
1289 /* A dictionary of the nested user-defined-types (class-types, or enums)
1290 found within this class. This table includes nested member class
1292 #define CLASSTYPE_NESTED_UTDS(NODE) \
1293 (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
1295 /* Nonzero if NODE has a primary base class, i.e., a base class with
1296 which it shares the virtual function table pointer. */
1297 #define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
1298 (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
1300 /* If non-NULL, this is the binfo for the primary base class, i.e.,
1301 the base class which contains the virtual function table pointer
1303 #define CLASSTYPE_PRIMARY_BINFO(NODE) \
1304 (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
1306 /* A vector of BINFOs for the direct and indirect virtual base classes
1307 that this type uses in a post-order depth-first left-to-right
1308 order. (In other words, these bases appear in the order that they
1309 should be initialized.) */
1310 #define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
1312 /* The type corresponding to NODE when NODE is used as a base class,
1313 i.e., NODE without virtual base classes. */
1315 #define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
1317 /* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */
1319 #define IS_FAKE_BASE_TYPE(NODE) \
1320 (TREE_CODE (NODE) == RECORD_TYPE \
1321 && TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \
1322 && CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE))
1324 /* These are the size and alignment of the type without its virtual
1325 base classes, for when we use this type as a base itself. */
1326 #define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE))
1327 #define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE))
1328 #define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE))
1329 #define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE))
1331 /* The alignment of NODE, without its virtual bases, in bytes. */
1332 #define CLASSTYPE_ALIGN_UNIT(NODE) \
1333 (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
1335 /* True if this a Java interface type, declared with
1336 '__attribute__ ((java_interface))'. */
1337 #define TYPE_JAVA_INTERFACE(NODE) \
1338 (LANG_TYPE_CLASS_CHECK (NODE)->java_interface)
1340 /* A VEC(tree) of virtual functions which cannot be inherited by
1341 derived classes. When deriving from this type, the derived
1342 class must provide its own definition for each of these functions. */
1343 #define CLASSTYPE_PURE_VIRTUALS(NODE) \
1344 (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
1346 /* Nonzero means that this type has an X() constructor. */
1347 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
1348 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
1350 /* Nonzero means that this type contains a mutable member. */
1351 #define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
1352 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1354 /* Nonzero means that this class type is a non-POD class. */
1355 #define CLASSTYPE_NON_POD_P(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
1357 /* Nonzero means that this class contains pod types whose default
1358 initialization is not a zero initialization (namely, pointers to
1360 #define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
1361 (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
1363 /* Nonzero if this class is "empty" in the sense of the C++ ABI. */
1364 #define CLASSTYPE_EMPTY_P(NODE) \
1365 (LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
1367 /* Nonzero if this class is "nearly empty", i.e., contains only a
1368 virtual function table pointer. */
1369 #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
1370 (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
1372 /* Nonzero if this class contains an empty subobject. */
1373 #define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
1374 (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
1376 /* A list of class types of which this type is a friend. The
1377 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1378 case of a template friend. */
1379 #define CLASSTYPE_FRIEND_CLASSES(NODE) \
1380 (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
1382 /* A list of the classes which grant friendship to this class. */
1383 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1384 (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
1386 /* Say whether this node was declared as a "class" or a "struct". */
1387 #define CLASSTYPE_DECLARED_CLASS(NODE) \
1388 (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
1390 /* Nonzero if this class has const members
1391 which have no specified initialization. */
1392 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
1393 (TYPE_LANG_SPECIFIC (NODE) \
1394 ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
1395 #define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
1396 (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
1398 /* Nonzero if this class has ref members
1399 which have no specified initialization. */
1400 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
1401 (TYPE_LANG_SPECIFIC (NODE) \
1402 ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
1403 #define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
1404 (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
1406 /* Nonzero if this class is included from a header file which employs
1407 `#pragma interface', and it is not included in its implementation file. */
1408 #define CLASSTYPE_INTERFACE_ONLY(NODE) \
1409 (LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
1411 /* True if we have already determined whether or not vtables, VTTs,
1412 typeinfo, and other similar per-class data should be emitted in
1413 this translation unit. This flag does not indicate whether or not
1414 these items should be emitted; it only indicates that we know one
1415 way or the other. */
1416 #define CLASSTYPE_INTERFACE_KNOWN(NODE) \
1417 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
1418 /* The opposite of CLASSTYPE_INTERFACE_KNOWN. */
1419 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
1420 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
1422 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
1423 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
1424 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
1425 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
1426 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
1427 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
1429 /* Nonzero if a _DECL node requires us to output debug info for this class. */
1430 #define CLASSTYPE_DEBUG_REQUESTED(NODE) \
1431 (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
1433 /* Additional macros for inheritance information. */
1435 /* Nonzero means that this class is on a path leading to a new vtable. */
1436 #define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE)
1438 /* Nonzero means B (a BINFO) has its own vtable. Any copies will not
1439 have this flag set. */
1440 #define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B))
1442 /* Compare a BINFO_TYPE with another type for equality. For a binfo,
1443 this is functionally equivalent to using same_type_p, but
1444 measurably faster. At least one of the arguments must be a
1445 BINFO_TYPE. The other can be a BINFO_TYPE or a regular type. If
1446 BINFO_TYPE(T) ever stops being the main variant of the class the
1447 binfo is for, this macro must change. */
1448 #define SAME_BINFO_TYPE_P(A, B) ((A) == (B))
1450 /* Any subobject that needs a new vtable must have a vptr and must not
1451 be a non-virtual primary base (since it would then use the vtable from a
1452 derived class and never become non-primary.) */
1453 #define SET_BINFO_NEW_VTABLE_MARKED(B) \
1454 (BINFO_NEW_VTABLE_MARKED (B) = 1, \
1455 gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)), \
1456 gcc_assert (TYPE_VFIELD (BINFO_TYPE (B))))
1458 /* Nonzero if this binfo is for a dependent base - one that should not
1460 #define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE)
1462 /* Nonzero if this binfo has lost its primary base binfo (because that
1463 is a nearly-empty virtual base that has been taken by some other
1464 base in the complete hierarchy. */
1465 #define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE)
1467 /* Nonzero if this BINFO is a primary base class. */
1468 #define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE)
1470 /* Used by various search routines. */
1471 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1473 /* A VEC(tree_pair_s) of the vcall indices associated with the class
1474 NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual
1475 function. The VALUE is the index into the virtual table where the
1476 vcall offset for that function is stored, when NODE is a virtual
1478 #define CLASSTYPE_VCALL_INDICES(NODE) \
1479 (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
1481 /* The various vtables for the class NODE. The primary vtable will be
1482 first, followed by the construction vtables and VTT, if any. */
1483 #define CLASSTYPE_VTABLES(NODE) \
1484 (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
1486 /* The std::type_info variable representing this class, or NULL if no
1487 such variable has been created. This field is only set for the
1488 TYPE_MAIN_VARIANT of the class. */
1489 #define CLASSTYPE_TYPEINFO_VAR(NODE) \
1490 (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
1492 /* Accessor macros for the BINFO_VIRTUALS list. */
1494 /* The number of bytes by which to adjust the `this' pointer when
1495 calling this virtual function. Subtract this value from the this
1496 pointer. Always non-NULL, might be constant zero though. */
1497 #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
1499 /* If non-NULL, the vtable index at which to find the vcall offset
1500 when calling this virtual function. Add the value at that vtable
1501 index to the this pointer. */
1502 #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
1504 /* The function to call. */
1505 #define BV_FN(NODE) (TREE_VALUE (NODE))
1508 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1509 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
1510 will be NULL_TREE to indicate a throw specification of `()', or
1511 no exceptions allowed. */
1512 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
1514 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
1515 #define TYPE_NOTHROW_P(NODE) \
1516 (TYPE_RAISES_EXCEPTIONS (NODE) \
1517 && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
1519 /* The binding level associated with the namespace. */
1520 #define NAMESPACE_LEVEL(NODE) \
1521 (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level)
1524 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
1525 a lang_decl (which has lang_decl_flags as its initial prefix).
1526 This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
1527 the full lang_decl, and not just lang_decl_flags. Keep these
1528 checks in ascending code order. */
1529 #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
1530 (!(TREE_CODE (NODE) == FIELD_DECL \
1531 || TREE_CODE (NODE) == VAR_DECL \
1532 || TREE_CODE (NODE) == CONST_DECL \
1533 || TREE_CODE (NODE) == USING_DECL))
1535 struct lang_decl_flags GTY(())
1537 ENUM_BITFIELD(languages) language : 4;
1538 unsigned global_ctor_p : 1;
1539 unsigned global_dtor_p : 1;
1540 unsigned anticipated_p : 1;
1541 unsigned template_conv_p : 1;
1543 unsigned operator_attr : 1;
1544 unsigned constructor_attr : 1;
1545 unsigned destructor_attr : 1;
1546 unsigned friend_attr : 1;
1547 unsigned static_function : 1;
1548 unsigned pure_virtual : 1;
1549 unsigned has_in_charge_parm_p : 1;
1550 unsigned has_vtt_parm_p : 1;
1552 unsigned deferred : 1;
1553 unsigned use_template : 2;
1554 unsigned nonconverting : 1;
1555 unsigned not_really_extern : 1;
1556 unsigned initialized_in_class : 1;
1557 unsigned assignment_operator_p : 1;
1561 unsigned can_be_full : 1;
1562 unsigned thunk_p : 1;
1563 unsigned this_thunk_p : 1;
1564 unsigned repo_available_p : 1;
1565 unsigned hidden_friend_p : 1;
1566 unsigned threadprivate_p : 1;
1567 /* One unused bit. */
1570 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
1572 In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
1573 VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
1574 DECL_TEMPLATE_INFO. */
1575 tree GTY ((tag ("0"))) template_info;
1577 /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
1578 struct cp_binding_level * GTY ((tag ("1"))) level;
1579 } GTY ((desc ("%1.u1sel"))) u;
1581 union lang_decl_u2 {
1582 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
1583 THUNK_VIRTUAL_OFFSET.
1584 Otherwise this is DECL_ACCESS. */
1585 tree GTY ((tag ("0"))) access;
1587 /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
1588 int GTY ((tag ("1"))) discriminator;
1589 } GTY ((desc ("%1.u2sel"))) u2;
1592 /* sorted_fields is sorted based on a pointer, so we need to be able
1593 to resort it if pointers get rearranged. */
1595 struct lang_decl GTY(())
1597 struct lang_decl_flags decl_flags;
1601 struct full_lang_decl
1603 /* In an overloaded operator, this is the value of
1604 DECL_OVERLOADED_OPERATOR_P. */
1605 ENUM_BITFIELD (tree_code) operator_code : 8;
1608 unsigned pending_inline_p : 1;
1609 unsigned spare : 22;
1611 /* For a non-thunk function decl, this is a tree list of
1612 friendly classes. For a thunk function decl, it is the
1613 thunked to function decl. */
1614 tree befriending_classes;
1616 /* For a non-virtual FUNCTION_DECL, this is
1617 DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
1618 DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
1619 this pointer and result pointer adjusting thunks are
1620 chained here. This pointer thunks to return pointer thunks
1621 will be chained on the return pointer thunk. */
1626 /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is
1627 DECL_CLONED_FUNCTION. */
1628 tree GTY ((tag ("0"))) cloned_function;
1630 /* In a FUNCTION_DECL for which THUNK_P holds this is the
1631 THUNK_FIXED_OFFSET. */
1632 HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset;
1633 } GTY ((desc ("%0.decl_flags.thunk_p"))) u5;
1637 struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields")))
1639 struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info;
1640 struct language_function * GTY ((tag ("1")))
1641 saved_language_function;
1642 } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u;
1643 } GTY ((tag ("1"))) f;
1644 } GTY ((desc ("%1.decl_flags.can_be_full"))) u;
1647 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
1649 #define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \
1650 ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
1651 if (lt->decl_flags.u2sel != TF) \
1652 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1653 <->decl_flags.u2; })
1657 #define LANG_DECL_U2_CHECK(NODE, TF) \
1658 (&DECL_LANG_SPECIFIC (NODE)->decl_flags.u2)
1660 #endif /* ENABLE_TREE_CHECKING */
1662 /* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
1663 declaration. Some entities (like a member function in a local
1664 class, or a local variable) do not have linkage at all, and this
1665 macro should not be used in those cases.
1667 Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
1668 created by language-independent code, and has C linkage. Most
1669 VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
1670 we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */
1671 #define DECL_LANGUAGE(NODE) \
1672 (DECL_LANG_SPECIFIC (NODE) \
1673 ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \
1674 : (TREE_CODE (NODE) == FUNCTION_DECL \
1675 ? lang_c : lang_cplusplus))
1677 /* Set the language linkage for NODE to LANGUAGE. */
1678 #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
1679 (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE))
1681 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
1682 #define DECL_CONSTRUCTOR_P(NODE) \
1683 (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr)
1685 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
1687 #define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
1688 (DECL_CONSTRUCTOR_P (NODE) \
1689 && DECL_NAME (NODE) == complete_ctor_identifier)
1691 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
1693 #define DECL_BASE_CONSTRUCTOR_P(NODE) \
1694 (DECL_CONSTRUCTOR_P (NODE) \
1695 && DECL_NAME (NODE) == base_ctor_identifier)
1697 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
1698 specialized in-charge constructor or the specialized not-in-charge
1700 #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
1701 (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
1703 /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
1704 #define DECL_COPY_CONSTRUCTOR_P(NODE) \
1705 (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
1707 /* Nonzero if NODE is a destructor. */
1708 #define DECL_DESTRUCTOR_P(NODE) \
1709 (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr)
1711 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
1712 specialized in-charge constructor, in-charge deleting constructor,
1713 or the base destructor. */
1714 #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
1715 (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
1717 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
1719 #define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
1720 (DECL_DESTRUCTOR_P (NODE) \
1721 && DECL_NAME (NODE) == complete_dtor_identifier)
1723 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
1725 #define DECL_BASE_DESTRUCTOR_P(NODE) \
1726 (DECL_DESTRUCTOR_P (NODE) \
1727 && DECL_NAME (NODE) == base_dtor_identifier)
1729 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
1730 object that deletes the object after it has been destroyed. */
1731 #define DECL_DELETING_DESTRUCTOR_P(NODE) \
1732 (DECL_DESTRUCTOR_P (NODE) \
1733 && DECL_NAME (NODE) == deleting_dtor_identifier)
1735 /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
1737 #define DECL_CLONED_FUNCTION_P(NODE) \
1738 ((TREE_CODE (NODE) == FUNCTION_DECL \
1739 || TREE_CODE (NODE) == TEMPLATE_DECL) \
1740 && DECL_LANG_SPECIFIC (NODE) \
1741 && !DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p \
1742 && DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
1744 /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
1746 #define DECL_CLONED_FUNCTION(NODE) \
1747 (DECL_LANG_SPECIFIC (NON_THUNK_FUNCTION_CHECK(NODE))->u.f.u5.cloned_function)
1749 /* Perform an action for each clone of FN, if FN is a function with
1750 clones. This macro should be used like:
1752 FOR_EACH_CLONE (clone, fn)
1756 #define FOR_EACH_CLONE(CLONE, FN) \
1757 if (TREE_CODE (FN) == FUNCTION_DECL \
1758 && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \
1759 || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))) \
1760 for (CLONE = TREE_CHAIN (FN); \
1761 CLONE && DECL_CLONED_FUNCTION_P (CLONE); \
1762 CLONE = TREE_CHAIN (CLONE))
1764 /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
1765 #define DECL_DISCRIMINATOR_P(NODE) \
1766 (TREE_CODE (NODE) == VAR_DECL \
1767 && DECL_FUNCTION_SCOPE_P (NODE))
1769 /* Discriminator for name mangling. */
1770 #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
1772 /* Nonzero if the VTT parm has been added to NODE. */
1773 #define DECL_HAS_VTT_PARM_P(NODE) \
1774 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_vtt_parm_p)
1776 /* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is
1778 #define DECL_NEEDS_VTT_PARM_P(NODE) \
1779 (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE)) \
1780 && (DECL_BASE_CONSTRUCTOR_P (NODE) \
1781 || DECL_BASE_DESTRUCTOR_P (NODE)))
1783 /* Nonzero if NODE is a user-defined conversion operator. */
1784 #define DECL_CONV_FN_P(NODE) \
1785 (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
1787 /* If FN is a conversion operator, the type to which it converts.
1788 Otherwise, NULL_TREE. */
1789 #define DECL_CONV_FN_TYPE(FN) \
1790 (DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE)
1792 /* Nonzero if NODE, which is a TEMPLATE_DECL, is a template
1793 conversion operator to a type dependent on the innermost template
1795 #define DECL_TEMPLATE_CONV_FN_P(NODE) \
1796 (DECL_LANG_SPECIFIC (NODE)->decl_flags.template_conv_p)
1798 /* Set the overloaded operator code for NODE to CODE. */
1799 #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
1800 (DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE))
1802 /* If NODE is an overloaded operator, then this returns the TREE_CODE
1803 associated with the overloaded operator.
1804 DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
1805 whether or not NODE is an assignment operator. If NODE is not an
1806 overloaded operator, ERROR_MARK is returned. Since the numerical
1807 value of ERROR_MARK is zero, this macro can be used as a predicate
1808 to test whether or not NODE is an overloaded operator. */
1809 #define DECL_OVERLOADED_OPERATOR_P(NODE) \
1810 (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
1811 ? DECL_LANG_SPECIFIC (NODE)->u.f.operator_code : ERROR_MARK)
1813 /* Nonzero if NODE is an assignment operator. */
1814 #define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
1815 (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p)
1817 /* For FUNCTION_DECLs: nonzero means that this function is a
1818 constructor or a destructor with an extra in-charge parameter to
1819 control whether or not virtual bases are constructed. */
1820 #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
1821 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p)
1823 /* Nonzero if DECL is a declaration of __builtin_constant_p. */
1824 #define DECL_IS_BUILTIN_CONSTANT_P(NODE) \
1825 (TREE_CODE (NODE) == FUNCTION_DECL \
1826 && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \
1827 && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P)
1829 /* Nonzero for _DECL means that this decl appears in (or will appear
1830 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
1831 detecting circularity in case members are multiply defined. In the
1832 case of a VAR_DECL, it is also used to determine how program storage
1833 should be allocated. */
1834 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
1836 /* Nonzero for a VAR_DECL means that the variable's initialization (if
1837 any) has been processed. (In general, DECL_INITIALIZED_P is
1838 !DECL_EXTERN, but static data members may be initialized even if
1840 #define DECL_INITIALIZED_P(NODE) \
1841 (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
1843 /* Nonzero for a VAR_DECL iff an explicit initializer was provided. */
1844 #define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \
1845 (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
1847 /* Nonzero for a VAR_DECL that was initialized with a
1848 constant-expression. */
1849 #define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
1850 (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
1852 /* Nonzero for a VAR_DECL that can be used in an integral constant
1857 An integral constant-expression can only involve ... const
1858 variables of static or enumeration types initialized with
1859 constant expressions ...
1861 The standard does not require that the expression be non-volatile.
1862 G++ implements the proposed correction in DR 457. */
1863 #define DECL_INTEGRAL_CONSTANT_VAR_P(NODE) \
1864 (TREE_CODE (NODE) == VAR_DECL \
1865 && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (NODE)) \
1866 && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (NODE)) \
1867 && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (NODE))
1869 /* Nonzero if the DECL was initialized in the class definition itself,
1870 rather than outside the class. This is used for both static member
1871 VAR_DECLS, and FUNTION_DECLS that are defined in the class. */
1872 #define DECL_INITIALIZED_IN_CLASS_P(DECL) \
1873 (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class)
1875 /* Nonzero for DECL means that this decl is just a friend declaration,
1876 and should not be added to the list of members for this class. */
1877 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr)
1879 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
1880 #define DECL_BEFRIENDING_CLASSES(NODE) \
1881 (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
1883 /* Nonzero for FUNCTION_DECL means that this decl is a static
1885 #define DECL_STATIC_FUNCTION_P(NODE) \
1886 (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function)
1888 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
1890 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
1891 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
1893 /* Nonzero for FUNCTION_DECL means that this decl is a member function
1894 (static or non-static). */
1895 #define DECL_FUNCTION_MEMBER_P(NODE) \
1896 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
1898 /* Nonzero for FUNCTION_DECL means that this member function
1899 has `this' as const X *const. */
1900 #define DECL_CONST_MEMFUNC_P(NODE) \
1901 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
1902 && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
1903 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
1905 /* Nonzero for FUNCTION_DECL means that this member function
1906 has `this' as volatile X *const. */
1907 #define DECL_VOLATILE_MEMFUNC_P(NODE) \
1908 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
1909 && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
1910 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
1912 /* Nonzero for a DECL means that this member is a non-static member. */
1913 #define DECL_NONSTATIC_MEMBER_P(NODE) \
1914 ((TREE_CODE (NODE) == FUNCTION_DECL \
1915 && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
1916 || TREE_CODE (NODE) == FIELD_DECL)
1918 /* Nonzero for _DECL means that this member object type
1920 #define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
1922 /* Nonzero for _DECL means that this constructor is a non-converting
1924 #define DECL_NONCONVERTING_P(NODE) \
1925 (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting)
1927 /* Nonzero for FUNCTION_DECL means that this member function is a pure
1928 virtual function. */
1929 #define DECL_PURE_VIRTUAL_P(NODE) \
1930 (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual)
1932 /* True (in a FUNCTION_DECL) if NODE is a virtual function that is an
1933 invalid overrider for a function from a base class. Once we have
1934 complained about an invalid overrider we avoid complaining about it
1936 #define DECL_INVALID_OVERRIDER_P(NODE) \
1937 (DECL_LANG_FLAG_4 (NODE))
1939 /* The thunks associated with NODE, a FUNCTION_DECL. */
1940 #define DECL_THUNKS(NODE) \
1941 (DECL_LANG_SPECIFIC (NODE)->u.f.context)
1943 /* Nonzero if NODE is a thunk, rather than an ordinary function. */
1944 #define DECL_THUNK_P(NODE) \
1945 (TREE_CODE (NODE) == FUNCTION_DECL \
1946 && DECL_LANG_SPECIFIC (NODE) \
1947 && DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p)
1949 /* Set DECL_THUNK_P for node. */
1950 #define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
1951 (DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p = 1, \
1952 DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1, \
1953 DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING))
1955 /* Nonzero if NODE is a this pointer adjusting thunk. */
1956 #define DECL_THIS_THUNK_P(NODE) \
1957 (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
1959 /* Nonzero if NODE is a result pointer adjusting thunk. */
1960 #define DECL_RESULT_THUNK_P(NODE) \
1961 (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
1963 /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
1964 #define DECL_NON_THUNK_FUNCTION_P(NODE) \
1965 (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
1967 /* Nonzero if NODE is `extern "C"'. */
1968 #define DECL_EXTERN_C_P(NODE) \
1969 (DECL_LANGUAGE (NODE) == lang_c)
1971 /* Nonzero if NODE is an `extern "C"' function. */
1972 #define DECL_EXTERN_C_FUNCTION_P(NODE) \
1973 (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
1975 /* True iff DECL is an entity with vague linkage whose definition is
1976 available in this translation unit. */
1977 #define DECL_REPO_AVAILABLE_P(NODE) \
1978 (DECL_LANG_SPECIFIC (NODE)->decl_flags.repo_available_p)
1980 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
1981 template function. */
1982 #define DECL_PRETTY_FUNCTION_P(NODE) \
1983 (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)))
1985 /* The _TYPE context in which this _DECL appears. This field holds the
1986 class where a virtual function instance is actually defined. */
1987 #define DECL_CLASS_CONTEXT(NODE) \
1988 (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
1990 /* For a non-member friend function, the class (if any) in which this
1991 friend was defined. For example, given:
1993 struct S { friend void f (); };
1995 the DECL_FRIEND_CONTEXT for `f' will be `S'. */
1996 #define DECL_FRIEND_CONTEXT(NODE) \
1997 ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
1998 ? DECL_LANG_SPECIFIC (NODE)->u.f.context \
2001 /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
2002 #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
2003 (DECL_LANG_SPECIFIC (NODE)->u.f.context = (CONTEXT))
2005 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
2006 #define CP_DECL_CONTEXT(NODE) \
2007 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
2008 #define CP_TYPE_CONTEXT(NODE) \
2009 (TYPE_CONTEXT (NODE) ? TYPE_CONTEXT (NODE) : global_namespace)
2010 #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
2012 /* 1 iff NODE has namespace scope, including the global namespace. */
2013 #define DECL_NAMESPACE_SCOPE_P(NODE) \
2014 (!DECL_TEMPLATE_PARM_P (NODE) \
2015 && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
2017 /* 1 iff NODE is a class member. */
2018 #define DECL_CLASS_SCOPE_P(NODE) \
2019 (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
2021 #define TYPE_CLASS_SCOPE_P(NODE) \
2022 (TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE)))
2024 /* 1 iff NODE is function-local. */
2025 #define DECL_FUNCTION_SCOPE_P(NODE) \
2026 (DECL_CONTEXT (NODE) \
2027 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
2029 /* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for
2030 both the primary typeinfo object and the associated NTBS name. */
2031 #define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
2033 /* 1 iff VAR_DECL node NODE is virtual table or VTT. */
2034 #define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
2036 /* Returns 1 iff VAR_DECL is a construction virtual table.
2037 DECL_VTABLE_OR_VTT_P will be true in this case and must be checked
2038 before using this macro. */
2039 #define DECL_CONSTRUCTION_VTABLE_P(NODE) \
2040 TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))
2042 /* 1 iff NODE is function-local, but for types. */
2043 #define LOCAL_CLASS_P(NODE) \
2044 (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
2046 /* For a NAMESPACE_DECL: the list of using namespace directives
2047 The PURPOSE is the used namespace, the value is the namespace
2048 that is the common ancestor. */
2049 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
2051 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
2052 of a namespace, to record the transitive closure of using namespace. */
2053 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
2055 /* In a NAMESPACE_DECL, the list of namespaces which have associated
2056 themselves with this one. */
2057 #define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
2058 (NAMESPACE_DECL_CHECK (NODE)->decl_non_common.saved_tree)
2060 /* In a NAMESPACE_DECL, points to the original namespace if this is
2061 a namespace alias. */
2062 #define DECL_NAMESPACE_ALIAS(NODE) \
2063 DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
2064 #define ORIGINAL_NAMESPACE(NODE) \
2065 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
2067 /* Nonzero if NODE is the std namespace. */
2068 #define DECL_NAMESPACE_STD_P(NODE) \
2069 (TREE_CODE (NODE) == NAMESPACE_DECL \
2070 && CP_DECL_CONTEXT (NODE) == global_namespace \
2071 && DECL_NAME (NODE) == std_identifier)
2073 /* In a TREE_LIST concatenating using directives, indicate indirect
2075 #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
2077 extern tree decl_shadowed_for_var_lookup (tree);
2078 extern void decl_shadowed_for_var_insert (tree, tree);
2080 /* Non zero if this is a using decl for a dependent scope. */
2081 #define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
2083 /* The scope named in a using decl. */
2084 #define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE))
2086 /* The decls named by a using decl. */
2087 #define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
2089 /* In a VAR_DECL, true if we have a shadowed local variable
2090 in the shadowed var table for this VAR_DECL. */
2091 #define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \
2092 (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p)
2094 /* In a VAR_DECL for a variable declared in a for statement,
2095 this is the shadowed (local) variable. */
2096 #define DECL_SHADOWED_FOR_VAR(NODE) \
2097 (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL)
2099 #define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \
2100 (decl_shadowed_for_var_insert (NODE, VAL))
2102 /* In a FUNCTION_DECL, this is nonzero if this function was defined in
2103 the class definition. We have saved away the text of the function,
2104 but have not yet processed it. */
2105 #define DECL_PENDING_INLINE_P(NODE) \
2106 (DECL_LANG_SPECIFIC (NODE)->u.f.pending_inline_p)
2108 /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
2110 #define DECL_PENDING_INLINE_INFO(NODE) \
2111 (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info)
2113 /* For a TYPE_DECL: if this structure has many fields, we'll sort them
2114 and put them into a TREE_VEC. */
2115 #define DECL_SORTED_FIELDS(NODE) \
2116 (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields)
2118 /* True if on the deferred_fns (see decl2.c) list. */
2119 #define DECL_DEFERRED_FN(DECL) \
2120 (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred)
2122 /* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
2123 TEMPLATE_DECL, the entity is either a template specialization (if
2124 DECL_USE_TEMPLATE is nonzero) or the abstract instance of the
2127 In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose
2128 TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a
2129 specialization or abstract instance. The TREE_VALUE is the
2130 template arguments used to specialize the template.
2134 template <typename T> struct S { friend void f(T) {} };
2136 In this case, S<int>::f is, from the point of view of the compiler,
2137 an instantiation of a template -- but, from the point of view of
2138 the language, each instantiation of S results in a wholly unrelated
2139 global function f. In this case, DECL_TEMPLATE_INFO for S<int>::f
2140 will be non-NULL, but DECL_USE_TEMPLATE will be zero. */
2141 #define DECL_TEMPLATE_INFO(NODE) \
2142 (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
2143 ->decl_flags.u.template_info)
2145 /* For a VAR_DECL, indicates that the variable has been processed.
2146 This flag is set and unset throughout the code; it is always
2147 used for a temporary purpose. */
2148 #define DECL_VAR_MARKED_P(NODE) \
2149 (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)))
2151 /* Template information for a RECORD_TYPE or UNION_TYPE. */
2152 #define CLASSTYPE_TEMPLATE_INFO(NODE) \
2153 (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
2155 /* Template information for an ENUMERAL_TYPE. Although an enumeration may
2156 not be a primary template, it may be declared within the scope of a
2157 primary template and the enumeration constants may depend on
2158 non-type template parameters. */
2159 #define ENUM_TEMPLATE_INFO(NODE) \
2160 (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
2162 /* Template information for a template template parameter. */
2163 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
2164 (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
2167 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2168 #define TYPE_TEMPLATE_INFO(NODE) \
2169 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2170 ? ENUM_TEMPLATE_INFO (NODE) : \
2171 (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
2172 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
2173 (TYPE_LANG_SPECIFIC (NODE) \
2174 ? CLASSTYPE_TEMPLATE_INFO (NODE) \
2177 /* Set the template information for an ENUMERAL_, RECORD_, or
2178 UNION_TYPE to VAL. */
2179 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
2180 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2181 ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
2182 : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
2184 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
2185 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
2186 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
2188 /* We use TREE_VECs to hold template arguments. If there is only one
2189 level of template arguments, then the TREE_VEC contains the
2190 arguments directly. If there is more than one level of template
2191 arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
2192 containing the template arguments for a single level. The first
2193 entry in the outer TREE_VEC is the outermost level of template
2194 parameters; the last is the innermost.
2196 It is incorrect to ever form a template argument vector containing
2197 only one level of arguments, but which is a TREE_VEC containing as
2198 its only entry the TREE_VEC for that level. */
2200 /* Nonzero if the template arguments is actually a vector of vectors,
2201 rather than just a vector. */
2202 #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
2203 (NODE && TREE_VEC_ELT (NODE, 0) \
2204 && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
2206 /* The depth of a template argument vector. When called directly by
2207 the parser, we use a TREE_LIST rather than a TREE_VEC to represent
2208 template arguments. In fact, we may even see NULL_TREE if there
2209 are no template arguments. In both of those cases, there is only
2210 one level of template arguments. */
2211 #define TMPL_ARGS_DEPTH(NODE) \
2212 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
2214 /* The LEVELth level of the template ARGS. The outermost level of
2215 args is level 1, not level 0. */
2216 #define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
2217 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
2218 ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
2220 /* Set the LEVELth level of the template ARGS to VAL. This macro does
2221 not work with single-level argument vectors. */
2222 #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
2223 (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
2225 /* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
2226 #define TMPL_ARG(ARGS, LEVEL, IDX) \
2227 (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
2229 /* Given a single level of template arguments in NODE, return the
2230 number of arguments. */
2231 #define NUM_TMPL_ARGS(NODE) \
2232 (TREE_VEC_LENGTH (NODE))
2234 /* Returns the innermost level of template arguments in ARGS. */
2235 #define INNERMOST_TEMPLATE_ARGS(NODE) \
2236 (get_innermost_template_args ((NODE), 1))
2238 /* The number of levels of template parameters given by NODE. */
2239 #define TMPL_PARMS_DEPTH(NODE) \
2240 ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
2242 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
2243 TEMPLATE_DECL will be the immediate parent, not the most general
2244 template. For example, in:
2246 template <class T> struct S { template <class U> void f(U); }
2248 the FUNCTION_DECL for S<int>::f<double> will have, as its
2249 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
2251 As a special case, for a member friend template of a template
2252 class, this value will not be a TEMPLATE_DECL, but rather an
2253 IDENTIFIER_NODE or OVERLOAD indicating the name of the template and
2254 any explicit template arguments provided. For example, in:
2256 template <class T> struct S { friend void f<int>(int, double); }
2258 the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
2259 DECL_TI_ARGS will be {int}. */
2260 #define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
2262 /* The template arguments used to obtain this decl from the most
2263 general form of DECL_TI_TEMPLATE. For the example given for
2264 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
2265 are always the full set of arguments required to instantiate this
2266 declaration from the most general template specialized here. */
2267 #define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
2269 /* The TEMPLATE_DECL associated with NODE, a class type. Even if NODE
2270 will be generated from a partial specialization, the TEMPLATE_DECL
2271 referred to here will be the original template. For example,
2274 template <typename T> struct S {};
2275 template <typename T> struct S<T*> {};
2277 the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>. */
2278 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
2279 #define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
2281 /* For a template instantiation TYPE, returns the TYPE corresponding
2282 to the primary template. Otherwise returns TYPE itself. */
2283 #define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
2284 ((CLASSTYPE_USE_TEMPLATE ((TYPE)) \
2285 && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
2286 ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
2287 (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
2290 /* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs. */
2291 #define TYPE_TI_TEMPLATE(NODE) \
2292 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
2294 /* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2295 #define TYPE_TI_ARGS(NODE) \
2296 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
2298 #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE)
2300 /* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the
2301 sense of [temp.mem]. */
2302 #define DECL_MEMBER_TEMPLATE_P(NODE) \
2303 (DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE)))
2305 /* Nonzero if the NODE corresponds to the template parameters for a
2306 member template, whose inline definition is being processed after
2307 the class definition is complete. */
2308 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
2310 /* Determine if a parameter (i.e., a PARM_DECL) is a function
2312 #define FUNCTION_PARAMETER_PACK_P(NODE) \
2313 (DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE)))
2315 /* Determines if NODE is an expansion of one or more parameter packs,
2316 e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */
2317 #define PACK_EXPANSION_P(NODE) \
2318 (TREE_CODE (NODE) == TYPE_PACK_EXPANSION \
2319 || TREE_CODE (NODE) == EXPR_PACK_EXPANSION)
2321 /* Extracts the type or expression pattern from a TYPE_PACK_EXPANSION or
2322 EXPR_PACK_EXPANSION. */
2323 #define PACK_EXPANSION_PATTERN(NODE) \
2324 (TREE_CODE (NODE) == TYPE_PACK_EXPANSION? TREE_TYPE (NODE) \
2325 : TREE_OPERAND (NODE, 0))
2327 /* Sets the type or expression pattern for a TYPE_PACK_EXPANSION or
2328 EXPR_PACK_EXPANSION. */
2329 #define SET_PACK_EXPANSION_PATTERN(NODE,VALUE) \
2330 if (TREE_CODE (NODE) == TYPE_PACK_EXPANSION) \
2331 TREE_TYPE (NODE) = VALUE; \
2333 TREE_OPERAND (NODE, 0) = VALUE
2335 /* The list of parameter packs used in the PACK_EXPANSION_* node. The
2336 TREE_VALUE of each TREE_LIST contains the parameter packs. */
2337 #define PACK_EXPANSION_PARAMETER_PACKS(NODE) TREE_CHAIN (NODE)
2339 /* Determine if this is an argument pack. */
2340 #define ARGUMENT_PACK_P(NODE) \
2341 (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK \
2342 || TREE_CODE (NODE) == NONTYPE_ARGUMENT_PACK)
2344 /* The arguments stored in an argument pack. Arguments are stored in a
2345 TREE_VEC, which may have length zero. */
2346 #define ARGUMENT_PACK_ARGS(NODE) \
2347 (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK? TREE_TYPE (NODE) \
2348 : TREE_OPERAND (NODE, 0))
2350 /* Set the arguments stored in an argument pack. VALUE must be a
2352 #define SET_ARGUMENT_PACK_ARGS(NODE,VALUE) \
2353 if (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK) \
2354 TREE_TYPE (NODE) = VALUE; \
2356 TREE_OPERAND (NODE, 0) = VALUE
2358 /* Whether the argument pack is "incomplete", meaning that more
2359 arguments can still be deduced. Incomplete argument packs are only
2360 used when the user has provided an explicit template argument list
2361 for a variadic function template. Some of the explicit template
2362 arguments will be placed into the beginning of the argument pack,
2363 but additional arguments might still be deduced. */
2364 #define ARGUMENT_PACK_INCOMPLETE_P(NODE) \
2365 TREE_LANG_FLAG_0 (ARGUMENT_PACK_ARGS (NODE))
2367 /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
2368 arguments used to fill this pack. */
2369 #define ARGUMENT_PACK_EXPLICIT_ARGS(NODE) \
2370 TREE_TYPE (ARGUMENT_PACK_ARGS (NODE))
2372 /* In an ARGUMENT_PACK_SELECT, the argument pack from which an
2373 argument will be selected. */
2374 #define ARGUMENT_PACK_SELECT_FROM_PACK(NODE) \
2375 (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->argument_pack)
2377 /* In an ARGUMENT_PACK_SELECT, the index of the argument we want to
2379 #define ARGUMENT_PACK_SELECT_INDEX(NODE) \
2380 (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index)
2382 /* In an ARGUMENT_PACK_SELECT, the actual underlying argument that the
2383 ARGUMENT_PACK_SELECT represents. */
2384 #define ARGUMENT_PACK_SELECT_ARG(NODE) \
2385 TREE_VEC_ELT (ARGUMENT_PACK_ARGS (ARGUMENT_PACK_SELECT_FROM_PACK (NODE)), \
2386 ARGUMENT_PACK_SELECT_INDEX (NODE));
2388 /* In a FUNCTION_DECL, the saved language-specific per-function data. */
2389 #define DECL_SAVED_FUNCTION_DATA(NODE) \
2390 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \
2391 ->u.f.u.saved_language_function)
2393 /* Indicates an indirect_expr is for converting a reference. */
2394 #define REFERENCE_REF_P(NODE) \
2395 TREE_LANG_FLAG_0 (INDIRECT_REF_CHECK (NODE))
2397 #define NEW_EXPR_USE_GLOBAL(NODE) \
2398 TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
2399 #define DELETE_EXPR_USE_GLOBAL(NODE) \
2400 TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE))
2401 #define DELETE_EXPR_USE_VEC(NODE) \
2402 TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE))
2404 /* Indicates that this is a non-dependent COMPOUND_EXPR which will
2405 resolve to a function call. */
2406 #define COMPOUND_EXPR_OVERLOADED(NODE) \
2407 TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE))
2409 /* In a CALL_EXPR appearing in a template, true if Koenig lookup
2410 should be performed at instantiation time. */
2411 #define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
2413 /* Indicates whether a string literal has been parenthesized. Such
2414 usages are disallowed in certain circumstances. */
2416 #define PAREN_STRING_LITERAL_P(NODE) \
2417 TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE))
2419 /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
2420 constructor call, rather than an ordinary function call. */
2421 #define AGGR_INIT_VIA_CTOR_P(NODE) \
2422 TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
2424 /* AGGR_INIT_EXPR accessors. These are equivalent to the CALL_EXPR
2425 accessors, except for AGGR_INIT_EXPR_SLOT (which takes the place of
2426 CALL_EXPR_STATIC_CHAIN). */
2428 #define AGGR_INIT_EXPR_FN(NODE) TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 1)
2429 #define AGGR_INIT_EXPR_SLOT(NODE) \
2430 TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 2)
2431 #define AGGR_INIT_EXPR_ARG(NODE, I) \
2432 TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), (I) + 3)
2433 #define aggr_init_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3)
2435 /* AGGR_INIT_EXPR_ARGP returns a pointer to the argument vector for NODE.
2436 We can't use &AGGR_INIT_EXPR_ARG (NODE, 0) because that will complain if
2437 the argument count is zero when checking is enabled. Instead, do
2438 the pointer arithmetic to advance past the 3 fixed operands in a
2439 AGGR_INIT_EXPR. That produces a valid pointer to just past the end of
2440 the operand array, even if it's not valid to dereference it. */
2441 #define AGGR_INIT_EXPR_ARGP(NODE) \
2442 (&(TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 0)) + 3)
2444 /* Abstract iterators for AGGR_INIT_EXPRs. */
2446 /* Structure containing iterator state. */
2447 typedef struct aggr_init_expr_arg_iterator_d GTY (())
2449 tree t; /* the aggr_init_expr */
2450 int n; /* argument count */
2451 int i; /* next argument index */
2452 } aggr_init_expr_arg_iterator;
2454 /* Initialize the abstract argument list iterator object ITER with the
2455 arguments from AGGR_INIT_EXPR node EXP. */
2457 init_aggr_init_expr_arg_iterator (tree exp,
2458 aggr_init_expr_arg_iterator *iter)
2461 iter->n = aggr_init_expr_nargs (exp);
2465 /* Return the next argument from abstract argument list iterator object ITER,
2466 and advance its state. Return NULL_TREE if there are no more arguments. */
2468 next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter)
2471 if (iter->i >= iter->n)
2473 result = AGGR_INIT_EXPR_ARG (iter->t, iter->i);
2478 /* Initialize the abstract argument list iterator object ITER, then advance
2479 past and return the first argument. Useful in for expressions, e.g.
2480 for (arg = first_aggr_init_expr_arg (exp, &iter); arg;
2481 arg = next_aggr_init_expr_arg (&iter)) */
2483 first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter)
2485 init_aggr_init_expr_arg_iterator (exp, iter);
2486 return next_aggr_init_expr_arg (iter);
2489 /* Test whether there are more arguments in abstract argument list iterator
2490 ITER, without changing its state. */
2492 more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
2494 return (iter->i < iter->n);
2497 /* Iterate through each argument ARG of AGGR_INIT_EXPR CALL, using variable
2498 ITER (of type aggr_init_expr_arg_iterator) to hold the iteration state. */
2499 #define FOR_EACH_AGGR_INIT_EXPR_ARG(arg, iter, call) \
2500 for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg); \
2501 (arg) = next_aggr_init_expr_arg (&(iter)))
2503 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
2504 TEMPLATE_DECL. This macro determines whether or not a given class
2505 type is really a template type, as opposed to an instantiation or
2506 specialization of one. */
2507 #define CLASSTYPE_IS_TEMPLATE(NODE) \
2508 (CLASSTYPE_TEMPLATE_INFO (NODE) \
2509 && !CLASSTYPE_USE_TEMPLATE (NODE) \
2510 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
2512 /* The name used by the user to name the typename type. Typically,
2513 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
2514 corresponding TYPE_DECL. However, this may also be a
2515 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
2516 #define TYPENAME_TYPE_FULLNAME(NODE) (TYPENAME_TYPE_CHECK (NODE))->type.values
2518 /* True if a TYPENAME_TYPE was declared as an "enum". */
2519 #define TYPENAME_IS_ENUM_P(NODE) \
2520 (TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE)))
2522 /* True if a TYPENAME_TYPE was declared as a "class", "struct", or
2524 #define TYPENAME_IS_CLASS_P(NODE) \
2525 (TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE)))
2527 /* Nonzero in INTEGER_CST means that this int is negative by dint of
2528 using a twos-complement negated operand. */
2529 #define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
2533 A class that declares or inherits a virtual function is called a
2534 polymorphic class. */
2535 #define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
2537 /* Nonzero if this class has a virtual function table pointer. */
2538 #define TYPE_CONTAINS_VPTR_P(NODE) \
2539 (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE))
2541 /* This flag is true of a local VAR_DECL if it was declared in a for
2542 statement, but we are no longer in the scope of the for. */
2543 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
2545 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
2546 if we already emitted a warning about using it. */
2547 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
2549 /* Nonzero if NODE is a FUNCTION_DECL (for a function with global
2550 scope) declared in a local scope. */
2551 #define DECL_LOCAL_FUNCTION_P(NODE) \
2552 DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
2554 /* Nonzero if NODE is a DECL which we know about but which has not
2555 been explicitly declared, such as a built-in function or a friend
2556 declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P
2558 #define DECL_ANTICIPATED(NODE) \
2559 (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.anticipated_p)
2561 /* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
2562 within a class but has not been declared in the surrounding scope.
2563 The function is invisible except via argument dependent lookup. */
2564 #define DECL_HIDDEN_FRIEND_P(NODE) \
2565 (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.hidden_friend_p)
2567 /* Nonzero if DECL has been declared threadprivate by
2568 #pragma omp threadprivate. */
2569 #define CP_DECL_THREADPRIVATE_P(DECL) \
2570 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->decl_flags.threadprivate_p)
2572 /* Record whether a typedef for type `int' was actually `signed int'. */
2573 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
2575 /* Returns nonzero if DECL has external linkage, as specified by the
2576 language standard. (This predicate may hold even when the
2577 corresponding entity is not actually given external linkage in the
2578 object file; see decl_linkage for details.) */
2579 #define DECL_EXTERNAL_LINKAGE_P(DECL) \
2580 (decl_linkage (DECL) == lk_external)
2582 /* Keep these codes in ascending code order. */
2584 #define INTEGRAL_CODE_P(CODE) \
2585 ((CODE) == ENUMERAL_TYPE \
2586 || (CODE) == BOOLEAN_TYPE \
2587 || (CODE) == INTEGER_TYPE)
2589 /* [basic.fundamental]
2591 Types bool, char, wchar_t, and the signed and unsigned integer types
2592 are collectively called integral types.
2594 Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
2595 types as well, which is incorrect in C++. Keep these checks in
2596 ascending code order. */
2597 #define CP_INTEGRAL_TYPE_P(TYPE) \
2598 (TREE_CODE (TYPE) == BOOLEAN_TYPE \
2599 || TREE_CODE (TYPE) == INTEGER_TYPE)
2601 /* Returns true if TYPE is an integral or enumeration name. Keep
2602 these checks in ascending code order. */
2603 #define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
2604 (TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE))
2606 /* [basic.fundamental]
2608 Integral and floating types are collectively called arithmetic
2609 types. Keep these checks in ascending code order. */
2610 #define ARITHMETIC_TYPE_P(TYPE) \
2611 (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
2615 Arithmetic types, enumeration types, pointer types, and
2616 pointer-to-member types, are collectively called scalar types.
2617 Keep these checks in ascending code order. */
2618 #define SCALAR_TYPE_P(TYPE) \
2619 (TYPE_PTRMEM_P (TYPE) \
2620 || TREE_CODE (TYPE) == ENUMERAL_TYPE \
2621 || ARITHMETIC_TYPE_P (TYPE) \
2622 || TYPE_PTR_P (TYPE) \
2623 || TYPE_PTRMEMFUNC_P (TYPE))
2627 An aggregate is an array or a class with no user-declared
2628 constructors, no private or protected non-static data members, no
2629 base classes, and no virtual functions.
2631 As an extension, we also treat vectors as aggregates. Keep these
2632 checks in ascending code order. */
2633 #define CP_AGGREGATE_TYPE_P(TYPE) \
2634 (TREE_CODE (TYPE) == VECTOR_TYPE \
2635 ||TREE_CODE (TYPE) == ARRAY_TYPE \
2636 || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
2638 /* Nonzero for a class type means that the class type has a
2639 user-declared constructor. */
2640 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
2642 /* When appearing in an INDIRECT_REF, it means that the tree structure
2643 underneath is actually a call to a constructor. This is needed
2644 when the constructor must initialize local storage (which can
2645 be automatically destroyed), rather than allowing it to allocate
2646 space from the heap.
2648 When appearing in a SAVE_EXPR, it means that underneath
2649 is a call to a constructor.
2651 When appearing in a CONSTRUCTOR, the expression is a
2654 When appearing in a FIELD_DECL, it means that this field
2655 has been duly initialized in its constructor. */
2656 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
2658 /* True if NODE is a brace-enclosed initializer. */
2659 #define BRACE_ENCLOSED_INITIALIZER_P(NODE) \
2660 (TREE_CODE (NODE) == CONSTRUCTOR && !TREE_TYPE (NODE))
2662 /* True if NODE is a compound-literal, i.e., a brace-enclosed
2663 initializer cast to a particular type. */
2664 #define COMPOUND_LITERAL_P(NODE) \
2665 (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE))
2667 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
2668 && VEC_empty (constructor_elt, \
2669 CONSTRUCTOR_ELTS (NODE)) \
2670 && !TREE_HAS_CONSTRUCTOR (NODE))
2672 /* Nonzero means that an object of this type can not be initialized using
2673 an initializer list. */
2674 #define CLASSTYPE_NON_AGGREGATE(NODE) \
2675 (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
2676 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
2677 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
2679 /* Nonzero if there is a user-defined X::op=(x&) for this class. */
2680 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
2681 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref)
2683 /* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
2685 A destructor is trivial if it is an implicitly declared
2688 - all of the direct base classes of its class have trivial
2691 - for all of the non-static data members of its class that are
2692 of class type (or array thereof), each such class has a
2693 trivial destructor. */
2694 #define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
2695 (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
2697 /* Nonzero for _TYPE node means that this type does not have a trivial
2698 destructor. Therefore, destroying an object of this type will
2699 involve a call to a destructor. This can apply to objects of
2700 ARRAY_TYPE is the type of the elements needs a destructor. */
2701 #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
2702 (TYPE_LANG_FLAG_4 (NODE))
2704 /* Nonzero for class type means that copy initialization of this type can use
2706 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
2707 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
2709 /* Nonzero for class type means that assignment of this type can use
2711 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
2712 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
2714 /* Returns true if NODE is a pointer-to-data-member. */
2715 #define TYPE_PTRMEM_P(NODE) \
2716 (TREE_CODE (NODE) == OFFSET_TYPE)
2717 /* Returns true if NODE is a pointer. */
2718 #define TYPE_PTR_P(NODE) \
2719 (TREE_CODE (NODE) == POINTER_TYPE)
2721 /* Returns true if NODE is an object type:
2725 An object type is a (possibly cv-qualified) type that is not a
2726 function type, not a reference type, and not a void type.
2728 Keep these checks in ascending order, for speed. */
2729 #define TYPE_OBJ_P(NODE) \
2730 (TREE_CODE (NODE) != REFERENCE_TYPE \
2731 && TREE_CODE (NODE) != VOID_TYPE \
2732 && TREE_CODE (NODE) != FUNCTION_TYPE \
2733 && TREE_CODE (NODE) != METHOD_TYPE)
2735 /* Returns true if NODE is a pointer to an object. Keep these checks
2736 in ascending tree code order. */
2737 #define TYPE_PTROB_P(NODE) \
2738 (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))
2740 /* Returns true if NODE is a reference to an object. Keep these checks
2741 in ascending tree code order. */
2742 #define TYPE_REF_OBJ_P(NODE) \
2743 (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE)))
2745 /* Returns true if NODE is a pointer to an object, or a pointer to
2746 void. Keep these checks in ascending tree code order. */
2747 #define TYPE_PTROBV_P(NODE) \
2748 (TYPE_PTR_P (NODE) \
2749 && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
2750 || TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
2752 /* Returns true if NODE is a pointer to function. */
2753 #define TYPE_PTRFN_P(NODE) \
2754 (TREE_CODE (NODE) == POINTER_TYPE \
2755 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2757 /* Returns true if NODE is a reference to function. */
2758 #define TYPE_REFFN_P(NODE) \
2759 (TREE_CODE (NODE) == REFERENCE_TYPE \
2760 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2762 /* Nonzero for _TYPE node means that this type is a pointer to member
2764 #define TYPE_PTRMEMFUNC_P(NODE) \
2765 (TREE_CODE (NODE) == RECORD_TYPE \
2766 && TYPE_LANG_SPECIFIC (NODE) \
2767 && TYPE_PTRMEMFUNC_FLAG (NODE))
2769 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
2770 (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
2772 /* Returns true if NODE is a pointer-to-member. */
2773 #define TYPE_PTR_TO_MEMBER_P(NODE) \
2774 (TYPE_PTRMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
2776 /* Indicates when overload resolution may resolve to a pointer to
2777 member function. [expr.unary.op]/3 */
2778 #define PTRMEM_OK_P(NODE) \
2779 TREE_LANG_FLAG_0 (TREE_CHECK2 ((NODE), ADDR_EXPR, OFFSET_REF))
2781 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
2782 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
2783 before using this macro. */
2784 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
2785 (TREE_TYPE (TYPE_FIELDS (NODE)))
2787 /* Returns `A' for a type like `int (A::*)(double)' */
2788 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
2789 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
2791 /* These are use to manipulate the canonical RECORD_TYPE from the
2792 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
2793 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
2794 (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
2795 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
2797 if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
2799 TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \
2800 (struct lang_type, sizeof (struct lang_type_ptrmem)); \
2801 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
2803 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
2806 /* For a pointer-to-member type of the form `T X::*', this is `X'.
2807 For a type like `void (X::*)() const', this type is `X', not `const
2808 X'. To get at the `const X' you have to look at the
2809 TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
2811 #define TYPE_PTRMEM_CLASS_TYPE(NODE) \
2812 (TYPE_PTRMEM_P (NODE) \
2813 ? TYPE_OFFSET_BASETYPE (NODE) \
2814 : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
2816 /* For a pointer-to-member type of the form `T X::*', this is `T'. */
2817 #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
2818 (TYPE_PTRMEM_P (NODE) \
2819 ? TREE_TYPE (NODE) \
2820 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
2822 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
2824 #define PTRMEM_CST_CLASS(NODE) \
2825 TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
2827 /* For a pointer-to-member constant `X::Y' this is the _DECL for
2829 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
2831 /* The expression in question for a TYPEOF_TYPE. */
2832 #define TYPEOF_TYPE_EXPR(NODE) (TYPEOF_TYPE_CHECK (NODE))->type.values
2834 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
2835 specified in its declaration. This can also be set for an
2836 erroneously declared PARM_DECL. */
2837 #define DECL_THIS_EXTERN(NODE) \
2838 DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
2840 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
2841 specified in its declaration. This can also be set for an
2842 erroneously declared PARM_DECL. */
2843 #define DECL_THIS_STATIC(NODE) \
2844 DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
2846 /* Nonzero for FIELD_DECL node means that this field is a base class
2847 of the parent object, as opposed to a member field. */
2848 #define DECL_FIELD_IS_BASE(NODE) \
2849 DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
2851 /* Nonzero if TYPE is an anonymous union or struct type. We have to use a
2852 flag for this because "A union for which objects or pointers are
2853 declared is not an anonymous union" [class.union]. */
2854 #define ANON_AGGR_TYPE_P(NODE) \
2855 (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
2856 #define SET_ANON_AGGR_TYPE_P(NODE) \
2857 (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
2859 /* Nonzero if TYPE is an anonymous union type. */
2860 #define ANON_UNION_TYPE_P(NODE) \
2861 (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
2863 #define UNKNOWN_TYPE LANG_TYPE
2865 /* Define fields and accessors for nodes representing declared names. */
2867 #define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
2869 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
2871 /* The format of each node in the DECL_FRIENDLIST is as follows:
2873 The TREE_PURPOSE will be the name of a function, i.e., an
2874 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose
2875 TREE_VALUEs are friends with the given name. */
2876 #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
2877 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
2878 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
2880 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
2881 each node is a type; the TREE_VALUE is the access granted for this
2882 DECL in that type. The DECL_ACCESS is set by access declarations.
2883 For example, if a member that would normally be public in a
2884 derived class is made protected, then the derived class and the
2885 protected_access_node will appear in the DECL_ACCESS for the node. */
2886 #define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
2888 /* Nonzero if the FUNCTION_DECL is a global constructor. */
2889 #define DECL_GLOBAL_CTOR_P(NODE) \
2890 (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p)
2892 /* Nonzero if the FUNCTION_DECL is a global destructor. */
2893 #define DECL_GLOBAL_DTOR_P(NODE) \
2894 (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p)
2896 /* Accessor macros for C++ template decl nodes. */
2898 /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
2899 is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
2900 template parameters, with 1 being the outermost set of template
2901 parameters. The TREE_VALUE is a vector, whose elements are the
2902 template parameters at each level. Each element in the vector is a
2903 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
2904 non-type parameter), or a TYPE_DECL (if the parameter is a type
2905 parameter). The TREE_PURPOSE is the default value, if any. The
2906 TEMPLATE_PARM_INDEX for the parameter is available as the
2907 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
2909 #define DECL_TEMPLATE_PARMS(NODE) DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments
2910 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
2911 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
2912 #define DECL_NTPARMS(NODE) \
2913 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
2914 /* For function, method, class-data templates. */
2915 #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE)
2916 /* For a static member variable template, the
2917 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
2918 implicitly generated instantiations of the variable. There are no
2919 partial instantiations of static member variables, so all of these
2920 will be full instantiations.
2922 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
2923 all instantiations and specializations of the class type, including
2924 partial instantiations and partial specializations.
2926 In both cases, the TREE_PURPOSE of each node contains the arguments
2927 used; the TREE_VALUE contains the generated variable. The template
2928 arguments are always complete. For example, given:
2930 template <class T> struct S1 {
2931 template <class U> struct S2 {};
2932 template <class U> struct S2<U*> {};
2935 the record for the partial specialization will contain, as its
2936 argument list, { {T}, {U*} }, and will be on the
2937 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
2938 <class U> struct S1<T>::S2'.
2940 This list is not used for function templates. */
2941 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE)
2942 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
2943 contains all instantiations and specializations of the function,
2944 including partial instantiations. For a partial instantiation
2945 which is a specialization, this list holds only full
2946 specializations of the template that are instantiations of the
2947 partial instantiation. For example, given:
2949 template <class T> struct S {
2950 template <class U> void f(U);
2951 template <> void f(T);
2954 the `S<int>::f<int>(int)' function will appear on the
2955 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
2956 template <class U> void S<T>::f(U)' and `template <class T> void
2957 S<int>::f(T)'. In the latter case, however, it will have only the
2958 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
2959 for the function declaration will point at the specialization, not
2960 the fully general template.
2962 For a class template, this list contains the partial
2963 specializations of this template. (Full specializations are not
2964 recorded on this list.) The TREE_PURPOSE holds the arguments used
2965 in the partial specialization (e.g., for `template <class T> struct
2966 S<T*, int>' this will be `T*'.) The arguments will also include
2967 any outer template arguments. The TREE_VALUE holds the innermost
2968 template parameters for the specialization (e.g., `T' in the
2969 example above.) The TREE_TYPE is the _TYPE node for the partial
2972 This list is not used for static variable templates. */
2973 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE)
2975 /* Nonzero for a DECL which is actually a template parameter. Keep
2976 these checks in ascending tree code order. */
2977 #define DECL_TEMPLATE_PARM_P(NODE) \
2978 (DECL_LANG_FLAG_0 (NODE) \
2979 && (TREE_CODE (NODE) == CONST_DECL \
2980 || TREE_CODE (NODE) == PARM_DECL \
2981 || TREE_CODE (NODE) == TYPE_DECL \
2982 || TREE_CODE (NODE) == TEMPLATE_DECL))
2984 /* Mark NODE as a template parameter. */
2985 #define SET_DECL_TEMPLATE_PARM_P(NODE) \
2986 (DECL_LANG_FLAG_0 (NODE) = 1)
2988 /* Nonzero if NODE is a template template parameter. */
2989 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
2990 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
2992 /* Nonzero if NODE is a TEMPLATE_DECL representing an
2993 UNBOUND_CLASS_TEMPLATE tree node. */
2994 #define DECL_UNBOUND_CLASS_TEMPLATE_P(NODE) \
2995 (TREE_CODE (NODE) == TEMPLATE_DECL && !DECL_TEMPLATE_RESULT (NODE))
2997 #define DECL_FUNCTION_TEMPLATE_P(NODE) \
2998 (TREE_CODE (NODE) == TEMPLATE_DECL \
2999 && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
3000 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
3002 /* Nonzero for a DECL that represents a template class. */
3003 #define DECL_CLASS_TEMPLATE_P(NODE) \
3004 (TREE_CODE (NODE) == TEMPLATE_DECL \
3005 && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
3006 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
3007 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
3009 /* Nonzero if NODE which declares a type. */
3010 #define DECL_DECLARES_TYPE_P(NODE) \
3011 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
3013 /* Nonzero if NODE is the typedef implicitly generated for a type when
3014 the type is declared. In C++, `struct S {};' is roughly
3015 equivalent to `struct S {}; typedef struct S S;' in C.
3016 DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this
3017 example. In C++, there is a second implicit typedef for each
3018 class, in the scope of `S' itself, so that you can say `S::S'.
3019 DECL_SELF_REFERENCE_P will hold for that second typedef. */
3020 #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
3021 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
3022 #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
3023 (DECL_LANG_FLAG_2 (NODE) = 1)
3024 #define DECL_SELF_REFERENCE_P(NODE) \
3025 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE))
3026 #define SET_DECL_SELF_REFERENCE_P(NODE) \
3027 (DECL_LANG_FLAG_4 (NODE) = 1)
3029 /* A `primary' template is one that has its own template header. A
3030 member function of a class template is a template, but not primary.
3031 A member template is primary. Friend templates are primary, too. */
3033 /* Returns the primary template corresponding to these parameters. */
3034 #define DECL_PRIMARY_TEMPLATE(NODE) \
3035 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
3037 /* Returns nonzero if NODE is a primary template. */
3038 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
3040 /* Nonzero iff NODE is a specialization of a template. The value
3041 indicates the type of specializations:
3043 1=implicit instantiation
3045 2=partial or explicit specialization, e.g.:
3047 template <> int min<int> (int, int),
3049 3=explicit instantiation, e.g.:
3051 template int min<int> (int, int);
3053 Note that NODE will be marked as a specialization even if the
3054 template it is instantiating is not a primary template. For
3057 template <typename T> struct O {
3062 both O<int>::f and O<int>::I will be marked as instantiations.
3064 If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also
3066 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template)
3068 /* Like DECL_USE_TEMPLATE, but for class types. */
3069 #define CLASSTYPE_USE_TEMPLATE(NODE) \
3070 (LANG_TYPE_CLASS_CHECK (NODE)->use_template)
3072 /* True if NODE is a specialization of a primary template. */
3073 #define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \
3074 (CLASS_TYPE_P (NODE) \
3075 && CLASSTYPE_USE_TEMPLATE (NODE) \
3076 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (arg)))
3078 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
3079 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
3080 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
3082 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
3083 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
3085 /* Returns true for an explicit or partial specialization of a class
3087 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
3088 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
3089 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
3090 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
3092 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
3093 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
3094 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
3095 (CLASSTYPE_USE_TEMPLATE (NODE) == 1)
3096 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
3097 (CLASSTYPE_USE_TEMPLATE (NODE) = 1)
3099 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
3100 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
3101 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
3102 (CLASSTYPE_USE_TEMPLATE (NODE) == 3)
3103 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
3104 (CLASSTYPE_USE_TEMPLATE (NODE) = 3)
3106 /* Nonzero if DECL is a friend function which is an instantiation
3107 from the point of view of the compiler, but not from the point of
3108 view of the language. For example given:
3109 template <class T> struct S { friend void f(T) {}; };
3110 the declaration of `void f(int)' generated when S<int> is
3111 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
3112 a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
3113 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
3114 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
3116 /* Nonzero iff we are currently processing a declaration for an
3117 entity with its own template parameter list, and which is not a
3118 full specialization. */
3119 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
3120 (processing_template_decl > template_class_depth (current_scope ()))
3122 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
3123 instantiated, i.e. its definition has been generated from the
3124 pattern given in the template. */
3125 #define DECL_TEMPLATE_INSTANTIATED(NODE) \
3126 DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
3128 /* We know what we're doing with this decl now. */
3129 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
3131 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
3132 so that assemble_external will work properly. So we have this flag to
3133 tell us whether the decl is really not external. */
3134 #define DECL_NOT_REALLY_EXTERN(NODE) \
3135 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
3137 #define DECL_REALLY_EXTERN(NODE) \
3138 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
3140 /* A thunk is a stub function.
3142 A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
3143 The address of the ordinary FUNCTION_DECL is given by the
3144 DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
3145 FUNCTION_DECL. The job of the thunk is to either adjust the this
3146 pointer before transferring control to the FUNCTION_DECL, or call
3147 FUNCTION_DECL and then adjust the result value. Note, the result
3148 pointer adjusting thunk must perform a call to the thunked
3149 function, (or be implemented via passing some invisible parameter
3150 to the thunked function, which is modified to perform the
3151 adjustment just before returning).
3153 A thunk may perform either, or both, of the following operations:
3155 o Adjust the this or result pointer by a constant offset.
3156 o Adjust the this or result pointer by looking up a vcall or vbase offset
3159 A this pointer adjusting thunk converts from a base to a derived
3160 class, and hence adds the offsets. A result pointer adjusting thunk
3161 converts from a derived class to a base, and hence subtracts the
3162 offsets. If both operations are performed, then the constant
3163 adjustment is performed first for this pointer adjustment and last
3164 for the result pointer adjustment.
3166 The constant adjustment is given by THUNK_FIXED_OFFSET. If the
3167 vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is
3168 used. For this pointer adjusting thunks, it is the vcall offset
3169 into the vtable. For result pointer adjusting thunks it is the
3170 binfo of the virtual base to convert to. Use that binfo's vbase
3173 It is possible to have equivalent covariant thunks. These are
3174 distinct virtual covariant thunks whose vbase offsets happen to
3175 have the same value. THUNK_ALIAS is used to pick one as the
3176 canonical thunk, which will get all the this pointer adjusting
3177 thunks attached to it. */
3179 /* An integer indicating how many bytes should be subtracted from the
3180 this or result pointer when this function is called. */
3181 #define THUNK_FIXED_OFFSET(DECL) \
3182 (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.f.u5.fixed_offset)
3184 /* A tree indicating how to perform the virtual adjustment. For a this
3185 adjusting thunk it is the number of bytes to be added to the vtable
3186 to find the vcall offset. For a result adjusting thunk, it is the
3187 binfo of the relevant virtual base. If NULL, then there is no
3188 virtual adjust. (The vptr is always located at offset zero from
3189 the this or result pointer.) (If the covariant type is within the
3190 class hierarchy being laid out, the vbase index is not yet known
3191 at the point we need to create the thunks, hence the need to use
3194 #define THUNK_VIRTUAL_OFFSET(DECL) \
3195 (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access)
3197 /* A thunk which is equivalent to another thunk. */
3198 #define THUNK_ALIAS(DECL) \
3199 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.template_info)
3201 /* For thunk NODE, this is the FUNCTION_DECL thunked to. It is
3202 possible for the target to be a thunk too. */
3203 #define THUNK_TARGET(NODE) \
3204 (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
3206 /* True for a SCOPE_REF iff the "template" keyword was used to
3207 indicate that the qualified name denotes a template. */
3208 #define QUALIFIED_NAME_IS_TEMPLATE(NODE) \
3209 (TREE_LANG_FLAG_0 (SCOPE_REF_CHECK (NODE)))
3211 /* True for an OMP_ATOMIC that has dependent parameters. These are stored
3212 as an expr in operand 1, and integer_zero_node in operand 0. */
3213 #define OMP_ATOMIC_DEPENDENT_P(NODE) \
3214 (TREE_CODE (TREE_OPERAND (OMP_ATOMIC_CHECK (NODE), 0)) == INTEGER_CST)
3216 /* Used while gimplifying continue statements bound to OMP_FOR nodes. */
3217 #define OMP_FOR_GIMPLIFYING_P(NODE) \
3218 (TREE_LANG_FLAG_0 (OMP_FOR_CHECK (NODE)))
3220 /* A language-specific token attached to the OpenMP data clauses to
3221 hold code (or code fragments) related to ctors, dtors, and op=.
3222 See semantics.c for details. */
3223 #define CP_OMP_CLAUSE_INFO(NODE) \
3224 TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
3225 OMP_CLAUSE_COPYPRIVATE))
3227 /* These macros provide convenient access to the various _STMT nodes
3228 created when parsing template declarations. */
3229 #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
3230 #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
3232 #define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
3233 #define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
3235 #define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
3237 /* Nonzero if this try block is a function try block. */
3238 #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
3239 #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
3240 #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
3241 #define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
3243 /* CLEANUP_STMT accessors. The statement(s) covered, the cleanup to run
3244 and the VAR_DECL for which this cleanup exists. */
3245 #define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
3246 #define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
3247 #define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2)
3249 /* IF_STMT accessors. These give access to the condition of the if
3250 statement, the then block of the if statement, and the else block
3251 of the if statement if it exists. */
3252 #define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
3253 #define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
3254 #define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
3256 /* WHILE_STMT accessors. These give access to the condition of the
3257 while statement and the body of the while statement, respectively. */
3258 #define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
3259 #define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
3261 /* DO_STMT accessors. These give access to the condition of the do
3262 statement and the body of the do statement, respectively. */
3263 #define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
3264 #define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
3266 /* FOR_STMT accessors. These give access to the init statement,
3267 condition, update expression, and body of the for statement,
3269 #define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
3270 #define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
3271 #define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
3272 #define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
3274 #define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
3275 #define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
3276 #define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
3278 /* STMT_EXPR accessor. */
3279 #define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
3281 /* EXPR_STMT accessor. This gives the expression associated with an
3282 expression statement. */
3283 #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
3285 /* True if this TARGET_EXPR was created by build_cplus_new, and so we can
3286 discard it if it isn't useful. */
3287 #define TARGET_EXPR_IMPLICIT_P(NODE) \
3288 TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE))
3290 /* An enumeration of the kind of tags that C++ accepts. */
3292 none_type = 0, /* Not a tag type. */
3293 record_type, /* "struct" types. */
3294 class_type, /* "class" types. */
3295 union_type, /* "union" types. */
3296 enum_type, /* "enum" types. */
3297 typename_type /* "typename" types. */
3300 /* The various kinds of lvalues we distinguish. */
3301 typedef enum cp_lvalue_kind {
3302 clk_none = 0, /* Things that are not an lvalue. */
3303 clk_ordinary = 1, /* An ordinary lvalue. */
3304 clk_class = 2, /* An rvalue of class-type. */
3305 clk_bitfield = 4, /* An lvalue for a bit-field. */
3306 clk_packed = 8 /* An lvalue for a packed field. */
3309 /* Various kinds of template specialization, instantiation, etc. */
3310 typedef enum tmpl_spec_kind {
3311 tsk_none, /* Not a template at all. */
3312 tsk_invalid_member_spec, /* An explicit member template
3313 specialization, but the enclosing
3314 classes have not all been explicitly
3316 tsk_invalid_expl_inst, /* An explicit instantiation containing
3317 template parameter lists. */
3318 tsk_excessive_parms, /* A template declaration with too many
3319 template parameter lists. */
3320 tsk_insufficient_parms, /* A template declaration with too few
3322 tsk_template, /* A template declaration. */
3323 tsk_expl_spec, /* An explicit specialization. */
3324 tsk_expl_inst /* An explicit instantiation. */
3327 /* The various kinds of access. BINFO_ACCESS depends on these being
3328 two bit quantities. The numerical values are important; they are
3329 used to initialize RTTI data structures, so changing them changes
3331 typedef enum access_kind {
3332 ak_none = 0, /* Inaccessible. */
3333 ak_public = 1, /* Accessible, as a `public' thing. */
3334 ak_protected = 2, /* Accessible, as a `protected' thing. */
3335 ak_private = 3 /* Accessible, as a `private' thing. */
3338 /* The various kinds of special functions. If you add to this list,
3339 you should update special_function_p as well. */
3340 typedef enum special_function_kind {
3341 sfk_none = 0, /* Not a special function. This enumeral
3342 must have value zero; see
3343 special_function_p. */
3344 sfk_constructor, /* A constructor. */
3345 sfk_copy_constructor, /* A copy constructor. */
3346 sfk_assignment_operator, /* An assignment operator. */
3347 sfk_destructor, /* A destructor. */
3348 sfk_complete_destructor, /* A destructor for complete objects. */
3349 sfk_base_destructor, /* A destructor for base subobjects. */
3350 sfk_deleting_destructor, /* A destructor for complete objects that
3351 deletes the object after it has been
3353 sfk_conversion /* A conversion operator. */
3354 } special_function_kind;
3356 /* The various kinds of linkage. From [basic.link],
3358 A name is said to have linkage when it might denote the same
3359 object, reference, function, type, template, namespace or value
3360 as a name introduced in another scope:
3362 -- When a name has external linkage, the entity it denotes can
3363 be referred to from scopes of other translation units or from
3364 other scopes of the same translation unit.
3366 -- When a name has internal linkage, the entity it denotes can
3367 be referred to by names from other scopes in the same
3370 -- When a name has no linkage, the entity it denotes cannot be
3371 referred to by names from other scopes. */
3373 typedef enum linkage_kind {
3374 lk_none, /* No linkage. */
3375 lk_internal, /* Internal linkage. */
3376 lk_external /* External linkage. */
3379 /* Bitmask flags to control type substitution. */
3380 typedef enum tsubst_flags_t {
3381 tf_none = 0, /* nothing special */
3382 tf_error = 1 << 0, /* give error messages */
3383 tf_warning = 1 << 1, /* give warnings too */
3384 tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
3385 tf_keep_type_decl = 1 << 3, /* retain typedef type decls
3386 (make_typename_type use) */
3387 tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
3388 instantiate_type use) */
3389 tf_user = 1 << 5, /* found template must be a user template
3390 (lookup_template_class use) */
3391 tf_conv = 1 << 6, /* We are determining what kind of
3392 conversion might be permissible,
3393 not actually performing the
3395 /* Convenient substitution flags combinations. */
3396 tf_warning_or_error = tf_warning | tf_error
3399 /* The kind of checking we can do looking in a class hierarchy. */
3400 typedef enum base_access {
3401 ba_any = 0, /* Do not check access, allow an ambiguous base,
3402 prefer a non-virtual base */
3403 ba_unique = 1 << 0, /* Must be a unique base. */
3404 ba_check_bit = 1 << 1, /* Check access. */
3405 ba_check = ba_unique | ba_check_bit,
3406 ba_ignore_scope = 1 << 2, /* Ignore access allowed by local scope. */
3407 ba_quiet = 1 << 3 /* Do not issue error messages. */
3410 /* The various kinds of access check during parsing. */
3411 typedef enum deferring_kind {
3412 dk_no_deferred = 0, /* Check access immediately */
3413 dk_deferred = 1, /* Deferred check */
3414 dk_no_check = 2 /* No access check */
3417 /* The kind of base we can find, looking in a class hierarchy.
3418 Values <0 indicate we failed. */
3419 typedef enum base_kind {
3420 bk_inaccessible = -3, /* The base is inaccessible */
3421 bk_ambig = -2, /* The base is ambiguous */
3422 bk_not_base = -1, /* It is not a base */
3423 bk_same_type = 0, /* It is the same type */
3424 bk_proper_base = 1, /* It is a proper base */
3425 bk_via_virtual = 2 /* It is a proper base, but via a virtual
3426 path. This might not be the canonical
3430 /* Node for "pointer to (virtual) function".
3431 This may be distinct from ptr_type_node so gdb can distinguish them. */
3432 #define vfunc_ptr_type_node vtable_entry_type
3435 /* For building calls to `delete'. */
3436 extern GTY(()) tree integer_two_node;
3437 extern GTY(()) tree integer_three_node;
3439 /* The number of function bodies which we are currently processing.
3440 (Zero if we are at namespace scope, one inside the body of a
3441 function, two inside the body of a function in a local class, etc.) */
3442 extern int function_depth;
3446 /* These values are used for the `STRICT' parameter to type_unification and
3447 fn_type_unification. Their meanings are described with the
3448 documentation for fn_type_unification. */
3450 typedef enum unification_kind_t {
3454 } unification_kind_t;
3456 /* Macros for operating on a template instantiation level node. */
3458 #define TINST_DECL(NODE) \
3459 (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->decl)
3460 #define TINST_LOCATION(NODE) \
3461 (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->locus)
3462 #define TINST_IN_SYSTEM_HEADER_P(NODE) \
3463 (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->in_system_header_p)
3467 extern int current_class_depth;
3469 /* An array of all local classes present in this translation unit, in
3470 declaration order. */
3471 extern GTY(()) VEC(tree,gc) *local_classes;
3473 /* Here's where we control how name mangling takes place. */
3475 /* Cannot use '$' up front, because this confuses gdb
3476 (names beginning with '$' are gdb-local identifiers).
3478 Note that all forms in which the '$' is significant are long enough
3479 for direct indexing (meaning that if we know there is a '$'
3480 at a particular location, we can index into the string at
3481 any other location that provides distinguishing characters). */
3483 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
3484 doesn't allow '$' in symbol names. */
3485 #ifndef NO_DOLLAR_IN_LABEL
3489 #define AUTO_TEMP_NAME "_$tmp_"
3490 #define VFIELD_BASE "$vf"
3491 #define VFIELD_NAME "_vptr$"
3492 #define VFIELD_NAME_FORMAT "_vptr$%s"
3493 #define ANON_AGGRNAME_FORMAT "$_%d"
3495 #else /* NO_DOLLAR_IN_LABEL */
3497 #ifndef NO_DOT_IN_LABEL
3501 #define AUTO_TEMP_NAME "_.tmp_"
3502 #define VFIELD_BASE ".vf"
3503 #define VFIELD_NAME "_vptr."
3504 #define VFIELD_NAME_FORMAT "_vptr.%s"
3506 #define ANON_AGGRNAME_FORMAT "._%d"
3508 #else /* NO_DOT_IN_LABEL */
3510 #define IN_CHARGE_NAME "__in_chrg"
3511 #define AUTO_TEMP_NAME "__tmp_"
3512 #define TEMP_NAME_P(ID_NODE) \
3513 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
3514 sizeof (AUTO_TEMP_NAME) - 1))
3515 #define VTABLE_NAME "__vt_"
3516 #define VTABLE_NAME_P(ID_NODE) \
3517 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
3518 sizeof (VTABLE_NAME) - 1))
3519 #define VFIELD_BASE "__vfb"
3520 #define VFIELD_NAME "__vptr_"
3521 #define VFIELD_NAME_P(ID_NODE) \
3522 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
3523 sizeof (VFIELD_NAME) - 1))
3524 #define VFIELD_NAME_FORMAT "__vptr_%s"
3526 #define ANON_AGGRNAME_PREFIX "__anon_"
3527 #define ANON_AGGRNAME_P(ID_NODE) \
3528 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
3529 sizeof (ANON_AGGRNAME_PREFIX) - 1))
3530 #define ANON_AGGRNAME_FORMAT "__anon_%d"
3532 #endif /* NO_DOT_IN_LABEL */
3533 #endif /* NO_DOLLAR_IN_LABEL */
3535 #define THIS_NAME "this"
3537 #define IN_CHARGE_NAME "__in_chrg"
3539 #define VTBL_PTR_TYPE "__vtbl_ptr_type"
3540 #define VTABLE_DELTA_NAME "__delta"
3541 #define VTABLE_PFN_NAME "__pfn"
3543 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
3545 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
3546 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
3547 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
3549 #define TEMP_NAME_P(ID_NODE) \
3550 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
3551 #define VFIELD_NAME_P(ID_NODE) \
3552 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
3554 /* For anonymous aggregate types, we need some sort of name to
3555 hold on to. In practice, this should not appear, but it should
3556 not be harmful if it does. */
3557 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3558 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
3559 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
3562 /* Nonzero if we're done parsing and into end-of-file activities. */
3566 /* A list of namespace-scope objects which have constructors or
3567 destructors which reside in the global scope. The decl is stored
3568 in the TREE_VALUE slot and the initializer is stored in the
3569 TREE_PURPOSE slot. */
3570 extern GTY(()) tree static_aggregates;
3572 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
3574 /* These are uses as bits in flags passed to various functions to
3575 control their behavior. Despite the LOOKUP_ prefix, many of these
3576 do not control name lookup. ??? Functions using these flags should
3577 probably be modified to accept explicit boolean flags for the
3578 behaviors relevant to them. */
3579 /* Check for access violations. */
3580 #define LOOKUP_PROTECT (1 << 0)
3581 /* Complain if no suitable member function matching the arguments is
3583 #define LOOKUP_COMPLAIN (1 << 1)
3584 #define LOOKUP_NORMAL (LOOKUP_PROTECT | LOOKUP_COMPLAIN)
3585 /* Even if the function found by lookup is a virtual function, it
3586 should be called directly. */
3587 #define LOOKUP_NONVIRTUAL (1 << 2)
3588 /* Non-converting (i.e., "explicit") constructors are not tried. */
3589 #define LOOKUP_ONLYCONVERTING (1 << 3)
3590 /* If a temporary is created, it should be created so that it lives
3591 as long as the current variable bindings; otherwise it only lives
3592 until the end of the complete-expression. It also forces
3593 direct-initialization in cases where other parts of the compiler
3594 have already generated a temporary, such as reference
3595 initialization and the catch parameter. */
3596 #define DIRECT_BIND (1 << 4)
3597 /* User-defined conversions are not permitted. (Built-in conversions
3599 #define LOOKUP_NO_CONVERSION (1 << 5)
3600 /* The user has explicitly called a destructor. (Therefore, we do
3601 not need to check that the object is non-NULL before calling the
3603 #define LOOKUP_DESTRUCTOR (1 << 6)
3604 /* Do not permit references to bind to temporaries. */
3605 #define LOOKUP_NO_TEMP_BIND (1 << 7)
3606 /* Do not accept objects, and possibly namespaces. */
3607 #define LOOKUP_PREFER_TYPES (1 << 8)
3608 /* Do not accept objects, and possibly types. */
3609 #define LOOKUP_PREFER_NAMESPACES (1 << 9)
3610 /* Accept types or namespaces. */
3611 #define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES)
3612 /* We are checking that a constructor can be called -- but we do not
3613 actually plan to call it. */
3614 #define LOOKUP_CONSTRUCTOR_CALLABLE (1 << 10)
3615 /* Return friend declarations and un-declared builtin functions.
3616 (Normally, these entities are registered in the symbol table, but
3617 not found by lookup.) */
3618 #define LOOKUP_HIDDEN (LOOKUP_CONSTRUCTOR_CALLABLE << 1)
3620 #define LOOKUP_NAMESPACES_ONLY(F) \
3621 (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
3622 #define LOOKUP_TYPES_ONLY(F) \
3623 (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
3624 #define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH)
3627 /* These flags are used by the conversion code.
3628 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
3629 CONV_STATIC : Perform the explicit conversions for static_cast.
3630 CONV_CONST : Perform the explicit conversions for const_cast.
3631 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
3632 CONV_PRIVATE : Perform upcasts to private bases.
3633 CONV_FORCE_TEMP : Require a new temporary when converting to the same
3636 #define CONV_IMPLICIT 1
3637 #define CONV_STATIC 2
3638 #define CONV_CONST 4
3639 #define CONV_REINTERPRET 8
3640 #define CONV_PRIVATE 16
3641 /* #define CONV_NONCONVERTING 32 */
3642 #define CONV_FORCE_TEMP 64
3643 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
3645 #define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
3646 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
3648 /* Used by build_expr_type_conversion to indicate which types are
3649 acceptable as arguments to the expression under consideration. */
3651 #define WANT_INT 1 /* integer types, including bool */
3652 #define WANT_FLOAT 2 /* floating point types */
3653 #define WANT_ENUM 4 /* enumerated types */
3654 #define WANT_POINTER 8 /* pointer types */
3655 #define WANT_NULL 16 /* null pointer constant */
3656 #define WANT_VECTOR 32 /* vector types */
3657 #define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR)
3659 /* Used with comptypes, and related functions, to guide type
3662 #define COMPARE_STRICT 0 /* Just check if the types are the
3664 #define COMPARE_BASE 1 /* Check to see if the second type is
3665 derived from the first. */
3666 #define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in
3668 #define COMPARE_REDECLARATION 4 /* The comparison is being done when
3669 another declaration of an existing
3671 #define COMPARE_STRUCTURAL 8 /* The comparison is intended to be
3672 structural. The actual comparison
3673 will be identical to
3676 /* Used with push_overloaded_decl. */
3677 #define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
3678 regardless of the current scope. */
3679 #define PUSH_LOCAL 1 /* Push the DECL into the current
3681 #define PUSH_USING 2 /* We are pushing this DECL as the
3682 result of a using declaration. */
3684 /* Used with start function. */
3685 #define SF_DEFAULT 0 /* No flags. */
3686 #define SF_PRE_PARSED 1 /* The function declaration has
3687 already been parsed. */
3688 #define SF_INCLASS_INLINE 2 /* The function is an inline, defined
3689 in the class body. */
3691 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
3692 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
3693 class derived from the type pointed to (referred to) by TYPE1. */
3694 #define same_or_base_type_p(TYPE1, TYPE2) \
3695 comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
3697 /* These macros are used to access a TEMPLATE_PARM_INDEX. */
3698 #define TEMPLATE_PARM_INDEX_CAST(NODE) \
3699 ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
3700 #define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
3701 #define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
3702 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
3703 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
3704 #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
3705 #define TEMPLATE_PARM_PARAMETER_PACK(NODE) \
3706 (TREE_LANG_FLAG_0 (TEMPLATE_PARM_INDEX_CHECK (NODE)))
3708 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
3709 TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
3710 #define TEMPLATE_TYPE_PARM_INDEX(NODE) \
3711 (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, TEMPLATE_TEMPLATE_PARM, \
3712 BOUND_TEMPLATE_TEMPLATE_PARM))->type.values
3713 #define TEMPLATE_TYPE_IDX(NODE) \
3714 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3715 #define TEMPLATE_TYPE_LEVEL(NODE) \
3716 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3717 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
3718 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3719 #define TEMPLATE_TYPE_DECL(NODE) \
3720 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3721 #define TEMPLATE_TYPE_PARAMETER_PACK(NODE) \
3722 (TEMPLATE_PARM_PARAMETER_PACK (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3724 /* These constants can used as bit flags in the process of tree formatting.
3726 TFF_PLAIN_IDENTIFIER: unqualified part of a name.
3727 TFF_SCOPE: include the class and namespace scope of the name.
3728 TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
3729 TFF_DECL_SPECIFIERS: print decl-specifiers.
3730 TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
3731 a class-key (resp. `enum').
3732 TFF_RETURN_TYPE: include function return type.
3733 TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
3734 TFF_EXCEPTION_SPECIFICATION: show function exception specification.
3735 TFF_TEMPLATE_HEADER: show the template<...> header in a
3736 template-declaration.
3737 TFF_TEMPLATE_NAME: show only template-name.
3738 TFF_EXPR_IN_PARENS: parenthesize expressions.
3739 TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments.
3740 TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the
3741 top-level entity. */
3743 #define TFF_PLAIN_IDENTIFIER (0)
3744 #define TFF_SCOPE (1)
3745 #define TFF_CHASE_TYPEDEF (1 << 1)
3746 #define TFF_DECL_SPECIFIERS (1 << 2)
3747 #define TFF_CLASS_KEY_OR_ENUM (1 << 3)
3748 #define TFF_RETURN_TYPE (1 << 4)
3749 #define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
3750 #define TFF_EXCEPTION_SPECIFICATION (1 << 6)
3751 #define TFF_TEMPLATE_HEADER (1 << 7)
3752 #define TFF_TEMPLATE_NAME (1 << 8)
3753 #define TFF_EXPR_IN_PARENS (1 << 9)
3754 #define TFF_NO_FUNCTION_ARGUMENTS (1 << 10)
3755 #define TFF_UNQUALIFIED_NAME (1 << 11)
3757 /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
3759 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
3760 ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
3761 ? TYPE_TI_TEMPLATE (NODE) \
3766 extern void init_reswords (void);
3768 /* Indexed by TREE_CODE, these tables give C-looking names to
3769 operators represented by TREE_CODES. For example,
3770 opname_tab[(int) MINUS_EXPR] == "-". */
3771 extern const char **opname_tab, **assignop_tab;
3773 typedef struct operator_name_info_t GTY(())
3775 /* The IDENTIFIER_NODE for the operator. */
3777 /* The name of the operator. */
3779 /* The mangled name of the operator. */
3780 const char *mangled_name;
3781 /* The arity of the operator. */
3783 } operator_name_info_t;
3785 /* A mapping from tree codes to operator name information. */
3786 extern GTY(()) operator_name_info_t operator_name_info
3787 [(int) LAST_CPLUS_TREE_CODE];
3788 /* Similar, but for assignment operators. */
3789 extern GTY(()) operator_name_info_t assignment_operator_name_info
3790 [(int) LAST_CPLUS_TREE_CODE];
3792 /* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
3795 typedef int cp_cv_quals;
3797 /* A storage class. */
3799 typedef enum cp_storage_class {
3800 /* sc_none must be zero so that zeroing a cp_decl_specifier_seq
3801 sets the storage_class field to sc_none. */
3810 /* An individual decl-specifier. */
3812 typedef enum cp_decl_spec {
3814 ds_signed = ds_first,
3831 /* A decl-specifier-seq. */
3833 typedef struct cp_decl_specifier_seq {
3834 /* The number of times each of the keywords has been seen. */
3835 unsigned specs[(int) ds_last];
3836 /* The primary type, if any, given by the decl-specifier-seq.
3837 Modifiers, like "short", "const", and "unsigned" are not
3838 reflected here. This field will be a TYPE, unless a typedef-name
3839 was used, in which case it will be a TYPE_DECL. */
3841 /* The attributes, if any, provided with the specifier sequence. */
3843 /* If non-NULL, a built-in type that the user attempted to redefine
3844 to some other type. */
3845 tree redefined_builtin_type;
3846 /* The storage class specified -- or sc_none if no storage class was
3847 explicitly specified. */
3848 cp_storage_class storage_class;
3849 /* True iff TYPE_SPEC indicates a user-defined type. */
3850 BOOL_BITFIELD user_defined_type_p : 1;
3851 /* True iff multiple types were (erroneously) specified for this
3852 decl-specifier-seq. */
3853 BOOL_BITFIELD multiple_types_p : 1;
3854 /* True iff multiple storage classes were (erroneously) specified
3855 for this decl-specifier-seq or a combination of a storage class
3856 with a typedef specifier. */
3857 BOOL_BITFIELD conflicting_specifiers_p : 1;
3858 /* True iff at least one decl-specifier was found. */
3859 BOOL_BITFIELD any_specifiers_p : 1;
3860 /* True iff "int" was explicitly provided. */
3861 BOOL_BITFIELD explicit_int_p : 1;
3862 /* True iff "char" was explicitly provided. */
3863 BOOL_BITFIELD explicit_char_p : 1;
3864 } cp_decl_specifier_seq;
3866 /* The various kinds of declarators. */
3868 typedef enum cp_declarator_kind {
3876 } cp_declarator_kind;
3880 typedef struct cp_declarator cp_declarator;
3882 typedef struct cp_parameter_declarator cp_parameter_declarator;
3884 /* A parameter, before it has been semantically analyzed. */
3885 struct cp_parameter_declarator {
3886 /* The next parameter, or NULL_TREE if none. */
3887 cp_parameter_declarator *next;
3888 /* The decl-specifiers-seq for the parameter. */
3889 cp_decl_specifier_seq decl_specifiers;
3890 /* The declarator for the parameter. */
3891 cp_declarator *declarator;
3892 /* The default-argument expression, or NULL_TREE, if none. */
3893 tree default_argument;
3894 /* True iff this is the first parameter in the list and the
3895 parameter sequence ends with an ellipsis. */
3900 struct cp_declarator {
3901 /* The kind of declarator. */
3902 ENUM_BITFIELD (cp_declarator_kind) kind : 4;
3903 /* Whether we parsed an ellipsis (`...') just before the declarator,
3904 to indicate this is a parameter pack. */
3905 BOOL_BITFIELD parameter_pack_p : 1;
3906 /* Attributes that apply to this declarator. */
3908 /* For all but cdk_id and cdk_error, the contained declarator. For
3909 cdk_id and cdk_error, guaranteed to be NULL. */
3910 cp_declarator *declarator;
3911 location_t id_loc; /* Currently only set for cdk_id. */
3913 /* For identifiers. */
3915 /* If non-NULL, the qualifying scope (a NAMESPACE_DECL or
3916 *_TYPE) for this identifier. */
3917 tree qualifying_scope;
3918 /* The unqualified name of the entity -- an IDENTIFIER_NODE,
3919 BIT_NOT_EXPR, or TEMPLATE_ID_EXPR. */
3920 tree unqualified_name;
3921 /* If this is the name of a function, what kind of special
3922 function (if any). */
3923 special_function_kind sfk;
3925 /* For functions. */
3927 /* The parameters to the function. */
3928 cp_parameter_declarator *parameters;
3929 /* The cv-qualifiers for the function. */
3930 cp_cv_quals qualifiers;
3931 /* The exception-specification for the function. */
3932 tree exception_specification;
3936 /* The bounds to the array. */
3939 /* For cdk_pointer, cdk_reference, and cdk_ptrmem. */
3941 /* The cv-qualifiers for the pointer. */
3942 cp_cv_quals qualifiers;
3943 /* For cdk_ptrmem, the class type containing the member. */
3949 /* A parameter list indicating for a function with no parameters,
3950 e.g "int f(void)". */
3951 extern cp_parameter_declarator *no_parameters;
3954 extern bool check_dtor_name (tree, tree);
3956 extern tree build_vfield_ref (tree, tree);
3957 extern tree build_conditional_expr (tree, tree, tree);
3958 extern tree build_addr_func (tree);
3959 extern tree build_call_a (tree, int, tree*);
3960 extern tree build_call_n (tree, int, ...);
3961 extern bool null_ptr_cst_p (tree);
3962 extern bool sufficient_parms_p (tree);
3963 extern tree type_decays_to (tree);
3964 extern tree build_user_type_conversion (tree, tree, int);
3965 extern tree build_new_function_call (tree, tree, bool);
3966 extern tree build_operator_new_call (tree, tree, tree *, tree *,
3968 extern tree build_new_method_call (tree, tree, tree, tree, int,
3970 extern tree build_special_member_call (tree, tree, tree, tree, int);
3971 extern tree build_new_op (enum tree_code, int, tree, tree, tree, bool *);
3972 extern tree build_op_delete_call (enum tree_code, tree, tree, bool, tree, tree);
3973 extern bool can_convert (tree, tree);
3974 extern bool can_convert_arg (tree, tree, tree, int);
3975 extern bool can_convert_arg_bad (tree, tree, tree);
3976 extern bool enforce_access (tree, tree, tree);
3977 extern tree convert_default_arg (tree, tree, tree, int);
3978 extern tree convert_arg_to_ellipsis (tree);
3979 extern tree build_x_va_arg (tree, tree);
3980 extern tree cxx_type_promotes_to (tree);
3981 extern tree type_passed_as (tree);
3982 extern tree convert_for_arg_passing (tree, tree);
3983 extern bool is_properly_derived_from (tree, tree);
3984 extern tree initialize_reference (tree, tree, tree, tree *);
3985 extern tree make_temporary_var_for_ref_to_temp (tree, tree);
3986 extern tree strip_top_quals (tree);
3987 extern tree perform_implicit_conversion (tree, tree);
3988 extern tree perform_direct_initialization_if_possible (tree, tree, bool);
3989 extern tree in_charge_arg_for_name (tree);
3990 extern tree build_cxx_call (tree, int, tree *);
3991 #ifdef ENABLE_CHECKING
3992 extern void validate_conversion_obstack (void);
3993 #endif /* ENABLE_CHECKING */
3996 extern tree build_base_path (enum tree_code, tree,
3998 extern tree convert_to_base (tree, tree, bool, bool);
3999 extern tree convert_to_base_statically (tree, tree);
4000 extern tree build_vtbl_ref (tree, tree);
4001 extern tree build_vfn_ref (tree, tree);
4002 extern tree get_vtable_decl (tree, int);
4003 extern void resort_type_method_vec (void *, void *,
4004 gt_pointer_operator, void *);
4005 extern bool add_method (tree, tree, tree);
4006 extern bool currently_open_class (tree);
4007 extern tree currently_open_derived_class (tree);
4008 extern tree finish_struct (tree, tree);
4009 extern void finish_struct_1 (tree);
4010 extern int resolves_to_fixed_type_p (tree, int *);
4011 extern void init_class_processing (void);
4012 extern int is_empty_class (tree);
4013 extern void pushclass (tree);
4014 extern void popclass (void);
4015 extern void push_nested_class (tree);
4016 extern void pop_nested_class (void);
4017 extern int current_lang_depth (void);
4018 extern void push_lang_context (tree);
4019 extern void pop_lang_context (void);
4020 extern tree instantiate_type (tree, tree, tsubst_flags_t);
4021 extern void print_class_statistics (void);
4022 extern void cxx_print_statistics (void);
4023 extern void cxx_print_xnode (FILE *, tree, int);
4024 extern void cxx_print_decl (FILE *, tree, int);
4025 extern void cxx_print_type (FILE *, tree, int);
4026 extern void cxx_print_identifier (FILE *, tree, int);
4027 extern void cxx_print_error_function (struct diagnostic_context *,
4029 extern void build_self_reference (void);
4030 extern int same_signature_p (tree, tree);
4031 extern void maybe_add_class_template_decl_list (tree, tree, int);
4032 extern void unreverse_member_declarations (tree);
4033 extern void invalidate_class_lookup_cache (void);
4034 extern void maybe_note_name_used_in_class (tree, tree);
4035 extern void note_name_declared_in_class (tree, tree);
4036 extern tree get_vtbl_decl_for_binfo (tree);
4037 extern void debug_class (tree);
4038 extern void debug_thunks (tree);
4039 extern tree cp_fold_obj_type_ref (tree, tree);
4040 extern void set_linkage_according_to_type (tree, tree);
4041 extern void determine_key_method (tree);
4042 extern void check_for_override (tree, tree);
4043 extern void push_class_stack (void);
4044 extern void pop_class_stack (void);