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