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