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