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