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