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