1 /* Definitions for C++ parsing and type checking.
2 Copyright (C) 1987, 92-97, 1998, 1999 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
27 /* Usage of TREE_LANG_FLAG_?:
28 0: BINFO_MARKED (BINFO nodes).
29 COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
30 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
31 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
32 LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
33 TREE_NEGATED_INT (in INTEGER_CST).
34 TREE_INDIRECT_USING (in NAMESPACE_DECL).
35 IDENTIFIER_MARKED (used by search routines).
36 LOCAL_BINDING_P (in CPLUS_BINDING)
37 ICS_USER_FLAG (in _CONV)
38 CLEANUP_P (in TRY_BLOCK)
39 AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
40 1: IDENTIFIER_VIRTUAL_P.
41 TI_PENDING_TEMPLATE_FLAG.
42 TEMPLATE_PARMS_FOR_INLINE.
43 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
44 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
45 TYPE_USES_COMPLEX_INHERITANCE (in _TYPE).
46 C_DECLARED_LABEL_FLAG.
47 INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
48 BASELINK_P (in TREE_LIST)
49 ICS_ELLIPSIS_FLAG (in _CONV)
50 2: IDENTIFIER_OPNAME_P.
54 ICS_THIS_FLAG (in _CONV)
55 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
56 BINFO_VTABLE_PATH_MARKED.
57 BINFO_PUSHDECLS_MARKED.
58 (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
59 ICS_BAD_FLAG (in _CONV)
60 4: BINFO_NEW_VTABLE_MARKED.
61 TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
63 NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
67 Usage of TYPE_LANG_FLAG_?:
68 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
69 1: TYPE_HAS_CONSTRUCTOR.
70 2: TYPE_HAS_DESTRUCTOR.
72 4: TYPE_NEEDS_DESTRUCTOR.
76 Usage of DECL_LANG_FLAG_?:
77 0: DECL_ERROR_REPORTED (in VAR_DECL).
78 DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
79 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
80 DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
81 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
82 DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
84 4: DECL_MAYBE_TEMPLATE.
85 5: DECL_INTERFACE_KNOWN.
86 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
87 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
89 Usage of language-independent fields in a language-dependent manner:
92 This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
93 forth as a substitute for the mark bits provided in `lang_type'.
94 At present, only the six low-order bits are used.
97 For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
98 For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME.
99 For a TEMPLATE_TEMPLATE_PARM, this is
100 TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
102 DECL_SAVED_INSNS/DECL_FIELD_SIZE
103 For a static VAR_DECL, this is DECL_INIT_PRIORITY.
106 For a binfo, this is a TREE_LIST. The TREE_PURPOSE of each node
107 gives the amount by which to adjust the `this' pointer when
108 calling the function. The TREE_VALUE is the declaration for the
109 virtual function itself. When CLASSTYPE_COM_INTERFACE_P does not
110 hold, the first entry does not have a TREE_VALUE; it is just an
113 /* Language-dependent contents of an identifier. */
115 struct lang_identifier
117 struct tree_identifier ignore;
118 tree namespace_bindings;
121 tree class_template_info;
127 tree label_value, implicit_decl;
139 char common[sizeof (struct tree_common)];
140 struct rtx_def *rtl; /* Unused, but required to match up with what
141 the middle-end expects. */
144 HOST_WIDE_INT orig_level;
146 } template_parm_index;
148 typedef struct ptrmem_cst
150 char common[sizeof (struct tree_common)];
154 /* Nonzero if this binding is for a local scope, as opposed to a class
155 or namespace scope. */
156 #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE)
158 /* Nonzero if BINDING_VALUE is from a base class of the class which is
159 currently being defined. */
160 #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE)
162 /* For a binding between a name and an entity at a non-local scope,
163 defines the scope where the binding is declared. (Either a class
164 _TYPE node, or a NAMESPACE_DECL.) This macro should be used only
165 for namespace-level bindings; on the IDENTIFIER_BINDING list
166 BINDING_LEVEL is used instead. */
167 #define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope.scope)
169 /* This is the declaration bound to the name. Possible values:
170 variable, overloaded function, namespace, template, enumerator. */
171 #define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value)
173 /* If name is bound to a type, this is the type (struct, union, enum). */
174 #define BINDING_TYPE(NODE) TREE_TYPE(NODE)
176 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
177 namespace_binding (NODE, global_namespace)
178 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
179 set_namespace_binding (NODE, global_namespace, VAL)
180 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
181 namespace_binding (NODE, current_namespace)
182 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
183 set_namespace_binding (NODE, current_namespace, VAL)
187 char common[sizeof (struct tree_common)];
190 struct binding_level *level;
195 /* The overloaded FUNCTION_DECL. */
196 #define OVL_FUNCTION(NODE) (((struct tree_overload*)NODE)->function)
197 #define OVL_CHAIN(NODE) TREE_CHAIN(NODE)
198 /* Polymorphic access to FUNCTION and CHAIN. */
199 #define OVL_CURRENT(NODE) \
200 ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
201 #define OVL_NEXT(NODE) \
202 ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
203 /* If set, this was imported in a using declaration.
204 This is not to confuse with being used somewhere, which
205 is not important for this node. */
206 #define OVL_USED(NODE) TREE_USED(NODE)
210 char common[sizeof (struct tree_common)];
214 /* A `baselink' is a TREE_LIST whose TREE_PURPOSE is a BINFO
215 indicating a particular base class, and whose TREE_VALUE is a
216 (possibly overloaded) function from that base class. */
217 #define BASELINK_P(NODE) \
218 (TREE_CODE (NODE) == TREE_LIST && TREE_LANG_FLAG_1 (NODE))
219 #define SET_BASELINK_P(NODE) \
220 (TREE_LANG_FLAG_1 (NODE) = 1)
222 #define WRAPPER_PTR(NODE) (((struct tree_wrapper*)(NODE))->u.ptr)
223 #define WRAPPER_INT(NODE) (((struct tree_wrapper*)(NODE))->u.i)
227 char common[sizeof (struct tree_common)];
234 #define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename)
235 #define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum)
238 char common[sizeof (struct tree_common)];
243 /* To identify to the debug emitters if it should pay attention to the
244 flag `-Wtemplate-debugging'. */
245 #define HAVE_TEMPLATES 1
247 /* Macros for access to language-specific slots in an identifier. */
249 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
250 (((struct lang_identifier *)(NODE))->namespace_bindings)
251 #define IDENTIFIER_TEMPLATE(NODE) \
252 (((struct lang_identifier *)(NODE))->class_template_info)
254 /* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the
255 identifier. It's TREE_CHAIN is the next outermost binding. Each
256 BINDING_VALUE is a DECL for the associated declaration. Thus,
257 name lookup consists simply of pulling off the node at the front
258 of the list (modulo oddities for looking up the names of types,
259 and such.) You can use BINDING_SCOPE or BINDING_LEVEL to
260 determine the scope that bound the name. */
261 #define IDENTIFIER_BINDING(NODE) \
262 (((struct lang_identifier*) (NODE))->bindings)
264 /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
265 NULL_TREE if there is no binding. */
266 #define IDENTIFIER_VALUE(NODE) \
267 (IDENTIFIER_BINDING (NODE) \
268 ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
271 /* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
272 class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
273 just a pointer to the BINDING_VALUE of one of the bindings in the
274 IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
275 IDENTIFIER_BINDING. */
276 #define IDENTIFIER_CLASS_VALUE(NODE) \
277 (((struct lang_identifier *) (NODE))->class_value)
279 /* The amount of time used by the file whose special "time identifier"
280 is NODE, represented as an INTEGER_CST. See get_time_identifier. */
281 #define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)
283 /* For a "time identifier" this is a INTEGER_CST. The
284 TREE_INT_CST_LOW is 1 if the corresponding file is "interface only".
285 The TRE_INT_CST_HIGH is 1 if it is "interface unknown". */
286 #define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)
288 /* TREE_TYPE only indicates on local and class scope the current
289 type. For namespace scope, the presence of a type in any namespace
290 is indicated with global_type_node, and the real type behind must
291 be found through lookup. */
292 #define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
293 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
294 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
295 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
297 #define LANG_ID_FIELD(NAME,NODE) \
298 (((struct lang_identifier *)(NODE))->x \
299 ? ((struct lang_identifier *)(NODE))->x->NAME : 0)
300 #define SET_LANG_ID(NODE,VALUE,NAME) \
301 (((struct lang_identifier *)(NODE))->x == 0 \
302 ? ((struct lang_identifier *)(NODE))->x \
303 = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
304 ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))
306 #define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)
307 #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
308 SET_LANG_ID(NODE, VALUE, label_value)
310 #define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)
311 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
312 SET_LANG_ID(NODE, VALUE, implicit_decl)
314 #define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)
315 #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
316 SET_LANG_ID(NODE, VALUE, error_locus)
319 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
321 /* Nonzero if this identifier is the prefix for a mangled C++ operator
323 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
325 /* Nonzero if this identifier is the name of a type-conversion
327 #define IDENTIFIER_TYPENAME_P(NODE) \
328 (! strncmp (IDENTIFIER_POINTER (NODE), \
329 OPERATOR_TYPENAME_FORMAT, \
330 strlen (OPERATOR_TYPENAME_FORMAT)))
332 /* Nonzero means reject anything that ANSI standard C forbids. */
335 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
336 #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
338 /* Record in each node resulting from a binary operator
339 what operator was specified for it. */
340 #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
342 /* Store a value in that field. */
343 #define C_SET_EXP_ORIGINAL_CODE(exp, code) \
344 (TREE_COMPLEXITY (exp) = (int)(code))
346 /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
347 next exception handler. */
348 extern tree exception_throw_decl;
353 CPTI_JAVA_SHORT_TYPE,
356 CPTI_JAVA_FLOAT_TYPE,
357 CPTI_JAVA_DOUBLE_TYPE,
359 CPTI_JAVA_BOOLEAN_TYPE,
363 CPTI_VTABLE_ENTRY_TYPE,
367 CPTI_ACCESS_MODE_TYPE,
370 CPTI_CLASS_DESC_TYPE,
377 CPTI_CLASS_STAR_TYPE,
390 CPTI_GLOBAL_DELETE_FNDECL,
395 extern tree cp_global_trees[CPTI_MAX];
397 #define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
398 #define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
399 #define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
400 #define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
401 #define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
402 #define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
403 #define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
404 #define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
406 #define void_zero_node cp_global_trees[CPTI_VOID_ZERO]
407 #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
408 #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
409 #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
410 #define __tp_desc_type_node cp_global_trees[CPTI_TP_DESC_TYPE]
411 #define __access_mode_type_node cp_global_trees[CPTI_ACCESS_MODE_TYPE]
412 #define __bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
413 #define __user_desc_type_node cp_global_trees[CPTI_USER_DESC_TYPE]
414 #define __class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
415 #define __ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
416 #define __attr_desc_type_node cp_global_trees[CPTI_ATTR_DESC_TYPE]
417 #define __func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
418 #define __ptmf_desc_type_node cp_global_trees[CPTI_PTMF_DESC_TYPE]
419 #define __ptmd_desc_type_node cp_global_trees[CPTI_PTMD_DESC_TYPE]
420 #define class_star_type_node cp_global_trees[CPTI_CLASS_STAR_TYPE]
421 #define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
422 #define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
423 #define union_type_node cp_global_trees[CPTI_UNION_TYPE]
424 #define enum_type_node cp_global_trees[CPTI_ENUM_TYPE]
425 #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
426 #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
427 #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
428 #define std_node cp_global_trees[CPTI_STD]
429 #define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
430 #define tinfo_fn_id cp_global_trees[CPTI_TINFO_FN_ID]
431 #define tinfo_fn_type cp_global_trees[CPTI_TINFO_FN_TYPE]
432 #define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
433 #define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
435 extern int current_function_returns_value;
436 extern int current_function_returns_null;
437 extern tree current_function_return_value;
439 extern tree current_namespace;
440 extern tree global_namespace;
442 extern tree ridpointers[];
443 extern tree ansi_opname[];
444 extern tree ansi_assopname[];
446 /* Nonzero means `$' can be in an identifier. */
448 extern int dollars_in_ident;
450 /* Nonzero means allow type mismatches in conditional expressions;
451 just make their values `void'. */
453 extern int flag_cond_mismatch;
455 /* Nonzero means don't recognize the keyword `asm'. */
457 extern int flag_no_asm;
459 /* For cross referencing. */
461 extern int flag_gnu_xref;
463 /* For environments where you can use GNU binutils (as, ld in particular). */
465 extern int flag_gnu_binutils;
467 /* Nonzero means warn about implicit declarations. */
469 extern int warn_implicit;
471 /* Nonzero means warn about usage of long long when `-pedantic'. */
473 extern int warn_long_long;
475 /* Nonzero means warn when all ctors or dtors are private, and the class
478 extern int warn_ctor_dtor_privacy;
480 /* Nonzero means warn about function definitions that default the return type
481 or that use a null return and have a return-type other than void. */
483 extern int warn_return_type;
485 /* Nonzero means give string constants the type `const char *', as mandated
488 extern int flag_const_strings;
490 /* Nonzero means warn about deprecated conversion from string constant to
493 extern int warn_write_strings;
495 /* Nonzero means warn about sizeof(function) or addition/subtraction
496 of function pointers. */
498 extern int warn_pointer_arith;
500 /* Nonzero means warn about suggesting putting in ()'s. */
502 extern int warn_parentheses;
504 /* Nonzero means warn about multiple (redundant) decls for the same single
505 variable or function. */
507 extern int warn_redundant_decls;
509 /* Warn if initializer is not completely bracketed. */
511 extern int warn_missing_braces;
513 /* Warn about comparison of signed and unsigned values. */
515 extern int warn_sign_compare;
517 /* Warn about a subscript that has type char. */
519 extern int warn_char_subscripts;
521 /* Nonzero means warn about pointer casts that can drop a type qualifier
522 from the pointer target type. */
524 extern int warn_cast_qual;
526 /* Warn about *printf or *scanf format/argument anomalies. */
528 extern int warn_format;
530 /* Nonzero means warn about non virtual destructors in classes that have
531 virtual functions. */
533 extern int warn_nonvdtor;
535 /* Non-zero means warn when we convert a pointer to member function
536 into a pointer to (void or function). */
538 extern int warn_pmf2ptr;
540 /* Nonzero means warn about violation of some Effective C++ style rules. */
542 extern int warn_ecpp;
544 /* Nonzero means warn where overload resolution chooses a promotion from
545 unsigned to signed over a conversion to an unsigned of the same size. */
547 extern int warn_sign_promo;
549 /* Non-zero means warn when a function is declared extern and later inline. */
551 extern int warn_extern_inline;
553 /* Non-zero means warn when an old-style cast is used. */
555 extern int warn_old_style_cast;
557 /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
559 extern int flag_signed_bitfields;
561 /* True for more efficient but incompatible (not fully tested)
562 vtable implementation (using thunks).
563 0 is old behavior; 1 is new behavior. */
564 extern int flag_vtable_thunks;
566 /* INTERFACE_ONLY nonzero means that we are in an "interface"
567 section of the compiler. INTERFACE_UNKNOWN nonzero means
568 we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
569 is zero and INTERFACE_ONLY is zero, it means that we are responsible
570 for exporting definitions that others might need. */
571 extern int interface_only, interface_unknown;
573 /* Nonzero means we should attempt to elide constructors when possible. */
575 extern int flag_elide_constructors;
577 /* Nonzero means enable obscure ANSI features and disable GNU extensions
578 that might cause ANSI-compliant code to be miscompiled. */
580 extern int flag_ansi;
582 /* Nonzero means that member functions defined in class scope are
583 inline by default. */
585 extern int flag_default_inline;
587 /* The name-mangling scheme to use. Versions of gcc before 2.8 use
589 extern int name_mangling_version;
591 /* Nonzero means that guiding declarations are allowed. */
592 extern int flag_guiding_decls;
594 /* Nonzero if squashed mangling is to be performed.
595 This uses the B and K codes to reference previously seen class types
596 and class qualifiers. */
597 extern int flag_do_squangling;
599 /* Nonzero means generate separate instantiation control files and juggle
600 them at link time. */
601 extern int flag_use_repository;
603 /* Nonzero if we want to issue diagnostics that the standard says are not
605 extern int flag_optional_diags;
607 /* Nonzero means do not consider empty argument prototype to mean function
608 takes no arguments. */
609 extern int flag_strict_prototype;
611 /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
612 extern int flag_vtable_gc;
614 /* Nonzero means make the default pedwarns warnings instead of errors.
615 The value of this flag is ignored if -pedantic is specified. */
616 extern int flag_permissive;
618 /* Nonzero if we want to obey access control semantics. */
620 extern int flag_access_control;
622 /* If this variable is defined to a non-NULL value, it will be called
623 after the file has been completely parsed. The argument will be
624 the GLOBAL_NAMESPACE. */
626 extern void (*back_end_hook) PROTO((tree));
629 /* C++ language-specific tree codes. */
630 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
631 enum cplus_tree_code {
632 __DUMMY = LAST_AND_UNUSED_TREE_CODE,
633 #include "cp-tree.def"
638 enum languages { lang_c, lang_cplusplus, lang_java };
640 /* Macros to make error reporting functions' lives easier. */
641 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
642 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
643 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
645 #define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
646 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
648 /* The _DECL for this _TYPE. */
649 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
651 /* Nonzero if T is a class (or struct or union) type. Also nonzero
652 for template type parameters, typename types, and instantiated
653 template template parameters. Despite its name,
654 this macro has nothing to do with the definition of aggregate given
655 in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
656 #define IS_AGGR_TYPE(t) \
657 (TREE_CODE (t) == TEMPLATE_TYPE_PARM \
658 || TREE_CODE (t) == TYPENAME_TYPE \
659 || TREE_CODE (t) == TYPEOF_TYPE \
660 || (TREE_CODE (t) == TEMPLATE_TEMPLATE_PARM \
661 && TYPE_TEMPLATE_INFO (t)) \
662 || TYPE_LANG_FLAG_5 (t))
664 /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
666 #define SET_IS_AGGR_TYPE(T, VAL) \
667 (TYPE_LANG_FLAG_5 (T) = (VAL))
669 /* Nonzero if T is a class type. Zero for template type parameters,
670 typename types, and so forth. */
671 #define CLASS_TYPE_P(t) \
672 (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t))
674 #define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
675 #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
676 (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
677 && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
678 #define IS_OVERLOAD_TYPE(t) \
679 (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
681 /* In a *_TYPE, nonzero means a built-in type. */
682 #define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
684 /* True if this a "Java" type, defined in 'extern "Java"'. */
685 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
687 /* The type qualifiers for this type, including the qualifiers on the
688 elements for an array type. */
689 #define CP_TYPE_QUALS(NODE) \
690 ((TREE_CODE (NODE) != ARRAY_TYPE) \
691 ? TYPE_QUALS (NODE) : cp_type_quals (NODE))
693 /* Nonzero if this type is const-qualified. */
694 #define CP_TYPE_CONST_P(NODE) \
695 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0)
697 /* Nonzero if this type is volatile-qualified. */
698 #define CP_TYPE_VOLATILE_P(NODE) \
699 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0)
701 /* Nonzero if this type is restrict-qualified. */
702 #define CP_TYPE_RESTRICT_P(NODE) \
703 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0)
705 /* Nonzero if this type is const-qualified, but not
706 volatile-qualified. Other qualifiers are ignored. This macro is
707 used to test whether or not it is OK to bind an rvalue to a
709 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
710 ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
713 #define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
714 (!flag_vtable_thunks ? \
715 TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
716 : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
717 : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
719 /* Virtual function addresses can be gotten from a virtual function
720 table entry using this macro. */
721 #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
722 (!flag_vtable_thunks ? \
723 TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
724 : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
725 : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
726 #define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
727 (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
728 #define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
729 #define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
730 (((CODE) == TREE_CODE (NODE) \
731 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
732 || IS_AGGR_TYPE (NODE))
734 /* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can
735 be an ambiguous base class of TYPE, and this macro will be false. */
736 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
737 #define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
738 #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
739 #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
741 /* This structure provides additional information above and beyond
742 what is provide in the ordinary tree_type. In the past, we used it
743 for the types of class types, template parameters types, typename
744 types, and so forth. However, there can be many (tens to hundreds
745 of thousands) of template parameter types in a compilation, and
746 there's no need for this additional information in that case.
747 Therefore, we now use this data structure only for class types.
749 In the past, it was thought that there would be relatively few
750 class types. However, in the presence of heavy use of templates,
751 many (i.e., thousands) of classes can easily be generated.
752 Therefore, we should endeavor to keep the size of this structure to
758 unsigned has_type_conversion : 1;
759 unsigned has_init_ref : 1;
760 unsigned has_default_ctor : 1;
761 unsigned uses_multiple_inheritance : 1;
762 unsigned const_needs_init : 1;
763 unsigned ref_needs_init : 1;
764 unsigned has_const_assign_ref : 1;
765 unsigned anon_aggr : 1;
767 unsigned has_nonpublic_ctor : 2;
768 unsigned has_nonpublic_assign_ref : 2;
769 unsigned vtable_needs_writing : 1;
770 unsigned has_assign_ref : 1;
771 unsigned gets_new : 2;
773 unsigned gets_delete : 2;
774 unsigned has_call_overloaded : 1;
775 unsigned has_array_ref_overloaded : 1;
776 unsigned has_arrow_overloaded : 1;
777 unsigned interface_only : 1;
778 unsigned interface_unknown : 1;
779 unsigned needs_virtual_reinit : 1;
782 unsigned vec_delete_takes_size : 1;
783 unsigned declared_class : 1;
785 unsigned being_defined : 1;
786 unsigned redefined : 1;
787 unsigned debug_requested : 1;
788 unsigned use_template : 2;
789 unsigned got_semicolon : 1;
790 unsigned ptrmemfunc_flag : 1;
791 unsigned was_anonymous : 1;
793 unsigned has_real_assign_ref : 1;
794 unsigned has_const_init_ref : 1;
795 unsigned has_complex_init_ref : 1;
796 unsigned has_complex_assign_ref : 1;
797 unsigned has_abstract_assign_ref : 1;
798 unsigned non_aggregate : 1;
799 unsigned is_partial_instantiation : 1;
800 unsigned has_mutable : 1;
802 unsigned com_interface : 1;
803 unsigned non_pod_class : 1;
805 /* When adding a flag here, consider whether or not it ought to
806 apply to a template instance if it applies to the template.
807 If so, make sure to copy it in instantiate_class_template! */
809 /* The MIPS compiler gets it wrong if this struct also
810 does not fill out to a multiple of 4 bytes. Add a
811 member `dummy' with new bits if you go over the edge. */
818 union tree_node *vfields;
819 union tree_node *vbases;
821 union tree_node *tags;
823 union tree_node *search_slot;
826 /* Room for another three unsigned chars. */
828 union tree_node *size;
830 union tree_node *abstract_virtuals;
831 union tree_node *friend_classes;
833 union tree_node *rtti;
835 union tree_node *methods;
837 union tree_node *template_info;
838 tree befriending_classes;
841 /* Indicates whether or not (and how) a template was expanded for this class.
842 0=no information yet/non-template class
843 1=implicit template instantiation
844 2=explicit template specialization
845 3=explicit template instantiation */
846 #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
848 /* Fields used for storing information before the class is defined.
849 After the class is defined, these fields hold other information. */
851 /* List of friends which were defined inline in this class definition. */
852 #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
854 /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
856 #define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
857 #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
858 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
860 /* Nonzero for _CLASSTYPE means that operator vec delete is defined and
861 takes the optional size_t argument. */
862 #define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
863 (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size)
864 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
865 (TYPE_NEEDS_DESTRUCTOR (NODE) \
866 || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
868 /* Nonzero means that this _CLASSTYPE node defines ways of converting
869 itself to other types. */
870 #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
872 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
873 #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
874 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
876 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
877 #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
878 #define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
880 /* Nonzero means that this type is being defined. I.e., the left brace
881 starting the definition of this type has been seen. */
882 #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
883 /* Nonzero means that this type has been redefined. In this case, if
884 convenient, don't reprocess any methods that appear in its redefinition. */
885 #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
887 /* The is the basetype that contains NODE's rtti. */
888 #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
890 /* Nonzero means that this _CLASSTYPE node overloads operator(). */
891 #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
893 /* Nonzero means that this _CLASSTYPE node overloads operator[]. */
894 #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
896 /* Nonzero means that this _CLASSTYPE node overloads operator->. */
897 #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
899 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
900 multiple inheritance. If this is 0 for the root of a type
901 hierarchy, then we can use more efficient search techniques. */
902 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
904 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
905 virtual base classes. If this is 0 for the root of a type
906 hierarchy, then we can use more efficient search techniques. */
907 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
909 /* Vector member functions defined in this class. Each element is
910 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
911 functions with the same name end up in the same slot. The first
912 two elements are for constructors, and destructors, respectively.
913 These are followed by ordinary member functions. There may be
914 empty entries at the end of the vector. */
915 #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
917 /* The first type conversion operator in the class (the others can be
918 searched with TREE_CHAIN), or the first non-constructor function if
919 there are no type conversion operators. */
920 #define CLASSTYPE_FIRST_CONVERSION(NODE) \
921 TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
922 ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
925 /* Mark bits for depth-first and breath-first searches. */
927 /* Get the value of the Nth mark bit. */
928 #define CLASSTYPE_MARKED_N(NODE, N) \
929 (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->type_flags.marks \
930 : TYPE_ALIAS_SET (NODE)) & (1 << N)) != 0)
932 /* Set the Nth mark bit. */
933 #define SET_CLASSTYPE_MARKED_N(NODE, N) \
934 (CLASS_TYPE_P (NODE) \
935 ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks |= (1 << (N))) \
936 : (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
938 /* Clear the Nth mark bit. */
939 #define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
940 (CLASS_TYPE_P (NODE) \
941 ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks &= ~(1 << (N))) \
942 : (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
944 /* Get the value of the mark bits. */
945 #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0)
946 #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1)
947 #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2)
948 #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3)
949 #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4)
950 #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5)
952 /* Macros to modify the above flags */
953 #define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N(NODE, 0)
954 #define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 0)
955 #define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N(NODE, 1)
956 #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1)
957 #define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N(NODE, 2)
958 #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2)
959 #define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N(NODE, 3)
960 #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3)
961 #define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N(NODE, 4)
962 #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4)
963 #define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N(NODE, 5)
964 #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5)
966 /* A list of the nested tag-types (class, struct, union, or enum)
967 found within this class. The TREE_PURPOSE of each node is the name
968 of the type; the TREE_VALUE is the type itself. This list includes
969 nested member class templates. */
970 #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
972 /* If this class has any bases, this is the number of the base class from
973 which our VFIELD is based, -1 otherwise. If this class has no base
974 classes, this is not used.
975 In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
976 1, if D's vtable came from B2. */
977 #define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
979 /* Remove when done merging. */
980 #define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
982 /* The number of virtual functions defined for this
984 #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
985 /* The virtual base classes that this type uses. */
986 #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
987 /* The virtual function pointer fields that this type contains. */
988 #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
990 /* Number of baseclasses defined for this type.
991 0 means no base classes. */
992 #define CLASSTYPE_N_BASECLASSES(NODE) \
993 (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
995 /* Used for keeping search-specific information. Any search routine
996 which uses this must define what exactly this slot is used for. */
997 #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
999 /* These are the size, mode and alignment of the type without its
1000 virtual base classes, for when we use this type as a base itself. */
1001 #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
1002 #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
1004 /* A cons list of virtual functions which cannot be inherited by
1005 derived classes. When deriving from this type, the derived
1006 class must provide its own definition for each of these functions. */
1007 #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
1009 /* Nonzero means that this aggr type has been `closed' by a semicolon. */
1010 #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
1012 /* Nonzero means that the main virtual function table pointer needs to be
1013 set because base constructors have placed the wrong value there.
1014 If this is zero, it means that they placed the right value there,
1015 and there is no need to change it. */
1016 #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
1018 /* Nonzero means that if this type has virtual functions, that
1019 the virtual function table will be written out. */
1020 #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
1022 /* Nonzero means that this type has an X() constructor. */
1023 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
1025 /* Nonzero means the type declared a ctor as private or protected. We
1026 use this to make sure we don't try to generate a copy ctor for a
1027 class that has a member of type NODE. */
1028 #define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor)
1030 /* Ditto, for operator=. */
1031 #define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref)
1033 /* Nonzero means that this type contains a mutable member */
1034 #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_mutable)
1035 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1037 /* Nonzero means that this class type is a non-POD class. */
1038 #define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_pod_class)
1040 /* Nonzero means that this type is meant for communication via COM. */
1041 #define CLASSTYPE_COM_INTERFACE(NODE) \
1042 (TYPE_LANG_SPECIFIC(NODE)->type_flags.com_interface)
1044 /* A list of class types of which this type is a friend. The
1045 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1046 case of a template friend. */
1047 #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
1049 /* A list of the classes which grant friendship to this class. */
1050 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1051 (TYPE_LANG_SPECIFIC (NODE)->befriending_classes)
1053 /* Say whether this node was declared as a "class" or a "struct". */
1054 #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
1056 /* Nonzero if this class has const members which have no specified initialization. */
1057 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
1059 /* Nonzero if this class has ref members which have no specified initialization. */
1060 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
1062 /* Nonzero if this class is included from a header file which employs
1063 `#pragma interface', and it is not included in its implementation file. */
1064 #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
1066 /* Same as above, but for classes whose purpose we do not know. */
1067 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
1068 #define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0)
1069 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X))
1070 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1)
1071 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0)
1073 /* Nonzero if a _DECL node requires us to output debug info for this class. */
1074 #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
1076 /* Additional macros for inheritance information. */
1078 /* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
1079 gcc/tree.h. In particular if D is derived from B then the BINFO
1080 for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
1081 D. In tree.h, this pointer is described as pointing in other
1082 direction. There is a different BINFO for each path to a virtual
1083 base; BINFOs for virtual bases are not shared. In addition, shared
1084 versions of each of the virtual class BINFOs are stored in
1085 CLASSTYPE_VBASECLASSES.
1087 We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
1088 inheritance is indicated by the absence of the other two flags, not
1089 by TREE_VIAR_PRIVATE, which is unused.
1091 The TREE_CHAIN is for scratch space in search.c. */
1093 /* Nonzero means marked by DFS or BFS search, including searches
1094 by `get_binfo' and `get_base_distance'. */
1095 #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
1096 /* Macros needed because of C compilers that don't allow conditional
1097 expressions to be lvalues. Grr! */
1098 #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
1099 #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
1101 /* Nonzero means marked in search through virtual inheritance hierarchy. */
1102 #define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1103 /* Modifier macros */
1104 #define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1105 #define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1107 /* Nonzero means marked in search for members or member functions. */
1108 #define BINFO_FIELDS_MARKED(NODE) \
1109 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
1110 #define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
1111 #define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
1113 /* Nonzero means that this class is on a path leading to a new vtable. */
1114 #define BINFO_VTABLE_PATH_MARKED(NODE) \
1115 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
1116 #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
1117 #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
1119 /* Nonzero means that this class has a new vtable. */
1120 #define BINFO_NEW_VTABLE_MARKED(NODE) \
1121 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
1122 #define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
1123 #define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
1125 /* Nonzero means this class has done dfs_pushdecls. */
1126 #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
1127 #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
1128 #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
1130 /* Used by various search routines. */
1131 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1133 /* Accessor macros for the vfield slots in structures. */
1135 /* Get the assoc info that caused this vfield to exist. */
1136 #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1138 /* Get that same information as a _TYPE. */
1139 #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1141 /* Get the value of the top-most type dominating the non-`normal' vfields. */
1142 #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
1144 /* Get the value of the top-most type that's `normal' for the vfield. */
1145 #define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
1147 /* Nonzero for TREE_LIST node means that this list of things
1148 is a list of parameters, as opposed to a list of expressions. */
1149 #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
1151 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1152 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
1153 will be NULL_TREE to indicate a throw specification of `()', or
1154 no exceptions allowed. */
1155 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
1157 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
1158 #define TYPE_NOTHROW_P(NODE) \
1159 (TYPE_RAISES_EXCEPTIONS (NODE) \
1160 && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
1162 /* The binding level associated with the namespace. */
1163 #define NAMESPACE_LEVEL(NODE) \
1164 (DECL_LANG_SPECIFIC(NODE)->decl_flags.u.level)
1167 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
1168 a lang_decl (which has lang_decl_flags as its initial prefix).
1169 This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
1170 the full lang_decl, and not just lang_decl_flags. */
1171 #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
1172 (!(TREE_CODE ((NODE)) == VAR_DECL \
1173 || TREE_CODE ((NODE)) == CONST_DECL \
1174 || TREE_CODE ((NODE)) == FIELD_DECL \
1175 || TREE_CODE ((NODE)) == USING_DECL))
1177 struct lang_decl_flags
1179 #ifdef ONLY_INT_FIELDS
1182 enum languages language : 8;
1185 unsigned operator_attr : 1;
1186 unsigned constructor_attr : 1;
1187 unsigned friend_attr : 1;
1188 unsigned static_function : 1;
1189 unsigned const_memfunc : 1;
1190 unsigned volatile_memfunc : 1;
1191 unsigned abstract_virtual : 1;
1192 unsigned permanent_attr : 1 ;
1194 unsigned constructor_for_vbase_attr : 1;
1195 unsigned mutable_flag : 1;
1196 unsigned saved_inline : 1;
1197 unsigned use_template : 2;
1198 unsigned nonconverting : 1;
1199 unsigned declared_inline : 1;
1200 unsigned not_really_extern : 1;
1202 unsigned needs_final_overrider : 1;
1203 unsigned bitfield : 1;
1204 unsigned defined_in_class : 1;
1211 /* In a FUNCTION_DECL or a VAR_DECL, this is DECL_TEMPLATE_INFO. */
1214 /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
1215 struct binding_level *level;
1221 struct lang_decl_flags decl_flags;
1223 tree main_decl_variant;
1224 tree befriending_classes;
1226 /* In a FUNCTION_DECL, this is DECL_SAVED_TREE. */
1232 struct pending_inline *pending_inline_info;
1233 /* The lang_decls on the free_lang_decl_chain are chained together
1234 through this pointer. */
1235 struct lang_decl *next;
1239 /* Non-zero if NODE is a _DECL with TREE_READONLY set. */
1240 #define TREE_READONLY_DECL_P(NODE) \
1241 (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
1243 /* Non-zero iff DECL is memory-based. The DECL_RTL of
1244 certain const variables might be a CONST_INT, or a REG
1245 in some cases. We cannot use `memory_operand' as a test
1246 here because on most RISC machines, a variable's address
1247 is not, by itself, a legitimate address. */
1248 #define DECL_IN_MEMORY_P(NODE) \
1249 (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
1251 /* For FUNCTION_DECLs: return the language in which this decl
1253 #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
1255 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
1256 #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
1258 /* There ought to be a better way to find out whether or not something is
1260 #define DECL_DESTRUCTOR_P(NODE) \
1261 (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (NODE)) \
1262 && DECL_LANGUAGE (NODE) == lang_cplusplus)
1264 /* Non-zero if NODE is a user-defined conversion operator. */
1265 #define DECL_CONV_FN_P(NODE) \
1266 (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)) && TREE_TYPE (DECL_NAME (NODE)))
1268 /* Non-zero if NODE is an overloaded operator. */
1269 #define DECL_OVERLOADED_OPERATOR_P(NODE) \
1270 (IDENTIFIER_OPNAME_P (DECL_NAME ((NODE))))
1272 /* For FUNCTION_DECLs: nonzero means that this function is a constructor
1273 for an object with virtual baseclasses. */
1274 #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
1276 /* Non-zero for a FUNCTION_DECL that declares a type-info function. */
1277 #define DECL_TINFO_FN_P(NODE) \
1278 (TREE_CODE (NODE) == FUNCTION_DECL \
1279 && DECL_ARTIFICIAL (NODE) \
1280 && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1282 /* Mark NODE as a type-info function. */
1283 #define SET_DECL_TINFO_FN_P(NODE) \
1284 (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1)
1286 /* Nonzero for _DECL means that this decl appears in (or will appear
1287 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
1288 detecting circularity in case members are multiply defined. In the
1289 case of a VAR_DECL, it is also used to determine how program storage
1290 should be allocated. */
1291 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
1293 /* Nonzero if the DECL was defined in the class definition itself,
1294 rather than outside the class. */
1295 #define DECL_DEFINED_IN_CLASS_P(DECL) \
1296 (DECL_LANG_SPECIFIC (DECL)->decl_flags.defined_in_class)
1298 /* Nonzero for FUNCTION_DECL means that this decl is just a
1299 friend declaration, and should not be added to the list of
1300 member functions for this class. */
1301 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
1303 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
1304 #define DECL_BEFRIENDING_CLASSES(NODE) \
1305 (DECL_LANG_SPECIFIC(NODE)->befriending_classes)
1307 /* Nonzero for FUNCTION_DECL means that this decl is a static
1309 #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
1311 /* Nonzero for a class member means that it is shared between all objects
1313 #define SHARED_MEMBER_P(NODE) \
1314 (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
1315 || TREE_CODE (NODE) == CONST_DECL)
1317 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
1319 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
1320 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
1322 /* Nonzero for FUNCTION_DECL means that this decl is a member function
1323 (static or non-static). */
1324 #define DECL_FUNCTION_MEMBER_P(NODE) \
1325 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
1327 /* Nonzero for FUNCTION_DECL means that this member function
1328 has `this' as const X *const. */
1329 #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
1331 /* Nonzero for FUNCTION_DECL means that this member function
1332 has `this' as volatile X *const. */
1333 #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
1335 /* Nonzero for a DECL means that this member is a non-static member. */
1336 #define DECL_NONSTATIC_MEMBER_P(NODE) \
1337 ((TREE_CODE (NODE) == FUNCTION_DECL \
1338 && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
1339 || TREE_CODE (NODE) == FIELD_DECL)
1341 /* Nonzero for _DECL means that this member object type
1343 #define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1345 /* Nonzero for _DECL means that this constructor is a non-converting
1347 #define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
1349 /* Nonzero for FUNCTION_DECL means that this member function
1350 exists as part of an abstract class's interface. */
1351 #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
1353 /* Nonzero for FUNCTION_DECL means that this member function
1354 must be overridden by derived classes. */
1355 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
1357 /* Nonzero if allocated on permanent_obstack. */
1358 #define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
1360 /* The _TYPE context in which this _DECL appears. This field holds the
1361 class where a virtual function instance is actually defined, and the
1362 lexical scope of a friend function defined in a class body. */
1363 #define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
1364 #define DECL_REAL_CONTEXT(NODE) \
1365 ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
1366 ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE))
1368 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
1369 #define CP_DECL_CONTEXT(NODE) \
1370 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
1371 #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
1373 /* For a virtual function, the base where we find its vtable entry.
1374 For a non-virtual function, the base where it is defined. */
1375 #define DECL_VIRTUAL_CONTEXT(NODE) DECL_CONTEXT (NODE)
1377 /* 1 iff NODE has namespace scope, including the global namespace. */
1378 #define DECL_NAMESPACE_SCOPE_P(NODE) \
1379 (DECL_CONTEXT (NODE) == NULL_TREE \
1380 || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
1382 /* 1 iff NODE is a class member. */
1383 #define DECL_CLASS_SCOPE_P(NODE) \
1384 (DECL_CONTEXT (NODE) \
1385 && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
1387 /* 1 iff NODE is function-local. */
1388 #define DECL_FUNCTION_SCOPE_P(NODE) \
1389 (DECL_CONTEXT (NODE) \
1390 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
1392 /* For a NAMESPACE_DECL: the list of using namespace directives
1393 The PURPOSE is the used namespace, the value is the namespace
1394 that is the common ancestor. */
1395 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX(NODE)
1397 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
1398 of a namespace, to record the transitive closure of using namespace. */
1399 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NODE)
1401 /* In a NAMESPACE_DECL, points to the original namespace if this is
1402 a namespace alias. */
1403 #define DECL_NAMESPACE_ALIAS(NODE) DECL_ABSTRACT_ORIGIN (NODE)
1404 #define ORIGINAL_NAMESPACE(NODE) \
1405 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
1407 /* In a non-local VAR_DECL with static storage duration, this is the
1408 initialization priority. If this value is zero, the NODE will be
1409 initialized at the DEFAULT_INIT_PRIORITY. */
1410 #define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE ((NODE)))
1412 /* In a TREE_LIST concatenating using directives, indicate indirekt
1414 #define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0)
1416 /* In a VAR_DECL for a variable declared in a for statement,
1417 this is the shadowed (local) variable. */
1418 #define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
1420 /* Points back to the decl which caused this lang_decl to be allocated. */
1421 #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
1423 /* For a FUNCTION_DECL: if this function was declared inline inside of
1424 a class declaration, this is where the text for the function is
1426 #define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->u.pending_inline_info)
1428 /* For a TYPE_DECL: if this function has many fields, we'll sort them
1429 and put them into a TREE_VEC. */
1430 #define DECL_SORTED_FIELDS(NODE) (DECL_LANG_SPECIFIC(NODE)->u.sorted_fields)
1432 /* True if on the saved_inlines (see decl2.c) list. */
1433 #define DECL_SAVED_INLINE(DECL) \
1434 (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
1436 /* For a VAR_DECL or FUNCTION_DECL: template-specific information. */
1437 #define DECL_TEMPLATE_INFO(NODE) \
1438 (DECL_LANG_SPECIFIC(NODE)->decl_flags.u.template_info)
1440 /* Template information for a RECORD_TYPE or UNION_TYPE. */
1441 #define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info)
1443 /* Template information for an ENUMERAL_TYPE. Although an enumeration may
1444 not be a primary template, it may be declared within the scope of a
1445 primary template and the enumeration constants may depend on
1446 non-type template parameters. */
1447 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1449 /* Template information for a template template parameter. */
1450 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1452 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1453 #define TYPE_TEMPLATE_INFO(NODE) \
1454 (TREE_CODE (NODE) == ENUMERAL_TYPE \
1455 ? ENUM_TEMPLATE_INFO (NODE) : \
1456 (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \
1457 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \
1458 : CLASSTYPE_TEMPLATE_INFO (NODE)))
1460 /* Set the template information for an ENUMERAL_, RECORD_, or
1461 UNION_TYPE to VAL. */
1462 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
1463 (TREE_CODE (NODE) == ENUMERAL_TYPE \
1464 ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \
1465 : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
1467 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
1468 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
1469 #define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE))
1470 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
1472 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
1473 TEMPLATE_DECL will be the immediate parent, not the most general
1474 template. For example, in:
1476 template <class T> struct S { template <class U> void f(U); }
1478 the FUNCTION_DECL for S<int>::f<double> will have, as its
1479 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
1481 As a special case, for a member friend template of a template
1482 class, this value will not be a TEMPLATE_DECL, but rather a
1483 LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
1484 and any explicit template arguments provided. For example, in:
1486 template <class T> struct S { friend void f<int>(int, double); }
1488 the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
1489 DECL_TI_ARGS will be {int}. */
1490 #define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
1492 /* The template arguments used to obtain this decl from the most
1493 general form of DECL_TI_TEMPLATE. For the example given for
1494 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
1495 are always the full set of arguments required to instantiate this
1496 declaration from the most general template specialized here. */
1497 #define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
1498 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
1499 #define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
1500 #define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE))
1501 #define ENUM_TI_TEMPLATE(NODE) \
1502 TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
1503 #define ENUM_TI_ARGS(NODE) \
1504 TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
1506 /* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1507 #define TYPE_TI_TEMPLATE(NODE) \
1508 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
1510 /* Like DECL_TI_ARGS, , but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1511 #define TYPE_TI_ARGS(NODE) \
1512 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
1514 #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE)
1516 /* Nonzero if the NODE corresponds to the template parameters for a
1517 member template, whose inline definition is being processed after
1518 the class definition is complete. */
1519 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
1521 /* In a template FUNCTION_DECL, the tree structure that will be
1522 substituted into to obtain instantiations. */
1523 #define DECL_SAVED_TREE(NODE) \
1524 (DECL_LANG_SPECIFIC ((NODE))->saved_tree)
1526 #define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
1527 #define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1528 #define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1529 #define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
1530 #define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1532 /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
1533 constructor call, rather than an ordinary function call. */
1534 #define AGGR_INIT_VIA_CTOR_P(NODE) TREE_LANG_FLAG_0 (NODE)
1536 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
1537 TEMPLATE_DECL. This macro determines whether or not a given class
1538 type is really a template type, as opposed to an instantiation or
1539 specialization of one. */
1540 #define CLASSTYPE_IS_TEMPLATE(NODE) \
1541 (CLASSTYPE_TEMPLATE_INFO (NODE) \
1542 && !CLASSTYPE_USE_TEMPLATE (NODE) \
1543 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
1545 /* The name used by the user to name the typename type. Typically,
1546 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
1547 corresponding TYPE_DECL. However, this may also be a
1548 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
1549 #define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE)
1551 /* Nonzero if NODE is an implicit typename. */
1552 #define IMPLICIT_TYPENAME_P(NODE) \
1553 (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
1555 /* Nonzero if NODE is a TYPE_DECL that should not be visible because
1556 it is from a dependent base class. */
1557 #define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE) \
1558 (TREE_CODE (NODE) == TYPE_DECL \
1559 && DECL_ARTIFICIAL (NODE) \
1560 && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
1562 /* Nonzero in INTEGER_CST means that this int is negative by dint of
1563 using a twos-complement negated operand. */
1564 #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
1567 /* Nonzero in any kind of _EXPR or _REF node means that it is a call
1568 to a storage allocation routine. If, later, alternate storage
1569 is found to hold the object, this call can be ignored. */
1570 #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
1573 /* Nonzero in any kind of _TYPE that uses multiple inheritance
1574 or virtual baseclasses. */
1575 #define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
1578 /* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
1579 gave; it's a DECL_NESTED_TYPENAME. Someone may want to set this on
1580 mangled function names, too, but it isn't currently. */
1581 #define TREE_MANGLED(NODE) (FOO)
1585 /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
1586 should be looked up in a non-standard way. */
1587 #define DECL_OVERLOADED(NODE) (FOO)
1590 /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
1591 For a FUNCTION_DECL, this is when the function is a virtual function.
1592 For a VAR_DECL, this is when the variable is a virtual function table.
1593 For a FIELD_DECL, when the field is the field for the virtual function table.
1594 For an IDENTIFIER_NODE, nonzero if any function with this name
1595 has been declared virtual.
1597 For a _TYPE if it uses virtual functions (or is derived from
1599 #define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
1601 extern int flag_new_for_scope;
1603 /* This flag is true of a local VAR_DECL if it was declared in a for
1604 statement, but we are no longer in the scope of the for. */
1605 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
1607 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
1608 if we already emitted a warning about using it. */
1609 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE)
1611 /* This _DECL represents a compiler-generated entity. */
1612 #define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
1614 /* Record whether a typedef for type `int' was actually `signed int'. */
1615 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
1617 /* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */
1618 #define DECL_C_BIT_FIELD(NODE) \
1619 (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield)
1620 #define SET_DECL_C_BIT_FIELD(NODE) \
1621 (DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield = 1)
1623 /* Nonzero if the type T promotes to itself.
1624 ANSI C states explicitly the list of types that promote;
1625 in particular, short promotes to int even if they have the same width. */
1626 #define C_PROMOTING_INTEGER_TYPE_P(t) \
1627 (TREE_CODE ((t)) == INTEGER_TYPE \
1628 && (TYPE_MAIN_VARIANT (t) == char_type_node \
1629 || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
1630 || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
1631 || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
1632 || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
1634 #define INTEGRAL_CODE_P(CODE) \
1635 (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
1637 /* [basic.fundamental]
1639 Types bool, char, wchar_t, and the signed and unsigned integer types
1640 are collectively called integral types.
1642 Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
1643 types as well, which is incorrect in C++. */
1644 #define CP_INTEGRAL_TYPE_P(TYPE) \
1645 (TREE_CODE ((TYPE)) == BOOLEAN_TYPE \
1646 || TREE_CODE ((TYPE)) == INTEGER_TYPE)
1648 /* [basic.fundamental]
1650 Integral and floating types are collectively called arithmetic
1652 #define ARITHMETIC_TYPE_P(TYPE) \
1653 (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
1655 /* Mark which labels are explicitly declared.
1656 These may be shadowed, and may be referenced from nested functions. */
1657 #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
1659 /* Nonzero for _TYPE means that the _TYPE defines
1660 at least one constructor. */
1661 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
1663 /* When appearing in an INDIRECT_REF, it means that the tree structure
1664 underneath is actually a call to a constructor. This is needed
1665 when the constructor must initialize local storage (which can
1666 be automatically destroyed), rather than allowing it to allocate
1667 space from the heap.
1669 When appearing in a SAVE_EXPR, it means that underneath
1670 is a call to a constructor.
1672 When appearing in a CONSTRUCTOR, it means that it was
1673 a GNU C constructor expression.
1675 When appearing in a FIELD_DECL, it means that this field
1676 has been duly initialized in its constructor. */
1677 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
1679 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
1680 && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
1681 && ! TREE_HAS_CONSTRUCTOR (NODE))
1684 /* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
1685 Used to generate more helpful error message in case somebody
1686 tries to take its address. */
1687 #define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
1690 /* Nonzero for _TYPE means that the _TYPE defines a destructor. */
1691 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
1694 /* Nonzero for _TYPE node means that creating an object of this type
1695 will involve a call to a constructor. This can apply to objects
1696 of ARRAY_TYPE if the type of the elements needs a constructor. */
1697 #define TYPE_NEEDS_CONSTRUCTING(NODE) ... defined in ../tree.h ...
1700 /* Nonzero means that an object of this type can not be initialized using
1701 an initializer list. */
1702 #define CLASSTYPE_NON_AGGREGATE(NODE) \
1703 (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate)
1704 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
1705 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
1707 /* Nonzero if there is a user-defined X::op=(x&) for this class. */
1708 #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
1709 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
1710 #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref)
1711 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref)
1713 /* Nonzero for _TYPE node means that destroying an object of this type
1714 will involve a call to a destructor. This can apply to objects
1715 of ARRAY_TYPE is the type of the elements needs a destructor. */
1716 #define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
1718 /* Nonzero for class type means that initialization of this type can use
1720 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
1721 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
1723 /* Nonzero for class type means that assignment of this type can use
1725 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
1726 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
1728 #define TYPE_PTRMEM_P(NODE) \
1729 (TREE_CODE (NODE) == POINTER_TYPE \
1730 && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
1731 #define TYPE_PTR_P(NODE) \
1732 (TREE_CODE (NODE) == POINTER_TYPE \
1733 && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
1734 #define TYPE_PTROB_P(NODE) \
1735 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
1736 && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
1737 #define TYPE_PTROBV_P(NODE) \
1738 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
1739 #define TYPE_PTRFN_P(NODE) \
1740 (TREE_CODE (NODE) == POINTER_TYPE \
1741 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
1743 /* Nonzero for _TYPE node means that this type is a pointer to member
1745 #define TYPE_PTRMEMFUNC_P(NODE) \
1746 (TREE_CODE(NODE) == RECORD_TYPE \
1747 && TYPE_LANG_SPECIFIC(NODE) \
1748 && TYPE_PTRMEMFUNC_FLAG (NODE))
1750 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
1751 (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
1753 /* A pointer-to-function member type looks like:
1764 where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
1765 pointer to member. The fields are used as follows:
1767 If __INDEX is -1, then the function to call is non-virtual, and
1768 is located at the address given by __PFN.
1770 If __INDEX is zero, then this a NULL pointer-to-member.
1772 Otherwise, the function to call is virtual. Then, __DELTA2 gives
1773 the offset from an instance of the object to the virtual function
1774 table, and __INDEX - 1 is the index into the vtable to use to
1777 The value to use for the THIS parameter is the address of the
1778 object plus __DELTA.
1791 struct S : public B1, B2 {};
1793 the pointer-to-member for `&S::f' looks like:
1795 { 4, -1, { &f__2B2 } };
1797 The `4' means that given an `S*' you have to add 4 bytes to get to
1798 the address of the `B2*'. Then, the -1 indicates that this is a
1799 non-virtual function. Of course, `&f__2B2' is the name of that
1802 (Of course, the exact values may differ depending on the mangling
1803 scheme, sizes of types, and such.). */
1805 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
1806 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
1807 before using this macro. */
1808 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
1810 /* Returns `A' for a type like `int (A::*)(double)' */
1811 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
1812 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
1814 /* These are use to manipulate the canonical RECORD_TYPE from the
1815 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
1816 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
1817 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
1818 /* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
1819 #define DELTA2_FROM_PTRMEMFUNC(NODE) delta2_from_ptrmemfunc ((NODE))
1820 #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
1822 /* For a pointer-to-member type of the form `T X::*', this is `X'. */
1823 #define TYPE_PTRMEM_CLASS_TYPE(NODE) \
1824 (TYPE_PTRMEM_P ((NODE)) \
1825 ? TYPE_OFFSET_BASETYPE (TREE_TYPE ((NODE))) \
1826 : TYPE_PTRMEMFUNC_OBJECT_TYPE ((NODE)))
1828 /* For a pointer-to-member type of the form `T X::*', this is `T'. */
1829 #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
1830 (TYPE_PTRMEM_P ((NODE)) \
1831 ? TREE_TYPE (TREE_TYPE (NODE)) \
1832 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE ((NODE))))
1834 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
1836 #define PTRMEM_CST_CLASS(NODE) \
1837 TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (NODE))
1839 /* For a pointer-to-member constant `X::Y' this is the _DECL for
1841 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t) NODE)->member)
1843 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
1844 specified in its declaration. */
1845 #define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE))
1847 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
1848 specified in its declaration. */
1849 #define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE))
1851 /* Nonzero in FUNCTION_DECL means it is really an operator.
1852 Just used to communicate formatting information to dbxout.c. */
1853 #define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
1855 /* Nonzero if TYPE is an anonymous union or struct type. We have to use a
1856 flag for this because "A union for which objects or pointers are
1857 declared is not an anonymous union" [class.union]. */
1858 #define ANON_AGGR_TYPE_P(NODE) \
1859 (CLASS_TYPE_P (NODE) && TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_aggr)
1860 #define SET_ANON_AGGR_TYPE_P(NODE) \
1861 (TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_aggr = 1)
1863 #define UNKNOWN_TYPE LANG_TYPE
1865 /* Define fields and accessors for nodes representing declared names. */
1868 /* C++: A derived class may be able to directly use the virtual
1869 function table of a base class. When it does so, it may
1870 still have a decl node used to access the virtual function
1871 table (so that variables of this type can initialize their
1872 virtual function table pointers by name). When such thievery
1873 is committed, know exactly which base class's virtual function
1874 table is the one being stolen. This effectively computes the
1875 transitive closure. */
1876 #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
1879 #define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous)
1881 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
1883 /* The format of each node in the DECL_FRIENDLIST is as follows:
1885 The TREE_PURPOSE will be the name of a function, i.e., an
1886 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the
1887 list of functions with that name which are friends. The
1888 TREE_PURPOSE of each node in this sublist will be error_mark_node,
1889 if the function was declared a friend individually, in which case
1890 the TREE_VALUE will be the function_decl. If, however, all
1891 functions with a given name in a class were declared to be friends,
1892 the TREE_PUROSE will be the class type, and the TREE_VALUE will be
1894 #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
1895 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
1896 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
1898 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
1899 each node is a type; the TREE_VALUE is the access granted for this
1900 DECL in that type. The DECL_ACCESS is set by access declarations.
1901 For example, if a member that would normally be public in a
1902 derived class is made protected, then the derived class and the
1903 protected_access_node will appear in the DECL_ACCESS for the node. */
1904 #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access)
1906 /* C++: all of these are overloaded!
1907 These apply to PARM_DECLs and VAR_DECLs. */
1908 #define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
1909 #define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
1911 /* Accessor macros for C++ template decl nodes. */
1913 /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
1914 is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
1915 template parameters, with 1 being the outermost set of template
1916 parameters. The TREE_VALUE is a vector, whose elements are the
1917 template parameters at each level. Each element in the vector is a
1918 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
1919 non-type parameter), or a TYPE_DECL (if the parameter is a type
1920 parameter). The TREE_PURPOSE is the default value, if any. The
1921 TEMPLATE_PARM_INDEX for the parameter is avilable as the
1922 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
1924 #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
1925 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
1926 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
1927 #define DECL_NTPARMS(NODE) \
1928 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
1929 /* For function, method, class-data templates. */
1930 #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
1931 /* For a static member variable template, the
1932 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
1933 implicitly generated instantiations of the variable. There are no
1934 partial instantiations of static member variables, so all of these
1935 will be full instantiations.
1937 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
1938 all instantiations and specializations of the class type, including
1939 partial instantiations and partial specializations.
1941 In both cases, the TREE_PURPOSE of each node contains the arguments
1942 used; the TREE_VALUE contains the generated variable. The template
1943 arguments are always complete. For example, given:
1945 template <class T> struct S1 {
1946 template <class U> struct S2 {};
1947 template <class U> struct S2<U*> {};
1950 the record for the partial specialization will contain, as its
1951 argument list, { {T}, {U*} }, and will be on the
1952 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
1953 <class U> struct S1<T>::S2'.
1955 This list is not used for function templates. */
1956 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
1957 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
1958 contains all instantiations and specializations of the function,
1959 including partial instantiations. For a partial instantiation
1960 which is a specialization, this list holds only full
1961 specializations of the template that are instantiations of the
1962 partial instantiation. For example, given:
1964 template <class T> struct S {
1965 template <class U> void f(U);
1966 template <> void f(T);
1969 the `S<int>::f<int>(int)' function will appear on the
1970 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
1971 template <class U> void S<T>::f(U)' and `template <class T> void
1972 S<int>::f(T)'. In the latter case, however, it will have only the
1973 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
1974 for the function declaration will point at the specialization, not
1975 the fully general template.
1977 For a class template, this list contains the partial
1978 specializations of this template. (Full specializations are not
1979 recorded on this list.) The TREE_PURPOSE holds the innermost
1980 arguments used in the partial specialization (e.g., for `template
1981 <class T> struct S<T*, int>' this will be `T*'.) The TREE_VALUE
1982 holds the innermost template parameters for the specialization
1983 (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node
1984 for the partial specialization.
1986 This list is not used for static variable templates. */
1987 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE)
1989 /* Nonzero for a DECL which is actually a template parameter. */
1990 #define DECL_TEMPLATE_PARM_P(NODE) \
1991 DECL_LANG_FLAG_0 (NODE)
1993 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
1994 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
1996 #define DECL_FUNCTION_TEMPLATE_P(NODE) \
1997 (TREE_CODE (NODE) == TEMPLATE_DECL \
1998 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
2000 /* Nonzero for a DECL that represents a template class. */
2001 #define DECL_CLASS_TEMPLATE_P(NODE) \
2002 (TREE_CODE (NODE) == TEMPLATE_DECL \
2003 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
2004 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
2006 /* Nonzero if NODE which declares a type. */
2007 #define DECL_DECLARES_TYPE_P(NODE) \
2008 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
2010 /* Nonzero if NODE is the typedef implicitly generated for a type when
2011 the type is declared. (In C++, `struct S {};' is roughly equivalent
2012 to `struct S {}; typedef struct S S;' in C. This macro will hold
2013 for the typedef indicated in this example. Note that in C++, there
2014 is a second implicit typedef for each class, in the scope of `S'
2015 itself, so that you can `S::S'. This macro does *not* hold for
2017 #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
2018 (TREE_CODE ((NODE)) == TYPE_DECL && DECL_LANG_FLAG_2 ((NODE)))
2019 #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
2020 (DECL_LANG_FLAG_2 ((NODE)) = 1)
2022 /* A `primary' template is one that has its own template header. A
2023 member function of a class template is a template, but not primary.
2024 A member template is primary. Friend templates are primary, too. */
2026 /* Returns the primary template corresponding to these parameters. */
2027 #define DECL_PRIMARY_TEMPLATE(NODE) \
2028 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
2030 /* Returns non-zero if NODE is a primary template. */
2031 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
2033 #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
2034 (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
2036 /* Indicates whether or not (and how) a template was expanded for this
2037 FUNCTION_DECL or VAR_DECL.
2038 0=normal declaration, e.g. int min (int, int);
2039 1=implicit template instantiation
2040 2=explicit template specialization, e.g. int min<int> (int, int);
2041 3=explicit template instantiation, e.g. template int min<int> (int, int); */
2042 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
2044 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
2045 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
2046 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
2048 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
2049 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
2050 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2051 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
2052 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2053 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
2055 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
2056 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
2057 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2058 (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
2059 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2060 (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
2062 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
2063 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
2064 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2065 (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
2066 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2067 (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
2069 /* Non-zero if DECL is a friend function which is an instantiation
2070 from the point of view of the compiler, but not from the point of
2071 view of the language. For example given:
2072 template <class T> struct S { friend void f(T) {}; };
2073 the declaration of `void f(int)' generated when S<int> is
2074 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
2075 a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
2076 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
2077 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
2079 /* Non-zero if TYPE is a partial instantiation of a template class,
2080 i.e., an instantiation whose instantiation arguments involve
2082 #define PARTIAL_INSTANTIATION_P(TYPE) \
2083 (TYPE_LANG_SPECIFIC (TYPE)->type_flags.is_partial_instantiation)
2085 /* Non-zero iff we are currently processing a declaration for an
2086 entity with its own template parameter list, and which is not a
2087 full specialization. */
2088 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
2089 (processing_template_decl > template_class_depth (current_class_type))
2091 /* This function may be a guiding decl for a template. */
2092 #define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
2094 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
2095 instantiated, i.e. its definition has been generated from the
2096 pattern given in the the template. */
2097 #define DECL_TEMPLATE_INSTANTIATED(NODE) DECL_LANG_FLAG_1(NODE)
2099 /* We know what we're doing with this decl now. */
2100 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
2102 /* This function was declared inline. This flag controls the linkage
2103 semantics of 'inline'; whether or not the function is inlined is
2104 controlled by DECL_INLINE. */
2105 #define DECL_THIS_INLINE(NODE) \
2106 (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
2108 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
2109 so that assemble_external will work properly. So we have this flag to
2110 tell us whether the decl is really not external. */
2111 #define DECL_NOT_REALLY_EXTERN(NODE) \
2112 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
2114 #define DECL_REALLY_EXTERN(NODE) \
2115 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
2117 #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
2119 /* ...and for unexpanded-parameterized-type nodes. */
2120 #define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
2121 #define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
2123 /* An un-parsed default argument looks like an identifier. */
2124 #define DEFARG_NODE_CHECK(t) TREE_CHECK(t, DEFAULT_ARG)
2125 #define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length)
2126 #define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
2128 /* These macros provide convenient access to the various _STMT nodes
2129 created when parsing template declarations. */
2130 #define IF_COND(NODE) TREE_OPERAND (NODE, 0)
2131 #define THEN_CLAUSE(NODE) TREE_OPERAND (NODE, 1)
2132 #define ELSE_CLAUSE(NODE) TREE_OPERAND (NODE, 2)
2133 #define WHILE_COND(NODE) TREE_OPERAND (NODE, 0)
2134 #define WHILE_BODY(NODE) TREE_OPERAND (NODE, 1)
2135 #define DO_COND(NODE) TREE_OPERAND (NODE, 0)
2136 #define DO_BODY(NODE) TREE_OPERAND (NODE, 1)
2137 #define RETURN_EXPR(NODE) TREE_OPERAND (NODE, 0)
2138 #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (NODE, 0)
2139 #define FOR_INIT_STMT(NODE) TREE_OPERAND (NODE, 0)
2140 #define FOR_COND(NODE) TREE_OPERAND (NODE, 1)
2141 #define FOR_EXPR(NODE) TREE_OPERAND (NODE, 2)
2142 #define FOR_BODY(NODE) TREE_OPERAND (NODE, 3)
2143 #define SWITCH_COND(NODE) TREE_OPERAND (NODE, 0)
2144 #define SWITCH_BODY(NODE) TREE_OPERAND (NODE, 1)
2145 #define CASE_LOW(NODE) TREE_OPERAND (NODE, 0)
2146 #define CASE_HIGH(NODE) TREE_OPERAND (NODE, 1)
2147 #define GOTO_DESTINATION(NODE) TREE_OPERAND (NODE, 0)
2148 #define TRY_STMTS(NODE) TREE_OPERAND (NODE, 0)
2149 #define TRY_HANDLERS(NODE) TREE_OPERAND (NODE, 1)
2150 #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (NODE)
2151 #define HANDLER_PARMS(NODE) TREE_OPERAND (NODE, 0)
2152 #define HANDLER_BODY(NODE) TREE_OPERAND (NODE, 1)
2153 #define COMPOUND_BODY(NODE) TREE_OPERAND (NODE, 0)
2154 #define ASM_CV_QUAL(NODE) TREE_OPERAND (NODE, 0)
2155 #define ASM_STRING(NODE) TREE_OPERAND (NODE, 1)
2156 #define ASM_OUTPUTS(NODE) TREE_OPERAND (NODE, 2)
2157 #define ASM_INPUTS(NODE) TREE_OPERAND (NODE, 3)
2158 #define ASM_CLOBBERS(NODE) TREE_OPERAND (NODE, 4)
2159 #define DECL_STMT_DECL(NODE) TREE_OPERAND (NODE, 0)
2160 #define STMT_EXPR_STMT(NODE) TREE_OPERAND (NODE, 0)
2161 #define SUBOBJECT_CLEANUP(NODE) TREE_OPERAND (NODE, 0)
2163 /* Nonzero for an ASM_STMT if the assembly statement is volatile. */
2164 #define ASM_VOLATILE_P(NODE) \
2165 (ASM_CV_QUAL ((NODE)) != NULL_TREE)
2167 /* The line-number at which a statement began. */
2168 #define STMT_LINENO(NODE) \
2169 (TREE_COMPLEXITY ((NODE)))
2171 /* The parameters for a call-declarator. */
2172 #define CALL_DECLARATOR_PARMS(NODE) \
2173 (TREE_PURPOSE (TREE_OPERAND ((NODE), 1)))
2175 /* The cv-qualifiers for a call-declarator. */
2176 #define CALL_DECLARATOR_QUALS(NODE) \
2177 (TREE_VALUE (TREE_OPERAND ((NODE), 1)))
2179 /* The exception-specification for a call-declarator. */
2180 #define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \
2181 (TREE_TYPE ((NODE)))
2183 /* An enumeration of the kind of tags that C++ accepts. */
2184 enum tag_types { record_type, class_type, union_type, enum_type };
2186 /* The various kinds of lvalues we distinguish. */
2187 typedef enum cp_lvalue_kind {
2188 clk_none = 0, /* Things that are not an lvalue. */
2189 clk_ordinary = 1, /* An ordinary lvalue. */
2190 clk_class = 2, /* An rvalue of class-type. */
2191 clk_bitfield = 4, /* An lvalue for a bit-field. */
2194 /* Zero means prototype weakly, as in ANSI C (no args means nothing).
2195 Each language context defines how this variable should be set. */
2196 extern int strict_prototype;
2197 extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
2199 /* Non-zero means that if a label exists, and no other identifier
2200 applies, use the value of the label. */
2201 extern int flag_labels_ok;
2203 /* Nonzero means allow Microsoft extensions without a pedwarn. */
2204 extern int flag_ms_extensions;
2206 /* Non-zero means to collect statistics which might be expensive
2207 and to print them when we are done. */
2208 extern int flag_detailed_statistics;
2210 /* Non-zero means warn in function declared in derived class has the
2211 same name as a virtual in the base class, but fails to match the
2212 type signature of any virtual function in the base class. */
2213 extern int warn_overloaded_virtual;
2215 /* Nonzero means warn about use of multicharacter literals. */
2216 extern int warn_multichar;
2218 /* Non-zero means warn if a non-templatized friend function is
2219 declared in a templatized class. This behavior is warned about with
2220 flag_guiding_decls in do_friend. */
2221 extern int warn_nontemplate_friend;
2224 extern void declare_function_name PROTO((void));
2225 extern void decl_attributes PROTO((tree, tree, tree));
2226 extern void init_function_format_info PROTO((void));
2227 extern void record_function_format PROTO((tree, tree, int, int, int));
2228 extern void check_function_format PROTO((tree, tree, tree));
2229 /* Print an error message for invalid operands to arith operation CODE.
2230 NOP_EXPR is used as a special case (see truthvalue_conversion). */
2231 extern void binary_op_error PROTO((enum tree_code));
2232 extern tree canonical_type_variant PROTO((tree));
2233 extern void c_expand_expr_stmt PROTO((tree));
2234 /* Validate the expression after `case' and apply default promotions. */
2235 extern tree check_case_value PROTO((tree));
2236 /* Concatenate a list of STRING_CST nodes into one STRING_CST. */
2237 extern tree combine_strings PROTO((tree));
2238 extern void constant_expression_warning PROTO((tree));
2239 extern tree convert_and_check PROTO((tree, tree));
2240 extern void overflow_warning PROTO((tree));
2241 extern void unsigned_conversion_warning PROTO((tree, tree));
2242 extern void c_apply_type_quals_to_decl PROTO((int, tree));
2244 /* Read the rest of the current #-directive line. */
2246 extern char *get_directive_line PROTO((void));
2247 #define GET_DIRECTIVE_LINE() get_directive_line ()
2249 extern char *get_directive_line PROTO((FILE *));
2250 #define GET_DIRECTIVE_LINE() get_directive_line (finput)
2252 /* Subroutine of build_binary_op, used for comparison operations.
2253 See if the operands have both been converted from subword integer types
2254 and, if so, perhaps change them both back to their original type. */
2255 extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
2256 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
2257 or validate its data type for an `if' or `while' statement or ?..: exp. */
2258 extern tree truthvalue_conversion PROTO((tree));
2259 extern tree type_for_mode PROTO((enum machine_mode, int));
2260 extern tree type_for_size PROTO((unsigned, int));
2261 extern int c_get_alias_set PROTO((tree));
2264 extern tree this_identifier;
2265 extern tree ctor_identifier, dtor_identifier;
2266 extern tree pfn_identifier;
2267 extern tree index_identifier;
2268 extern tree delta_identifier;
2269 extern tree delta2_identifier;
2270 extern tree pfn_or_delta2_identifier;
2271 extern tree tag_identifier;
2272 extern tree vt_off_identifier;
2273 extern tree empty_except_spec;
2275 extern int in_function_try_handler;
2277 /* A node that is a list (length 1) of error_mark_nodes. */
2278 extern tree error_mark_list;
2280 /* Node for "pointer to (virtual) function".
2281 This may be distinct from ptr_type_node so gdb can distinguish them. */
2282 #define vfunc_ptr_type_node \
2283 (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
2286 /* For building calls to `delete'. */
2287 extern tree integer_two_node, integer_three_node;
2289 extern tree null_node;
2291 extern tree anonymous_namespace_name;
2295 /* These values are used for the `STRICT' parameter to type_unfication and
2296 fn_type_unification. Their meanings are described with the
2297 documentation for fn_type_unification. */
2299 typedef enum unification_kind_t {
2303 } unification_kind_t;
2305 extern tree current_template_parms;
2306 extern HOST_WIDE_INT processing_template_decl;
2307 extern tree last_tree;
2309 /* The template currently being instantiated, and where the instantiation
2316 struct tinst_level *next;
2319 extern void maybe_print_template_context PROTO ((void));
2323 /* When parsing a class definition, the access specifier most recently
2324 given by the user, or, if no access specifier was given, the
2325 default value appropriate for the kind of class (i.e., struct,
2326 class, or union). */
2327 extern tree current_access_specifier;
2329 extern tree current_class_name;
2330 extern tree current_class_type;
2331 extern tree current_class_ptr;
2332 extern tree previous_class_type;
2333 extern tree current_class_ref;
2334 extern int current_class_depth;
2336 extern tree current_lang_name;
2337 extern tree lang_name_cplusplus, lang_name_c, lang_name_java;
2339 /* The low-water mark on the class-cache obstack. */
2340 extern char *class_cache_firstobj;
2342 /* Points to the name of that function. May not be the DECL_NAME
2343 of CURRENT_FUNCTION_DECL due to overloading */
2344 extern tree original_function_name;
2347 extern tree global_base_init_list;
2348 extern tree current_base_init_list, current_member_init_list;
2350 extern int current_function_just_assigned_this;
2351 extern int current_function_parms_stored;
2353 /* Here's where we control how name mangling takes place. */
2355 #define OPERATOR_ASSIGN_FORMAT "__a%s"
2356 #define OPERATOR_FORMAT "__%s"
2357 #define OPERATOR_TYPENAME_FORMAT "__op"
2359 /* Cannot use '$' up front, because this confuses gdb
2360 (names beginning with '$' are gdb-local identifiers).
2362 Note that all forms in which the '$' is significant are long enough
2363 for direct indexing (meaning that if we know there is a '$'
2364 at a particular location, we can index into the string at
2365 any other location that provides distinguishing characters). */
2367 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
2368 doesn't allow '$' in symbol names. */
2369 #ifndef NO_DOLLAR_IN_LABEL
2373 #define VPTR_NAME "$v"
2374 #define THROW_NAME "$eh_throw"
2375 #define DESTRUCTOR_DECL_PREFIX "_$_"
2376 #define AUTO_VTABLE_NAME "__vtbl$me__"
2377 #define AUTO_TEMP_NAME "_$tmp_"
2378 #define AUTO_TEMP_FORMAT "_$tmp_%d"
2379 #define VTABLE_BASE "$vb"
2380 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
2381 #define VFIELD_BASE "$vf"
2382 #define VFIELD_NAME "_vptr$"
2383 #define VFIELD_NAME_FORMAT "_vptr$%s"
2384 #define VBASE_NAME "_vb$"
2385 #define VBASE_NAME_FORMAT "_vb$%s"
2386 #define STATIC_NAME_FORMAT "_%s$%s"
2387 #define ANON_AGGRNAME_FORMAT "$_%d"
2389 #else /* NO_DOLLAR_IN_LABEL */
2391 #ifndef NO_DOT_IN_LABEL
2395 #define VPTR_NAME ".v"
2396 #define THROW_NAME ".eh_throw"
2397 #define DESTRUCTOR_DECL_PREFIX "_._"
2398 #define AUTO_VTABLE_NAME "__vtbl.me__"
2399 #define AUTO_TEMP_NAME "_.tmp_"
2400 #define AUTO_TEMP_FORMAT "_.tmp_%d"
2401 #define VTABLE_BASE ".vb"
2402 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s")
2403 #define VFIELD_BASE ".vf"
2404 #define VFIELD_NAME "_vptr."
2405 #define VFIELD_NAME_FORMAT "_vptr.%s"
2406 #define VBASE_NAME "_vb."
2407 #define VBASE_NAME_FORMAT "_vb.%s"
2408 #define STATIC_NAME_FORMAT "_%s.%s"
2410 #define ANON_AGGRNAME_FORMAT "._%d"
2412 #else /* NO_DOT_IN_LABEL */
2414 #define VPTR_NAME "__vptr"
2415 #define VPTR_NAME_P(ID_NODE) \
2416 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
2417 #define THROW_NAME "__eh_throw"
2418 #define DESTRUCTOR_DECL_PREFIX "__destr_"
2419 #define DESTRUCTOR_NAME_P(ID_NODE) \
2420 (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
2421 sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
2422 #define IN_CHARGE_NAME "__in_chrg"
2423 #define AUTO_VTABLE_NAME "__vtbl_me__"
2424 #define AUTO_TEMP_NAME "__tmp_"
2425 #define TEMP_NAME_P(ID_NODE) \
2426 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
2427 sizeof (AUTO_TEMP_NAME) - 1))
2428 #define AUTO_TEMP_FORMAT "__tmp_%d"
2429 #define VTABLE_BASE "__vtb"
2430 #define VTABLE_NAME "__vt_"
2431 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s")
2432 #define VTABLE_NAME_P(ID_NODE) \
2433 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
2434 sizeof (VTABLE_NAME) - 1))
2435 #define VFIELD_BASE "__vfb"
2436 #define VFIELD_NAME "__vptr_"
2437 #define VFIELD_NAME_P(ID_NODE) \
2438 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
2439 sizeof (VFIELD_NAME) - 1))
2440 #define VFIELD_NAME_FORMAT "_vptr_%s"
2441 #define VBASE_NAME "__vb_"
2442 #define VBASE_NAME_P(ID_NODE) \
2443 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
2444 sizeof (VBASE_NAME) - 1))
2445 #define VBASE_NAME_FORMAT "__vb_%s"
2446 #define STATIC_NAME_FORMAT "__static_%s_%s"
2448 #define ANON_AGGRNAME_PREFIX "__anon_"
2449 #define ANON_AGGRNAME_P(ID_NODE) \
2450 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
2451 sizeof (ANON_AGGRNAME_PREFIX) - 1))
2452 #define ANON_AGGRNAME_FORMAT "__anon_%d"
2453 #define ANON_PARMNAME_FORMAT "__%d"
2454 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2455 && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
2456 && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
2458 #endif /* NO_DOT_IN_LABEL */
2459 #endif /* NO_DOLLAR_IN_LABEL */
2461 #define THIS_NAME "this"
2462 #define DESTRUCTOR_NAME_FORMAT "~%s"
2463 #define FILE_FUNCTION_PREFIX_LEN 9
2464 #define CTOR_NAME "__ct"
2465 #define DTOR_NAME "__dt"
2467 #define IN_CHARGE_NAME "__in_chrg"
2469 #define VTBL_PTR_TYPE "__vtbl_ptr_type"
2470 #define VTABLE_DELTA_NAME "__delta"
2471 #define VTABLE_INDEX_NAME "__index"
2472 #define VTABLE_PFN_NAME "__pfn"
2473 #define VTABLE_DELTA2_NAME "__delta2"
2475 #define EXCEPTION_CLEANUP_NAME "exception cleanup"
2477 #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
2479 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
2481 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2482 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
2483 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
2484 && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
2486 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2487 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
2488 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2490 #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2491 && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
2492 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2494 #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
2495 #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
2497 /* For anonymous aggregate types, we need some sort of name to
2498 hold on to. In practice, this should not appear, but it should
2499 not be harmful if it does. */
2500 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2501 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
2502 #define ANON_PARMNAME_FORMAT "_%d"
2503 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2504 && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
2505 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
2507 /* Store the vbase pointer field name for type TYPE into pointer BUF. */
2508 #define FORMAT_VBASE_NAME(BUF,TYPE) do { \
2509 char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \
2510 + sizeof (VBASE_NAME) + 1); \
2511 sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \
2515 /* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
2517 #define MAIN_NAME_P(ID_NODE) \
2518 (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
2520 /* Returns non-zero iff NODE is a declaration for the global function
2522 #define DECL_MAIN_P(NODE) \
2523 (TREE_CODE (NODE) == FUNCTION_DECL \
2524 && DECL_LANGUAGE (NODE) == lang_c \
2525 && DECL_NAME (NODE) != NULL_TREE \
2526 && MAIN_NAME_P (DECL_NAME (NODE)))
2529 /* Define the sets of attributes that member functions and baseclasses
2530 can have. These are sensible combinations of {public,private,protected}
2531 cross {virtual,non-virtual}. */
2534 extern tree access_default_node; /* 0 */
2535 extern tree access_public_node; /* 1 */
2536 extern tree access_protected_node; /* 2 */
2537 extern tree access_private_node; /* 3 */
2538 extern tree access_default_virtual_node; /* 4 */
2539 extern tree access_public_virtual_node; /* 5 */
2540 extern tree access_protected_virtual_node; /* 6 */
2541 extern tree access_private_virtual_node; /* 7 */
2543 /* Things for handling inline functions. */
2545 struct pending_inline
2547 struct pending_inline *next; /* pointer to next in chain */
2548 int lineno; /* line number we got the text from */
2549 char *filename; /* name of file we were processing */
2550 tree fndecl; /* FUNCTION_DECL that brought us here */
2551 int token; /* token we were scanning */
2552 int token_value; /* value of token we were scanning (YYSTYPE) */
2554 char *buf; /* pointer to character stream */
2555 int len; /* length of stream */
2556 unsigned int can_free : 1; /* free this after we're done with it? */
2557 unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
2558 unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */
2562 extern struct pending_inline *pending_inlines;
2564 /* Positive values means that we cannot make optimizing assumptions about
2565 `this'. Negative values means we know `this' to be of static type. */
2567 extern int flag_this_is_variable;
2569 /* Nonzero means generate 'rtti' that give run-time type information. */
2571 extern int flag_rtti;
2573 /* Nonzero means do emit exported implementations of functions even if
2574 they can be inlined. */
2576 extern int flag_implement_inlines;
2578 /* Nonzero means templates obey #pragma interface and implementation. */
2580 extern int flag_external_templates;
2582 /* Nonzero means templates are emitted where they are instantiated. */
2584 extern int flag_alt_external_templates;
2586 /* Nonzero means implicit template instantiations are emitted. */
2588 extern int flag_implicit_templates;
2590 /* Nonzero if we want to emit defined symbols with common-like linkage as
2591 weak symbols where possible, in order to conform to C++ semantics.
2592 Otherwise, emit them as local symbols. */
2594 extern int flag_weak;
2596 /* Nonzero to enable experimental ABI changes. */
2598 extern int flag_new_abi;
2600 /* Nonzero to not ignore namespace std. */
2602 extern int flag_honor_std;
2604 /* Nonzero if we're done parsing and into end-of-file activities. */
2608 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
2610 /* The following two can be derived from the previous one */
2611 extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
2613 /* Some macros for char-based bitfields. */
2614 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
2615 #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
2616 #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
2618 /* These are uses as bits in flags passed to build_method_call
2619 to control its error reporting behavior.
2621 LOOKUP_PROTECT means flag access violations.
2622 LOOKUP_COMPLAIN mean complain if no suitable member function
2623 matching the arguments is found.
2624 LOOKUP_NORMAL is just a combination of these two.
2625 LOOKUP_NONVIRTUAL means make a direct call to the member function found
2626 LOOKUP_GLOBAL means search through the space of overloaded functions,
2627 as well as the space of member functions.
2628 LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
2629 in the parameter list.
2630 LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
2631 DIRECT_BIND means that if a temporary is created, it should be created so
2632 that it lives as long as the current variable bindings; otherwise it
2633 only lives until the end of the complete-expression.
2634 LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
2635 after. Note, LOOKUP_COMPLAIN is checked and error messages printed
2636 before LOOKUP_SPECULATIVELY is checked.
2637 LOOKUP_NO_CONVERSION means that user-defined conversions are not
2638 permitted. Built-in conversions are permitted.
2639 LOOKUP_DESTRUCTOR means explicit call to destructor.
2640 LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references.
2642 These are used in global lookup to support elaborated types and
2645 LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
2646 LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
2647 LOOKUP_PREFER_BOTH means class-or-namespace-name.
2648 LOOKUP_TEMPLATES_EXPECTED means that class templates also count
2651 #define LOOKUP_PROTECT (1)
2652 #define LOOKUP_COMPLAIN (2)
2653 #define LOOKUP_NORMAL (3)
2654 /* #define LOOKUP_UNUSED (4) */
2655 #define LOOKUP_NONVIRTUAL (8)
2656 #define LOOKUP_GLOBAL (16)
2657 #define LOOKUP_HAS_IN_CHARGE (32)
2658 #define LOOKUP_SPECULATIVELY (64)
2659 #define LOOKUP_ONLYCONVERTING (128)
2660 #define DIRECT_BIND (256)
2661 #define LOOKUP_NO_CONVERSION (512)
2662 #define LOOKUP_DESTRUCTOR (512)
2663 #define LOOKUP_NO_TEMP_BIND (1024)
2664 #define LOOKUP_PREFER_TYPES (2048)
2665 #define LOOKUP_PREFER_NAMESPACES (4096)
2666 #define LOOKUP_PREFER_BOTH (6144)
2667 #define LOOKUP_TEMPLATES_EXPECTED (8192)
2669 #define LOOKUP_NAMESPACES_ONLY(f) \
2670 (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES))
2671 #define LOOKUP_TYPES_ONLY(f) \
2672 (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
2673 #define LOOKUP_QUALIFIERS_ONLY(f) ((f) & LOOKUP_PREFER_BOTH)
2676 /* These flags are used by the conversion code.
2677 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
2678 CONV_STATIC : Perform the explicit conversions for static_cast.
2679 CONV_CONST : Perform the explicit conversions for const_cast.
2680 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
2681 CONV_PRIVATE : Perform upcasts to private bases.
2682 CONV_FORCE_TEMP : Require a new temporary when converting to the same
2685 #define CONV_IMPLICIT 1
2686 #define CONV_STATIC 2
2687 #define CONV_CONST 4
2688 #define CONV_REINTERPRET 8
2689 #define CONV_PRIVATE 16
2690 /* #define CONV_NONCONVERTING 32 */
2691 #define CONV_FORCE_TEMP 64
2692 #define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
2693 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2695 #define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2696 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
2698 /* Used by build_expr_type_conversion to indicate which types are
2699 acceptable as arguments to the expression under consideration. */
2701 #define WANT_INT 1 /* integer types, including bool */
2702 #define WANT_FLOAT 2 /* floating point types */
2703 #define WANT_ENUM 4 /* enumerated types */
2704 #define WANT_POINTER 8 /* pointer types */
2705 #define WANT_NULL 16 /* null pointer constant */
2706 #define WANT_ARITH (WANT_INT | WANT_FLOAT)
2708 /* Used with comptypes, and related functions, to guide type
2711 #define COMPARE_STRICT 0 /* Just check if the types are the
2713 #define COMPARE_BASE 1 /* Check to see if the second type is
2714 derived from the first, or if both
2715 are pointers (or references) and
2716 the types pointed to by the second
2717 type is derived from the pointed to
2719 #define COMPARE_RELAXED 2 /* Like COMPARE_DERIVED, but in
2720 reverse. Also treat enmeration
2721 types as the same as integer types
2722 of the same width. */
2723 #define COMPARE_REDECLARATION 4 /* The comparsion is being done when
2724 another declaration of an existing
2726 #define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
2727 extra-linguistic type attributes. */
2729 /* Used with push_overloaded_decl. */
2730 #define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
2731 regardless of the current scope. */
2732 #define PUSH_LOCAL 1 /* Push the DECL into the current
2734 #define PUSH_USING 2 /* We are pushing this DECL as the
2735 result of a using declaration. */
2737 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
2739 #define same_type_p(type1, type2) \
2740 comptypes ((type1), (type2), COMPARE_STRICT)
2742 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
2743 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
2744 class derived from the type pointed to (referred to) by TYPE1. */
2745 #define same_or_base_type_p(type1, type2) \
2746 comptypes ((type1), (type2), COMPARE_BASE)
2748 /* These macros are used to access a TEMPLATE_PARM_INDEX. */
2749 #define TEMPLATE_PARM_IDX(NODE) (((template_parm_index*) NODE)->index)
2750 #define TEMPLATE_PARM_LEVEL(NODE) (((template_parm_index*) NODE)->level)
2751 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
2752 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (((template_parm_index*) NODE)->orig_level)
2753 #define TEMPLATE_PARM_DECL(NODE) (((template_parm_index*) NODE)->decl)
2755 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM
2756 and TEMPLATE_TEMPLATE_PARM nodes. */
2757 #define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
2758 #define TEMPLATE_TYPE_IDX(NODE) \
2759 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2760 #define TEMPLATE_TYPE_LEVEL(NODE) \
2761 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2762 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
2763 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2764 #define TEMPLATE_TYPE_DECL(NODE) \
2765 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2768 /* Indexed by TREE_CODE, these tables give C-looking names to
2769 operators represented by TREE_CODES. For example,
2770 opname_tab[(int) MINUS_EXPR] == "-". */
2771 extern const char **opname_tab, **assignop_tab;
2774 extern int check_dtor_name PROTO((tree, tree));
2775 extern int get_arglist_len_in_bytes PROTO((tree));
2777 extern tree build_vfield_ref PROTO((tree, tree));
2778 extern tree resolve_scope_to_name PROTO((tree, tree));
2779 extern tree build_scoped_method_call PROTO((tree, tree, tree, tree));
2780 extern tree build_addr_func PROTO((tree));
2781 extern tree build_call PROTO((tree, tree, tree));
2782 extern tree build_method_call PROTO((tree, tree, tree, tree, int));
2783 extern int null_ptr_cst_p PROTO((tree));
2784 extern tree type_decays_to PROTO((tree));
2785 extern tree build_user_type_conversion PROTO((tree, tree, int));
2786 extern tree build_new_function_call PROTO((tree, tree));
2787 extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree));
2788 extern tree build_op_new_call PROTO((enum tree_code, tree, tree, int));
2789 extern tree build_op_delete_call PROTO((enum tree_code, tree, tree, int, tree));
2790 extern int can_convert PROTO((tree, tree));
2791 extern int can_convert_arg PROTO((tree, tree, tree));
2792 extern int enforce_access PROTO((tree, tree));
2793 extern tree convert_default_arg PROTO((tree, tree, tree));
2794 extern tree convert_arg_to_ellipsis PROTO((tree));
2795 extern int is_properly_derived_from PROTO((tree, tree));
2796 extern tree initialize_reference PROTO((tree, tree));
2797 extern tree strip_top_quals PROTO((tree));
2798 extern tree perform_implicit_conversion PROTO((tree, tree));
2801 extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
2802 extern tree build_vtbl_ref PROTO((tree, tree));
2803 extern tree build_vfn_ref PROTO((tree *, tree, tree));
2804 extern void add_method PROTO((tree, tree *, tree));
2805 extern int currently_open_class PROTO((tree));
2806 extern tree get_vfield_offset PROTO((tree));
2807 extern void duplicate_tag_error PROTO((tree));
2808 extern tree finish_struct PROTO((tree, tree));
2809 extern void finish_struct_1 PROTO((tree));
2810 extern int resolves_to_fixed_type_p PROTO((tree, int *));
2811 extern void init_class_processing PROTO((void));
2812 extern int is_empty_class PROTO((tree));
2813 extern void pushclass PROTO((tree, int));
2814 extern void popclass PROTO((void));
2815 extern void push_nested_class PROTO((tree, int));
2816 extern void pop_nested_class PROTO((void));
2817 extern void push_lang_context PROTO((tree));
2818 extern void pop_lang_context PROTO((void));
2819 extern tree instantiate_type PROTO((tree, tree, int));
2820 extern void print_class_statistics PROTO((void));
2821 extern void push_cache_obstack PROTO((void));
2822 extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree));
2823 extern void build_self_reference PROTO((void));
2824 extern void warn_hidden PROTO((tree));
2825 extern tree get_enclosing_class PROTO((tree));
2826 int is_base_of_enclosing_class PROTO((tree, tree));
2827 extern void unreverse_member_declarations PROTO((tree));
2828 extern void invalidate_class_lookup_cache PROTO((void));
2829 extern void maybe_note_name_used_in_class PROTO((tree, tree));
2830 extern void note_name_declared_in_class PROTO((tree, tree));
2833 extern tree convert_to_reference PROTO((tree, tree, int, int, tree));
2834 extern tree convert_from_reference PROTO((tree));
2835 extern tree convert_pointer_to_real PROTO((tree, tree));
2836 extern tree convert_pointer_to PROTO((tree, tree));
2837 extern tree ocp_convert PROTO((tree, tree, int, int));
2838 extern tree cp_convert PROTO((tree, tree));
2839 extern tree convert PROTO((tree, tree));
2840 extern tree convert_force PROTO((tree, tree, int));
2841 extern tree build_type_conversion PROTO((tree, tree, int));
2842 extern tree build_expr_type_conversion PROTO((int, tree, int));
2843 extern tree type_promotes_to PROTO((tree));
2844 extern tree perform_qualification_conversions PROTO((tree, tree));
2847 /* resume_binding_level */
2848 extern void set_identifier_local_value PROTO((tree, tree));
2849 extern int global_bindings_p PROTO((void));
2850 extern int toplevel_bindings_p PROTO((void));
2851 extern int namespace_bindings_p PROTO((void));
2852 extern void keep_next_level PROTO((int));
2853 extern int kept_level_p PROTO((void));
2854 extern void declare_parm_level PROTO((void));
2855 extern void declare_pseudo_global_level PROTO((void));
2856 extern int pseudo_global_level_p PROTO((void));
2857 extern void set_class_shadows PROTO((tree));
2858 extern void pushlevel PROTO((int));
2859 extern void note_level_for_for PROTO((void));
2860 extern void pushlevel_temporary PROTO((int));
2861 extern tree poplevel PROTO((int, int, int));
2862 extern void resume_level PROTO((struct binding_level *));
2863 extern void delete_block PROTO((tree));
2864 extern void insert_block PROTO((tree));
2865 extern void add_block_current_level PROTO((tree));
2866 extern void set_block PROTO((tree));
2867 extern void pushlevel_class PROTO((void));
2868 extern void print_binding_stack PROTO((void));
2869 extern void print_binding_level PROTO((struct binding_level *));
2870 extern void push_namespace PROTO((tree));
2871 extern void pop_namespace PROTO((void));
2872 extern void push_nested_namespace PROTO((tree));
2873 extern void pop_nested_namespace PROTO((tree));
2874 extern void maybe_push_to_top_level PROTO((int));
2875 extern void push_to_top_level PROTO((void));
2876 extern void pop_from_top_level PROTO((void));
2877 extern tree identifier_type_value PROTO((tree));
2878 extern void set_identifier_type_value PROTO((tree, tree));
2879 extern void pop_everything PROTO((void));
2880 extern void pushtag PROTO((tree, tree, int));
2881 extern tree make_anon_name PROTO((void));
2882 extern void clear_anon_tags PROTO((void));
2883 extern int decls_match PROTO((tree, tree));
2884 extern int duplicate_decls PROTO((tree, tree));
2885 extern tree pushdecl PROTO((tree));
2886 extern tree pushdecl_top_level PROTO((tree));
2887 extern void pushdecl_class_level PROTO((tree));
2889 extern void pushdecl_nonclass_level PROTO((tree));
2891 extern tree pushdecl_namespace_level PROTO((tree));
2892 extern tree push_using_decl PROTO((tree, tree));
2893 extern tree push_using_directive PROTO((tree));
2894 extern void push_class_level_binding PROTO((tree, tree));
2895 extern tree implicitly_declare PROTO((tree));
2896 extern tree lookup_label PROTO((tree));
2897 extern tree shadow_label PROTO((tree));
2898 extern tree define_label PROTO((char *, int, tree));
2899 extern void push_switch PROTO((void));
2900 extern void pop_switch PROTO((void));
2901 extern void define_case_label PROTO((void));
2902 extern tree getdecls PROTO((void));
2903 extern tree gettags PROTO((void));
2905 extern void set_current_level_tags_transparency PROTO((int));
2907 extern tree binding_for_name PROTO((tree, tree));
2908 extern tree namespace_binding PROTO((tree, tree));
2909 extern void set_namespace_binding PROTO((tree, tree, tree));
2910 extern tree lookup_namespace_name PROTO((tree, tree));
2911 extern tree build_typename_type PROTO((tree, tree, tree, tree));
2912 extern tree make_typename_type PROTO((tree, tree));
2913 extern tree lookup_name_nonclass PROTO((tree));
2914 extern tree lookup_function_nonclass PROTO((tree, tree));
2915 extern tree lookup_name PROTO((tree, int));
2916 extern tree lookup_name_current_level PROTO((tree));
2917 extern tree lookup_type_current_level PROTO((tree));
2918 extern tree lookup_name_namespace_only PROTO((tree));
2919 extern void begin_only_namespace_names PROTO((void));
2920 extern void end_only_namespace_names PROTO((void));
2921 extern tree namespace_ancestor PROTO((tree, tree));
2922 extern tree unqualified_namespace_lookup PROTO((tree, int, tree *));
2923 extern int lookup_using_namespace PROTO((tree, tree, tree, tree, int, tree *));
2924 extern int qualified_lookup_using_namespace PROTO((tree, tree, tree, int));
2925 extern tree auto_function PROTO((tree, tree, enum built_in_function));
2926 extern void init_decl_processing PROTO((void));
2927 extern int init_type_desc PROTO((void));
2928 extern tree define_function
2929 PROTO((const char *, tree, enum built_in_function,
2930 void (*) (tree), const char *));
2931 extern tree check_tag_decl PROTO((tree));
2932 extern void shadow_tag PROTO((tree));
2933 extern tree groktypename PROTO((tree));
2934 extern tree start_decl PROTO((tree, tree, int, tree, tree));
2935 extern void start_decl_1 PROTO((tree));
2936 extern void cp_finish_decl PROTO((tree, tree, tree, int, int));
2937 extern void finish_decl PROTO((tree, tree, tree));
2938 extern void expand_static_init PROTO((tree, tree));
2939 extern int complete_array_type PROTO((tree, tree, int));
2940 extern tree build_ptrmemfunc_type PROTO((tree));
2941 /* the grokdeclarator prototype is in decl.h */
2942 extern int parmlist_is_exprlist PROTO((tree));
2943 extern int copy_args_p PROTO((tree));
2944 extern int grok_ctor_properties PROTO((tree, tree));
2945 extern void grok_op_properties PROTO((tree, int, int));
2946 extern tree xref_tag PROTO((tree, tree, int));
2947 extern tree xref_tag_from_type PROTO((tree, tree, int));
2948 extern void xref_basetypes PROTO((tree, tree, tree, tree));
2949 extern tree start_enum PROTO((tree));
2950 extern tree finish_enum PROTO((tree));
2951 extern tree build_enumerator PROTO((tree, tree, tree));
2952 extern int start_function PROTO((tree, tree, tree, int));
2953 extern void expand_start_early_try_stmts PROTO((void));
2954 extern void store_parm_decls PROTO((void));
2955 extern void store_return_init PROTO((tree));
2956 extern void finish_function PROTO((int, int, int));
2957 extern tree start_method PROTO((tree, tree, tree));
2958 extern tree finish_method PROTO((tree));
2959 extern void hack_incomplete_structures PROTO((tree));
2960 extern tree maybe_build_cleanup_and_delete PROTO((tree));
2961 extern tree maybe_build_cleanup PROTO((tree));
2962 extern void cplus_expand_expr_stmt PROTO((tree));
2963 extern void finish_stmt PROTO((void));
2964 extern void push_cp_function_context PROTO((tree));
2965 extern void pop_cp_function_context PROTO((tree));
2966 extern int in_function_p PROTO((void));
2967 extern void replace_defarg PROTO((tree, tree));
2968 extern void print_other_binding_stack PROTO((struct binding_level *));
2969 extern void revert_static_member_fn PROTO((tree*, tree*, tree*));
2970 extern void fixup_anonymous_aggr PROTO((tree));
2971 extern int check_static_variable_definition PROTO((tree, tree));
2972 extern void push_local_binding PROTO((tree, tree, int));
2973 extern int push_class_binding PROTO((tree, tree));
2974 extern tree check_default_argument PROTO((tree, tree));
2975 extern tree push_overloaded_decl PROTO((tree, int));
2976 extern void clear_identifier_class_values PROTO((void));
2977 extern void storetags PROTO((tree));
2978 extern int vtable_decl_p PROTO((tree, void *));
2979 extern int vtype_decl_p PROTO((tree, void *));
2980 extern int sigtable_decl_p PROTO((tree, void *));
2981 typedef int (*walk_globals_pred) PROTO((tree, void *));
2982 typedef int (*walk_globals_fn) PROTO((tree *, void *));
2983 extern int walk_globals PROTO((walk_globals_pred,
2986 typedef int (*walk_namespaces_fn) PROTO((tree, void *));
2987 extern int walk_namespaces PROTO((walk_namespaces_fn,
2989 extern int wrapup_globals_for_namespace PROTO((tree, void *));
2990 extern tree cp_namespace_decls PROTO((tree));
2991 extern tree create_implicit_typedef PROTO((tree, tree));
2992 extern tree maybe_push_decl PROTO((tree));
2995 extern int check_java_method PROTO((tree));
2996 extern int lang_decode_option PROTO((int, char **));
2997 extern tree grok_method_quals PROTO((tree, tree, tree));
2998 extern void warn_if_unknown_interface PROTO((tree));
2999 extern void grok_x_components PROTO((tree));
3000 extern void maybe_retrofit_in_chrg PROTO((tree));
3001 extern void maybe_make_one_only PROTO((tree));
3002 extern void grokclassfn PROTO((tree, tree, enum overload_flags, tree));
3003 extern tree grok_alignof PROTO((tree));
3004 extern tree grok_array_decl PROTO((tree, tree));
3005 extern tree delete_sanity PROTO((tree, tree, int, int));
3006 extern tree check_classfn PROTO((tree, tree));
3007 extern void check_member_template PROTO((tree));
3008 extern tree grokfield PROTO((tree, tree, tree, tree, tree));
3009 extern tree grokbitfield PROTO((tree, tree, tree));
3010 extern tree groktypefield PROTO((tree, tree));
3011 extern tree grokoptypename PROTO((tree, tree));
3012 extern int copy_assignment_arg_p PROTO((tree, int));
3013 extern void cplus_decl_attributes PROTO((tree, tree, tree));
3014 extern tree constructor_name_full PROTO((tree));
3015 extern tree constructor_name PROTO((tree));
3016 extern void setup_vtbl_ptr PROTO((void));
3017 extern void mark_inline_for_output PROTO((tree));
3018 extern void clear_temp_name PROTO((void));
3019 extern tree get_temp_name PROTO((tree, int));
3020 extern void finish_anon_union PROTO((tree));
3021 extern tree finish_table PROTO((tree, tree, tree, int));
3022 extern void finish_builtin_type PROTO((tree, const char *,
3023 tree *, int, tree));
3024 extern tree coerce_new_type PROTO((tree));
3025 extern tree coerce_delete_type PROTO((tree));
3026 extern void comdat_linkage PROTO((tree));
3027 extern void import_export_class PROTO((tree));
3028 extern void import_export_vtable PROTO((tree, tree, int));
3029 extern void import_export_decl PROTO((tree));
3030 extern tree build_cleanup PROTO((tree));
3031 extern void finish_file PROTO((void));
3032 extern tree reparse_absdcl_as_expr PROTO((tree, tree));
3033 extern tree reparse_absdcl_as_casts PROTO((tree, tree));
3034 extern tree build_expr_from_tree PROTO((tree));
3035 extern tree reparse_decl_as_expr PROTO((tree, tree));
3036 extern tree finish_decl_parsing PROTO((tree));
3037 extern tree check_cp_case_value PROTO((tree));
3038 extern void set_decl_namespace PROTO((tree, tree, int));
3039 extern tree current_decl_namespace PROTO((void));
3040 extern void push_decl_namespace PROTO((tree));
3041 extern void pop_decl_namespace PROTO((void));
3042 extern void push_scope PROTO((tree));
3043 extern void pop_scope PROTO((tree));
3044 extern void do_namespace_alias PROTO((tree, tree));
3045 extern void do_toplevel_using_decl PROTO((tree));
3046 extern void do_local_using_decl PROTO((tree));
3047 extern tree do_class_using_decl PROTO((tree));
3048 extern void do_using_directive PROTO((tree));
3049 extern void check_default_args PROTO((tree));
3050 extern void mark_used PROTO((tree));
3051 extern tree handle_class_head PROTO((tree, tree, tree));
3052 extern tree lookup_arg_dependent PROTO((tree, tree, tree));
3053 extern void finish_static_data_member_decl PROTO((tree, tree, tree, int, int));
3056 /* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */
3057 extern void cp_error PVPROTO((const char *, ...));
3058 extern void cp_error_at PVPROTO((const char *, ...));
3059 extern void cp_warning PVPROTO((const char *, ...));
3060 extern void cp_warning_at PVPROTO((const char *, ...));
3061 extern void cp_pedwarn PVPROTO((const char *, ...));
3062 extern void cp_pedwarn_at PVPROTO((const char *, ...));
3063 extern void cp_compiler_error PVPROTO((const char *, ...));
3064 extern void cp_sprintf PVPROTO((const char *, ...));
3065 extern void cp_deprecated PROTO((const char*));
3068 extern void init_error PROTO((void));
3069 extern char *fndecl_as_string PROTO((tree, int));
3070 extern char *type_as_string PROTO((tree, int));
3071 extern char *type_as_string_real PROTO((tree, int, int));
3072 extern char *args_as_string PROTO((tree, int));
3073 extern char *decl_as_string PROTO((tree, int));
3074 extern char *expr_as_string PROTO((tree, int));
3075 extern char *code_as_string PROTO((enum tree_code, int));
3076 extern char *language_as_string PROTO((enum languages, int));
3077 extern char *parm_as_string PROTO((int, int));
3078 extern char *op_as_string PROTO((enum tree_code, int));
3079 extern char *assop_as_string PROTO((enum tree_code, int));
3080 extern char *cv_as_string PROTO((tree, int));
3081 extern char *lang_decl_name PROTO((tree, int));
3082 extern char *cp_file_of PROTO((tree));
3083 extern int cp_line_of PROTO((tree));
3086 extern void init_exception_processing PROTO((void));
3087 extern void expand_start_catch_block PROTO((tree, tree));
3088 extern void expand_end_catch_block PROTO((void));
3089 extern void expand_builtin_throw PROTO((void));
3090 extern void expand_start_eh_spec PROTO((void));
3091 extern void expand_exception_blocks PROTO((void));
3092 extern tree start_anon_func PROTO((void));
3093 extern void end_anon_func PROTO((void));
3094 extern void expand_throw PROTO((tree));
3095 extern tree build_throw PROTO((tree));
3096 extern void mark_all_runtime_matches PROTO((void));
3099 extern void init_cplus_expand PROTO((void));
3100 extern void fixup_result_decl PROTO((tree, struct rtx_def *));
3101 extern int extract_init PROTO((tree, tree));
3102 extern void do_case PROTO((tree, tree));
3103 extern tree cplus_expand_constant PROTO((tree));
3106 extern int is_friend PROTO((tree, tree));
3107 extern void make_friend_class PROTO((tree, tree));
3108 extern void add_friend PROTO((tree, tree));
3109 extern void add_friends PROTO((tree, tree, tree));
3110 extern tree do_friend PROTO((tree, tree, tree, tree, tree, enum overload_flags, tree, int));
3113 extern void init_init_processing PROTO((void));
3114 extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree));
3115 extern void emit_base_init PROTO((tree));
3116 extern void check_base_init PROTO((tree));
3117 extern void expand_member_init PROTO((tree, tree, tree));
3118 extern tree build_aggr_init PROTO((tree, tree, int));
3119 extern int is_aggr_typedef PROTO((tree, int));
3120 extern int is_aggr_type PROTO((tree, int));
3121 extern tree get_aggr_from_typedef PROTO((tree, int));
3122 extern tree get_type_value PROTO((tree));
3123 extern tree build_member_call PROTO((tree, tree, tree));
3124 extern tree build_offset_ref PROTO((tree, tree));
3125 extern tree resolve_offset_ref PROTO((tree));
3126 extern tree decl_constant_value PROTO((tree));
3127 extern tree build_new PROTO((tree, tree, tree, int));
3128 extern tree build_new_1 PROTO((tree));
3129 extern tree build_vec_init PROTO((tree, tree, tree, tree, int));
3130 extern tree build_x_delete PROTO((tree, int, tree));
3131 extern tree build_delete PROTO((tree, tree, tree, int, int));
3132 extern tree build_vbase_delete PROTO((tree, tree));
3133 extern tree build_vec_delete PROTO((tree, tree, tree, tree, int));
3134 extern tree create_temporary_var PROTO((tree));
3139 extern char *file_name_nondirectory PROTO((const char *));
3140 extern tree make_pointer_declarator PROTO((tree, tree));
3141 extern tree make_reference_declarator PROTO((tree, tree));
3142 extern tree make_call_declarator PROTO((tree, tree, tree, tree));
3143 extern void set_quals_and_spec PROTO((tree, tree, tree));
3144 extern const char *operator_name_string PROTO((tree));
3145 extern void lang_init PROTO((void));
3146 extern void lang_finish PROTO((void));
3148 extern void reinit_lang_specific PROTO((void));
3150 extern void reinit_parse_for_function PROTO((void));
3151 extern void print_parse_statistics PROTO((void));
3152 extern void extract_interface_info PROTO((void));
3153 extern void do_pending_inlines PROTO((void));
3154 extern void process_next_inline PROTO((tree));
3155 extern struct pending_input *save_pending_input PROTO((void));
3156 extern void restore_pending_input PROTO((struct pending_input *));
3157 extern void yyungetc PROTO((int, int));
3158 extern void reinit_parse_for_method PROTO((int, tree));
3159 extern void reinit_parse_for_block PROTO((int, struct obstack *));
3160 extern tree cons_up_default_function PROTO((tree, tree, int));
3161 extern void check_for_missing_semicolon PROTO((tree));
3162 extern void note_got_semicolon PROTO((tree));
3163 extern void note_list_got_semicolon PROTO((tree));
3164 extern void do_pending_lang_change PROTO((void));
3165 extern int identifier_type PROTO((tree));
3166 extern void see_typename PROTO((void));
3167 extern tree do_identifier PROTO((tree, int, tree));
3168 extern tree do_scoped_id PROTO((tree, int));
3169 extern tree identifier_typedecl_value PROTO((tree));
3170 extern int real_yylex PROTO((void));
3171 extern int is_rid PROTO((tree));
3172 extern tree build_lang_decl PROTO((enum tree_code, tree, tree));
3173 extern void retrofit_lang_decl PROTO((tree));
3174 extern void copy_lang_decl PROTO((tree));
3175 extern tree make_lang_type PROTO((enum tree_code));
3176 extern void dump_time_statistics PROTO((void));
3177 extern void compiler_error PVPROTO((const char *, ...))
3179 extern void yyerror PROTO((const char *));
3180 extern void clear_inline_text_obstack PROTO((void));
3181 extern void maybe_snarf_defarg PROTO((void));
3182 extern tree snarf_defarg PROTO((void));
3183 extern void add_defarg_fn PROTO((tree));
3184 extern void do_pending_defargs PROTO((void));
3185 extern int identifier_type PROTO((tree));
3186 extern void yyhook PROTO((int));
3187 extern int cp_type_qual_from_rid PROTO((tree));
3190 extern void init_method PROTO((void));
3191 extern void do_inline_function_hair PROTO((tree, tree));
3192 extern char *build_overload_name PROTO((tree, int, int));
3193 extern tree build_static_name PROTO((tree, tree));
3194 extern tree build_decl_overload PROTO((tree, tree, int));
3195 extern tree build_decl_overload_real PROTO((tree, tree, tree, tree,
3197 extern void set_mangled_name_for_decl PROTO((tree));
3198 extern tree build_typename_overload PROTO((tree));
3199 extern tree build_overload_with_type PROTO((tree, tree));
3200 extern tree build_destructor_name PROTO((tree));
3201 extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree));
3202 extern tree hack_identifier PROTO((tree, tree));
3203 extern tree make_thunk PROTO((tree, int));
3204 extern void emit_thunk PROTO((tree));
3205 extern void synthesize_method PROTO((tree));
3206 extern tree get_id_2 PROTO((const char *, tree));
3209 extern void check_template_shadow PROTO ((tree));
3210 extern tree innermost_args PROTO ((tree));
3211 extern tree tsubst PROTO ((tree, tree, int, tree));
3212 extern tree tsubst_expr PROTO ((tree, tree, int, tree));
3213 extern tree tsubst_copy PROTO ((tree, tree, int, tree));
3214 extern void maybe_begin_member_template_processing PROTO((tree));
3215 extern void maybe_end_member_template_processing PROTO((void));
3216 extern tree finish_member_template_decl PROTO((tree));
3217 extern void begin_template_parm_list PROTO((void));
3218 extern void begin_specialization PROTO((void));
3219 extern void reset_specialization PROTO((void));
3220 extern void end_specialization PROTO((void));
3221 extern void begin_explicit_instantiation PROTO((void));
3222 extern void end_explicit_instantiation PROTO((void));
3223 extern tree check_explicit_specialization PROTO((tree, tree, int, int));
3224 extern tree process_template_parm PROTO((tree, tree));
3225 extern tree end_template_parm_list PROTO((tree));
3226 extern void end_template_decl PROTO((void));
3227 extern tree current_template_args PROTO((void));
3228 extern tree push_template_decl PROTO((tree));
3229 extern tree push_template_decl_real PROTO((tree, int));
3230 extern void redeclare_class_template PROTO((tree, tree));
3231 extern tree lookup_template_class PROTO((tree, tree, tree, tree, int));
3232 extern tree lookup_template_function PROTO((tree, tree));
3233 extern int uses_template_parms PROTO((tree));
3234 extern tree instantiate_class_template PROTO((tree));
3235 extern tree instantiate_template PROTO((tree, tree));
3236 extern void overload_template_name PROTO((tree));
3237 extern int fn_type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t));
3238 struct tinst_level *tinst_for_decl PROTO((void));
3239 extern void mark_decl_instantiated PROTO((tree, int));
3240 extern int more_specialized PROTO((tree, tree, tree));
3241 extern void mark_class_instantiated PROTO((tree, int));
3242 extern void do_decl_instantiation PROTO((tree, tree, tree));
3243 extern void do_type_instantiation PROTO((tree, tree));
3244 extern tree instantiate_decl PROTO((tree));
3245 extern tree get_bindings PROTO((tree, tree, tree));
3246 extern void add_tree PROTO((tree));
3247 extern void begin_tree PROTO((void));
3248 extern void end_tree PROTO((void));
3249 extern void add_maybe_template PROTO((tree, tree));
3250 extern void pop_tinst_level PROTO((void));
3251 extern int more_specialized_class PROTO((tree, tree));
3252 extern int is_member_template PROTO((tree));
3253 extern int template_parms_equal PROTO((tree, tree));
3254 extern int comp_template_parms PROTO((tree, tree));
3255 extern int template_class_depth PROTO((tree));
3256 extern int is_specialization_of PROTO((tree, tree));
3257 extern int comp_template_args PROTO((tree, tree));
3258 extern void maybe_process_partial_specialization PROTO((tree));
3259 extern void maybe_check_template_type PROTO((tree));
3260 extern tree most_specialized_instantiation PROTO((tree, tree));
3261 extern void print_candidates PROTO((tree));
3262 extern int instantiate_pending_templates PROTO((void));
3263 extern tree tsubst_default_argument PROTO((tree, tree, tree));
3265 extern int processing_specialization;
3266 extern int processing_explicit_instantiation;
3267 extern int processing_template_parmlist;
3270 extern void repo_template_used PROTO((tree));
3271 extern void repo_template_instantiated PROTO((tree, int));
3272 extern void init_repo PROTO((const char *));
3273 extern void finish_repo PROTO((void));
3276 extern void init_rtti_processing PROTO((void));
3277 extern tree get_tinfo_fn_dynamic PROTO((tree));
3278 extern tree build_typeid PROTO((tree));
3279 extern tree build_x_typeid PROTO((tree));
3280 extern tree get_tinfo_fn PROTO((tree));
3281 extern tree get_typeid PROTO((tree));
3282 extern tree get_typeid_1 PROTO((tree));
3283 extern tree build_dynamic_cast PROTO((tree, tree));
3284 extern void synthesize_tinfo_fn PROTO((tree));
3287 extern int types_overlap_p PROTO((tree, tree));
3288 extern tree get_vbase PROTO((tree, tree));
3289 extern tree get_binfo PROTO((tree, tree, int));
3290 extern int get_base_distance PROTO((tree, tree, int, tree *));
3291 extern int accessible_p PROTO((tree, tree));
3292 extern tree lookup_field PROTO((tree, tree, int, int));
3293 extern int lookup_fnfields_1 PROTO((tree, tree));
3294 extern tree lookup_fnfields PROTO((tree, tree, int));
3295 extern tree lookup_member PROTO((tree, tree, int, int));
3296 extern tree lookup_nested_tag PROTO((tree, tree));
3297 extern tree get_matching_virtual PROTO((tree, tree, int));
3298 extern tree get_abstract_virtuals PROTO((tree));
3299 extern tree init_vbase_pointers PROTO((tree, tree));
3300 extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
3301 extern void clear_search_slots PROTO((tree));
3302 extern tree get_vbase_types PROTO((tree));
3303 extern void note_debug_info_needed PROTO((tree));
3304 extern void push_class_decls PROTO((tree));
3305 extern void pop_class_decls PROTO((void));
3306 extern void unuse_fields PROTO((tree));
3307 extern void print_search_statistics PROTO((void));
3308 extern void init_search_processing PROTO((void));
3309 extern void reinit_search_statistics PROTO((void));
3310 extern tree current_scope PROTO((void));
3311 extern int at_function_scope_p PROTO((void));
3312 extern tree lookup_conversions PROTO((tree));
3313 extern tree binfo_for_vtable PROTO((tree));
3314 extern int binfo_from_vbase PROTO((tree));
3315 extern tree dfs_walk PROTO((tree,
3316 tree (*)(tree, void *),
3317 tree (*) (tree, void *),
3319 extern tree dfs_unmark PROTO((tree, void *));
3320 extern tree markedp PROTO((tree, void *));
3322 /* in semantics.c */
3323 extern void finish_expr_stmt PROTO((tree));
3324 extern tree begin_if_stmt PROTO((void));
3325 extern void finish_if_stmt_cond PROTO((tree, tree));
3326 extern tree finish_then_clause PROTO((tree));
3327 extern void begin_else_clause PROTO((void));
3328 extern void finish_else_clause PROTO((tree));
3329 extern void finish_if_stmt PROTO((void));
3330 extern tree begin_while_stmt PROTO((void));
3331 extern void finish_while_stmt_cond PROTO((tree, tree));
3332 extern void finish_while_stmt PROTO((tree));
3333 extern tree begin_do_stmt PROTO((void));
3334 extern void finish_do_body PROTO((tree));
3335 extern void finish_do_stmt PROTO((tree, tree));
3336 extern void finish_return_stmt PROTO((tree));
3337 extern tree begin_for_stmt PROTO((void));
3338 extern void finish_for_init_stmt PROTO((tree));
3339 extern void finish_for_cond PROTO((tree, tree));
3340 extern void finish_for_expr PROTO((tree, tree));
3341 extern void finish_for_stmt PROTO((tree, tree));
3342 extern void finish_break_stmt PROTO((void));
3343 extern void finish_continue_stmt PROTO((void));
3344 extern void begin_switch_stmt PROTO((void));
3345 extern tree finish_switch_cond PROTO((tree));
3346 extern void finish_switch_stmt PROTO((tree, tree));
3347 extern void finish_case_label PROTO((tree, tree));
3348 extern void finish_goto_stmt PROTO((tree));
3349 extern tree begin_try_block PROTO((void));
3350 extern void finish_try_block PROTO((tree));
3351 extern void finish_handler_sequence PROTO((tree));
3352 extern tree begin_function_try_block PROTO((void));
3353 extern void finish_function_try_block PROTO((tree));
3354 extern void finish_function_handler_sequence PROTO((tree));
3355 extern tree begin_handler PROTO((void));
3356 extern void finish_handler_parms PROTO((tree));
3357 extern void finish_handler PROTO((tree));
3358 extern void finish_cleanup PROTO((tree, tree));
3359 extern tree begin_compound_stmt PROTO((int));
3360 extern tree finish_compound_stmt PROTO((int, tree));
3361 extern void finish_asm_stmt PROTO((tree, tree, tree, tree, tree));
3362 extern void finish_label_stmt PROTO((tree));
3363 extern void finish_subobject PROTO((tree));
3364 extern tree finish_parenthesized_expr PROTO((tree));
3365 extern tree begin_stmt_expr PROTO((void));
3366 extern tree finish_stmt_expr PROTO((tree, tree));
3367 extern tree finish_call_expr PROTO((tree, tree, int));
3368 extern tree finish_increment_expr PROTO((tree, enum tree_code));
3369 extern tree finish_this_expr PROTO((void));
3370 extern tree finish_object_call_expr PROTO((tree, tree, tree));
3371 extern tree finish_qualified_object_call_expr PROTO((tree, tree, tree));
3372 extern tree finish_pseudo_destructor_call_expr PROTO((tree, tree, tree));
3373 extern tree finish_qualified_call_expr PROTO ((tree, tree));
3374 extern tree finish_label_address_expr PROTO((tree));
3375 extern tree finish_unary_op_expr PROTO((enum tree_code, tree));
3376 extern tree finish_id_expr PROTO((tree));
3377 extern int begin_new_placement PROTO((void));
3378 extern tree finish_new_placement PROTO((tree, int));
3379 extern int begin_function_definition PROTO((tree, tree));
3380 extern tree begin_constructor_declarator PROTO((tree, tree));
3381 extern tree finish_declarator PROTO((tree, tree, tree, tree, int));
3382 extern void finish_translation_unit PROTO((void));
3383 extern tree finish_template_type_parm PROTO((tree, tree));
3384 extern tree finish_template_template_parm PROTO((tree, tree));
3385 extern tree finish_parmlist PROTO((tree, int));
3386 extern tree begin_class_definition PROTO((tree));
3387 extern tree finish_class_definition PROTO((tree, tree, int, int));
3388 extern void finish_default_args PROTO((void));
3389 extern void begin_inline_definitions PROTO((void));
3390 extern void finish_inline_definitions PROTO((void));
3391 extern tree finish_member_class_template PROTO((tree));
3392 extern void finish_template_decl PROTO((tree));
3393 extern tree finish_template_type PROTO((tree, tree, int));
3394 extern void enter_scope_of PROTO((tree));
3395 extern tree finish_base_specifier PROTO((tree, tree));
3396 extern void finish_member_declaration PROTO((tree));
3397 extern void check_multiple_declarators PROTO((void));
3398 extern tree finish_typeof PROTO((tree));
3399 extern void add_decl_stmt PROTO((tree));
3400 extern void finish_named_return_value PROTO((tree, tree));
3401 extern tree expand_stmt PROTO((tree));
3402 extern void expand_body PROTO((tree));
3403 extern void begin_stmt_tree PROTO((tree));
3404 extern void finish_stmt_tree PROTO((tree));
3405 extern int expanding_p;
3406 extern int stmts_are_full_exprs_p;
3407 extern tree last_expr_type;
3408 /* Non-zero if we are presently building a statement tree, rather
3409 than expanding each statement as we encounter it. */
3410 #define building_stmt_tree() \
3411 (processing_template_decl || !expanding_p)
3414 extern void init_spew PROTO((void));
3415 extern int peekyylex PROTO((void));
3416 extern int yylex PROTO((void));
3417 extern tree arbitrate_lookup PROTO((tree, tree, tree));
3420 extern void init_cplus_unsave PROTO((void));
3421 extern void cplus_unsave_expr_now PROTO((tree));
3422 extern int pod_type_p PROTO((tree));
3423 extern void unshare_base_binfos PROTO((tree));
3424 extern int member_p PROTO((tree));
3425 extern cp_lvalue_kind real_lvalue_p PROTO((tree));
3426 extern tree build_min PVPROTO((enum tree_code, tree, ...));
3427 extern tree build_min_nt PVPROTO((enum tree_code, ...));
3428 extern tree min_tree_cons PROTO((tree, tree, tree));
3429 extern int lvalue_p PROTO((tree));
3430 extern int lvalue_or_else PROTO((tree, const char *));
3431 extern tree build_cplus_new PROTO((tree, tree));
3432 extern tree get_target_expr PROTO((tree));
3433 extern tree break_out_cleanups PROTO((tree));
3434 extern tree break_out_calls PROTO((tree));
3435 extern tree build_cplus_method_type PROTO((tree, tree, tree));
3436 extern tree build_cplus_staticfn_type PROTO((tree, tree, tree));
3437 extern tree build_cplus_array_type PROTO((tree, tree));
3438 extern int layout_basetypes PROTO((tree, int));
3439 extern tree build_vbase_pointer_fields PROTO((tree));
3440 extern tree build_base_fields PROTO((tree));
3441 extern tree hash_tree_cons PROTO((tree, tree, tree));
3442 extern tree hash_tree_chain PROTO((tree, tree));
3443 extern tree hash_chainon PROTO((tree, tree));
3444 extern tree make_binfo PROTO((tree, tree, tree, tree));
3445 extern tree binfo_value PROTO((tree, tree));
3446 extern tree reverse_path PROTO((tree));
3447 extern int count_functions PROTO((tree));
3448 extern int is_overloaded_fn PROTO((tree));
3449 extern tree get_first_fn PROTO((tree));
3450 extern tree binding_init PROTO((struct tree_binding*));
3451 extern int bound_pmf_p PROTO((tree));
3452 extern tree ovl_cons PROTO((tree, tree));
3453 extern tree scratch_ovl_cons PROTO((tree, tree));
3454 extern int ovl_member PROTO((tree, tree));
3455 extern tree build_overload PROTO((tree, tree));
3456 extern tree fnaddr_from_vtable_entry PROTO((tree));
3457 extern tree function_arg_chain PROTO((tree));
3458 extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
3459 extern int is_aggr_type_2 PROTO((tree, tree));
3460 extern char *lang_printable_name PROTO((tree, int));
3461 extern tree build_exception_variant PROTO((tree, tree));
3462 extern tree copy_template_template_parm PROTO((tree));
3463 extern tree copy_to_permanent PROTO((tree));
3464 extern tree permanent_p PROTO((tree));
3465 extern void print_lang_statistics PROTO((void));
3466 extern void __eprintf
3467 PROTO((const char *, const char *, unsigned, const char *));
3468 extern tree array_type_nelts_total PROTO((tree));
3469 extern tree array_type_nelts_top PROTO((tree));
3470 extern tree break_out_target_exprs PROTO((tree));
3471 extern tree get_type_decl PROTO((tree));
3472 extern tree vec_binfo_member PROTO((tree, tree));
3473 extern tree hack_decl_function_context PROTO((tree));
3474 extern tree decl_namespace_context PROTO((tree));
3475 extern tree lvalue_type PROTO((tree));
3476 extern tree error_type PROTO((tree));
3477 extern tree make_temp_vec PROTO((int));
3478 extern tree build_ptr_wrapper PROTO((void *));
3479 extern tree build_expr_ptr_wrapper PROTO((void *));
3480 extern tree build_int_wrapper PROTO((int));
3481 extern tree build_srcloc_here PROTO((void));
3482 extern int varargs_function_p PROTO((tree));
3483 extern int really_overloaded_fn PROTO((tree));
3484 extern int cp_tree_equal PROTO((tree, tree));
3485 extern int can_free PROTO((struct obstack *, tree));
3486 extern tree mapcar PROTO((tree, tree (*) (tree)));
3487 extern tree no_linkage_check PROTO((tree));
3488 extern void debug_binfo PROTO((tree));
3489 extern void push_expression_obstack PROTO((void));
3490 extern void push_permanent_obstack PROTO((void));
3491 extern tree build_dummy_object PROTO((tree));
3492 extern tree maybe_dummy_object PROTO((tree, tree *));
3493 extern int is_dummy_object PROTO((tree));
3494 extern tree search_tree PROTO((tree, tree (*)(tree)));
3495 extern int cp_valid_lang_attribute PROTO((tree, tree, tree, tree));
3496 extern tree make_ptrmem_cst PROTO((tree, tree));
3497 extern tree cp_build_qualified_type_real PROTO((tree, int, int));
3498 #define cp_build_qualified_type(TYPE, QUALS) \
3499 cp_build_qualified_type_real ((TYPE), (QUALS), /*complain=*/1)
3501 #define scratchalloc expralloc
3502 #define scratch_tree_cons expr_tree_cons
3503 #define build_scratch_list build_expr_list
3504 #define make_scratch_vec make_temp_vec
3505 #define push_scratch_obstack push_expression_obstack
3508 extern int string_conv_p PROTO((tree, tree, int));
3509 extern tree condition_conversion PROTO((tree));
3510 extern tree target_type PROTO((tree));
3511 extern tree require_complete_type PROTO((tree));
3512 extern tree require_complete_type_in_void PROTO((tree));
3513 extern tree complete_type PROTO((tree));
3514 extern tree complete_type_or_else PROTO((tree, tree));
3515 extern int type_unknown_p PROTO((tree));
3516 extern int fntype_p PROTO((tree));
3517 extern tree commonparms PROTO((tree, tree));
3518 extern tree original_type PROTO((tree));
3519 extern tree common_type PROTO((tree, tree));
3520 extern int comp_except_specs PROTO((tree, tree, int));
3521 extern int comptypes PROTO((tree, tree, int));
3522 extern int comp_target_types PROTO((tree, tree, int));
3523 extern int compparms PROTO((tree, tree));
3524 extern int comp_target_types PROTO((tree, tree, int));
3525 extern int comp_cv_qualification PROTO((tree, tree));
3526 extern int comp_cv_qual_signature PROTO((tree, tree));
3527 extern int self_promoting_args_p PROTO((tree));
3528 extern tree unsigned_type PROTO((tree));
3529 extern tree signed_type PROTO((tree));
3530 extern tree signed_or_unsigned_type PROTO((int, tree));
3531 extern tree expr_sizeof PROTO((tree));
3532 extern tree c_sizeof PROTO((tree));
3533 extern tree c_sizeof_nowarn PROTO((tree));
3534 extern tree c_alignof PROTO((tree));
3535 extern tree inline_conversion PROTO((tree));
3536 extern tree decay_conversion PROTO((tree));
3537 extern tree default_conversion PROTO((tree));
3538 extern tree build_object_ref PROTO((tree, tree, tree));
3539 extern tree build_component_ref_1 PROTO((tree, tree, int));
3540 extern tree build_component_ref PROTO((tree, tree, tree, int));
3541 extern tree build_x_component_ref PROTO((tree, tree, tree, int));
3542 extern tree build_x_indirect_ref PROTO((tree, const char *));
3543 extern tree build_indirect_ref PROTO((tree, const char *));
3544 extern tree build_array_ref PROTO((tree, tree));
3545 extern tree build_x_function_call PROTO((tree, tree, tree));
3546 extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
3547 extern tree build_function_call_real PROTO((tree, tree, int, int));
3548 extern tree build_function_call PROTO((tree, tree));
3549 extern tree build_function_call_maybe PROTO((tree, tree));
3550 extern tree convert_arguments PROTO((tree, tree, tree, int));
3551 extern tree build_x_binary_op PROTO((enum tree_code, tree, tree));
3552 extern tree build_binary_op PROTO((enum tree_code, tree, tree));
3553 extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code));
3554 extern tree build_x_unary_op PROTO((enum tree_code, tree));
3555 extern tree build_unary_op PROTO((enum tree_code, tree, int));
3556 extern tree unary_complex_lvalue PROTO((enum tree_code, tree));
3557 extern int mark_addressable PROTO((tree));
3558 extern tree build_x_conditional_expr PROTO((tree, tree, tree));
3559 extern tree build_conditional_expr PROTO((tree, tree, tree));
3560 extern tree build_x_compound_expr PROTO((tree));
3561 extern tree build_compound_expr PROTO((tree));
3562 extern tree build_static_cast PROTO((tree, tree));
3563 extern tree build_reinterpret_cast PROTO((tree, tree));
3564 extern tree build_const_cast PROTO((tree, tree));
3565 extern tree build_c_cast PROTO((tree, tree));
3566 extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree));
3567 extern tree build_modify_expr PROTO((tree, enum tree_code, tree));
3568 extern tree convert_for_initialization PROTO((tree, tree, tree, int, const char *, tree, int));
3569 extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int));
3570 extern void c_expand_return PROTO((tree));
3571 extern tree c_expand_start_case PROTO((tree));
3572 extern int comp_ptr_ttypes PROTO((tree, tree));
3573 extern int ptr_reasonably_similar PROTO((tree, tree));
3574 extern tree build_ptrmemfunc PROTO((tree, tree, int));
3575 extern int cp_type_quals PROTO((tree));
3576 extern int cp_has_mutable_p PROTO((tree));
3577 extern int at_least_as_qualified_p PROTO((tree, tree));
3578 extern int more_qualified_p PROTO((tree, tree));
3579 extern tree build_ptrmemfunc1 PROTO((tree, tree, tree, tree, tree));
3580 extern void expand_ptrmemfunc_cst PROTO((tree, tree *, tree *, tree *, tree *));
3581 extern tree delta2_from_ptrmemfunc PROTO((tree));
3582 extern tree pfn_from_ptrmemfunc PROTO((tree));
3583 extern tree type_after_usual_arithmetic_conversions PROTO((tree, tree));
3584 extern tree composite_pointer_type PROTO((tree, tree, tree, tree,
3588 extern tree error_not_base_type PROTO((tree, tree));
3589 extern tree binfo_or_else PROTO((tree, tree));
3590 extern void readonly_error PROTO((tree, const char *, int));
3591 extern int abstract_virtuals_error PROTO((tree, tree));
3592 extern void incomplete_type_error PROTO((tree, tree));
3593 extern void my_friendly_abort PROTO((int))
3595 extern void my_friendly_assert PROTO((int, int));
3596 extern tree store_init_value PROTO((tree, tree));
3597 extern tree digest_init PROTO((tree, tree, tree *));
3598 extern tree build_scoped_ref PROTO((tree, tree));
3599 extern tree build_x_arrow PROTO((tree));
3600 extern tree build_m_component_ref PROTO((tree, tree));
3601 extern tree build_functional_cast PROTO((tree, tree));
3602 extern char *enum_name_string PROTO((tree, tree));
3603 extern void report_case_error PROTO((int, tree, tree, tree));
3604 extern void check_for_new_type PROTO((const char *, flagged_type_tree));
3605 extern tree add_exception_specifier PROTO((tree, tree, int));
3608 extern void GNU_xref_begin PROTO((const char *));
3609 extern void GNU_xref_end PROTO((int));
3610 extern void GNU_xref_file PROTO((const char *));
3611 extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT));
3612 extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
3613 extern void GNU_xref_ref PROTO((tree, const char *));
3614 extern void GNU_xref_decl PROTO((tree, tree));
3615 extern void GNU_xref_call PROTO((tree, const char *));
3616 extern void GNU_xref_function PROTO((tree, tree));
3617 extern void GNU_xref_assign PROTO((tree));
3618 extern void GNU_xref_hier PROTO((tree, tree, int, int, int));
3619 extern void GNU_xref_member PROTO((tree, tree));
3622 extern void dump_node_to_file PROTO ((tree, const char *));
3626 #endif /* not _CP_TREE_H */