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