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. */
25 /* Usage of TREE_LANG_FLAG_?:
26 0: BINFO_MARKED (BINFO nodes).
27 COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
28 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
29 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
30 LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
31 TREE_NEGATED_INT (in INTEGER_CST).
32 TREE_INDIRECT_USING (in NAMESPACE_DECL).
33 IDENTIFIER_MARKED (used by search routines).
34 LOCAL_BINDING_P (in CPLUS_BINDING)
35 1: IDENTIFIER_VIRTUAL_P.
36 TI_PENDING_TEMPLATE_FLAG.
37 TEMPLATE_PARMS_FOR_INLINE.
38 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
39 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
40 TYPE_USES_COMPLEX_INHERITANCE (in _TYPE).
41 C_DECLARED_LABEL_FLAG.
42 INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
43 BASELINK_P (in TREE_LIST)
44 2: IDENTIFIER_OPNAME_P.
48 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
49 BINFO_VTABLE_PATH_MARKED.
50 BINFO_PUSHDECLS_MARKED.
51 (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
52 4: BINFO_NEW_VTABLE_MARKED.
53 TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
55 5: TYPE_USES_PVBASES (in a class TYPE).
58 Usage of TYPE_LANG_FLAG_?:
59 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
60 1: TYPE_HAS_CONSTRUCTOR.
61 2: TYPE_HAS_DESTRUCTOR.
63 4: TYPE_NEEDS_DESTRUCTOR.
67 Usage of DECL_LANG_FLAG_?:
68 0: DECL_ERROR_REPORTED (in VAR_DECL).
69 DECL_TEMPLATE_PARM_P (in CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
70 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
71 DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
72 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
74 4: DECL_MAYBE_TEMPLATE.
75 5: DECL_INTERFACE_KNOWN.
76 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
77 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
79 Usage of language-independent fields in a language-dependent manner:
82 This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
83 forth as a substitute for the mark bits provided in `lang_type'.
84 At present, only the six low-order bits are used.
87 For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
88 For a TYPENAME_TYPE, this is TYPENAME_TYPE_FULLNAME.
89 For a TEMPLATE_TEMPLATE_PARM, this is
90 TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
92 DECL_SAVED_INSNS/DECL_FIELD_SIZE
93 For a static VAR_DECL, this is DECL_INIT_PRIORITY.
96 /* Language-dependent contents of an identifier. */
98 struct lang_identifier
100 struct tree_identifier ignore;
101 tree namespace_bindings;
104 tree class_template_info;
110 tree label_value, implicit_decl;
122 char common[sizeof (struct tree_common)];
123 struct rtx_def *rtl; /* Unused, but required to match up with what
124 the middle-end expects. */
127 HOST_WIDE_INT orig_level;
129 } template_parm_index;
131 typedef struct ptrmem_cst
133 char common[sizeof (struct tree_common)];
137 /* Nonzero if this binding is for a local scope, as opposed to a class
138 or namespace scope. */
139 #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0(NODE)
141 /* Nonzero if BINDING_VALUE is from a base class of the class which is
142 currently being defined. */
143 #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1(NODE)
145 /* For a binding between a name and an entity at a non-local scope,
146 defines the scope where the binding is declared. (Either a class
147 _TYPE node, or a NAMESPACE_DECL.) This macro should be used only
148 for namespace-level bindings; on the IDENTIFIER_BINDING list
149 BINDING_LEVEL is used instead. */
150 #define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope.scope)
152 /* This is the declaration bound to the name. Possible values:
153 variable, overloaded function, namespace, template, enumerator. */
154 #define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value)
156 /* If name is bound to a type, this is the type (struct, union, enum). */
157 #define BINDING_TYPE(NODE) TREE_TYPE(NODE)
159 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
160 namespace_binding (NODE, global_namespace)
161 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
162 set_namespace_binding (NODE, global_namespace, VAL)
163 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
164 namespace_binding (NODE, current_namespace)
165 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
166 set_namespace_binding (NODE, current_namespace, VAL)
170 char common[sizeof (struct tree_common)];
173 struct binding_level *level;
178 /* The overloaded FUNCTION_DECL. */
179 #define OVL_FUNCTION(NODE) (((struct tree_overload*)NODE)->function)
180 #define OVL_CHAIN(NODE) TREE_CHAIN(NODE)
181 /* Polymorphic access to FUNCTION and CHAIN. */
182 #define OVL_CURRENT(NODE) \
183 ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
184 #define OVL_NEXT(NODE) \
185 ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
186 /* If set, this was imported in a using declaration.
187 This is not to confuse with being used somewhere, which
188 is not important for this node. */
189 #define OVL_USED(NODE) TREE_USED(NODE)
193 char common[sizeof (struct tree_common)];
197 /* A `baselink' is a TREE_LIST whose TREE_PURPOSE is a BINFO
198 indicating a particular base class, and whose TREE_VALUE is a
199 (possibly overloaded) function from that base class. */
200 #define BASELINK_P(NODE) \
201 (TREE_CODE ((NODE)) == TREE_LIST && TREE_LANG_FLAG_1 ((NODE)))
202 #define SET_BASELINK_P(NODE) \
203 (TREE_LANG_FLAG_1 ((NODE)) = 1)
205 #define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr)
206 #define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i)
210 char common[sizeof (struct tree_common)];
217 #define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename)
218 #define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum)
221 char common[sizeof (struct tree_common)];
226 /* To identify to the debug emitters if it should pay attention to the
227 flag `-Wtemplate-debugging'. */
228 #define HAVE_TEMPLATES 1
230 /* Macros for access to language-specific slots in an identifier. */
232 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
233 (((struct lang_identifier *)(NODE))->namespace_bindings)
234 #define IDENTIFIER_TEMPLATE(NODE) \
235 (((struct lang_identifier *)(NODE))->class_template_info)
237 /* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the
238 identifier. It's TREE_CHAIN is the next outermost binding. Each
239 BINDING_VALUE is a DECL for the associated declaration. Thus,
240 name lookup consists simply of pulling off the node at the front
241 of the list (modulo oddities for looking up the names of types,
242 and such.) You can use BINDING_SCOPE or BINDING_LEVEL to
243 determine the scope that bound the name. */
244 #define IDENTIFIER_BINDING(NODE) \
245 (((struct lang_identifier*) (NODE))->bindings)
247 /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
248 NULL_TREE if there is no binding. */
249 #define IDENTIFIER_VALUE(NODE) \
250 (IDENTIFIER_BINDING (NODE) \
251 ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
254 /* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
255 class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
256 just a pointer to the BINDING_VALUE of one of the bindings in the
257 IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
258 IDENTIFIER_BINDING. */
259 #define IDENTIFIER_CLASS_VALUE(NODE) \
260 (((struct lang_identifier *) (NODE))->class_value)
262 /* The amount of time used by the file whose special "time identifier"
263 is NODE, represented as an INTEGER_CST. See get_time_identifier. */
264 #define TIME_IDENTIFIER_TIME(NODE) IDENTIFIER_BINDING(NODE)
266 /* For a "time identifier" this is a INTEGER_CST. The
267 TREE_INT_CST_LOW is 1 if the corresponding file is "interface only".
268 The TRE_INT_CST_HIGH is 1 if it is "interface unknown". */
269 #define TIME_IDENTIFIER_FILEINFO(NODE) IDENTIFIER_CLASS_VALUE (NODE)
271 /* TREE_TYPE only indicates on local and class scope the current
272 type. For namespace scope, the presence of a type in any namespace
273 is indicated with global_type_node, and the real type behind must
274 be found through lookup. */
275 #define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
276 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
277 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
278 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
280 #define LANG_ID_FIELD(NAME,NODE) \
281 (((struct lang_identifier *)(NODE))->x \
282 ? ((struct lang_identifier *)(NODE))->x->NAME : 0)
283 #define SET_LANG_ID(NODE,VALUE,NAME) \
284 (((struct lang_identifier *)(NODE))->x == 0 \
285 ? ((struct lang_identifier *)(NODE))->x \
286 = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
287 ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))
289 #define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)
290 #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
291 SET_LANG_ID(NODE, VALUE, label_value)
293 #define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)
294 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
295 SET_LANG_ID(NODE, VALUE, implicit_decl)
297 #define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)
298 #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
299 SET_LANG_ID(NODE, VALUE, error_locus)
302 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
304 /* Nonzero if this identifier is the prefix for a mangled C++ operator name. */
305 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
307 /* Nonzero if this identifier is the name of a type-conversion
309 #define IDENTIFIER_TYPENAME_P(NODE) \
310 (! strncmp (IDENTIFIER_POINTER (NODE), \
311 OPERATOR_TYPENAME_FORMAT, \
312 strlen (OPERATOR_TYPENAME_FORMAT)))
314 /* Nonzero means reject anything that ANSI standard C forbids. */
317 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
318 #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
320 /* Record in each node resulting from a binary operator
321 what operator was specified for it. */
322 #define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
324 /* Store a value in that field. */
325 #define C_SET_EXP_ORIGINAL_CODE(exp, code) \
326 (TREE_COMPLEXITY (exp) = (int)(code))
328 /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
329 next exception handler. */
330 extern tree exception_throw_decl;
332 extern tree double_type_node, long_double_type_node, float_type_node;
333 extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
334 extern tree ptrdiff_type_node;
336 extern tree short_integer_type_node, short_unsigned_type_node;
337 extern tree long_integer_type_node, long_unsigned_type_node;
338 extern tree long_long_integer_type_node, long_long_unsigned_type_node;
339 extern tree unsigned_type_node;
340 extern tree string_type_node, char_array_type_node, int_array_type_node;
341 extern tree wchar_array_type_node;
342 extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
344 extern tree complex_integer_type_node;
345 extern tree complex_float_type_node;
346 extern tree complex_double_type_node;
347 extern tree complex_long_double_type_node;
349 extern tree intQI_type_node, unsigned_intQI_type_node;
350 extern tree intHI_type_node, unsigned_intHI_type_node;
351 extern tree intSI_type_node, unsigned_intSI_type_node;
352 extern tree intDI_type_node, unsigned_intDI_type_node;
353 #if HOST_BITS_PER_WIDE_INT >= 64
354 extern tree intTI_type_node, unsigned_intTI_type_node;
357 extern tree java_byte_type_node;
358 extern tree java_short_type_node;
359 extern tree java_int_type_node;
360 extern tree java_long_type_node;
361 extern tree java_float_type_node;
362 extern tree java_double_type_node;
363 extern tree java_char_type_node;
364 extern tree java_boolean_type_node;
366 extern int current_function_returns_value;
367 extern int current_function_returns_null;
368 extern tree current_function_return_value;
370 extern tree current_namespace;
371 extern tree global_namespace;
373 extern tree ridpointers[];
374 extern tree ansi_opname[];
375 extern tree ansi_assopname[];
377 /* Nonzero means `$' can be in an identifier. */
379 extern int dollars_in_ident;
381 /* Nonzero means allow type mismatches in conditional expressions;
382 just make their values `void'. */
384 extern int flag_cond_mismatch;
386 /* Nonzero means don't recognize the keyword `asm'. */
388 extern int flag_no_asm;
390 /* For cross referencing. */
392 extern int flag_gnu_xref;
394 /* For environments where you can use GNU binutils (as, ld in particular). */
396 extern int flag_gnu_binutils;
398 /* Nonzero means warn about implicit declarations. */
400 extern int warn_implicit;
402 /* Nonzero means warn about usage of long long when `-pedantic'. */
404 extern int warn_long_long;
406 /* Nonzero means warn when all ctors or dtors are private, and the class
409 extern int warn_ctor_dtor_privacy;
411 /* Nonzero means warn about function definitions that default the return type
412 or that use a null return and have a return-type other than void. */
414 extern int warn_return_type;
416 /* Nonzero means give string constants the type `const char *', as mandated
419 extern int flag_const_strings;
421 /* Nonzero means warn about deprecated conversion from string constant to
424 extern int warn_write_strings;
426 /* Nonzero means warn about sizeof(function) or addition/subtraction
427 of function pointers. */
429 extern int warn_pointer_arith;
431 /* Nonzero means warn about suggesting putting in ()'s. */
433 extern int warn_parentheses;
435 /* Nonzero means warn about multiple (redundant) decls for the same single
436 variable or function. */
438 extern int warn_redundant_decls;
440 /* Warn if initializer is not completely bracketed. */
442 extern int warn_missing_braces;
444 /* Warn about comparison of signed and unsigned values. */
446 extern int warn_sign_compare;
448 /* Warn about a subscript that has type char. */
450 extern int warn_char_subscripts;
452 /* Nonzero means warn about pointer casts that can drop a type qualifier
453 from the pointer target type. */
455 extern int warn_cast_qual;
457 /* Warn about *printf or *scanf format/argument anomalies. */
459 extern int warn_format;
461 /* Nonzero means warn about non virtual destructors in classes that have
462 virtual functions. */
464 extern int warn_nonvdtor;
466 /* Non-zero means warn when we convert a pointer to member function
467 into a pointer to (void or function). */
469 extern int warn_pmf2ptr;
471 /* Nonzero means warn about violation of some Effective C++ style rules. */
473 extern int warn_ecpp;
475 /* Nonzero means warn where overload resolution chooses a promotion from
476 unsigned to signed over a conversion to an unsigned of the same size. */
478 extern int warn_sign_promo;
480 /* Non-zero means warn when a function is declared extern and later inline. */
482 extern int warn_extern_inline;
484 /* Non-zero means warn when an old-style cast is used. */
486 extern int warn_old_style_cast;
488 /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
490 extern int flag_signed_bitfields;
492 /* 3 means write out only virtuals function tables `defined'
493 in this implementation file.
494 2 means write out only specific virtual function tables
495 and give them (C) public access.
496 1 means write out virtual function tables and give them
498 0 means write out virtual function tables and give them
499 (C) static access (default).
500 -1 means declare virtual function tables extern. */
502 extern int write_virtuals;
504 /* True for more efficient but incompatible (not fully tested)
505 vtable implementation (using thunks).
506 0 is old behavior; 1 is new behavior; 3 adds vlist arguments;
507 2 is 3 plus backwards-compatibility to 1. */
508 extern int flag_vtable_thunks, flag_vtable_thunks_compat;
510 /* INTERFACE_ONLY nonzero means that we are in an "interface"
511 section of the compiler. INTERFACE_UNKNOWN nonzero means
512 we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
513 is zero and INTERFACE_ONLY is zero, it means that we are responsible
514 for exporting definitions that others might need. */
515 extern int interface_only, interface_unknown;
517 /* Nonzero means we should attempt to elide constructors when possible. */
519 extern int flag_elide_constructors;
521 /* Nonzero means enable obscure ANSI features and disable GNU extensions
522 that might cause ANSI-compliant code to be miscompiled. */
524 extern int flag_ansi;
526 /* Nonzero means recognize and handle signature language constructs. */
528 extern int flag_handle_signatures;
530 /* Nonzero means that member functions defined in class scope are
531 inline by default. */
533 extern int flag_default_inline;
535 /* The name-mangling scheme to use. Versions of gcc before 2.8 use
537 extern int name_mangling_version;
539 /* Nonzero means that guiding declarations are allowed. */
540 extern int flag_guiding_decls;
542 /* Nonzero if squashed mangling is to be performed.
543 This uses the B and K codes to reference previously seen class types
544 and class qualifiers. */
545 extern int flag_do_squangling;
547 /* Nonzero means generate separate instantiation control files and juggle
548 them at link time. */
549 extern int flag_use_repository;
551 /* Nonzero if we want to issue diagnostics that the standard says are not
553 extern int flag_optional_diags;
555 /* Nonzero means do not consider empty argument prototype to mean function
556 takes no arguments. */
557 extern int flag_strict_prototype;
559 /* Nonzero means output .vtable_{entry,inherit} for use in doing vtable gc. */
560 extern int flag_vtable_gc;
562 /* Nonzero means make the default pedwarns warnings instead of errors.
563 The value of this flag is ignored if -pedantic is specified. */
564 extern int flag_permissive;
566 /* Nonzero if we want to obey access control semantics. */
568 extern int flag_access_control;
571 /* C++ language-specific tree codes. */
572 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
573 enum cplus_tree_code {
574 __DUMMY = LAST_AND_UNUSED_TREE_CODE,
575 #include "cp-tree.def"
580 enum languages { lang_c, lang_cplusplus, lang_java };
582 /* Macros to make error reporting functions' lives easier. */
583 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
584 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
585 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
587 #define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
588 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
590 /* The _DECL for this _TYPE. */
591 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
593 /* Nonzero if T is a class (or struct or union) type. Also nonzero
594 for template type parameters and typename types. Despite its name,
595 this macro has nothing to do with the definition of aggregate given
596 in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
597 #define IS_AGGR_TYPE(t) \
598 (TREE_CODE (t) == TEMPLATE_TYPE_PARM \
599 || TREE_CODE (t) == TYPENAME_TYPE \
600 || TREE_CODE (t) == TYPEOF_TYPE \
601 || TYPE_LANG_FLAG_5 (t))
603 /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
605 #define SET_IS_AGGR_TYPE(T, VAL) \
606 (TYPE_LANG_FLAG_5 (T) = (VAL))
608 /* Nonzero if T is a class type. Zero for template type parameters,
609 typename types, and so forth. */
610 #define CLASS_TYPE_P(t) \
611 (IS_AGGR_TYPE_CODE (TREE_CODE (t)) && IS_AGGR_TYPE (t))
613 #define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
614 #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
615 (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
616 && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
617 #define IS_OVERLOAD_TYPE(t) \
618 (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
620 /* In a *_TYPE, nonzero means a built-in type. */
621 #define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
623 /* True if this a "Java" type, defined in 'extern "Java"'. */
624 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
626 /* The type qualifiers for this type, including the qualifiers on the
627 elements for an array type. */
628 #define CP_TYPE_QUALS(NODE) \
629 ((TREE_CODE (NODE) != ARRAY_TYPE) \
630 ? TYPE_QUALS (NODE) : cp_type_quals (NODE))
632 /* Nonzero if this type is const-qualified. */
633 #define CP_TYPE_CONST_P(NODE) \
634 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0)
636 /* Nonzero if this type is volatile-qualified. */
637 #define CP_TYPE_VOLATILE_P(NODE) \
638 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0)
640 /* Nonzero if this type is restrict-qualified. */
641 #define CP_TYPE_RESTRICT_P(NODE) \
642 ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0)
644 /* Nonzero if this type is const-qualified, but not
645 volatile-qualified. Other qualifiers are ignored. This macro is
646 used to test whether or not it is OK to bind an rvalue to a
648 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
649 ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
652 #define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
653 (!flag_vtable_thunks ? \
654 TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
655 : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
656 : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
658 /* Virtual function addresses can be gotten from a virtual function
659 table entry using this macro. */
660 #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
661 (!flag_vtable_thunks ? \
662 TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
663 : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
664 : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
665 #define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
666 (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
667 #define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
668 #define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
669 (((CODE) == TREE_CODE (NODE) \
670 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
671 || IS_AGGR_TYPE (NODE))
673 /* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can
674 be an ambiguous base class of TYPE, and this macro will be false. */
675 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
676 #define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
677 #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
678 #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
680 /* This structure provides additional information above and beyond
681 what is provide in the ordinary tree_type. In the past, we used it
682 for the types of class types, template parameters types, typename
683 types, and so forth. However, there can be many (tens to hundreds
684 of thousands) of template parameter types in a compilation, and
685 there's no need for this additional information in that case.
686 Therefore, we now use this data structure only for class types.
688 In the past, it was thought that there would be relatively few
689 class types. However, in the presence of heavy use of templates,
690 many (i.e., thousands) of classes can easily be generated.
691 Therefore, we should endeavor to keep the size of this structure to
697 unsigned has_type_conversion : 1;
698 unsigned has_init_ref : 1;
699 unsigned has_default_ctor : 1;
700 unsigned uses_multiple_inheritance : 1;
701 unsigned const_needs_init : 1;
702 unsigned ref_needs_init : 1;
703 unsigned has_const_assign_ref : 1;
704 unsigned anon_union : 1;
706 unsigned has_nonpublic_ctor : 2;
707 unsigned has_nonpublic_assign_ref : 2;
708 unsigned vtable_needs_writing : 1;
709 unsigned has_assign_ref : 1;
710 unsigned gets_new : 2;
712 unsigned gets_delete : 2;
713 unsigned has_call_overloaded : 1;
714 unsigned has_array_ref_overloaded : 1;
715 unsigned has_arrow_overloaded : 1;
716 unsigned interface_only : 1;
717 unsigned interface_unknown : 1;
718 unsigned needs_virtual_reinit : 1;
721 unsigned vec_delete_takes_size : 1;
722 unsigned declared_class : 1;
724 unsigned being_defined : 1;
725 unsigned redefined : 1;
726 unsigned debug_requested : 1;
727 unsigned use_template : 2;
728 unsigned got_semicolon : 1;
729 unsigned ptrmemfunc_flag : 1;
730 unsigned is_signature : 1;
732 unsigned is_signature_pointer : 1;
733 unsigned is_signature_reference : 1;
734 unsigned has_opaque_typedecls : 1;
735 unsigned sigtable_has_been_generated : 1;
736 unsigned was_anonymous : 1;
737 unsigned has_real_assign_ref : 1;
738 unsigned has_const_init_ref : 1;
739 unsigned has_complex_init_ref : 1;
741 unsigned has_complex_assign_ref : 1;
742 unsigned has_abstract_assign_ref : 1;
743 unsigned non_aggregate : 1;
744 unsigned is_partial_instantiation : 1;
745 unsigned has_mutable : 1;
746 unsigned com_interface : 1;
747 /* When adding a flag here, consider whether or not it ought to
748 apply to a template instance if it applies to the template.
749 If so, make sure to copy it in instantiate_class_template! */
751 /* The MIPS compiler gets it wrong if this struct also
752 does not fill out to a multiple of 4 bytes. Add a
753 member `dummy' with new bits if you go over the edge. */
760 union tree_node *vfields;
761 union tree_node *vbases;
763 union tree_node *tags;
765 union tree_node *search_slot;
768 /* Room for another three unsigned chars. */
770 union tree_node *size;
772 union tree_node *abstract_virtuals;
773 union tree_node *friend_classes;
775 union tree_node *rtti;
777 union tree_node *methods;
779 union tree_node *signature;
780 union tree_node *signature_pointer_to;
781 union tree_node *signature_reference_to;
782 union tree_node *template_info;
783 tree befriending_classes;
786 /* Indicates whether or not (and how) a template was expanded for this class.
787 0=no information yet/non-template class
788 1=implicit template instantiation
789 2=explicit template specialization
790 3=explicit template instantiation */
791 #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
793 /* Fields used for storing information before the class is defined.
794 After the class is defined, these fields hold other information. */
796 /* List of friends which were defined inline in this class definition. */
797 #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
799 /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
801 #define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
802 #define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
803 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
805 /* Nonzero for _CLASSTYPE means that operator vec delete is defined and
806 takes the optional size_t argument. */
807 #define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
808 (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size)
809 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
810 (TYPE_NEEDS_DESTRUCTOR (NODE) \
811 || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
813 /* Nonzero means that this _CLASSTYPE node defines ways of converting
814 itself to other types. */
815 #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
817 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
818 #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
819 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
821 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
822 #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
823 #define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
825 /* Nonzero means that this type is being defined. I.e., the left brace
826 starting the definition of this type has been seen. */
827 #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
828 /* Nonzero means that this type has been redefined. In this case, if
829 convenient, don't reprocess any methods that appear in its redefinition. */
830 #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
832 /* Nonzero means that this type is a signature. */
833 # define IS_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)?TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature:0)
834 # define SET_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=1)
835 # define CLEAR_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=0)
837 /* Nonzero means that this type is a signature pointer type. */
838 # define IS_SIGNATURE_POINTER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_pointer)
840 /* Nonzero means that this type is a signature reference type. */
841 # define IS_SIGNATURE_REFERENCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_reference)
843 /* Nonzero means that this signature contains opaque type declarations. */
844 #define SIGNATURE_HAS_OPAQUE_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_opaque_typedecls)
846 /* Nonzero means that a signature table has been generated
847 for this signature. */
848 #define SIGTABLE_HAS_BEEN_GENERATED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.sigtable_has_been_generated)
850 /* If NODE is a class, this is the signature type that contains NODE's
851 signature after it has been computed using sigof(). */
852 #define CLASSTYPE_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
854 /* If NODE is a signature pointer or signature reference, this is the
855 signature type the pointer/reference points to. */
856 #define SIGNATURE_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
858 /* If NODE is a signature, this is a vector of all methods defined
859 in the signature or in its base types together with their default
861 #define SIGNATURE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
863 /* If NODE is a signature, this is the _TYPE node that contains NODE's
864 signature pointer type. */
865 #define SIGNATURE_POINTER_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_pointer_to)
867 /* If NODE is a signature, this is the _TYPE node that contains NODE's
868 signature reference type. */
869 #define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to)
871 /* The is the basetype that contains NODE's rtti. */
872 #define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
874 /* Nonzero means that this _CLASSTYPE node overloads operator(). */
875 #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
877 /* Nonzero means that this _CLASSTYPE node overloads operator[]. */
878 #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
880 /* Nonzero means that this _CLASSTYPE node overloads operator->. */
881 #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
883 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
884 multiple inheritance. If this is 0 for the root of a type
885 hierarchy, then we can use more efficient search techniques. */
886 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
888 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
889 virtual base classes. If this is 0 for the root of a type
890 hierarchy, then we can use more efficient search techniques. */
891 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
893 /* Nonzero means that this _CLASSTYPE uses polymorphic virtual bases.
894 This flag is set only when we use vtable thunks. */
895 #define TYPE_USES_PVBASES(NODE) (TREE_LANG_FLAG_5(NODE))
897 /* Vector member functions defined in this class. Each element is
898 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
899 functions with the same name end up in the same slot. The first
900 two elements are for constructors, and destructors, respectively.
901 These are followed by ordinary member functions. There may be
902 empty entries at the end of the vector. */
903 #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
905 /* The first type conversion operator in the class (the others can be
906 searched with TREE_CHAIN), or the first non-constructor function if
907 there are no type conversion operators. */
908 #define CLASSTYPE_FIRST_CONVERSION(NODE) \
909 TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
910 ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
913 /* Mark bits for depth-first and breath-first searches. */
915 /* Get the value of the Nth mark bit. */
916 #define CLASSTYPE_MARKED_N(NODE, N) \
917 (((CLASS_TYPE_P (NODE) ? TYPE_LANG_SPECIFIC (NODE)->type_flags.marks \
918 : TYPE_ALIAS_SET (NODE)) & (1 << N)) != 0)
920 /* Set the Nth mark bit. */
921 #define SET_CLASSTYPE_MARKED_N(NODE, N) \
922 (CLASS_TYPE_P (NODE) \
923 ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks |= (1 << (N))) \
924 : (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
926 /* Clear the Nth mark bit. */
927 #define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
928 (CLASS_TYPE_P (NODE) \
929 ? (TYPE_LANG_SPECIFIC (NODE)->type_flags.marks &= ~(1 << (N))) \
930 : (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
932 /* Get the value of the mark bits. */
933 #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N(NODE, 0)
934 #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N(NODE, 1)
935 #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N(NODE, 2)
936 #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N(NODE, 3)
937 #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N(NODE, 4)
938 #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N(NODE, 5)
940 /* Macros to modify the above flags */
941 #define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N(NODE, 0)
942 #define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 0)
943 #define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N(NODE, 1)
944 #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 1)
945 #define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N(NODE, 2)
946 #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 2)
947 #define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N(NODE, 3)
948 #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 3)
949 #define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N(NODE, 4)
950 #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 4)
951 #define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N(NODE, 5)
952 #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N(NODE, 5)
954 /* A list of the nested tag-types (class, struct, union, or enum)
955 found within this class. The TREE_PURPOSE of each node is the name
956 of the type; the TREE_VALUE is the type itself. This list includes
957 nested member class templates. */
958 #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
960 /* If this class has any bases, this is the number of the base class from
961 which our VFIELD is based, -1 otherwise. If this class has no base
962 classes, this is not used.
963 In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
964 1, if D's vtable came from B2. */
965 #define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
967 /* Remove when done merging. */
968 #define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
970 /* The number of virtual functions defined for this
972 #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
973 /* The list of binfos of virtual base classes that this type uses. */
974 #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
975 /* The virtual function pointer fields that this type contains. */
976 #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
978 /* Number of baseclasses defined for this type.
979 0 means no base classes. */
980 #define CLASSTYPE_N_BASECLASSES(NODE) \
981 (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
983 /* Used for keeping search-specific information. Any search routine
984 which uses this must define what exactly this slot is used for. */
985 #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
987 /* These are the size, mode and alignment of the type without its
988 virtual base classes, for when we use this type as a base itself. */
989 #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
990 #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
992 /* A cons list of virtual functions which cannot be inherited by
993 derived classes. When deriving from this type, the derived
994 class must provide its own definition for each of these functions. */
995 #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
997 /* Nonzero means that this aggr type has been `closed' by a semicolon. */
998 #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
1000 /* Nonzero means that the main virtual function table pointer needs to be
1001 set because base constructors have placed the wrong value there.
1002 If this is zero, it means that they placed the right value there,
1003 and there is no need to change it. */
1004 #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
1006 /* Nonzero means that if this type has virtual functions, that
1007 the virtual function table will be written out. */
1008 #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
1010 /* Nonzero means that this type has an X() constructor. */
1011 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
1013 /* Nonzero means the type declared a ctor as private or protected. We
1014 use this to make sure we don't try to generate a copy ctor for a
1015 class that has a member of type NODE. */
1016 #define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor)
1018 /* Ditto, for operator=. */
1019 #define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref)
1021 /* Nonzero means that this type contains a mutable member */
1022 #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_mutable)
1023 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1025 /* Nonzero means that this type is meant for communication via COM. */
1026 #define CLASSTYPE_COM_INTERFACE(NODE) \
1027 (TYPE_LANG_SPECIFIC(NODE)->type_flags.com_interface)
1029 /* A list of class types of which this type is a friend. The
1030 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1031 case of a template friend. */
1032 #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
1034 /* A list of the classes which grant friendship to this class. */
1035 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1036 (TYPE_LANG_SPECIFIC (NODE)->befriending_classes)
1038 /* Say whether this node was declared as a "class" or a "struct". */
1039 #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
1041 /* Nonzero if this class has const members which have no specified initialization. */
1042 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
1044 /* Nonzero if this class has ref members which have no specified initialization. */
1045 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
1047 /* Nonzero if this class is included from a header file which employs
1048 `#pragma interface', and it is not included in its implementation file. */
1049 #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
1051 /* Same as above, but for classes whose purpose we do not know. */
1052 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
1053 #define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0)
1054 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X))
1055 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1)
1056 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0)
1058 /* Nonzero if a _DECL node requires us to output debug info for this class. */
1059 #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
1061 /* Additional macros for inheritance information. */
1063 /* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
1064 gcc/tree.h. In particular if D is derived from B then the BINFO
1065 for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
1066 D. In tree.h, this pointer is described as pointing in other
1067 direction. There is a different BINFO for each path to a virtual
1068 base; BINFOs for virtual bases are not shared. In addition, shared
1069 versions of each of the virtual class BINFOs are stored in
1070 CLASSTYPE_VBASECLASSES.
1072 We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
1073 inheritance is indicated by the absence of the other two flags, not
1074 by TREE_VIAR_PRIVATE, which is unused.
1076 The TREE_CHAIN is for scratch space in search.c. */
1078 /* Nonzero means marked by DFS or BFS search, including searches
1079 by `get_binfo' and `get_base_distance'. */
1080 #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
1081 /* Macros needed because of C compilers that don't allow conditional
1082 expressions to be lvalues. Grr! */
1083 #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
1084 #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
1086 /* Nonzero means marked in search through virtual inheritance hierarchy. */
1087 #define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1088 /* Modifier macros */
1089 #define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1090 #define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
1092 /* Nonzero means marked in search for members or member functions. */
1093 #define BINFO_FIELDS_MARKED(NODE) \
1094 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
1095 #define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
1096 #define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
1098 /* Nonzero means that this class is on a path leading to a new vtable. */
1099 #define BINFO_VTABLE_PATH_MARKED(NODE) \
1100 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
1101 #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
1102 #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
1104 /* Nonzero means that this class has a new vtable. */
1105 #define BINFO_NEW_VTABLE_MARKED(NODE) \
1106 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
1107 #define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
1108 #define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
1110 /* Nonzero means this class has done dfs_pushdecls. */
1111 #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
1112 #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
1113 #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
1115 /* Used by various search routines. */
1116 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1118 /* Accessor macros for the vfield slots in structures. */
1120 /* Get the assoc info that caused this vfield to exist. */
1121 #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1123 /* Get that same information as a _TYPE. */
1124 #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1126 /* Get the value of the top-most type dominating the non-`normal' vfields. */
1127 #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
1129 /* Get the value of the top-most type that's `normal' for the vfield. */
1130 #define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
1132 /* Nonzero for TREE_LIST node means that this list of things
1133 is a list of parameters, as opposed to a list of expressions. */
1134 #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
1136 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1137 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
1138 will be NULL_TREE to indicate a throw specification of `(...)', or,
1139 equivalently, no throw specification. */
1140 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
1142 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
1143 #define TYPE_NOTHROW_P(NODE) \
1144 (TYPE_RAISES_EXCEPTIONS (NODE) \
1145 && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
1147 /* The binding level associated with the namespace. */
1148 #define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
1151 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
1152 a lang_decl (which has lang_decl_flags as its initial prefix). A
1153 FUNCTION_DECL, NAMESPACE_DECL, TYPE_DECL, or USING_DECL may have a
1154 full lang_decl. A FIELD_DECL, or a static data member VAR_DECL,
1155 will have only lang_decl_flags. Thus, one should only access the
1156 members of lang_decl that are not in lang_decl_flags for DECLs that
1157 are not FIELD_DECLs or VAR_DECLs. */
1159 struct lang_decl_flags
1161 #ifdef ONLY_INT_FIELDS
1164 enum languages language : 8;
1167 unsigned operator_attr : 1;
1168 unsigned constructor_attr : 1;
1169 unsigned friend_attr : 1;
1170 unsigned static_function : 1;
1171 unsigned const_memfunc : 1;
1172 unsigned volatile_memfunc : 1;
1173 unsigned abstract_virtual : 1;
1174 unsigned permanent_attr : 1 ;
1176 unsigned mutable_flag : 1;
1177 unsigned is_default_implementation : 1;
1178 unsigned saved_inline : 1;
1179 unsigned use_template : 2;
1180 unsigned nonconverting : 1;
1181 unsigned declared_inline : 1;
1182 unsigned not_really_extern : 1;
1183 unsigned needs_final_overrider : 1;
1184 unsigned bitfield : 1;
1185 unsigned defined_in_class : 1;
1186 unsigned constructor_for_vbase_attr : 2;
1191 tree memfunc_pointer_to;
1193 struct binding_level *level;
1198 struct lang_decl_flags decl_flags;
1200 tree main_decl_variant;
1201 tree befriending_classes;
1202 struct pending_inline *pending_inline_info;
1205 /* Non-zero if NODE is a _DECL with TREE_READONLY set. */
1206 #define TREE_READONLY_DECL_P(NODE) \
1207 (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
1209 /* Non-zero iff DECL is memory-based. The DECL_RTL of
1210 certain const variables might be a CONST_INT, or a REG
1211 in some cases. We cannot use `memory_operand' as a test
1212 here because on most RISC machines, a variable's address
1213 is not, by itself, a legitimate address. */
1214 #define DECL_IN_MEMORY_P(NODE) \
1215 (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
1217 /* For FUNCTION_DECLs: return the language in which this decl
1219 #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
1221 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
1222 #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
1224 /* There ought to be a better way to find out whether or not something is
1226 #define DECL_DESTRUCTOR_P(NODE) \
1227 (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (NODE)) \
1228 && DECL_LANGUAGE (NODE) == lang_cplusplus)
1230 #define DECL_CONV_FN_P(NODE) \
1231 (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)) && TREE_TYPE (DECL_NAME (NODE)))
1233 #define CONSTRUCTOR_FOR_VBASE 1
1234 #define CONSTRUCTOR_FOR_PVBASE 2
1235 #define DESTRUCTOR_FOR_PVBASE 3
1237 /* For FUNCTION_DECLs: nonzero means that this function is a con/destructor
1238 for an object with virtual baseclasses. */
1239 #define DECL_CONSTRUCTOR_FOR_VBASE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
1241 /* Nonzero means that this function is a constructor for an object
1242 with virtual baseclasses. */
1243 #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) \
1244 (DECL_CONSTRUCTOR_FOR_VBASE (NODE) == CONSTRUCTOR_FOR_VBASE)
1246 /* Nonzero means that this function is a constructor for an object
1247 with virtual baseclasses which have virtual functions. */
1248 #define DECL_CONSTRUCTOR_FOR_PVBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr == CONSTRUCTOR_FOR_PVBASE)
1250 /* Nonzero means that this function is a destructor for an object
1251 with virtual baseclasses which have virtual functions. */
1252 #define DECL_DESTRUCTOR_FOR_PVBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr == DESTRUCTOR_FOR_PVBASE)
1254 /* Nonzero means that this function is a wrapper around a PVBASE ctor. */
1255 #define DECL_VLIST_CTOR_WRAPPER_P(NODE) \
1256 (DECL_CONSTRUCTOR_FOR_VBASE_P (NODE) && DECL_VLIST_CTOR_WRAPPED (NODE)\
1257 && TREE_CODE (DECL_VLIST_CTOR_WRAPPED (NODE)) == FUNCTION_DECL \
1258 && DECL_CONSTRUCTOR_FOR_PVBASE_P (DECL_VLIST_CTOR_WRAPPED (NODE)))
1260 /* Refers to original function that NODE wraps. */
1261 #define DECL_VLIST_CTOR_WRAPPED(NODE) DECL_MEMFUNC_POINTER_TO (NODE)
1263 /* Non-zero for a FUNCTION_DECL that declares a type-info function. */
1264 #define DECL_TINFO_FN_P(NODE) \
1265 (TREE_CODE (NODE) == FUNCTION_DECL \
1266 && DECL_ARTIFICIAL (NODE) \
1267 && DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1269 /* Mark NODE as a type-info function. */
1270 #define SET_DECL_TINFO_FN_P(NODE) \
1271 (DECL_LANG_SPECIFIC((NODE))->decl_flags.mutable_flag = 1)
1273 /* For FUNCTION_DECLs: nonzero means that this function is a default
1274 implementation of a signature method. */
1275 #define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation)
1277 /* Nonzero for _DECL means that this decl appears in (or will appear
1278 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
1279 detecting circularity in case members are multiply defined. In the
1280 case of a VAR_DECL, it is also used to determine how program storage
1281 should be allocated. */
1282 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
1284 /* Nonzero if the DECL was defined in the class definition itself,
1285 rather than outside the class. */
1286 #define DECL_DEFINED_IN_CLASS_P(DECL) \
1287 (DECL_LANG_SPECIFIC (DECL)->decl_flags.defined_in_class)
1289 /* Nonzero for FUNCTION_DECL means that this decl is just a
1290 friend declaration, and should not be added to the list of
1291 member functions for this class. */
1292 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
1294 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
1295 #define DECL_BEFRIENDING_CLASSES(NODE) \
1296 (DECL_LANG_SPECIFIC(NODE)->befriending_classes)
1298 /* Nonzero for FUNCTION_DECL means that this decl is a static
1300 #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
1302 /* Nonzero for a class member means that it is shared between all objects
1304 #define SHARED_MEMBER_P(NODE) \
1305 (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
1306 || TREE_CODE (NODE) == CONST_DECL)
1308 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
1310 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
1311 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
1313 /* Nonzero for FUNCTION_DECL means that this decl is a member function
1314 (static or non-static). */
1315 #define DECL_FUNCTION_MEMBER_P(NODE) \
1316 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
1318 /* Nonzero for FUNCTION_DECL means that this member function
1319 has `this' as const X *const. */
1320 #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
1322 /* Nonzero for FUNCTION_DECL means that this member function
1323 has `this' as volatile X *const. */
1324 #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
1326 /* Nonzero for a DECL means that this member is a non-static member. */
1327 #define DECL_NONSTATIC_MEMBER_P(NODE) \
1328 ((TREE_CODE (NODE) == FUNCTION_DECL \
1329 && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
1330 || TREE_CODE (NODE) == FIELD_DECL)
1332 /* Nonzero for _DECL means that this member object type
1334 #define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1336 /* Nonzero for _DECL means that this constructor is a non-converting
1338 #define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
1340 /* Nonzero for FUNCTION_DECL means that this member function
1341 exists as part of an abstract class's interface. */
1342 #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
1344 /* Nonzero for FUNCTION_DECL means that this member function
1345 must be overridden by derived classes. */
1346 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
1348 /* Nonzero if allocated on permanent_obstack. */
1349 #define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
1351 /* The _TYPE context in which this _DECL appears. This field holds the
1352 class where a virtual function instance is actually defined, and the
1353 lexical scope of a friend function defined in a class body. */
1354 #define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
1355 #define DECL_REAL_CONTEXT(NODE) \
1356 ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
1357 ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE))
1359 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
1360 #define CP_DECL_CONTEXT(NODE) \
1361 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
1362 #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
1364 /* For a virtual function, the base where we find its vtable entry.
1365 For a non-virtual function, the base where it is defined. */
1366 #define DECL_VIRTUAL_CONTEXT(NODE) DECL_CONTEXT (NODE)
1368 /* 1 iff NODE has namespace scope, including the global namespace. */
1369 #define DECL_NAMESPACE_SCOPE_P(NODE) \
1370 (DECL_CONTEXT (NODE) == NULL_TREE \
1371 || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
1373 /* 1 iff NODE is a class member. */
1374 #define DECL_CLASS_SCOPE_P(NODE) \
1375 (DECL_CONTEXT (NODE) \
1376 && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
1378 /* 1 iff NODE is function-local. */
1379 #define DECL_FUNCTION_SCOPE_P(NODE) \
1380 (DECL_CONTEXT (NODE) \
1381 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
1383 /* For a NAMESPACE_DECL: the list of using namespace directives
1384 The PURPOSE is the used namespace, the value is the namespace
1385 that is the common ancestor. */
1386 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX(NODE)
1388 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
1389 of a namespace, to record the transitive closure of using namespace. */
1390 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NODE)
1392 /* In a NAMESPACE_DECL, points to the original namespace if this is
1393 a namespace alias. */
1394 #define DECL_NAMESPACE_ALIAS(NODE) DECL_ABSTRACT_ORIGIN (NODE)
1395 #define ORIGINAL_NAMESPACE(NODE) \
1396 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
1398 /* In a non-local VAR_DECL with static storage duration, this is the
1399 initialization priority. If this value is zero, the NODE will be
1400 initialized at the DEFAULT_INIT_PRIORITY. */
1401 #define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE ((NODE)))
1403 /* In a TREE_LIST concatenating using directives, indicate indirekt
1405 #define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0)
1407 /* In a VAR_DECL for a variable declared in a for statement,
1408 this is the shadowed (local) variable. */
1409 #define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
1411 /* Points back to the decl which caused this lang_decl to be allocated. */
1412 #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
1414 /* For a FUNCTION_DECL: if this function was declared inline inside of
1415 a class declaration, this is where the text for the function is
1417 #define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
1419 /* True if on the saved_inlines (see decl2.c) list. */
1420 #define DECL_SAVED_INLINE(DECL) \
1421 (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
1423 /* For a FUNCTION_DECL: if this function was declared inside a signature
1424 declaration, this is the corresponding member function pointer that was
1426 #define DECL_MEMFUNC_POINTER_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
1428 /* For a FIELD_DECL: this points to the signature member function from
1429 which this signature member function pointer was created. */
1430 #define DECL_MEMFUNC_POINTING_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
1432 /* For a VAR_DECL or FUNCTION_DECL: template-specific information. */
1433 #define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.template_info)
1435 /* Template information for a RECORD_TYPE or UNION_TYPE. */
1436 #define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info)
1438 /* Template information for an ENUMERAL_TYPE. Although an enumeration may
1439 not be a primary template, it may be declared within the scope of a
1440 primary template and the enumeration constants may depend on
1441 non-type template parameters. */
1442 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1444 /* Template information for a template template parameter. */
1445 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1447 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1448 #define TYPE_TEMPLATE_INFO(NODE) \
1449 (TREE_CODE (NODE) == ENUMERAL_TYPE \
1450 ? ENUM_TEMPLATE_INFO (NODE) : \
1451 (TREE_CODE (NODE) == TEMPLATE_TEMPLATE_PARM \
1452 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \
1453 : CLASSTYPE_TEMPLATE_INFO (NODE)))
1455 /* Set the template information for an ENUMERAL_, RECORD_, or
1456 UNION_TYPE to VAL. */
1457 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
1458 (TREE_CODE (NODE) == ENUMERAL_TYPE \
1459 ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \
1460 : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
1462 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
1463 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
1464 #define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE))
1465 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
1467 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
1468 TEMPLATE_DECL will be the immediate parent, not the most general
1469 template. For example, in:
1471 template <class T> struct S { template <class U> void f(U); }
1473 the FUNCTION_DECL for S<int>::f<double> will have, as its
1474 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
1476 As a special case, for a member friend template of a template
1477 class, this value will not be a TEMPLATE_DECL, but rather a
1478 LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
1479 and any explicit template arguments provided. For example, in:
1481 template <class T> struct S { friend void f<int>(int, double); }
1483 the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
1484 DECL_TI_ARGS will be {int}. */
1485 #define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
1487 /* The template arguments used to obtain this decl from the most
1488 general form of DECL_TI_TEMPLATE. For the example given for
1489 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
1490 are always the full set of arguments required to instantiate this
1491 declaration from the most general template specialized here. */
1492 #define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
1493 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
1494 #define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
1495 #define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE))
1496 #define ENUM_TI_TEMPLATE(NODE) \
1497 TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
1498 #define ENUM_TI_ARGS(NODE) \
1499 TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
1501 /* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1502 #define TYPE_TI_TEMPLATE(NODE) \
1503 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
1505 /* Like DECL_TI_ARGS, , but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1506 #define TYPE_TI_ARGS(NODE) \
1507 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
1509 #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE)
1511 /* Nonzero if the NODE corresponds to the template parameters for a
1512 member template, whose inline definition is being processed after
1513 the class definition is complete. */
1514 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
1516 #define DECL_SAVED_TREE(NODE) DECL_MEMFUNC_POINTER_TO (NODE)
1517 #define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
1518 #define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1519 #define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1520 #define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
1521 #define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1523 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
1524 TEMPLATE_DECL. This macro determines whether or not a given class
1525 type is really a template type, as opposed to an instantiation or
1526 specialization of one. */
1527 #define CLASSTYPE_IS_TEMPLATE(NODE) \
1528 (CLASSTYPE_TEMPLATE_INFO (NODE) \
1529 && !CLASSTYPE_USE_TEMPLATE (NODE) \
1530 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
1532 /* The name used by the user to name the typename type. Typically,
1533 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
1534 corresponding TYPE_DECL. However, this may also be a
1535 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
1536 #define TYPENAME_TYPE_FULLNAME(NODE) TYPE_BINFO (NODE)
1538 /* Nonzero if NODE is an implicit typename. */
1539 #define IMPLICIT_TYPENAME_P(NODE) \
1540 (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
1542 /* Nonzero in INTEGER_CST means that this int is negative by dint of
1543 using a twos-complement negated operand. */
1544 #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
1547 /* Nonzero in any kind of _EXPR or _REF node means that it is a call
1548 to a storage allocation routine. If, later, alternate storage
1549 is found to hold the object, this call can be ignored. */
1550 #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
1553 /* Nonzero in any kind of _TYPE that uses multiple inheritance
1554 or virtual baseclasses. */
1555 #define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
1558 /* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
1559 gave; it's a DECL_NESTED_TYPENAME. Someone may want to set this on
1560 mangled function names, too, but it isn't currently. */
1561 #define TREE_MANGLED(NODE) (FOO)
1565 /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
1566 should be looked up in a non-standard way. */
1567 #define DECL_OVERLOADED(NODE) (FOO)
1570 /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
1571 For a FUNCTION_DECL, this is when the function is a virtual function.
1572 For a VAR_DECL, this is when the variable is a virtual function table.
1573 For a FIELD_DECL, when the field is the field for the virtual function table.
1574 For an IDENTIFIER_NODE, nonzero if any function with this name
1575 has been declared virtual.
1577 For a _TYPE if it uses virtual functions (or is derived from
1579 #define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
1581 extern int flag_new_for_scope;
1583 /* This flag is true of a local VAR_DECL if it was declared in a for
1584 statement, but we are no longer in the scope of the for. */
1585 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
1587 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
1588 if we already emitted a warning about using it. */
1589 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE)
1591 /* This _DECL represents a compiler-generated entity. */
1592 #define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
1594 /* Record whether a typedef for type `int' was actually `signed int'. */
1595 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
1597 /* In a FIELD_DECL, nonzero if the decl was originally a bitfield. */
1598 #define DECL_C_BIT_FIELD(NODE) \
1599 (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield)
1600 #define SET_DECL_C_BIT_FIELD(NODE) \
1601 (DECL_LANG_SPECIFIC (NODE)->decl_flags.bitfield = 1)
1603 /* Nonzero if the type T promotes to itself.
1604 ANSI C states explicitly the list of types that promote;
1605 in particular, short promotes to int even if they have the same width. */
1606 #define C_PROMOTING_INTEGER_TYPE_P(t) \
1607 (TREE_CODE ((t)) == INTEGER_TYPE \
1608 && (TYPE_MAIN_VARIANT (t) == char_type_node \
1609 || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
1610 || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
1611 || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
1612 || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
1614 #define INTEGRAL_CODE_P(CODE) \
1615 (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
1616 #define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE))
1618 /* Mark which labels are explicitly declared.
1619 These may be shadowed, and may be referenced from nested functions. */
1620 #define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
1622 /* Nonzero for _TYPE means that the _TYPE defines
1623 at least one constructor. */
1624 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
1626 /* When appearing in an INDIRECT_REF, it means that the tree structure
1627 underneath is actually a call to a constructor. This is needed
1628 when the constructor must initialize local storage (which can
1629 be automatically destroyed), rather than allowing it to allocate
1630 space from the heap.
1632 When appearing in a SAVE_EXPR, it means that underneath
1633 is a call to a constructor.
1635 When appearing in a CONSTRUCTOR, it means that it was
1636 a GNU C constructor expression.
1638 When appearing in a FIELD_DECL, it means that this field
1639 has been duly initialized in its constructor. */
1640 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
1642 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
1643 && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
1644 && ! TREE_HAS_CONSTRUCTOR (NODE))
1647 /* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
1648 Used to generate more helpful error message in case somebody
1649 tries to take its address. */
1650 #define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
1653 /* Nonzero for _TYPE means that the _TYPE defines a destructor. */
1654 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
1657 /* Nonzero for _TYPE node means that creating an object of this type
1658 will involve a call to a constructor. This can apply to objects
1659 of ARRAY_TYPE if the type of the elements needs a constructor. */
1660 #define TYPE_NEEDS_CONSTRUCTING(NODE) ... defined in ../tree.h ...
1663 /* Nonzero means that an object of this type can not be initialized using
1664 an initializer list. */
1665 #define CLASSTYPE_NON_AGGREGATE(NODE) \
1666 (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate)
1667 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
1668 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
1670 /* Nonzero if there is a user-defined X::op=(x&) for this class. */
1671 #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
1672 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
1673 #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref)
1674 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref)
1676 /* Nonzero for _TYPE node means that destroying an object of this type
1677 will involve a call to a destructor. This can apply to objects
1678 of ARRAY_TYPE is the type of the elements needs a destructor. */
1679 #define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
1681 /* Nonzero for class type means that initialization of this type can use
1683 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
1684 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
1686 /* Nonzero for class type means that assignment of this type can use
1688 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
1689 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
1691 #define TYPE_PTRMEM_P(NODE) \
1692 (TREE_CODE (NODE) == POINTER_TYPE \
1693 && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
1694 #define TYPE_PTR_P(NODE) \
1695 (TREE_CODE (NODE) == POINTER_TYPE \
1696 && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
1697 #define TYPE_PTROB_P(NODE) \
1698 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
1699 && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
1700 #define TYPE_PTROBV_P(NODE) \
1701 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
1702 #define TYPE_PTRFN_P(NODE) \
1703 (TREE_CODE (NODE) == POINTER_TYPE \
1704 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
1706 /* Nonzero for _TYPE node means that this type is a pointer to member
1708 #define TYPE_PTRMEMFUNC_P(NODE) \
1709 (TREE_CODE(NODE) == RECORD_TYPE && TYPE_PTRMEMFUNC_FLAG (NODE))
1710 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
1711 (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
1713 /* A pointer-to-function member type looks like:
1724 where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
1725 pointer to member. The fields are used as follows:
1727 If __INDEX is -1, then the function to call is non-virtual, and
1728 is located at the address given by __PFN.
1730 If __INDEX is zero, then this a NULL pointer-to-member.
1732 Otherwise, the function to call is virtual. Then, __DELTA2 gives
1733 the offset from an instance of the object to the virtual function
1734 table, and __INDEX - 1 is the index into the vtable to use to
1737 The value to use for the THIS parameter is the address of the
1738 object plus __DELTA.
1751 struct S : public B1, B2 {};
1753 the pointer-to-member for `&S::f' looks like:
1755 { 4, -1, { &f__2B2 } };
1757 The `4' means that given an `S*' you have to add 4 bytes to get to
1758 the address of the `B2*'. Then, the -1 indicates that this is a
1759 non-virtual function. Of course, `&f__2B2' is the name of that
1762 (Of course, the exactl values may differ depending on the mangling
1763 scheme, sizes of types, and such.). */
1765 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
1766 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
1767 before using this macro. */
1768 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
1770 /* Returns `A' for a type like `int (A::*)(double)' */
1771 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
1772 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
1774 /* These are use to manipulate the canonical RECORD_TYPE from the
1775 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
1776 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
1777 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
1778 /* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
1779 #define DELTA2_FROM_PTRMEMFUNC(NODE) delta2_from_ptrmemfunc ((NODE))
1780 #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
1782 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
1784 #define PTRMEM_CST_CLASS(NODE) \
1785 (TYPE_PTRMEM_P (TREE_TYPE (NODE)) \
1786 ? TYPE_OFFSET_BASETYPE (TREE_TYPE (TREE_TYPE (NODE))) \
1787 : TYPE_PTRMEMFUNC_OBJECT_TYPE (TREE_TYPE (NODE)))
1789 /* For a pointer-to-member constant `X::Y' this is the _DECL for
1791 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t) NODE)->member)
1793 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
1794 specified in its declaration. */
1795 #define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE))
1797 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
1798 specified in its declaration. */
1799 #define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE))
1801 /* Nonzero in FUNCTION_DECL means it is really an operator.
1802 Just used to communicate formatting information to dbxout.c. */
1803 #define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
1805 #define ANON_UNION_P(NODE) (DECL_NAME (NODE) == 0)
1807 /* Nonzero if TYPE is an anonymous union type. We have to use a flag for
1808 this because "A union for which objects or pointers are declared is not
1809 an anonymous union" [class.union]. */
1810 #define ANON_UNION_TYPE_P(NODE) \
1811 (TYPE_LANG_SPECIFIC (NODE) \
1812 && TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_union)
1813 #define SET_ANON_UNION_TYPE_P(NODE) \
1814 (TYPE_LANG_SPECIFIC (NODE)->type_flags.anon_union = 1)
1816 #define UNKNOWN_TYPE LANG_TYPE
1818 /* Define fields and accessors for nodes representing declared names. */
1821 /* C++: A derived class may be able to directly use the virtual
1822 function table of a base class. When it does so, it may
1823 still have a decl node used to access the virtual function
1824 table (so that variables of this type can initialize their
1825 virtual function table pointers by name). When such thievery
1826 is committed, know exactly which base class's virtual function
1827 table is the one being stolen. This effectively computes the
1828 transitive closure. */
1829 #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
1832 #define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous)
1834 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
1836 /* The format of each node in the DECL_FRIENDLIST is as follows:
1838 The TREE_PURPOSE will be the name of a function, i.e., an
1839 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the
1840 list of functions with that name which are friends. The
1841 TREE_PURPOSE of each node in this sublist will be error_mark_node,
1842 if the function was declared a friend individually, in which case
1843 the TREE_VALUE will be the function_decl. If, however, all
1844 functions with a given name in a class were declared to be friends,
1845 the TREE_PUROSE will be the class type, and the TREE_VALUE will be
1847 #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
1848 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
1849 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
1851 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
1852 each node is a type; the TREE_VALUE is the access granted for this
1853 DECL in that type. The DECL_ACCESS is set by access declarations.
1854 For example, if a member that would normally be public in a
1855 derived class is made protected, then the derived class and the
1856 protected_access_node will appear in the DECL_ACCESS for the node. */
1857 #define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access)
1859 /* C++: all of these are overloaded!
1860 These apply to PARM_DECLs and VAR_DECLs. */
1861 #define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
1862 #define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
1864 /* Accessor macros for C++ template decl nodes. */
1866 /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
1867 is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
1868 template parameters, with 1 being the outermost set of template
1869 parameters. The TREE_VALUE is a vector, whose elements are the
1870 template parameters at each level. Each element in the vector is a
1871 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
1872 non-type parameter), or a TYPE_DECL (if the parameter is a type
1873 parameter). The TREE_PURPOSE is the default value, if any. The
1874 TEMPLATE_PARM_INDEX for the parameter is avilable as the
1875 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
1877 #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
1878 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
1879 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
1880 #define DECL_NTPARMS(NODE) \
1881 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
1882 /* For function, method, class-data templates. */
1883 #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
1884 /* For a static member variable template, the
1885 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
1886 implicitly generated instantiations of the variable. There are no
1887 partial instantiations of static member variables, so all of these
1888 will be full instantiations.
1890 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
1891 all instantiations and specializations of the class type, including
1892 partial instantiations and partial specializations.
1894 In both cases, the TREE_PURPOSE of each node contains the arguments
1895 used; the TREE_VALUE contains the generated variable. The template
1896 arguments are always complete. For example, given:
1898 template <class T> struct S1 {
1899 template <class U> struct S2 {};
1900 template <class U> struct S2<U*> {};
1903 the record for the partial specialization will contain, as its
1904 argument list, { {T}, {U*} }, and will be on the
1905 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
1906 <class U> struct S1<T>::S2'.
1908 This list is not used for function templates. */
1909 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
1910 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
1911 contains all instantiations and specializations of the function,
1912 including partial instantiations. For a partial instantiation
1913 which is a specialization, this list holds only full
1914 specializations of the template that are instantiations of the
1915 partial instantiation. For example, given:
1917 template <class T> struct S {
1918 template <class U> void f(U);
1919 template <> void f(T);
1922 the `S<int>::f<int>(int)' function will appear on the
1923 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
1924 template <class U> void S<T>::f(U)' and `template <class T> void
1925 S<int>::f(T)'. In the latter case, however, it will have only the
1926 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
1927 for the function declaration will point at the specialization, not
1928 the fully general template.
1930 For a class template, this list contains the partial
1931 specializations of this template. (Full specializations are not
1932 recorded on this list.) The TREE_PURPOSE holds the innermost
1933 arguments used in the partial specialization (e.g., for `template
1934 <class T> struct S<T*, int>' this will be `T*'.) The TREE_VALUE
1935 holds the innermost template parameters for the specialization
1936 (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node
1937 for the partial specialization.
1939 This list is not used for static variable templates. */
1940 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE)
1941 #define DECL_TEMPLATE_INJECT(NODE) DECL_INITIAL(NODE)
1943 /* Nonzero for a DECL which is actually a template parameter. */
1944 #define DECL_TEMPLATE_PARM_P(NODE) \
1945 DECL_LANG_FLAG_0 (NODE)
1947 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
1948 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
1950 #define DECL_FUNCTION_TEMPLATE_P(NODE) \
1951 (TREE_CODE (NODE) == TEMPLATE_DECL \
1952 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
1954 /* Nonzero for a DECL that represents a template class. */
1955 #define DECL_CLASS_TEMPLATE_P(NODE) \
1956 (TREE_CODE (NODE) == TEMPLATE_DECL \
1957 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
1958 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
1960 /* Nonzero if NODE which declares a type. */
1961 #define DECL_DECLARES_TYPE_P(NODE) \
1962 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
1964 /* A `primary' template is one that has its own template header. A
1965 member function of a class template is a template, but not primary.
1966 A member template is primary. Friend templates are primary, too. */
1968 /* Returns the primary template corresponding to these parameters. */
1969 #define DECL_PRIMARY_TEMPLATE(NODE) \
1970 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
1972 /* Returns non-zero if NODE is a primary template. */
1973 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
1975 #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
1976 (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
1978 /* Indicates whether or not (and how) a template was expanded for this
1979 FUNCTION_DECL or VAR_DECL.
1980 0=normal declaration, e.g. int min (int, int);
1981 1=implicit template instantiation
1982 2=explicit template specialization, e.g. int min<int> (int, int);
1983 3=explicit template instantiation, e.g. template int min<int> (int, int); */
1984 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
1986 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
1987 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
1988 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
1990 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
1991 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
1992 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
1993 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
1994 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
1995 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
1997 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
1998 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
1999 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2000 (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
2001 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2002 (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
2004 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
2005 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
2006 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2007 (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
2008 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2009 (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
2011 /* Non-zero if DECL is a friend function which is an instantiation
2012 from the point of view of the compiler, but not from the point of
2013 view of the language. For example given:
2014 template <class T> struct S { friend void f(T) {}; };
2015 the declaration of `void f(int)' generated when S<int> is
2016 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
2017 a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
2018 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
2019 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
2021 /* Non-zero if TYPE is a partial instantiation of a template class,
2022 i.e., an instantiation whose instantiation arguments involve
2024 #define PARTIAL_INSTANTIATION_P(TYPE) \
2025 (TYPE_LANG_SPECIFIC (TYPE)->type_flags.is_partial_instantiation)
2027 /* Non-zero iff we are currently processing a declaration for an
2028 entity with its own template parameter list, and which is not a
2029 full specialization. */
2030 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
2031 (processing_template_decl > template_class_depth (current_class_type))
2033 /* This function may be a guiding decl for a template. */
2034 #define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
2036 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
2037 instantiated, i.e. its definition has been generated from the
2038 pattern given in the the template. */
2039 #define DECL_TEMPLATE_INSTANTIATED(NODE) DECL_LANG_FLAG_1(NODE)
2041 /* We know what we're doing with this decl now. */
2042 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
2044 /* This function was declared inline. This flag controls the linkage
2045 semantics of 'inline'; whether or not the function is inlined is
2046 controlled by DECL_INLINE. */
2047 #define DECL_THIS_INLINE(NODE) \
2048 (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
2050 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
2051 so that assemble_external will work properly. So we have this flag to
2052 tell us whether the decl is really not external. */
2053 #define DECL_NOT_REALLY_EXTERN(NODE) \
2054 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
2056 #define DECL_REALLY_EXTERN(NODE) \
2057 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
2059 #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
2061 /* ...and for unexpanded-parameterized-type nodes. */
2062 #define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
2063 #define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
2065 /* An un-parsed default argument looks like an identifier. */
2066 #define DEFARG_NODE_CHECK(t) TREE_CHECK(t, DEFAULT_ARG)
2067 #define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length)
2068 #define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
2070 #define builtin_function(NAME, TYPE, CODE, LIBNAME) \
2071 define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME)
2073 /* These macros provide convenient access to the various _STMT nodes
2074 created when parsing template declarations. */
2075 #define IF_COND(NODE) TREE_OPERAND (NODE, 0)
2076 #define THEN_CLAUSE(NODE) TREE_OPERAND (NODE, 1)
2077 #define ELSE_CLAUSE(NODE) TREE_OPERAND (NODE, 2)
2078 #define WHILE_COND(NODE) TREE_OPERAND (NODE, 0)
2079 #define WHILE_BODY(NODE) TREE_OPERAND (NODE, 1)
2080 #define DO_COND(NODE) TREE_OPERAND (NODE, 0)
2081 #define DO_BODY(NODE) TREE_OPERAND (NODE, 1)
2082 #define RETURN_EXPR(NODE) TREE_OPERAND (NODE, 0)
2083 #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (NODE, 0)
2084 #define FOR_INIT_STMT(NODE) TREE_OPERAND (NODE, 0)
2085 #define FOR_COND(NODE) TREE_OPERAND (NODE, 1)
2086 #define FOR_EXPR(NODE) TREE_OPERAND (NODE, 2)
2087 #define FOR_BODY(NODE) TREE_OPERAND (NODE, 3)
2088 #define SWITCH_COND(NODE) TREE_OPERAND (NODE, 0)
2089 #define SWITCH_BODY(NODE) TREE_OPERAND (NODE, 1)
2090 #define CASE_LOW(NODE) TREE_OPERAND (NODE, 0)
2091 #define CASE_HIGH(NODE) TREE_OPERAND (NODE, 1)
2092 #define GOTO_DESTINATION(NODE) TREE_OPERAND (NODE, 0)
2093 #define TRY_STMTS(NODE) TREE_OPERAND (NODE, 0)
2094 #define TRY_HANDLERS(NODE) TREE_OPERAND (NODE, 1)
2095 #define HANDLER_PARMS(NODE) TREE_OPERAND (NODE, 0)
2096 #define HANDLER_BODY(NODE) TREE_OPERAND (NODE, 1)
2097 #define COMPOUND_BODY(NODE) TREE_OPERAND (NODE, 0)
2098 #define ASM_CV_QUAL(NODE) TREE_OPERAND (NODE, 0)
2099 #define ASM_STRING(NODE) TREE_OPERAND (NODE, 1)
2100 #define ASM_OUTPUTS(NODE) TREE_OPERAND (NODE, 2)
2101 #define ASM_INPUTS(NODE) TREE_OPERAND (NODE, 3)
2102 #define ASM_CLOBBERS(NODE) TREE_OPERAND (NODE, 4)
2104 /* An enumeration of the kind of tags that C++ accepts. */
2105 enum tag_types { record_type, class_type, union_type, enum_type,
2108 /* Zero means prototype weakly, as in ANSI C (no args means nothing).
2109 Each language context defines how this variable should be set. */
2110 extern int strict_prototype;
2111 extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
2113 /* Non-zero means that if a label exists, and no other identifier
2114 applies, use the value of the label. */
2115 extern int flag_labels_ok;
2117 /* Non-zero means to collect statistics which might be expensive
2118 and to print them when we are done. */
2119 extern int flag_detailed_statistics;
2121 /* Non-zero means warn in function declared in derived class has the
2122 same name as a virtual in the base class, but fails to match the
2123 type signature of any virtual function in the base class. */
2124 extern int warn_overloaded_virtual;
2126 /* Nonzero means warn about use of multicharacter literals. */
2127 extern int warn_multichar;
2129 /* Non-zero means warn if a non-templatized friend function is
2130 declared in a templatized class. This behavior is warned about with
2131 flag_guiding_decls in do_friend. */
2132 extern int warn_nontemplate_friend;
2135 extern void declare_function_name PROTO((void));
2136 extern void decl_attributes PROTO((tree, tree, tree));
2137 extern void init_function_format_info PROTO((void));
2138 extern void record_function_format PROTO((tree, tree, int, int, int));
2139 extern void check_function_format PROTO((tree, tree, tree));
2140 /* Print an error message for invalid operands to arith operation CODE.
2141 NOP_EXPR is used as a special case (see truthvalue_conversion). */
2142 extern void binary_op_error PROTO((enum tree_code));
2143 extern tree cp_build_qualified_type PROTO((tree, int));
2144 extern tree canonical_type_variant PROTO((tree));
2145 extern void c_expand_expr_stmt PROTO((tree));
2146 /* Validate the expression after `case' and apply default promotions. */
2147 extern tree check_case_value PROTO((tree));
2148 /* Concatenate a list of STRING_CST nodes into one STRING_CST. */
2149 extern tree combine_strings PROTO((tree));
2150 extern void constant_expression_warning PROTO((tree));
2151 extern tree convert_and_check PROTO((tree, tree));
2152 extern void overflow_warning PROTO((tree));
2153 extern void unsigned_conversion_warning PROTO((tree, tree));
2154 extern void c_apply_type_quals_to_decl PROTO((int, tree));
2156 /* Read the rest of the current #-directive line. */
2158 extern char *get_directive_line PROTO((void));
2159 #define GET_DIRECTIVE_LINE() get_directive_line ()
2161 extern char *get_directive_line PROTO((FILE *));
2162 #define GET_DIRECTIVE_LINE() get_directive_line (finput)
2164 /* Subroutine of build_binary_op, used for comparison operations.
2165 See if the operands have both been converted from subword integer types
2166 and, if so, perhaps change them both back to their original type. */
2167 extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
2168 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
2169 or validate its data type for an `if' or `while' statement or ?..: exp. */
2170 extern tree truthvalue_conversion PROTO((tree));
2171 extern tree type_for_mode PROTO((enum machine_mode, int));
2172 extern tree type_for_size PROTO((unsigned, int));
2173 extern int c_get_alias_set PROTO((tree));
2176 extern tree void_list_node;
2177 extern tree void_zero_node;
2178 extern tree default_function_type;
2179 extern tree vtable_entry_type;
2180 extern tree sigtable_entry_type;
2181 extern tree __t_desc_type_node;
2183 extern tree __tp_desc_type_node;
2185 extern tree __access_mode_type_node;
2186 extern tree __bltn_desc_type_node, __user_desc_type_node;
2187 extern tree __class_desc_type_node, __attr_desc_type_node;
2188 extern tree __ptr_desc_type_node, __func_desc_type_node;
2189 extern tree __ptmf_desc_type_node, __ptmd_desc_type_node;
2190 extern tree type_info_type_node;
2191 extern tree class_star_type_node;
2192 extern tree this_identifier;
2193 extern tree ctor_identifier, dtor_identifier;
2194 extern tree pfn_identifier;
2195 extern tree index_identifier;
2196 extern tree delta_identifier;
2197 extern tree delta2_identifier;
2198 extern tree pfn_or_delta2_identifier;
2199 extern tree tag_identifier;
2200 extern tree vt_off_identifier;
2201 extern tree in_charge_identifier;
2203 /* A node that is a list (length 1) of error_mark_nodes. */
2204 extern tree error_mark_list;
2206 extern tree ptr_type_node;
2207 extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
2208 extern tree unknown_type_node;
2209 extern tree opaque_type_node, signature_type_node;
2211 extern tree vlist_identifier, vlist_type_node, vlist_zero_node;
2213 /* Node for "pointer to (virtual) function".
2214 This may be distinct from ptr_type_node so gdb can distinguish them. */
2215 #define vfunc_ptr_type_node \
2216 (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
2218 /* The type of a vtbl, i.e., an array of vtable entries. */
2219 extern tree vtbl_type_node;
2220 /* The type of a class vtbl pointer, i.e., a pointer to a vtable entry. */
2221 extern tree vtbl_ptr_type_node;
2222 extern tree delta_type_node;
2223 extern tree std_node;
2225 extern tree long_long_integer_type_node, long_long_unsigned_type_node;
2226 /* For building calls to `delete'. */
2227 extern tree integer_two_node, integer_three_node;
2228 extern tree boolean_type_node, boolean_true_node, boolean_false_node;
2230 extern tree null_node;
2232 extern tree anonymous_namespace_name;
2234 /* The FUNCTION_DECL for the default `::operator delete'. */
2236 extern tree global_delete_fndecl;
2240 /* These values are used for the `STRICT' parameter to type_unfication and
2241 fn_type_unification. Their meanings are described with the
2242 documentation for fn_type_unification. */
2244 typedef enum unification_kind_t {
2248 } unification_kind_t;
2250 extern tree current_template_parms;
2251 extern HOST_WIDE_INT processing_template_decl;
2252 extern tree last_tree;
2254 /* The template currently being instantiated, and where the instantiation
2261 struct tinst_level *next;
2264 extern int minimal_parse_mode;
2266 extern void maybe_print_template_context PROTO ((void));
2270 /* When parsing a class definition, the access specifier most recently
2271 given by the user, or, if no access specifier was given, the
2272 default value appropriate for the kind of class (i.e., struct,
2273 class, or union). */
2274 extern tree current_access_specifier;
2276 extern tree current_class_name;
2277 extern tree current_class_type;
2278 extern tree current_class_ptr;
2279 extern tree previous_class_type;
2280 extern tree current_class_ref;
2281 extern int current_class_depth;
2283 extern tree current_lang_name;
2284 extern tree lang_name_cplusplus, lang_name_c, lang_name_java;
2286 /* The low-water mark on the class-cache obstack. */
2287 extern char *class_cache_firstobj;
2289 /* Points to the name of that function. May not be the DECL_NAME
2290 of CURRENT_FUNCTION_DECL due to overloading */
2291 extern tree original_function_name;
2294 extern tree global_base_init_list;
2295 extern tree current_base_init_list, current_member_init_list;
2297 extern int current_function_just_assigned_this;
2298 extern int current_function_parms_stored;
2300 /* Here's where we control how name mangling takes place. */
2302 #define OPERATOR_ASSIGN_FORMAT "__a%s"
2303 #define OPERATOR_FORMAT "__%s"
2304 #define OPERATOR_TYPENAME_FORMAT "__op"
2306 /* Cannot use '$' up front, because this confuses gdb
2307 (names beginning with '$' are gdb-local identifiers).
2309 Note that all forms in which the '$' is significant are long enough
2310 for direct indexing (meaning that if we know there is a '$'
2311 at a particular location, we can index into the string at
2312 any other location that provides distinguishing characters). */
2314 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
2315 doesn't allow '$' in symbol names. */
2316 #ifndef NO_DOLLAR_IN_LABEL
2320 #define VPTR_NAME "$v"
2321 #define THROW_NAME "$eh_throw"
2322 #define DESTRUCTOR_DECL_PREFIX "_$_"
2323 #define AUTO_VTABLE_NAME "__vtbl$me__"
2324 #define AUTO_TEMP_NAME "_$tmp_"
2325 #define AUTO_TEMP_FORMAT "_$tmp_%d"
2326 #define VTABLE_BASE "$vb"
2327 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
2328 #define VCTABLE_NAME "__vc$"
2329 #define VLIST_NAME_FORMAT "__vl$%s"
2330 #define VFIELD_BASE "$vf"
2331 #define VFIELD_NAME "_vptr$"
2332 #define VFIELD_NAME_FORMAT "_vptr$%s"
2333 #define VBASE_NAME "_vb$"
2334 #define VBASE_NAME_FORMAT "_vb$%s"
2335 #define STATIC_NAME_FORMAT "_%s$%s"
2336 #define ANON_AGGRNAME_FORMAT "$_%d"
2338 #else /* NO_DOLLAR_IN_LABEL */
2340 #ifndef NO_DOT_IN_LABEL
2344 #define VPTR_NAME ".v"
2345 #define THROW_NAME ".eh_throw"
2346 #define DESTRUCTOR_DECL_PREFIX "_._"
2347 #define AUTO_VTABLE_NAME "__vtbl.me__"
2348 #define AUTO_TEMP_NAME "_.tmp_"
2349 #define AUTO_TEMP_FORMAT "_.tmp_%d"
2350 #define VTABLE_BASE ".vb"
2351 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s")
2352 #define VCTABLE_NAME "__vc."
2353 #define VLIST_NAME_FORMAT "__vl.%s"
2354 #define VFIELD_BASE ".vf"
2355 #define VFIELD_NAME "_vptr."
2356 #define VFIELD_NAME_FORMAT "_vptr.%s"
2357 #define VBASE_NAME "_vb."
2358 #define VBASE_NAME_FORMAT "_vb.%s"
2359 #define STATIC_NAME_FORMAT "_%s.%s"
2361 #define ANON_AGGRNAME_FORMAT "._%d"
2363 #else /* NO_DOT_IN_LABEL */
2365 #define VPTR_NAME "__vptr"
2366 #define VPTR_NAME_P(ID_NODE) \
2367 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
2368 #define THROW_NAME "__eh_throw"
2369 #define DESTRUCTOR_DECL_PREFIX "__destr_"
2370 #define DESTRUCTOR_NAME_P(ID_NODE) \
2371 (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
2372 sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
2373 #define IN_CHARGE_NAME "__in_chrg"
2374 #define AUTO_VTABLE_NAME "__vtbl_me__"
2375 #define AUTO_TEMP_NAME "__tmp_"
2376 #define TEMP_NAME_P(ID_NODE) \
2377 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
2378 sizeof (AUTO_TEMP_NAME) - 1))
2379 #define AUTO_TEMP_FORMAT "__tmp_%d"
2380 #define VTABLE_BASE "__vtb"
2381 #define VTABLE_NAME "__vt_"
2382 #define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s")
2383 #define VTABLE_NAME_P(ID_NODE) \
2384 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
2385 sizeof (VTABLE_NAME) - 1))
2386 #define VCTABLE_NAME "__vc_"
2387 #define VLIST_NAME_FORMAT "__vl_%s"
2388 #define VFIELD_BASE "__vfb"
2389 #define VFIELD_NAME "__vptr_"
2390 #define VFIELD_NAME_P(ID_NODE) \
2391 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
2392 sizeof (VFIELD_NAME) - 1))
2393 #define VFIELD_NAME_FORMAT "_vptr_%s"
2394 #define VBASE_NAME "__vb_"
2395 #define VBASE_NAME_P(ID_NODE) \
2396 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
2397 sizeof (VBASE_NAME) - 1))
2398 #define VBASE_NAME_FORMAT "__vb_%s"
2399 #define STATIC_NAME_FORMAT "__static_%s_%s"
2401 #define ANON_AGGRNAME_PREFIX "__anon_"
2402 #define ANON_AGGRNAME_P(ID_NODE) \
2403 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
2404 sizeof (ANON_AGGRNAME_PREFIX) - 1))
2405 #define ANON_AGGRNAME_FORMAT "__anon_%d"
2406 #define ANON_PARMNAME_FORMAT "__%d"
2407 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2408 && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
2409 && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
2411 #endif /* NO_DOT_IN_LABEL */
2412 #endif /* NO_DOLLAR_IN_LABEL */
2414 #define THIS_NAME "this"
2415 #define DESTRUCTOR_NAME_FORMAT "~%s"
2416 #define FILE_FUNCTION_PREFIX_LEN 9
2417 #define CTOR_NAME "__ct"
2418 #define DTOR_NAME "__dt"
2420 #define IN_CHARGE_NAME "__in_chrg"
2421 #define VLIST_NAME "__vlist"
2422 #define VLIST1_NAME "__vlist1"
2423 #define VLIST_TYPE_NAME "6_Vlist"
2425 #define VTBL_PTR_TYPE "__vtbl_ptr_type"
2426 #define VTABLE_DELTA_NAME "__delta"
2427 #define VTABLE_INDEX_NAME "__index"
2428 #define VTABLE_PFN_NAME "__pfn"
2429 #define VTABLE_DELTA2_NAME "__delta2"
2431 #define SIGNATURE_FIELD_NAME "__s_"
2432 #define SIGNATURE_FIELD_NAME_FORMAT "__s_%s"
2433 #define SIGNATURE_OPTR_NAME "__optr"
2434 #define SIGNATURE_SPTR_NAME "__sptr"
2435 #define SIGNATURE_POINTER_NAME "__sp_"
2436 #define SIGNATURE_POINTER_NAME_FORMAT "__%s%s%ssp_%s"
2437 #define SIGNATURE_REFERENCE_NAME "__sr_"
2438 #define SIGNATURE_REFERENCE_NAME_FORMAT "__%s%s%ssr_%s"
2440 #define SIGTABLE_PTR_TYPE "__sigtbl_ptr_type"
2441 #define SIGTABLE_NAME_FORMAT "__st_%s_%s"
2442 #define SIGTABLE_NAME_FORMAT_LONG "__st_%s_%s_%d"
2443 #define SIGTABLE_TAG_NAME "__tag"
2444 #define SIGTABLE_VB_OFF_NAME "__vb_off"
2445 #define SIGTABLE_VT_OFF_NAME "__vt_off"
2446 #define EXCEPTION_CLEANUP_NAME "exception cleanup"
2448 #define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
2450 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
2452 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2453 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
2454 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
2455 && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
2457 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2458 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
2459 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2461 #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2462 && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
2463 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2465 #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
2466 #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
2468 /* For anonymous aggregate types, we need some sort of name to
2469 hold on to. In practice, this should not appear, but it should
2470 not be harmful if it does. */
2471 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2472 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
2473 #define ANON_PARMNAME_FORMAT "_%d"
2474 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2475 && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
2476 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
2478 /* Store the vbase pointer field name for type TYPE into pointer BUF. */
2479 #define FORMAT_VBASE_NAME(BUF,TYPE) do { \
2480 char *wbuf = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \
2481 + sizeof (VBASE_NAME) + 1); \
2482 sprintf (wbuf, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \
2486 /* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
2488 #define MAIN_NAME_P(ID_NODE) \
2489 (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
2491 /* Returns non-zero iff NODE is a declaration for the global function
2493 #define DECL_MAIN_P(NODE) \
2494 (TREE_CODE (NODE) == FUNCTION_DECL \
2495 && DECL_LANGUAGE (NODE) == lang_c \
2496 && DECL_NAME (NODE) != NULL_TREE \
2497 && MAIN_NAME_P (DECL_NAME (NODE)))
2500 /* Define the sets of attributes that member functions and baseclasses
2501 can have. These are sensible combinations of {public,private,protected}
2502 cross {virtual,non-virtual}. */
2505 extern tree access_default_node; /* 0 */
2506 extern tree access_public_node; /* 1 */
2507 extern tree access_protected_node; /* 2 */
2508 extern tree access_private_node; /* 3 */
2509 extern tree access_default_virtual_node; /* 4 */
2510 extern tree access_public_virtual_node; /* 5 */
2511 extern tree access_protected_virtual_node; /* 6 */
2512 extern tree access_private_virtual_node; /* 7 */
2514 /* Things for handling inline functions. */
2516 struct pending_inline
2518 struct pending_inline *next; /* pointer to next in chain */
2519 int lineno; /* line number we got the text from */
2520 char *filename; /* name of file we were processing */
2521 tree fndecl; /* FUNCTION_DECL that brought us here */
2522 int token; /* token we were scanning */
2523 int token_value; /* value of token we were scanning (YYSTYPE) */
2525 char *buf; /* pointer to character stream */
2526 int len; /* length of stream */
2527 unsigned int can_free : 1; /* free this after we're done with it? */
2528 unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
2529 unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */
2533 extern struct pending_inline *pending_inlines;
2535 /* Positive values means that we cannot make optimizing assumptions about
2536 `this'. Negative values means we know `this' to be of static type. */
2538 extern int flag_this_is_variable;
2540 /* Nonzero means generate 'rtti' that give run-time type information. */
2542 extern int flag_rtti;
2544 /* Nonzero means do emit exported implementations of functions even if
2545 they can be inlined. */
2547 extern int flag_implement_inlines;
2549 /* Nonzero means templates obey #pragma interface and implementation. */
2551 extern int flag_external_templates;
2553 /* Nonzero means templates are emitted where they are instantiated. */
2555 extern int flag_alt_external_templates;
2557 /* Nonzero means implicit template instantiations are emitted. */
2559 extern int flag_implicit_templates;
2561 /* Nonzero if we want to emit defined symbols with common-like linkage as
2562 weak symbols where possible, in order to conform to C++ semantics.
2563 Otherwise, emit them as local symbols. */
2565 extern int flag_weak;
2567 /* Nonzero to enable experimental ABI changes. */
2569 extern int flag_new_abi;
2571 /* Nonzero to not ignore namespace std. */
2573 extern int flag_honor_std;
2575 /* Nonzero if we're done parsing and into end-of-file activities. */
2579 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
2581 /* The following two can be derived from the previous one */
2582 extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
2584 /* Some macros for char-based bitfields. */
2585 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
2586 #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
2587 #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
2589 /* These are uses as bits in flags passed to build_method_call
2590 to control its error reporting behavior.
2592 LOOKUP_PROTECT means flag access violations.
2593 LOOKUP_COMPLAIN mean complain if no suitable member function
2594 matching the arguments is found.
2595 LOOKUP_NORMAL is just a combination of these two.
2596 LOOKUP_NONVIRTUAL means make a direct call to the member function found
2597 LOOKUP_GLOBAL means search through the space of overloaded functions,
2598 as well as the space of member functions.
2599 LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
2600 in the parameter list.
2601 LOOKUP_HAS_VLIST means that the "vlist" variable is already in
2603 LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
2604 DIRECT_BIND means that if a temporary is created, it should be created so
2605 that it lives as long as the current variable bindings; otherwise it
2606 only lives until the end of the complete-expression.
2607 LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
2608 after. Note, LOOKUP_COMPLAIN is checked and error messages printed
2609 before LOOKUP_SPECULATIVELY is checked.
2610 LOOKUP_NO_CONVERSION means that user-defined conversions are not
2611 permitted. Built-in conversions are permitted.
2612 LOOKUP_DESTRUCTOR means explicit call to destructor.
2613 LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references.
2615 These are used in global lookup to support elaborated types and
2618 LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
2619 LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
2620 LOOKUP_PREFER_BOTH means class-or-namespace-name.
2621 LOOKUP_TEMPLATES_EXPECTED means that class templates also count
2624 #define LOOKUP_PROTECT (1)
2625 #define LOOKUP_COMPLAIN (2)
2626 #define LOOKUP_NORMAL (3)
2627 /* #define LOOKUP_UNUSED (4) */
2628 #define LOOKUP_NONVIRTUAL (8)
2629 #define LOOKUP_GLOBAL (16)
2630 #define LOOKUP_HAS_IN_CHARGE (32)
2631 #define LOOKUP_SPECULATIVELY (64)
2632 #define LOOKUP_ONLYCONVERTING (128)
2633 #define DIRECT_BIND (256)
2634 #define LOOKUP_NO_CONVERSION (512)
2635 #define LOOKUP_DESTRUCTOR (512)
2636 #define LOOKUP_NO_TEMP_BIND (1024)
2637 #define LOOKUP_PREFER_TYPES (2048)
2638 #define LOOKUP_PREFER_NAMESPACES (4096)
2639 #define LOOKUP_PREFER_BOTH (6144)
2640 #define LOOKUP_TEMPLATES_EXPECTED (8192)
2641 #define LOOKUP_HAS_VLIST (16384)
2643 #define LOOKUP_NAMESPACES_ONLY(f) \
2644 (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES))
2645 #define LOOKUP_TYPES_ONLY(f) \
2646 (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
2647 #define LOOKUP_QUALIFIERS_ONLY(f) ((f) & LOOKUP_PREFER_BOTH)
2650 /* These flags are used by the conversion code.
2651 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
2652 CONV_STATIC : Perform the explicit conversions for static_cast.
2653 CONV_CONST : Perform the explicit conversions for const_cast.
2654 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
2655 CONV_PRIVATE : Perform upcasts to private bases.
2656 CONV_FORCE_TEMP : Require a new temporary when converting to the same
2659 #define CONV_IMPLICIT 1
2660 #define CONV_STATIC 2
2661 #define CONV_CONST 4
2662 #define CONV_REINTERPRET 8
2663 #define CONV_PRIVATE 16
2664 /* #define CONV_NONCONVERTING 32 */
2665 #define CONV_FORCE_TEMP 64
2666 #define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
2667 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2669 #define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2670 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
2672 /* Used by build_expr_type_conversion to indicate which types are
2673 acceptable as arguments to the expression under consideration. */
2675 #define WANT_INT 1 /* integer types, including bool */
2676 #define WANT_FLOAT 2 /* floating point types */
2677 #define WANT_ENUM 4 /* enumerated types */
2678 #define WANT_POINTER 8 /* pointer types */
2679 #define WANT_NULL 16 /* null pointer constant */
2680 #define WANT_ARITH (WANT_INT | WANT_FLOAT)
2682 /* Used with comptypes, and related functions, to guide type
2685 #define COMPARE_STRICT 0 /* Just check if the types are the
2687 #define COMPARE_BASE 1 /* Check to see if the second type is
2688 derived from the first, or if both
2689 are pointers (or references) and
2690 the types pointed to by the second
2691 type is derived from the pointed to
2693 #define COMPARE_RELAXED 2 /* Like COMPARE_DERIVED, but in
2694 reverse. Also treat enmeration
2695 types as the same as integer types
2696 of the same width. */
2697 #define COMPARE_REDECLARATION 4 /* The comparsion is being done when
2698 another declaration of an existing
2700 #define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
2701 extra-linguistic type attributes. */
2703 /* Used with push_overloaded_decl. */
2704 #define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
2705 regardless of the current scope. */
2706 #define PUSH_LOCAL 1 /* Push the DECL into the current
2708 #define PUSH_USING 2 /* We are pushing this DECL as the
2709 result of a using declaration. */
2711 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
2713 #define same_type_p(type1, type2) \
2714 comptypes ((type1), (type2), COMPARE_STRICT)
2716 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
2717 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
2718 class derived from the type pointed to (referred to) by TYPE1. */
2719 #define same_or_base_type_p(type1, type2) \
2720 comptypes ((type1), (type2), COMPARE_BASE)
2722 /* These macros are used to access a TEMPLATE_PARM_INDEX. */
2723 #define TEMPLATE_PARM_IDX(NODE) (((template_parm_index*) NODE)->index)
2724 #define TEMPLATE_PARM_LEVEL(NODE) (((template_parm_index*) NODE)->level)
2725 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
2726 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (((template_parm_index*) NODE)->orig_level)
2727 #define TEMPLATE_PARM_DECL(NODE) (((template_parm_index*) NODE)->decl)
2729 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM
2730 and TEMPLATE_TEMPLATE_PARM nodes. */
2731 #define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
2732 #define TEMPLATE_TYPE_IDX(NODE) \
2733 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2734 #define TEMPLATE_TYPE_LEVEL(NODE) \
2735 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2736 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
2737 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2738 #define TEMPLATE_TYPE_DECL(NODE) \
2739 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2742 /* Indexed by TREE_CODE, these tables give C-looking names to
2743 operators represented by TREE_CODES. For example,
2744 opname_tab[(int) MINUS_EXPR] == "-". */
2745 extern char **opname_tab, **assignop_tab;
2748 extern int check_dtor_name PROTO((tree, tree));
2749 extern int get_arglist_len_in_bytes PROTO((tree));
2751 extern tree build_vfield_ref PROTO((tree, tree));
2752 extern tree resolve_scope_to_name PROTO((tree, tree));
2753 extern tree build_scoped_method_call PROTO((tree, tree, tree, tree));
2754 extern tree build_addr_func PROTO((tree));
2755 extern tree build_call PROTO((tree, tree, tree));
2756 extern tree build_method_call PROTO((tree, tree, tree, tree, int));
2757 extern int null_ptr_cst_p PROTO((tree));
2758 extern tree type_decays_to PROTO((tree));
2759 extern tree build_user_type_conversion PROTO((tree, tree, int));
2760 extern tree build_new_function_call PROTO((tree, tree));
2761 extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree));
2762 extern tree build_op_new_call PROTO((enum tree_code, tree, tree, int));
2763 extern tree build_op_delete_call PROTO((enum tree_code, tree, tree, int, tree));
2764 extern int can_convert PROTO((tree, tree));
2765 extern int can_convert_arg PROTO((tree, tree, tree));
2766 extern int enforce_access PROTO((tree, tree));
2767 extern tree convert_default_arg PROTO((tree, tree, tree));
2768 extern tree convert_arg_to_ellipsis PROTO((tree));
2769 extern int is_properly_derived_from PROTO((tree, tree));
2772 extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
2773 extern tree build_vtbl_ref PROTO((tree, tree));
2774 extern tree build_vfn_ref PROTO((tree *, tree, tree));
2775 extern void add_method PROTO((tree, tree *, tree));
2776 extern int currently_open_class PROTO((tree));
2777 extern tree get_vfield_offset PROTO((tree));
2778 extern void duplicate_tag_error PROTO((tree));
2779 extern tree finish_struct PROTO((tree, tree, int));
2780 extern void finish_struct_1 PROTO((tree, int));
2781 extern int resolves_to_fixed_type_p PROTO((tree, int *));
2782 extern void init_class_processing PROTO((void));
2783 extern int is_empty_class PROTO((tree));
2784 extern void pushclass PROTO((tree, int));
2785 extern void popclass PROTO((void));
2786 extern void push_nested_class PROTO((tree, int));
2787 extern void pop_nested_class PROTO((void));
2788 extern void push_lang_context PROTO((tree));
2789 extern void pop_lang_context PROTO((void));
2790 extern tree instantiate_type PROTO((tree, tree, int));
2791 extern void print_class_statistics PROTO((void));
2792 extern void push_cache_obstack PROTO((void));
2793 extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *, tree));
2794 extern void build_self_reference PROTO((void));
2795 extern void warn_hidden PROTO((tree));
2796 extern tree get_enclosing_class PROTO((tree));
2797 int is_base_of_enclosing_class PROTO((tree, tree));
2798 extern void unreverse_member_declarations PROTO((tree));
2799 extern void invalidate_class_lookup_cache PROTO((void));
2800 extern void maybe_note_name_used_in_class PROTO((tree, tree));
2801 extern void note_name_declared_in_class PROTO((tree, tree));
2804 extern tree convert_to_reference PROTO((tree, tree, int, int, tree));
2805 extern tree convert_from_reference PROTO((tree));
2806 extern tree convert_pointer_to_real PROTO((tree, tree));
2807 extern tree convert_pointer_to PROTO((tree, tree));
2808 extern tree ocp_convert PROTO((tree, tree, int, int));
2809 extern tree cp_convert PROTO((tree, tree));
2810 extern tree convert PROTO((tree, tree));
2811 extern tree convert_force PROTO((tree, tree, int));
2812 extern tree build_type_conversion PROTO((tree, tree, int));
2813 extern tree build_expr_type_conversion PROTO((int, tree, int));
2814 extern tree type_promotes_to PROTO((tree));
2815 extern tree perform_qualification_conversions PROTO((tree, tree));
2818 /* resume_binding_level */
2819 extern void set_identifier_local_value PROTO((tree, tree));
2820 extern int global_bindings_p PROTO((void));
2821 extern int toplevel_bindings_p PROTO((void));
2822 extern int namespace_bindings_p PROTO((void));
2823 extern void keep_next_level PROTO((void));
2824 extern int kept_level_p PROTO((void));
2825 extern void declare_parm_level PROTO((void));
2826 extern void declare_pseudo_global_level PROTO((void));
2827 extern int pseudo_global_level_p PROTO((void));
2828 extern void set_class_shadows PROTO((tree));
2829 extern void pushlevel PROTO((int));
2830 extern void note_level_for_for PROTO((void));
2831 extern void pushlevel_temporary PROTO((int));
2832 extern tree poplevel PROTO((int, int, int));
2833 extern void resume_level PROTO((struct binding_level *));
2834 extern void delete_block PROTO((tree));
2835 extern void insert_block PROTO((tree));
2836 extern void add_block_current_level PROTO((tree));
2837 extern void set_block PROTO((tree));
2838 extern void pushlevel_class PROTO((void));
2839 extern void print_binding_stack PROTO((void));
2840 extern void print_binding_level PROTO((struct binding_level *));
2841 extern void push_namespace PROTO((tree));
2842 extern void pop_namespace PROTO((void));
2843 extern void maybe_push_to_top_level PROTO((int));
2844 extern void push_to_top_level PROTO((void));
2845 extern void pop_from_top_level PROTO((void));
2846 extern tree identifier_type_value PROTO((tree));
2847 extern void set_identifier_type_value PROTO((tree, tree));
2848 extern void pop_everything PROTO((void));
2849 extern void pushtag PROTO((tree, tree, int));
2850 extern tree make_anon_name PROTO((void));
2851 extern void clear_anon_tags PROTO((void));
2852 extern int decls_match PROTO((tree, tree));
2853 extern int duplicate_decls PROTO((tree, tree));
2854 extern tree pushdecl PROTO((tree));
2855 extern tree pushdecl_top_level PROTO((tree));
2856 extern void pushdecl_class_level PROTO((tree));
2858 extern void pushdecl_nonclass_level PROTO((tree));
2860 extern tree pushdecl_namespace_level PROTO((tree));
2861 extern tree push_using_decl PROTO((tree, tree));
2862 extern tree push_using_directive PROTO((tree));
2863 extern void push_class_level_binding PROTO((tree, tree));
2864 extern tree implicitly_declare PROTO((tree));
2865 extern tree lookup_label PROTO((tree));
2866 extern tree shadow_label PROTO((tree));
2867 extern tree define_label PROTO((char *, int, tree));
2868 extern void push_switch PROTO((void));
2869 extern void pop_switch PROTO((void));
2870 extern void define_case_label PROTO((void));
2871 extern tree getdecls PROTO((void));
2872 extern tree gettags PROTO((void));
2874 extern void set_current_level_tags_transparency PROTO((int));
2876 extern tree binding_for_name PROTO((tree, tree));
2877 extern tree namespace_binding PROTO((tree, tree));
2878 extern void set_namespace_binding PROTO((tree, tree, tree));
2879 extern tree lookup_namespace_name PROTO((tree, tree));
2880 extern tree build_typename_type PROTO((tree, tree, tree, tree));
2881 extern tree make_typename_type PROTO((tree, tree));
2882 extern tree lookup_name_nonclass PROTO((tree));
2883 extern tree lookup_function_nonclass PROTO((tree, tree));
2884 extern tree lookup_name PROTO((tree, int));
2885 extern tree lookup_name_current_level PROTO((tree));
2886 extern tree lookup_type_current_level PROTO((tree));
2887 extern tree lookup_name_namespace_only PROTO((tree));
2888 extern void begin_only_namespace_names PROTO((void));
2889 extern void end_only_namespace_names PROTO((void));
2890 extern tree namespace_ancestor PROTO((tree, tree));
2891 extern int lookup_using_namespace PROTO((tree,tree,tree,tree,int));
2892 extern int qualified_lookup_using_namespace PROTO((tree,tree,tree,int));
2893 extern tree auto_function PROTO((tree, tree, enum built_in_function));
2894 extern void init_decl_processing PROTO((void));
2895 extern int init_type_desc PROTO((void));
2896 extern tree define_function
2897 PROTO((const char *, tree, enum built_in_function,
2898 void (*) (tree), const char *));
2899 extern tree check_tag_decl PROTO((tree));
2900 extern void shadow_tag PROTO((tree));
2901 extern tree groktypename PROTO((tree));
2902 extern tree start_decl PROTO((tree, tree, int, tree, tree));
2903 extern void start_decl_1 PROTO((tree));
2904 extern void cp_finish_decl PROTO((tree, tree, tree, int, int));
2905 extern void finish_decl PROTO((tree, tree, tree));
2906 extern void expand_static_init PROTO((tree, tree));
2907 extern int complete_array_type PROTO((tree, tree, int));
2908 extern tree build_ptrmemfunc_type PROTO((tree));
2909 /* the grokdeclarator prototype is in decl.h */
2910 extern int parmlist_is_exprlist PROTO((tree));
2911 extern int copy_args_p PROTO((tree));
2912 extern int grok_ctor_properties PROTO((tree, tree));
2913 extern void grok_op_properties PROTO((tree, int, int));
2914 extern tree xref_tag PROTO((tree, tree, int));
2915 extern tree xref_tag_from_type PROTO((tree, tree, int));
2916 extern void xref_basetypes PROTO((tree, tree, tree, tree));
2917 extern tree start_enum PROTO((tree));
2918 extern tree finish_enum PROTO((tree));
2919 extern tree build_enumerator PROTO((tree, tree, tree));
2920 extern int start_function PROTO((tree, tree, tree, int));
2921 extern void expand_start_early_try_stmts PROTO((void));
2922 extern void store_parm_decls PROTO((void));
2923 extern void store_return_init PROTO((tree, tree));
2924 extern void finish_function PROTO((int, int, int));
2925 extern tree start_method PROTO((tree, tree, tree));
2926 extern tree finish_method PROTO((tree));
2927 extern void hack_incomplete_structures PROTO((tree));
2928 extern tree maybe_build_cleanup_and_delete PROTO((tree));
2929 extern tree maybe_build_cleanup PROTO((tree));
2930 extern void cplus_expand_expr_stmt PROTO((tree));
2931 extern void finish_stmt PROTO((void));
2932 extern void push_cp_function_context PROTO((tree));
2933 extern void pop_cp_function_context PROTO((tree));
2934 extern int in_function_p PROTO((void));
2935 extern void replace_defarg PROTO((tree, tree));
2936 extern void print_other_binding_stack PROTO((struct binding_level *));
2937 extern void revert_static_member_fn PROTO((tree*, tree*, tree*));
2938 extern void fixup_anonymous_union PROTO((tree));
2939 extern int check_static_variable_definition PROTO((tree, tree));
2940 extern void push_local_binding PROTO((tree, tree, int));
2941 extern int push_class_binding PROTO((tree, tree));
2942 extern tree check_default_argument PROTO((tree, tree));
2943 extern tree push_overloaded_decl PROTO((tree, int));
2944 extern void clear_identifier_class_values PROTO((void));
2945 extern void storetags PROTO((tree));
2946 extern int vtable_decl_p PROTO((tree, void *));
2947 extern int vtype_decl_p PROTO((tree, void *));
2948 extern int sigtable_decl_p PROTO((tree, void *));
2949 typedef int (*walk_globals_pred) PROTO((tree, void *));
2950 typedef int (*walk_globals_fn) PROTO((tree *, void *));
2951 extern int walk_globals PROTO((walk_globals_pred,
2954 typedef int (*walk_namespaces_fn) PROTO((tree, void *));
2955 extern int walk_namespaces PROTO((walk_namespaces_fn,
2957 extern int wrapup_globals_for_namespace PROTO((tree, void *));
2960 extern int check_java_method PROTO((tree));
2961 extern int lang_decode_option PROTO((int, char **));
2962 extern tree grok_method_quals PROTO((tree, tree, tree));
2963 extern void warn_if_unknown_interface PROTO((tree));
2964 extern void grok_x_components PROTO((tree));
2965 extern void maybe_retrofit_in_chrg PROTO((tree));
2966 extern void maybe_make_one_only PROTO((tree));
2967 extern void grokclassfn PROTO((tree, tree, enum overload_flags, tree));
2968 extern tree grok_alignof PROTO((tree));
2969 extern tree grok_array_decl PROTO((tree, tree));
2970 extern tree delete_sanity PROTO((tree, tree, int, int));
2971 extern tree check_classfn PROTO((tree, tree));
2972 extern void check_member_template PROTO((tree));
2973 extern tree grokfield PROTO((tree, tree, tree, tree, tree));
2974 extern tree grokbitfield PROTO((tree, tree, tree));
2975 extern tree groktypefield PROTO((tree, tree));
2976 extern tree grokoptypename PROTO((tree, tree));
2977 extern int copy_assignment_arg_p PROTO((tree, int));
2978 extern void cplus_decl_attributes PROTO((tree, tree, tree));
2979 extern tree constructor_name_full PROTO((tree));
2980 extern tree constructor_name PROTO((tree));
2981 extern void setup_vtbl_ptr PROTO((void));
2982 extern void mark_inline_for_output PROTO((tree));
2983 extern void clear_temp_name PROTO((void));
2984 extern tree get_temp_name PROTO((tree, int));
2985 extern tree get_temp_regvar PROTO((tree, tree));
2986 extern void finish_anon_union PROTO((tree));
2987 extern tree finish_table PROTO((tree, tree, tree, int));
2988 extern void finish_builtin_type PROTO((tree, const char *,
2989 tree *, int, tree));
2990 extern tree coerce_new_type PROTO((tree));
2991 extern tree coerce_delete_type PROTO((tree));
2992 extern void comdat_linkage PROTO((tree));
2993 extern void import_export_class PROTO((tree));
2994 extern void import_export_vtable PROTO((tree, tree, int));
2995 extern void import_export_decl PROTO((tree));
2996 extern tree build_cleanup PROTO((tree));
2997 extern void finish_file PROTO((void));
2998 extern tree reparse_absdcl_as_expr PROTO((tree, tree));
2999 extern tree reparse_absdcl_as_casts PROTO((tree, tree));
3000 extern tree build_expr_from_tree PROTO((tree));
3001 extern tree reparse_decl_as_expr PROTO((tree, tree));
3002 extern tree finish_decl_parsing PROTO((tree));
3003 extern tree check_cp_case_value PROTO((tree));
3004 extern void set_decl_namespace PROTO((tree, tree, int));
3005 extern tree current_decl_namespace PROTO((void));
3006 extern void push_decl_namespace PROTO((tree));
3007 extern void pop_decl_namespace PROTO((void));
3008 extern void push_scope PROTO((tree));
3009 extern void pop_scope PROTO((tree));
3010 extern void do_namespace_alias PROTO((tree, tree));
3011 extern void do_toplevel_using_decl PROTO((tree));
3012 extern void do_local_using_decl PROTO((tree));
3013 extern tree do_class_using_decl PROTO((tree));
3014 extern void do_using_directive PROTO((tree));
3015 extern void check_default_args PROTO((tree));
3016 extern void mark_used PROTO((tree));
3017 extern tree handle_class_head PROTO((tree, tree, tree));
3018 extern tree lookup_arg_dependent PROTO((tree, tree, tree));
3019 extern void finish_static_data_member_decl PROTO((tree, tree, tree, int, int));
3022 /* The cp_* functions aren't suitable for ATTRIBUTE_PRINTF. */
3023 extern void cp_error PVPROTO((const char *, ...));
3024 extern void cp_error_at PVPROTO((const char *, ...));
3025 extern void cp_warning PVPROTO((const char *, ...));
3026 extern void cp_warning_at PVPROTO((const char *, ...));
3027 extern void cp_pedwarn PVPROTO((const char *, ...));
3028 extern void cp_pedwarn_at PVPROTO((const char *, ...));
3029 extern void cp_compiler_error PVPROTO((const char *, ...));
3030 extern void cp_sprintf PVPROTO((const char *, ...));
3031 extern void cp_deprecated PROTO((const char*));
3034 extern void init_error PROTO((void));
3035 extern char *fndecl_as_string PROTO((tree, int));
3036 extern char *type_as_string PROTO((tree, int));
3037 extern char *type_as_string_real PROTO((tree, int, int));
3038 extern char *args_as_string PROTO((tree, int));
3039 extern char *decl_as_string PROTO((tree, int));
3040 extern char *expr_as_string PROTO((tree, int));
3041 extern char *code_as_string PROTO((enum tree_code, int));
3042 extern char *language_as_string PROTO((enum languages, int));
3043 extern char *parm_as_string PROTO((int, int));
3044 extern char *op_as_string PROTO((enum tree_code, int));
3045 extern char *assop_as_string PROTO((enum tree_code, int));
3046 extern char *cv_as_string PROTO((tree, int));
3047 extern char *lang_decl_name PROTO((tree, int));
3048 extern char *cp_file_of PROTO((tree));
3049 extern int cp_line_of PROTO((tree));
3052 extern void init_exception_processing PROTO((void));
3053 extern void expand_start_catch_block PROTO((tree, tree));
3054 extern void expand_end_catch_block PROTO((void));
3055 extern void expand_builtin_throw PROTO((void));
3056 extern void expand_start_eh_spec PROTO((void));
3057 extern void expand_exception_blocks PROTO((void));
3058 extern tree start_anon_func PROTO((void));
3059 extern void end_anon_func PROTO((void));
3060 extern void expand_throw PROTO((tree));
3061 extern tree build_throw PROTO((tree));
3062 extern void mark_all_runtime_matches PROTO((void));
3065 extern void init_cplus_expand PROTO((void));
3066 extern void fixup_result_decl PROTO((tree, struct rtx_def *));
3067 extern int extract_init PROTO((tree, tree));
3068 extern void do_case PROTO((tree, tree));
3071 extern int is_friend PROTO((tree, tree));
3072 extern void make_friend_class PROTO((tree, tree));
3073 extern void add_friend PROTO((tree, tree));
3074 extern void add_friends PROTO((tree, tree, tree));
3075 extern tree do_friend PROTO((tree, tree, tree, tree, tree, enum overload_flags, tree, int));
3078 extern void init_init_processing PROTO((void));
3079 extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree));
3080 extern void emit_base_init PROTO((tree, int));
3081 extern void check_base_init PROTO((tree));
3082 extern void expand_member_init PROTO((tree, tree, tree));
3083 extern void expand_aggr_init PROTO((tree, tree, int));
3084 extern int is_aggr_typedef PROTO((tree, int));
3085 extern int is_aggr_type PROTO((tree, int));
3086 extern tree get_aggr_from_typedef PROTO((tree, int));
3087 extern tree get_type_value PROTO((tree));
3088 extern tree build_member_call PROTO((tree, tree, tree));
3089 extern tree build_offset_ref PROTO((tree, tree));
3090 extern tree resolve_offset_ref PROTO((tree));
3091 extern tree decl_constant_value PROTO((tree));
3092 extern tree build_new PROTO((tree, tree, tree, int));
3093 extern tree build_new_1 PROTO((tree));
3094 extern tree expand_vec_init PROTO((tree, tree, tree, tree, int));
3095 extern tree build_x_delete PROTO((tree, int, tree));
3096 extern tree build_delete PROTO((tree, tree, tree, int, int));
3097 extern tree build_vbase_delete PROTO((tree, tree));
3098 extern tree build_vec_delete PROTO((tree, tree, tree, tree, int));
3099 extern tree build_base_dtor_call PROTO((tree, tree, tree));
3100 extern void init_vlist PROTO((tree));
3105 extern char *file_name_nondirectory PROTO((const char *));
3106 extern tree make_pointer_declarator PROTO((tree, tree));
3107 extern tree make_reference_declarator PROTO((tree, tree));
3108 extern tree make_call_declarator PROTO((tree, tree, tree, tree));
3109 extern void set_quals_and_spec PROTO((tree, tree, tree));
3110 extern char *operator_name_string PROTO((tree));
3111 extern void lang_init PROTO((void));
3112 extern void lang_finish PROTO((void));
3114 extern void reinit_lang_specific PROTO((void));
3116 extern void reinit_parse_for_function PROTO((void));
3117 extern void print_parse_statistics PROTO((void));
3118 extern void extract_interface_info PROTO((void));
3119 extern void do_pending_inlines PROTO((void));
3120 extern void process_next_inline PROTO((tree));
3121 extern struct pending_input *save_pending_input PROTO((void));
3122 extern void restore_pending_input PROTO((struct pending_input *));
3123 extern void yyungetc PROTO((int, int));
3124 extern void reinit_parse_for_method PROTO((int, tree));
3125 extern void reinit_parse_for_block PROTO((int, struct obstack *));
3126 extern tree cons_up_default_function PROTO((tree, tree, int));
3127 extern void check_for_missing_semicolon PROTO((tree));
3128 extern void note_got_semicolon PROTO((tree));
3129 extern void note_list_got_semicolon PROTO((tree));
3130 extern void do_pending_lang_change PROTO((void));
3131 extern int identifier_type PROTO((tree));
3132 extern void see_typename PROTO((void));
3133 extern tree do_identifier PROTO((tree, int, tree));
3134 extern tree do_scoped_id PROTO((tree, int));
3135 extern tree identifier_typedecl_value PROTO((tree));
3136 extern int real_yylex PROTO((void));
3137 extern int is_rid PROTO((tree));
3138 extern tree build_lang_decl PROTO((enum tree_code, tree, tree));
3139 extern void retrofit_lang_decl PROTO((tree));
3140 extern tree build_lang_field_decl PROTO((enum tree_code, tree, tree));
3141 extern void copy_lang_decl PROTO((tree));
3142 extern tree make_lang_type PROTO((enum tree_code));
3143 extern void dump_time_statistics PROTO((void));
3144 extern void compiler_error PVPROTO((const char *, ...))
3146 extern void yyerror PROTO((const char *));
3147 extern void clear_inline_text_obstack PROTO((void));
3148 extern void maybe_snarf_defarg PROTO((void));
3149 extern tree snarf_defarg PROTO((void));
3150 extern void add_defarg_fn PROTO((tree));
3151 extern void do_pending_defargs PROTO((void));
3152 extern int identifier_type PROTO((tree));
3153 extern void yyhook PROTO((int));
3154 extern int cp_type_qual_from_rid PROTO((tree));
3157 extern void init_method PROTO((void));
3158 extern void do_inline_function_hair PROTO((tree, tree));
3159 extern char *build_overload_name PROTO((tree, int, int));
3160 extern tree build_static_name PROTO((tree, tree));
3161 extern tree build_decl_overload PROTO((tree, tree, int));
3162 extern tree build_decl_overload_real PROTO((tree, tree, tree, tree,
3164 extern void set_mangled_name_for_decl PROTO((tree));
3165 extern tree build_typename_overload PROTO((tree));
3166 extern tree build_overload_with_type PROTO((tree, tree));
3167 extern tree build_destructor_name PROTO((tree, int));
3168 extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree));
3169 extern tree hack_identifier PROTO((tree, tree));
3170 extern tree make_thunk PROTO((tree, int));
3171 extern void emit_thunk PROTO((tree));
3172 extern void synthesize_method PROTO((tree));
3173 extern tree get_id_2 PROTO((char *, tree));
3174 extern tree get_vlist_vtable_id PROTO((tree, tree));
3178 extern void check_template_shadow PROTO ((tree));
3179 extern tree innermost_args PROTO ((tree));
3180 extern tree tsubst PROTO ((tree, tree, int, tree));
3181 extern tree tsubst_expr PROTO ((tree, tree, int, tree));
3182 extern tree tsubst_copy PROTO ((tree, tree, int, tree));
3183 extern void maybe_begin_member_template_processing PROTO((tree));
3184 extern void maybe_end_member_template_processing PROTO((void));
3185 extern tree finish_member_template_decl PROTO((tree));
3186 extern void begin_template_parm_list PROTO((void));
3187 extern void begin_specialization PROTO((void));
3188 extern void reset_specialization PROTO((void));
3189 extern void end_specialization PROTO((void));
3190 extern void begin_explicit_instantiation PROTO((void));
3191 extern void end_explicit_instantiation PROTO((void));
3192 extern tree check_explicit_specialization PROTO((tree, tree, int, int));
3193 extern tree process_template_parm PROTO((tree, tree));
3194 extern tree end_template_parm_list PROTO((tree));
3195 extern void end_template_decl PROTO((void));
3196 extern tree current_template_args PROTO((void));
3197 extern tree push_template_decl PROTO((tree));
3198 extern tree push_template_decl_real PROTO((tree, int));
3199 extern void redeclare_class_template PROTO((tree, tree));
3200 extern tree lookup_template_class PROTO((tree, tree, tree, tree, int));
3201 extern tree lookup_template_function PROTO((tree, tree));
3202 extern int uses_template_parms PROTO((tree));
3203 extern tree instantiate_class_template PROTO((tree));
3204 extern tree instantiate_template PROTO((tree, tree));
3205 extern void overload_template_name PROTO((tree));
3206 extern int fn_type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t));
3207 struct tinst_level *tinst_for_decl PROTO((void));
3208 extern void mark_decl_instantiated PROTO((tree, int));
3209 extern int more_specialized PROTO((tree, tree, tree));
3210 extern void mark_class_instantiated PROTO((tree, int));
3211 extern void do_decl_instantiation PROTO((tree, tree, tree));
3212 extern void do_type_instantiation PROTO((tree, tree));
3213 extern tree instantiate_decl PROTO((tree));
3214 extern tree do_poplevel PROTO((void));
3215 extern tree get_bindings PROTO((tree, tree, tree));
3217 extern void add_tree PROTO((tree));
3218 extern void begin_tree PROTO((void));
3219 extern void end_tree PROTO((void));
3220 extern void add_maybe_template PROTO((tree, tree));
3221 extern void pop_tinst_level PROTO((void));
3222 extern int more_specialized_class PROTO((tree, tree));
3223 extern void do_pushlevel PROTO((void));
3224 extern int is_member_template PROTO((tree));
3225 extern int template_parms_equal PROTO((tree, tree));
3226 extern int comp_template_parms PROTO((tree, tree));
3227 extern int template_class_depth PROTO((tree));
3228 extern int is_specialization_of PROTO((tree, tree));
3229 extern int comp_template_args PROTO((tree, tree));
3230 extern void maybe_process_partial_specialization PROTO((tree));
3231 extern void maybe_check_template_type PROTO((tree));
3232 extern tree most_specialized_instantiation PROTO((tree, tree));
3233 extern void print_candidates PROTO((tree));
3234 extern int instantiate_pending_templates PROTO((void));
3236 extern int processing_specialization;
3237 extern int processing_explicit_instantiation;
3238 extern int processing_template_parmlist;
3241 extern void repo_template_used PROTO((tree));
3242 extern void repo_template_instantiated PROTO((tree, int));
3243 extern void init_repo PROTO((const char *));
3244 extern void finish_repo PROTO((void));
3247 extern void init_rtti_processing PROTO((void));
3248 extern tree get_tinfo_fn_dynamic PROTO((tree));
3249 extern tree build_typeid PROTO((tree));
3250 extern tree build_x_typeid PROTO((tree));
3251 extern tree get_tinfo_fn PROTO((tree));
3252 extern tree get_tinfo_fn_unused PROTO((tree));
3253 extern tree get_typeid PROTO((tree));
3254 extern tree get_typeid_1 PROTO((tree));
3255 extern tree build_dynamic_cast PROTO((tree, tree));
3256 extern void synthesize_tinfo_fn PROTO((tree));
3259 extern int types_overlap_p PROTO((tree, tree));
3260 extern tree get_vbase PROTO((tree, tree));
3261 extern tree get_binfo PROTO((tree, tree, int));
3262 extern int get_base_distance PROTO((tree, tree, int, tree *));
3263 extern int accessible_p PROTO((tree, tree));
3264 extern tree lookup_field PROTO((tree, tree, int, int));
3265 extern int lookup_fnfields_1 PROTO((tree, tree));
3266 extern tree lookup_fnfields PROTO((tree, tree, int));
3267 extern tree lookup_member PROTO((tree, tree, int, int));
3268 extern tree lookup_nested_tag PROTO((tree, tree));
3269 extern tree get_matching_virtual PROTO((tree, tree, int));
3270 extern tree get_abstract_virtuals PROTO((tree));
3271 extern tree init_vbase_pointers PROTO((tree, tree));
3272 extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
3273 extern void clear_search_slots PROTO((tree));
3274 extern tree get_vbase_types PROTO((tree));
3275 extern void note_debug_info_needed PROTO((tree));
3276 extern void push_class_decls PROTO((tree));
3277 extern void pop_class_decls PROTO((void));
3278 extern void unuse_fields PROTO((tree));
3279 extern void print_search_statistics PROTO((void));
3280 extern void init_search_processing PROTO((void));
3281 extern void reinit_search_statistics PROTO((void));
3282 extern tree current_scope PROTO((void));
3283 extern tree lookup_conversions PROTO((tree));
3284 extern tree binfo_for_vtable PROTO((tree));
3285 extern tree dfs_walk PROTO((tree,
3286 tree (*)(tree, void *),
3287 tree (*) (tree, void *),
3289 extern tree dfs_unmark PROTO((tree, void *));
3290 extern tree markedp PROTO((tree, void *));
3292 /* in semantics.c */
3293 extern void finish_expr_stmt PROTO((tree));
3294 extern tree begin_if_stmt PROTO((void));
3295 extern void finish_if_stmt_cond PROTO((tree, tree));
3296 extern tree finish_then_clause PROTO((tree));
3297 extern void begin_else_clause PROTO((void));
3298 extern void finish_else_clause PROTO((tree));
3299 extern void finish_if_stmt PROTO((void));
3300 extern tree begin_while_stmt PROTO((void));
3301 extern void finish_while_stmt_cond PROTO((tree, tree));
3302 extern void finish_while_stmt PROTO((tree));
3303 extern tree begin_do_stmt PROTO((void));
3304 extern void finish_do_body PROTO((tree));
3305 extern void finish_do_stmt PROTO((tree, tree));
3306 extern void finish_return_stmt PROTO((tree));
3307 extern tree begin_for_stmt PROTO((void));
3308 extern void finish_for_init_stmt PROTO((tree));
3309 extern void finish_for_cond PROTO((tree, tree));
3310 extern void finish_for_expr PROTO((tree, tree));
3311 extern void finish_for_stmt PROTO((tree, tree));
3312 extern void finish_break_stmt PROTO((void));
3313 extern void finish_continue_stmt PROTO((void));
3314 extern void begin_switch_stmt PROTO((void));
3315 extern tree finish_switch_cond PROTO((tree));
3316 extern void finish_switch_stmt PROTO((tree, tree));
3317 extern void finish_case_label PROTO((tree, tree));
3318 extern void finish_goto_stmt PROTO((tree));
3319 extern tree begin_try_block PROTO((void));
3320 extern void finish_try_block PROTO((tree));
3321 extern void finish_handler_sequence PROTO((tree));
3322 extern tree begin_handler PROTO((void));
3323 extern void finish_handler_parms PROTO((tree));
3324 extern void finish_handler PROTO((tree));
3325 extern tree begin_compound_stmt PROTO((int));
3326 extern tree finish_compound_stmt PROTO((int, tree));
3327 extern void finish_asm_stmt PROTO((tree, tree, tree, tree, tree));
3328 extern tree finish_parenthesized_expr PROTO((tree));
3329 extern tree begin_stmt_expr PROTO((void));
3330 extern tree finish_stmt_expr PROTO((tree, tree));
3331 extern tree finish_call_expr PROTO((tree, tree, int));
3332 extern tree finish_increment_expr PROTO((tree, enum tree_code));
3333 extern tree finish_this_expr PROTO((void));
3334 extern tree finish_object_call_expr PROTO((tree, tree, tree));
3335 extern tree finish_qualified_object_call_expr PROTO((tree, tree, tree));
3336 extern tree finish_pseudo_destructor_call_expr PROTO((tree, tree, tree));
3337 extern tree finish_qualified_call_expr PROTO ((tree, tree));
3338 extern tree finish_label_address_expr PROTO((tree));
3339 extern tree finish_unary_op_expr PROTO((enum tree_code, tree));
3340 extern tree finish_id_expr PROTO((tree));
3341 extern int begin_new_placement PROTO((void));
3342 extern tree finish_new_placement PROTO((tree, int));
3343 extern int begin_function_definition PROTO((tree, tree));
3344 extern tree begin_constructor_declarator PROTO((tree, tree));
3345 extern tree finish_declarator PROTO((tree, tree, tree, tree, int));
3346 extern void finish_translation_unit PROTO((void));
3347 extern tree finish_template_type_parm PROTO((tree, tree));
3348 extern tree finish_template_template_parm PROTO((tree, tree));
3349 extern tree finish_parmlist PROTO((tree, int));
3350 extern tree begin_class_definition PROTO((tree));
3351 extern tree finish_class_definition PROTO((tree, tree, int, int));
3352 extern void finish_default_args PROTO((void));
3353 extern void begin_inline_definitions PROTO((void));
3354 extern void finish_inline_definitions PROTO((void));
3355 extern tree finish_member_class_template PROTO((tree));
3356 extern void finish_template_decl PROTO((tree));
3357 extern tree finish_template_type PROTO((tree, tree, int));
3358 extern void enter_scope_of PROTO((tree));
3359 extern tree finish_base_specifier PROTO((tree, tree, int));
3360 extern void finish_member_declaration PROTO((tree));
3361 extern void check_multiple_declarators PROTO((void));
3362 extern tree finish_typeof PROTO((tree));
3365 extern tree build_signature_pointer_type PROTO((tree));
3366 extern tree build_signature_reference_type PROTO((tree));
3367 extern tree build_signature_pointer_constructor PROTO((tree, tree));
3368 extern tree build_signature_method_call PROTO((tree, tree));
3369 extern tree build_optr_ref PROTO((tree));
3370 extern void append_signature_fields PROTO((tree));
3373 extern void init_spew PROTO((void));
3374 extern int peekyylex PROTO((void));
3375 extern int yylex PROTO((void));
3376 extern tree arbitrate_lookup PROTO((tree, tree, tree));
3379 extern int pod_type_p PROTO((tree));
3380 extern void unshare_base_binfos PROTO((tree));
3381 extern int member_p PROTO((tree));
3382 extern int real_lvalue_p PROTO((tree));
3383 extern tree build_min PVPROTO((enum tree_code, tree, ...));
3384 extern tree build_min_nt PVPROTO((enum tree_code, ...));
3385 extern tree min_tree_cons PROTO((tree, tree, tree));
3386 extern int lvalue_p PROTO((tree));
3387 extern int lvalue_or_else PROTO((tree, const char *));
3388 extern tree build_cplus_new PROTO((tree, tree));
3389 extern tree get_target_expr PROTO((tree));
3390 extern tree break_out_cleanups PROTO((tree));
3391 extern tree break_out_calls PROTO((tree));
3392 extern tree build_cplus_method_type PROTO((tree, tree, tree));
3393 extern tree build_cplus_staticfn_type PROTO((tree, tree, tree));
3394 extern tree build_cplus_array_type PROTO((tree, tree));
3395 extern int layout_basetypes PROTO((tree, int));
3396 extern tree build_vbase_pointer_fields PROTO((tree));
3397 extern tree build_base_fields PROTO((tree));
3398 extern tree hash_tree_cons PROTO((tree, tree, tree));
3399 extern tree hash_tree_chain PROTO((tree, tree));
3400 extern tree hash_chainon PROTO((tree, tree));
3401 extern tree make_binfo PROTO((tree, tree, tree, tree));
3402 extern tree binfo_value PROTO((tree, tree));
3403 extern tree reverse_path PROTO((tree));
3404 extern int count_functions PROTO((tree));
3405 extern int is_overloaded_fn PROTO((tree));
3406 extern tree get_first_fn PROTO((tree));
3407 extern tree binding_init PROTO((struct tree_binding*));
3408 extern int bound_pmf_p PROTO((tree));
3409 extern tree ovl_cons PROTO((tree, tree));
3410 extern tree scratch_ovl_cons PROTO((tree, tree));
3411 extern int ovl_member PROTO((tree, tree));
3412 extern tree build_overload PROTO((tree, tree));
3413 extern tree fnaddr_from_vtable_entry PROTO((tree));
3414 extern tree function_arg_chain PROTO((tree));
3415 extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
3416 extern int is_aggr_type_2 PROTO((tree, tree));
3417 extern char *lang_printable_name PROTO((tree, int));
3418 extern tree build_exception_variant PROTO((tree, tree));
3419 extern tree copy_template_template_parm PROTO((tree));
3420 extern tree copy_to_permanent PROTO((tree));
3421 extern tree permanent_p PROTO((tree));
3422 extern void print_lang_statistics PROTO((void));
3423 extern void __eprintf
3424 PROTO((const char *, const char *, unsigned, const char *));
3425 extern tree array_type_nelts_total PROTO((tree));
3426 extern tree array_type_nelts_top PROTO((tree));
3427 extern tree break_out_target_exprs PROTO((tree));
3428 extern tree get_type_decl PROTO((tree));
3429 extern tree vec_binfo_member PROTO((tree, tree));
3430 extern tree hack_decl_function_context PROTO((tree));
3431 extern tree decl_namespace_context PROTO((tree));
3432 extern tree lvalue_type PROTO((tree));
3433 extern tree error_type PROTO((tree));
3434 extern tree make_temp_vec PROTO((int));
3435 extern tree build_ptr_wrapper PROTO((void *));
3436 extern tree build_expr_ptr_wrapper PROTO((void *));
3437 extern tree build_int_wrapper PROTO((int));
3438 extern tree build_srcloc_here PROTO((void));
3439 extern int varargs_function_p PROTO((tree));
3440 extern int really_overloaded_fn PROTO((tree));
3441 extern int cp_tree_equal PROTO((tree, tree));
3442 extern int can_free PROTO((struct obstack *, tree));
3443 extern tree mapcar PROTO((tree, tree (*) (tree)));
3444 extern tree no_linkage_check PROTO((tree));
3445 extern void debug_binfo PROTO((tree));
3446 extern void push_expression_obstack PROTO((void));
3447 extern tree build_dummy_object PROTO((tree));
3448 extern tree maybe_dummy_object PROTO((tree, tree *));
3449 extern int is_dummy_object PROTO((tree));
3450 extern tree search_tree PROTO((tree, tree (*)(tree)));
3451 extern int cp_valid_lang_attribute PROTO((tree, tree, tree, tree));
3452 extern tree make_ptrmem_cst PROTO((tree, tree));
3454 #define scratchalloc expralloc
3455 #define scratch_tree_cons expr_tree_cons
3456 #define build_scratch_list build_expr_list
3457 #define make_scratch_vec make_temp_vec
3458 #define push_scratch_obstack push_expression_obstack
3461 extern int string_conv_p PROTO((tree, tree, int));
3462 extern tree condition_conversion PROTO((tree));
3463 extern tree target_type PROTO((tree));
3464 extern tree require_complete_type PROTO((tree));
3465 extern tree require_complete_type_in_void PROTO((tree));
3466 extern tree complete_type PROTO((tree));
3467 extern tree complete_type_or_else PROTO((tree, tree));
3468 extern int type_unknown_p PROTO((tree));
3469 extern int fntype_p PROTO((tree));
3470 extern tree commonparms PROTO((tree, tree));
3471 extern tree original_type PROTO((tree));
3472 extern tree common_type PROTO((tree, tree));
3473 extern int compexcepttypes PROTO((tree, tree));
3474 extern int comptypes PROTO((tree, tree, int));
3475 extern int comp_target_types PROTO((tree, tree, int));
3476 extern int compparms PROTO((tree, tree));
3477 extern int comp_target_types PROTO((tree, tree, int));
3478 extern int comp_cv_qualification PROTO((tree, tree));
3479 extern int comp_cv_qual_signature PROTO((tree, tree));
3480 extern int self_promoting_args_p PROTO((tree));
3481 extern tree unsigned_type PROTO((tree));
3482 extern tree signed_type PROTO((tree));
3483 extern tree signed_or_unsigned_type PROTO((int, tree));
3484 extern tree expr_sizeof PROTO((tree));
3485 extern tree c_sizeof PROTO((tree));
3486 extern tree c_sizeof_nowarn PROTO((tree));
3487 extern tree c_alignof PROTO((tree));
3488 extern tree inline_conversion PROTO((tree));
3489 extern tree decay_conversion PROTO((tree));
3490 extern tree default_conversion PROTO((tree));
3491 extern tree build_object_ref PROTO((tree, tree, tree));
3492 extern tree build_component_ref_1 PROTO((tree, tree, int));
3493 extern tree build_component_ref PROTO((tree, tree, tree, int));
3494 extern tree build_x_component_ref PROTO((tree, tree, tree, int));
3495 extern tree build_x_indirect_ref PROTO((tree, const char *));
3496 extern tree build_indirect_ref PROTO((tree, const char *));
3497 extern tree build_array_ref PROTO((tree, tree));
3498 extern tree build_x_function_call PROTO((tree, tree, tree));
3499 extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
3500 extern tree build_function_call_real PROTO((tree, tree, int, int));
3501 extern tree build_function_call PROTO((tree, tree));
3502 extern tree build_function_call_maybe PROTO((tree, tree));
3503 extern tree convert_arguments PROTO((tree, tree, tree, int));
3504 extern tree build_x_binary_op PROTO((enum tree_code, tree, tree));
3505 extern tree build_binary_op PROTO((enum tree_code, tree, tree));
3506 extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code));
3507 extern tree build_x_unary_op PROTO((enum tree_code, tree));
3508 extern tree build_unary_op PROTO((enum tree_code, tree, int));
3509 extern tree unary_complex_lvalue PROTO((enum tree_code, tree));
3510 extern int mark_addressable PROTO((tree));
3511 extern tree build_x_conditional_expr PROTO((tree, tree, tree));
3512 extern tree build_conditional_expr PROTO((tree, tree, tree));
3513 extern tree build_x_compound_expr PROTO((tree));
3514 extern tree build_compound_expr PROTO((tree));
3515 extern tree build_static_cast PROTO((tree, tree));
3516 extern tree build_reinterpret_cast PROTO((tree, tree));
3517 extern tree build_const_cast PROTO((tree, tree));
3518 extern tree build_c_cast PROTO((tree, tree));
3519 extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree));
3520 extern tree build_modify_expr PROTO((tree, enum tree_code, tree));
3521 extern tree convert_for_initialization PROTO((tree, tree, tree, int, const char *, tree, int));
3522 extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int));
3523 extern void c_expand_return PROTO((tree));
3524 extern tree c_expand_start_case PROTO((tree));
3525 extern int comp_ptr_ttypes PROTO((tree, tree));
3526 extern int ptr_reasonably_similar PROTO((tree, tree));
3527 extern tree build_ptrmemfunc PROTO((tree, tree, int));
3528 extern int cp_type_quals PROTO((tree));
3529 extern int cp_has_mutable_p PROTO((tree));
3530 extern int at_least_as_qualified_p PROTO((tree, tree));
3531 extern int more_qualified_p PROTO((tree, tree));
3532 extern tree build_ptrmemfunc1 PROTO((tree, tree, tree, tree, tree));
3533 extern void expand_ptrmemfunc_cst PROTO((tree, tree *, tree *, tree *, tree *));
3534 extern tree delta2_from_ptrmemfunc PROTO((tree));
3535 extern tree pfn_from_ptrmemfunc PROTO((tree));
3538 extern tree error_not_base_type PROTO((tree, tree));
3539 extern tree binfo_or_else PROTO((tree, tree));
3540 extern void readonly_error PROTO((tree, const char *, int));
3541 extern void abstract_virtuals_error PROTO((tree, tree));
3542 extern void signature_error PROTO((tree, tree));
3543 extern void incomplete_type_error PROTO((tree, tree));
3544 extern void my_friendly_abort PROTO((int))
3546 extern void my_friendly_assert PROTO((int, int));
3547 extern tree store_init_value PROTO((tree, tree));
3548 extern tree digest_init PROTO((tree, tree, tree *));
3549 extern tree build_scoped_ref PROTO((tree, tree));
3550 extern tree build_x_arrow PROTO((tree));
3551 extern tree build_m_component_ref PROTO((tree, tree));
3552 extern tree build_functional_cast PROTO((tree, tree));
3553 extern char *enum_name_string PROTO((tree, tree));
3554 extern void report_case_error PROTO((int, tree, tree, tree));
3555 extern void check_for_new_type PROTO((const char *, flagged_type_tree));
3556 extern tree initializer_constant_valid_p PROTO((tree, tree));
3559 extern void GNU_xref_begin PROTO((const char *));
3560 extern void GNU_xref_end PROTO((int));
3561 extern void GNU_xref_file PROTO((const char *));
3562 extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT));
3563 extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
3564 extern void GNU_xref_ref PROTO((tree, const char *));
3565 extern void GNU_xref_decl PROTO((tree, tree));
3566 extern void GNU_xref_call PROTO((tree, const char *));
3567 extern void GNU_xref_function PROTO((tree, tree));
3568 extern void GNU_xref_assign PROTO((tree));
3569 extern void GNU_xref_hier PROTO((tree, tree, int, int, int));
3570 extern void GNU_xref_member PROTO((tree, tree));
3574 #endif /* not _CP_TREE_H */