]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/cp/cp-tree.h
Make-lang.in (po-generated): Remove parse.c.
[thirdparty/gcc.git] / gcc / cp / cp-tree.h
1 /* Definitions for C++ parsing and type checking.
2 Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002 Free Software Foundation, Inc.
4 Contributed by Michael Tiemann (tiemann@cygnus.com)
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 #ifndef GCC_CP_TREE_H
24 #define GCC_CP_TREE_H
25
26 #include "function.h"
27 #include "hashtab.h"
28 #include "splay-tree.h"
29 #include "varray.h"
30
31 #ifndef __GNUC__
32 #error "You should be using 'make bootstrap' -- see installation instructions"
33 #endif
34
35 #include "c-common.h"
36
37 struct diagnostic_context;
38
39 /* Usage of TREE_LANG_FLAG_?:
40 0: BINFO_MARKED (BINFO nodes).
41 IDENTIFIER_MARKED (IDENTIFIER_NODEs)
42 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
43 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
44 LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
45 TREE_INDIRECT_USING (in NAMESPACE_DECL).
46 LOCAL_BINDING_P (in CPLUS_BINDING)
47 ICS_USER_FLAG (in _CONV)
48 CLEANUP_P (in TRY_BLOCK)
49 AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
50 PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF)
51 PARMLIST_ELLIPSIS_P (in PARMLIST)
52 1: IDENTIFIER_VIRTUAL_P.
53 TI_PENDING_TEMPLATE_FLAG.
54 TEMPLATE_PARMS_FOR_INLINE.
55 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
56 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
57 TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (in _TYPE).
58 INHERITED_VALUE_BINDING_P (in CPLUS_BINDING)
59 ICS_ELLIPSIS_FLAG (in _CONV)
60 BINFO_ACCESS (in BINFO)
61 DECL_INITIALIZED_P (in VAR_DECL)
62 2: IDENTIFIER_OPNAME_P.
63 TYPE_POLYMORPHIC_P (in _TYPE)
64 ICS_THIS_FLAG (in _CONV)
65 BINDING_HAS_LEVEL_P (in CPLUS_BINDING)
66 BINFO_LOST_PRIMARY_P (in BINFO)
67 TREE_PARMLIST (in TREE_LIST)
68 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
69 BINFO_VTABLE_PATH_MARKED.
70 BINFO_PUSHDECLS_MARKED.
71 (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
72 ICS_BAD_FLAG (in _CONV)
73 FN_TRY_BLOCK_P (in TRY_BLOCK)
74 IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
75 4: BINFO_NEW_VTABLE_MARKED.
76 TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
77 or FIELD_DECL).
78 NEED_TEMPORARY_P (in REF_BIND, BASE_CONV)
79 IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
80 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
81 6: BINFO_ACCESS (in BINFO)
82
83 Usage of TYPE_LANG_FLAG_?:
84 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
85 1: TYPE_HAS_CONSTRUCTOR.
86 2: TYPE_HAS_DESTRUCTOR.
87 3: TYPE_FOR_JAVA.
88 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
89 5: IS_AGGR_TYPE.
90 6: TYPE_BUILT_IN.
91
92 Usage of DECL_LANG_FLAG_?:
93 0: DECL_ERROR_REPORTED (in VAR_DECL).
94 DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
95 DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
96 DECL_MUTABLE_P (in FIELD_DECL)
97 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
98 DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
99 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
100 DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
101 3: DECL_IN_AGGR_P.
102 4: DECL_C_BIT_FIELD (in a FIELD_DECL)
103 DECL_MAYBE_TEMPLATE (in a FUNCTION_DECL)
104 5: DECL_INTERFACE_KNOWN.
105 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
106 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
107 DECL_THUNK_P (in a member FUNCTION_DECL)
108
109 Usage of language-independent fields in a language-dependent manner:
110
111 TREE_USED
112 This field is BINFO_INDIRECT_PRIMARY_P in a BINFO.
113
114 TYPE_ALIAS_SET
115 This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
116 forth as a substitute for the mark bits provided in `lang_type'.
117 At present, only the six low-order bits are used.
118
119 TYPE_BINFO
120 For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
121 For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
122
123 BINFO_VIRTUALS
124 For a binfo, this is a TREE_LIST. There is an entry for each
125 virtual function declared either in BINFO or its direct and
126 indirect primary bases.
127
128 The BV_DELTA of each node gives the amount by which to adjust the
129 `this' pointer when calling the function. If the method is an
130 overridden version of a base class method, then it is assumed
131 that, prior to adjustment, the this pointer points to an object
132 of the base class.
133
134 The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
135 index of the vcall offset for this entry.
136
137 The BV_FN is the declaration for the virtual function itself.
138
139 BINFO_VTABLE
140 This is an expression with POINTER_TYPE that gives the value
141 to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
142 to extract the VAR_DECL for the complete vtable.
143
144 DECL_ARGUMENTS
145 For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
146
147 DECL_VINDEX
148 This field is NULL for a non-virtual function. For a virtual
149 function, it is eventually set to an INTEGER_CST indicating the
150 index in the vtable at which this function can be found. When
151 a virtual function is declared, but before it is known what
152 function is overridden, this field is the error_mark_node.
153
154 Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
155 the virtual function this one overrides, and whose TREE_CHAIN is
156 the old DECL_VINDEX. */
157
158 /* Language-specific tree checkers. */
159
160 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
161
162 #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
163 ({ const tree __t = (NODE); \
164 enum tree_code const __c = TREE_CODE(__t); \
165 if (__c != VAR_DECL && __c != FUNCTION_DECL) \
166 tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
167 __FUNCTION__); \
168 __t; })
169
170 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
171 ({ const tree __t = (NODE); \
172 enum tree_code const __c = TREE_CODE(__t); \
173 if (__c != VAR_DECL \
174 && __c != FUNCTION_DECL \
175 && __c != PARM_DECL) \
176 tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
177 __FUNCTION__); \
178 __t; })
179
180 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
181 ({ const tree __t = (NODE); \
182 enum tree_code const __c = TREE_CODE(__t); \
183 if (__c != VAR_DECL \
184 && __c != FUNCTION_DECL \
185 && __c != TYPE_DECL \
186 && __c != TEMPLATE_DECL) \
187 tree_check_failed (__t, VAR_DECL, __FILE__, __LINE__, \
188 __FUNCTION__); \
189 __t; })
190
191 #define RECORD_OR_UNION_TYPE_CHECK(NODE) \
192 ({ const tree __t = (NODE); \
193 enum tree_code const __c = TREE_CODE(__t); \
194 if (__c != RECORD_TYPE && __c != UNION_TYPE) \
195 tree_check_failed (__t, RECORD_TYPE, __FILE__, __LINE__, \
196 __FUNCTION__); \
197 __t; })
198
199 #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
200 ({ const tree __t = (NODE); \
201 enum tree_code const __c = TREE_CODE(__t); \
202 if (__c != BOUND_TEMPLATE_TEMPLATE_PARM) \
203 tree_check_failed (__t, BOUND_TEMPLATE_TEMPLATE_PARM, \
204 __FILE__, __LINE__, __FUNCTION__); \
205 __t; })
206
207 #else /* not ENABLE_TREE_CHECKING, or not gcc */
208
209 #define VAR_OR_FUNCTION_DECL_CHECK(NODE) (NODE)
210 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) (NODE)
211 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) (NODE)
212 #define RECORD_OR_UNION_TYPE_CHECK(NODE) (NODE)
213 #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) (NODE)
214
215 #endif
216
217 /* Returns TRUE if generated code should match ABI version N or
218 greater is in use. */
219
220 #define abi_version_at_least(N) \
221 (flag_abi_version == 0 || flag_abi_version >= (N))
222
223 \f
224 /* Language-dependent contents of an identifier. */
225
226 struct lang_identifier GTY(())
227 {
228 struct c_common_identifier c_common;
229 tree namespace_bindings;
230 tree bindings;
231 tree class_value;
232 tree class_template_info;
233 struct lang_id2 *x;
234 };
235
236 /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
237 keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
238 and C_RID_YYCODE is the token number wanted by Yacc. */
239
240 #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
241
242 extern const short rid_to_yy[RID_MAX];
243 #define C_RID_YYCODE(ID) rid_to_yy[C_RID_CODE (ID)]
244
245 #define LANG_IDENTIFIER_CAST(NODE) \
246 ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
247
248 struct lang_id2 GTY(())
249 {
250 tree label_value;
251 tree implicit_decl;
252 tree error_locus;
253 };
254
255 typedef struct flagged_type_tree_s GTY(())
256 {
257 tree t;
258 int new_type_flag;
259 tree lookups;
260 } flagged_type_tree;
261
262 typedef struct template_parm_index_s GTY(())
263 {
264 struct tree_common common;
265 HOST_WIDE_INT index;
266 HOST_WIDE_INT level;
267 HOST_WIDE_INT orig_level;
268 tree decl;
269 } template_parm_index;
270
271 struct ptrmem_cst GTY(())
272 {
273 struct tree_common common;
274 /* This isn't used, but the middle-end expects all constants to have
275 this field. */
276 rtx rtl;
277 tree member;
278 };
279 typedef struct ptrmem_cst * ptrmem_cst_t;
280
281 /* Nonzero if this binding is for a local scope, as opposed to a class
282 or namespace scope. */
283 #define LOCAL_BINDING_P(NODE) TREE_LANG_FLAG_0 (NODE)
284
285 /* Nonzero if BINDING_VALUE is from a base class of the class which is
286 currently being defined. */
287 #define INHERITED_VALUE_BINDING_P(NODE) TREE_LANG_FLAG_1 (NODE)
288
289 /* For a binding between a name and an entity at a non-local scope,
290 defines the scope where the binding is declared. (Either a class
291 _TYPE node, or a NAMESPACE_DECL.) This macro should be used only
292 for namespace-level bindings; on the IDENTIFIER_BINDING list
293 BINDING_LEVEL is used instead. */
294 #define BINDING_SCOPE(NODE) \
295 (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->scope.scope)
296
297 /* Nonzero if NODE has BINDING_LEVEL, rather than BINDING_SCOPE. */
298 #define BINDING_HAS_LEVEL_P(NODE) TREE_LANG_FLAG_2 (NODE)
299
300 /* This is the declaration bound to the name. Possible values:
301 variable, overloaded function, namespace, template, enumerator. */
302 #define BINDING_VALUE(NODE) \
303 (((struct tree_binding*)CPLUS_BINDING_CHECK (NODE))->value)
304
305 /* If name is bound to a type, this is the type (struct, union, enum). */
306 #define BINDING_TYPE(NODE) TREE_TYPE (NODE)
307
308 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
309 namespace_binding ((NODE), global_namespace)
310 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
311 set_namespace_binding ((NODE), global_namespace, (VAL))
312 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
313 namespace_binding ((NODE), current_namespace)
314 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
315 set_namespace_binding ((NODE), current_namespace, (VAL))
316
317 #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
318
319 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
320 sense of `same'. */
321 #define same_type_p(TYPE1, TYPE2) \
322 comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
323
324 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring
325 top-level qualifiers. */
326 #define same_type_ignoring_top_level_qualifiers_p(TYPE1, TYPE2) \
327 same_type_p (TYPE_MAIN_VARIANT (TYPE1), TYPE_MAIN_VARIANT (TYPE2))
328
329 /* Nonzero if we are presently building a statement tree, rather
330 than expanding each statement as we encounter it. */
331 #define building_stmt_tree() (last_tree != NULL_TREE)
332
333 /* Returns nonzero iff NODE is a declaration for the global function
334 `main'. */
335 #define DECL_MAIN_P(NODE) \
336 (DECL_EXTERN_C_FUNCTION_P (NODE) \
337 && DECL_NAME (NODE) != NULL_TREE \
338 && MAIN_NAME_P (DECL_NAME (NODE)))
339
340
341 struct tree_binding GTY(())
342 {
343 struct tree_common common;
344 union tree_binding_u {
345 tree GTY ((tag ("0"))) scope;
346 struct cp_binding_level * GTY ((tag ("1"))) level;
347 } GTY ((desc ("BINDING_HAS_LEVEL_P ((tree)&%0)"))) scope;
348 tree value;
349 };
350
351 /* The overloaded FUNCTION_DECL. */
352 #define OVL_FUNCTION(NODE) \
353 (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
354 #define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
355 /* Polymorphic access to FUNCTION and CHAIN. */
356 #define OVL_CURRENT(NODE) \
357 ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
358 #define OVL_NEXT(NODE) \
359 ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
360 /* If set, this was imported in a using declaration.
361 This is not to confuse with being used somewhere, which
362 is not important for this node. */
363 #define OVL_USED(NODE) TREE_USED (NODE)
364
365 struct tree_overload GTY(())
366 {
367 struct tree_common common;
368 tree function;
369 };
370
371 /* Returns true iff NODE is a BASELINK. */
372 #define BASELINK_P(NODE) \
373 (TREE_CODE (NODE) == BASELINK)
374 /* The BINFO indicating the base from which the BASELINK_FUNCTIONS came. */
375 #define BASELINK_BINFO(NODE) \
376 (TREE_OPERAND (BASELINK_CHECK (NODE), 0))
377 /* The functions referred to by the BASELINK; either a FUNCTION_DECL,
378 a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */
379 #define BASELINK_FUNCTIONS(NODE) \
380 (TREE_OPERAND (BASELINK_CHECK (NODE), 1))
381 /* The BINFO in which the search for the functions indicated by this baselink
382 began. This base is used to determine the accessibility of functions
383 selected by overload resolution. */
384 #define BASELINK_ACCESS_BINFO(NODE) \
385 (TREE_OPERAND (BASELINK_CHECK (NODE), 2))
386 /* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
387 to which the conversion should occur. This value is important if
388 the BASELINK_FUNCTIONS include a template conversion operator --
389 the BASELINK_OPTYPE can be used to determine what type the user
390 requested. */
391 #define BASELINK_OPTYPE(NODE) \
392 (TREE_CHAIN (BASELINK_CHECK (NODE)))
393
394 #define WRAPPER_ZC(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->z_c)
395
396 struct tree_wrapper GTY(())
397 {
398 struct tree_common common;
399 struct z_candidate *z_c;
400 };
401
402 #define SOURCE_LOCUS(NODE) \
403 (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->locus)
404 #define SRCLOC_FILE(NODE) SOURCE_LOCUS (NODE).file
405 #define SRCLOC_LINE(NODE) SOURCE_LOCUS (NODE).line
406
407 struct tree_srcloc GTY(())
408 {
409 struct tree_common common;
410 location_t locus;
411 };
412
413 /* Macros for access to language-specific slots in an identifier. */
414
415 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
416 (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
417 #define IDENTIFIER_TEMPLATE(NODE) \
418 (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
419
420 /* The IDENTIFIER_BINDING is the innermost CPLUS_BINDING for the
421 identifier. It's TREE_CHAIN is the next outermost binding. Each
422 BINDING_VALUE is a DECL for the associated declaration. Thus,
423 name lookup consists simply of pulling off the node at the front
424 of the list (modulo oddities for looking up the names of types,
425 and such.) You can use BINDING_SCOPE or BINDING_LEVEL to
426 determine the scope that bound the name. */
427 #define IDENTIFIER_BINDING(NODE) \
428 (LANG_IDENTIFIER_CAST (NODE)->bindings)
429
430 /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
431 NULL_TREE if there is no binding. */
432 #define IDENTIFIER_VALUE(NODE) \
433 (IDENTIFIER_BINDING (NODE) \
434 ? BINDING_VALUE (IDENTIFIER_BINDING (NODE)) \
435 : NULL_TREE)
436
437 /* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
438 class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
439 just a pointer to the BINDING_VALUE of one of the bindings in the
440 IDENTIFIER_BINDINGs list, so any time that this is non-NULL so is
441 IDENTIFIER_BINDING. */
442 #define IDENTIFIER_CLASS_VALUE(NODE) \
443 (LANG_IDENTIFIER_CAST (NODE)->class_value)
444
445 /* TREE_TYPE only indicates on local and class scope the current
446 type. For namespace scope, the presence of a type in any namespace
447 is indicated with global_type_node, and the real type behind must
448 be found through lookup. */
449 #define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
450 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
451 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
452 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
453
454 #define LANG_ID_FIELD(NAME, NODE) \
455 (LANG_IDENTIFIER_CAST (NODE)->x \
456 ? LANG_IDENTIFIER_CAST (NODE)->x->NAME : 0)
457
458 #define SET_LANG_ID(NODE, VALUE, NAME) \
459 (LANG_IDENTIFIER_CAST (NODE)->x == 0 \
460 ? LANG_IDENTIFIER_CAST (NODE)->x \
461 = (struct lang_id2 *)ggc_alloc_cleared (sizeof (struct lang_id2)) : 0, \
462 LANG_IDENTIFIER_CAST (NODE)->x->NAME = (VALUE))
463
464 #define IDENTIFIER_LABEL_VALUE(NODE) \
465 LANG_ID_FIELD (label_value, NODE)
466 #define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
467 SET_LANG_ID (NODE, VALUE, label_value)
468
469 #define IDENTIFIER_IMPLICIT_DECL(NODE) \
470 LANG_ID_FIELD (implicit_decl, NODE)
471 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE, VALUE) \
472 SET_LANG_ID (NODE, VALUE, implicit_decl)
473
474 #define IDENTIFIER_ERROR_LOCUS(NODE) \
475 LANG_ID_FIELD (error_locus, NODE)
476 #define SET_IDENTIFIER_ERROR_LOCUS(NODE, VALUE) \
477 SET_LANG_ID (NODE, VALUE, error_locus)
478
479 /* Nonzero if this identifier is used as a virtual function name somewhere
480 (optimizes searches). */
481 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
482
483 /* Nonzero if this identifier is the prefix for a mangled C++ operator
484 name. */
485 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
486
487 /* Nonzero if this identifier is the name of a type-conversion
488 operator. */
489 #define IDENTIFIER_TYPENAME_P(NODE) \
490 TREE_LANG_FLAG_4 (NODE)
491
492 /* Nonzero if this identifier is the name of a constructor or
493 destructor. */
494 #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
495 TREE_LANG_FLAG_3 (NODE)
496
497 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
498 #define C_TYPE_FIELDS_READONLY(TYPE) TYPE_LANG_FLAG_0 (TYPE)
499
500 /* Store a value in that field. */
501 #define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
502 (TREE_COMPLEXITY (EXP) = (int)(CODE))
503
504 /* The tokens stored in the default argument. */
505
506 #define DEFARG_TOKENS(NODE) \
507 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
508
509 struct tree_default_arg GTY (())
510 {
511 struct tree_common common;
512 struct cp_token_cache *tokens;
513 };
514
515 enum cp_tree_node_structure_enum {
516 TS_CP_COMMON,
517 TS_CP_GENERIC,
518 TS_CP_IDENTIFIER,
519 TS_CP_TPI,
520 TS_CP_PTRMEM,
521 TS_CP_BINDING,
522 TS_CP_OVERLOAD,
523 TS_CP_WRAPPER,
524 TS_CP_SRCLOC,
525 TS_CP_DEFAULT_ARG,
526 LAST_TS_CP_ENUM
527 };
528
529 /* The resulting tree type. */
530 union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
531 chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
532 {
533 struct tree_common GTY ((tag ("TS_CP_COMMON"))) common;
534 union tree_node GTY ((tag ("TS_CP_GENERIC"),
535 desc ("tree_node_structure (&%h)"))) generic;
536 struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
537 struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
538 struct tree_binding GTY ((tag ("TS_CP_BINDING"))) binding;
539 struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
540 struct tree_wrapper GTY ((tag ("TS_CP_WRAPPER"))) wrapper;
541 struct tree_srcloc GTY ((tag ("TS_CP_SRCLOC"))) srcloc;
542 struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
543 struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
544 };
545
546 \f
547 enum cp_tree_index
548 {
549 CPTI_JAVA_BYTE_TYPE,
550 CPTI_JAVA_SHORT_TYPE,
551 CPTI_JAVA_INT_TYPE,
552 CPTI_JAVA_LONG_TYPE,
553 CPTI_JAVA_FLOAT_TYPE,
554 CPTI_JAVA_DOUBLE_TYPE,
555 CPTI_JAVA_CHAR_TYPE,
556 CPTI_JAVA_BOOLEAN_TYPE,
557
558 CPTI_WCHAR_DECL,
559 CPTI_VTABLE_ENTRY_TYPE,
560 CPTI_DELTA_TYPE,
561 CPTI_VTABLE_INDEX_TYPE,
562 CPTI_CLEANUP_TYPE,
563 CPTI_VTT_PARM_TYPE,
564
565 CPTI_TI_DESC_TYPE,
566 CPTI_BLTN_DESC_TYPE,
567 CPTI_PTR_DESC_TYPE,
568 CPTI_ARY_DESC_TYPE,
569 CPTI_FUNC_DESC_TYPE,
570 CPTI_ENUM_DESC_TYPE,
571 CPTI_CLASS_DESC_TYPE,
572 CPTI_SI_CLASS_DESC_TYPE,
573 CPTI_VMI_CLASS_DESC_TYPE,
574 CPTI_PTM_DESC_TYPE,
575 CPTI_BASE_DESC_TYPE,
576
577 CPTI_CLASS_TYPE,
578 CPTI_RECORD_TYPE,
579 CPTI_UNION_TYPE,
580 CPTI_ENUM_TYPE,
581 CPTI_UNKNOWN_TYPE,
582 CPTI_VTBL_TYPE,
583 CPTI_VTBL_PTR_TYPE,
584 CPTI_STD,
585 CPTI_ABI,
586 CPTI_TYPE_INFO_TYPE,
587 CPTI_TYPE_INFO_PTR_TYPE,
588 CPTI_TYPE_INFO_REF_TYPE,
589 CPTI_ABORT_FNDECL,
590 CPTI_GLOBAL_DELETE_FNDECL,
591 CPTI_AGGR_TAG,
592
593 CPTI_ACCESS_DEFAULT,
594 CPTI_ACCESS_PUBLIC,
595 CPTI_ACCESS_PROTECTED,
596 CPTI_ACCESS_PRIVATE,
597 CPTI_ACCESS_DEFAULT_VIRTUAL,
598 CPTI_ACCESS_PUBLIC_VIRTUAL,
599 CPTI_ACCESS_PROTECTED_VIRTUAL,
600 CPTI_ACCESS_PRIVATE_VIRTUAL,
601
602 CPTI_CTOR_IDENTIFIER,
603 CPTI_COMPLETE_CTOR_IDENTIFIER,
604 CPTI_BASE_CTOR_IDENTIFIER,
605 CPTI_DTOR_IDENTIFIER,
606 CPTI_COMPLETE_DTOR_IDENTIFIER,
607 CPTI_BASE_DTOR_IDENTIFIER,
608 CPTI_DELETING_DTOR_IDENTIFIER,
609 CPTI_DELTA_IDENTIFIER,
610 CPTI_IN_CHARGE_IDENTIFIER,
611 CPTI_VTT_PARM_IDENTIFIER,
612 CPTI_NELTS_IDENTIFIER,
613 CPTI_THIS_IDENTIFIER,
614 CPTI_PFN_IDENTIFIER,
615 CPTI_VPTR_IDENTIFIER,
616 CPTI_STD_IDENTIFIER,
617
618 CPTI_LANG_NAME_C,
619 CPTI_LANG_NAME_CPLUSPLUS,
620 CPTI_LANG_NAME_JAVA,
621
622 CPTI_EMPTY_EXCEPT_SPEC,
623 CPTI_NULL,
624 CPTI_JCLASS,
625 CPTI_TERMINATE,
626 CPTI_CALL_UNEXPECTED,
627 CPTI_ATEXIT,
628 CPTI_DSO_HANDLE,
629 CPTI_DCAST,
630
631 CPTI_DYNAMIC_CLASSES,
632
633 CPTI_MAX
634 };
635
636 extern GTY(()) tree cp_global_trees[CPTI_MAX];
637
638 #define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
639 #define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
640 #define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
641 #define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
642 #define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
643 #define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
644 #define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
645 #define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
646
647 #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
648 #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
649 /* The type used to represent an offset by which to adjust the `this'
650 pointer in pointer-to-member types. */
651 #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
652 /* The type used to represent an index into the vtable. */
653 #define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
654
655 #define ti_desc_type_node cp_global_trees[CPTI_TI_DESC_TYPE]
656 #define bltn_desc_type_node cp_global_trees[CPTI_BLTN_DESC_TYPE]
657 #define ptr_desc_type_node cp_global_trees[CPTI_PTR_DESC_TYPE]
658 #define ary_desc_type_node cp_global_trees[CPTI_ARY_DESC_TYPE]
659 #define func_desc_type_node cp_global_trees[CPTI_FUNC_DESC_TYPE]
660 #define enum_desc_type_node cp_global_trees[CPTI_ENUM_DESC_TYPE]
661 #define class_desc_type_node cp_global_trees[CPTI_CLASS_DESC_TYPE]
662 #define si_class_desc_type_node cp_global_trees[CPTI_SI_CLASS_DESC_TYPE]
663 #define vmi_class_desc_type_node cp_global_trees[CPTI_VMI_CLASS_DESC_TYPE]
664 #define ptm_desc_type_node cp_global_trees[CPTI_PTM_DESC_TYPE]
665 #define base_desc_type_node cp_global_trees[CPTI_BASE_DESC_TYPE]
666
667 #define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
668 #define record_type_node cp_global_trees[CPTI_RECORD_TYPE]
669 #define union_type_node cp_global_trees[CPTI_UNION_TYPE]
670 #define enum_type_node cp_global_trees[CPTI_ENUM_TYPE]
671 #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
672 #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
673 #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
674 #define std_node cp_global_trees[CPTI_STD]
675 #define abi_node cp_global_trees[CPTI_ABI]
676 #define type_info_type_node cp_global_trees[CPTI_TYPE_INFO_TYPE]
677 #define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
678 #define type_info_ref_type cp_global_trees[CPTI_TYPE_INFO_REF_TYPE]
679 #define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
680 #define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
681 #define current_aggr cp_global_trees[CPTI_AGGR_TAG]
682
683 /* Define the sets of attributes that member functions and baseclasses
684 can have. These are sensible combinations of {public,private,protected}
685 cross {virtual,non-virtual}. */
686
687 #define access_default_node cp_global_trees[CPTI_ACCESS_DEFAULT]
688 #define access_public_node cp_global_trees[CPTI_ACCESS_PUBLIC]
689 #define access_protected_node cp_global_trees[CPTI_ACCESS_PROTECTED]
690 #define access_private_node cp_global_trees[CPTI_ACCESS_PRIVATE]
691 #define access_default_virtual_node cp_global_trees[CPTI_ACCESS_DEFAULT_VIRTUAL]
692 #define access_public_virtual_node cp_global_trees[CPTI_ACCESS_PUBLIC_VIRTUAL]
693 #define access_protected_virtual_node cp_global_trees[CPTI_ACCESS_PROTECTED_VIRTUAL]
694 #define access_private_virtual_node cp_global_trees[CPTI_ACCESS_PRIVATE_VIRTUAL]
695
696 /* We cache these tree nodes so as to call get_identifier less
697 frequently. */
698
699 /* The name of a constructor that takes an in-charge parameter to
700 decide whether or not to construct virtual base classes. */
701 #define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
702 /* The name of a constructor that constructs virtual base classes. */
703 #define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
704 /* The name of a constructor that does not construct virtual base classes. */
705 #define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
706 /* The name of a destructor that takes an in-charge parameter to
707 decide whether or not to destroy virtual base classes and whether
708 or not to delete the object. */
709 #define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
710 /* The name of a destructor that destroys virtual base classes. */
711 #define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
712 /* The name of a destructor that does not destroy virtual base
713 classes. */
714 #define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
715 /* The name of a destructor that destroys virtual base classes, and
716 then deletes the entire object. */
717 #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
718 #define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
719 #define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
720 /* The name of the parameter that contains a pointer to the VTT to use
721 for this subobject constructor or destructor. */
722 #define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
723 #define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
724 #define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
725 #define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
726 #define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
727 /* The name of the std namespace. */
728 #define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
729 #define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
730 #define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
731 #define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
732
733 /* Exception specifier used for throw(). */
734 #define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
735
736 /* The node for `__null'. */
737 #define null_node cp_global_trees[CPTI_NULL]
738
739 /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
740 #define jclass_node cp_global_trees[CPTI_JCLASS]
741
742 /* The declaration for `std::terminate'. */
743 #define terminate_node cp_global_trees[CPTI_TERMINATE]
744
745 /* The declaration for "__cxa_call_unexpected". */
746 #define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED]
747
748 /* A pointer to `std::atexit'. */
749 #define atexit_node cp_global_trees[CPTI_ATEXIT]
750
751 /* A pointer to `__dso_handle'. */
752 #define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
753
754 /* The declaration of the dynamic_cast runtime. */
755 #define dynamic_cast_node cp_global_trees[CPTI_DCAST]
756
757 /* The type of a destructor. */
758 #define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
759
760 /* The type of the vtt parameter passed to subobject constructors and
761 destructors. */
762 #define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
763
764 /* A TREE_LIST of all of the dynamic classes in the program. */
765
766 #define dynamic_classes cp_global_trees[CPTI_DYNAMIC_CLASSES]
767
768 /* Global state. */
769
770 struct saved_scope GTY(())
771 {
772 tree old_bindings;
773 tree old_namespace;
774 tree decl_ns_list;
775 tree class_name;
776 tree class_type;
777 tree access_specifier;
778 tree function_decl;
779 varray_type lang_base;
780 tree lang_name;
781 tree template_parms;
782 tree x_previous_class_type;
783 tree x_previous_class_values;
784 tree x_saved_tree;
785 tree lookups;
786 tree last_parms;
787
788 HOST_WIDE_INT x_processing_template_decl;
789 int x_processing_specialization;
790 bool x_processing_explicit_instantiation;
791 int need_pop_function_context;
792 int check_access;
793
794 struct stmt_tree_s x_stmt_tree;
795
796 struct cp_binding_level *class_bindings;
797 struct cp_binding_level *bindings;
798
799 struct saved_scope *prev;
800 };
801
802 /* The current open namespace. */
803
804 #define current_namespace scope_chain->old_namespace
805
806 /* The stack for namespaces of current declarations. */
807
808 #define decl_namespace_list scope_chain->decl_ns_list
809
810 /* IDENTIFIER_NODE: name of current class */
811
812 #define current_class_name scope_chain->class_name
813
814 /* _TYPE: the type of the current class */
815
816 #define current_class_type scope_chain->class_type
817
818 /* When parsing a class definition, the access specifier most recently
819 given by the user, or, if no access specifier was given, the
820 default value appropriate for the kind of class (i.e., struct,
821 class, or union). */
822
823 #define current_access_specifier scope_chain->access_specifier
824
825 /* Pointer to the top of the language name stack. */
826
827 #define current_lang_base scope_chain->lang_base
828 #define current_lang_name scope_chain->lang_name
829
830 /* Parsing a function declarator leaves a list of parameter names
831 or a chain or parameter decls here. */
832
833 #define current_template_parms scope_chain->template_parms
834
835 #define processing_template_decl scope_chain->x_processing_template_decl
836 #define processing_specialization scope_chain->x_processing_specialization
837 #define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
838
839 /* _TYPE: the previous type that was a class */
840
841 #define previous_class_type scope_chain->x_previous_class_type
842
843 /* This is a copy of the class_shadowed list of the previous class
844 binding contour when at global scope. It's used to reset
845 IDENTIFIER_CLASS_VALUEs when entering another class scope (i.e. a
846 cache miss). */
847
848 #define previous_class_values scope_chain->x_previous_class_values
849
850 /* A list of private types mentioned, for deferred access checking. */
851
852 #define type_lookups scope_chain->lookups
853
854 extern GTY(()) struct saved_scope *scope_chain;
855
856 /* Global state pertinent to the current function. */
857
858 struct language_function GTY(())
859 {
860 struct c_language_function base;
861
862 tree x_dtor_label;
863 tree x_current_class_ptr;
864 tree x_current_class_ref;
865 tree x_eh_spec_block;
866 tree x_in_charge_parm;
867 tree x_vtt_parm;
868 tree x_return_value;
869
870 int returns_value;
871 int returns_null;
872 int returns_abnormally;
873 int in_function_try_handler;
874 int x_expanding_p;
875
876 struct named_label_use_list *x_named_label_uses;
877 struct named_label_list *x_named_labels;
878 struct cp_binding_level *bindings;
879 varray_type x_local_names;
880
881 const char *cannot_inline;
882 };
883
884 /* The current C++-specific per-function global variables. */
885
886 #define cp_function_chain (cfun->language)
887
888 /* In a destructor, the point at which all derived class destroying
889 has been done, just before any base class destroying will be done. */
890
891 #define dtor_label cp_function_chain->x_dtor_label
892
893 /* When we're processing a member function, current_class_ptr is the
894 PARM_DECL for the `this' pointer. The current_class_ref is an
895 expression for `*this'. */
896
897 #define current_class_ptr \
898 (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE)
899 #define current_class_ref \
900 (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
901
902 /* The EH_SPEC_BLOCK for the exception-specifiers for the current
903 function, if any. */
904
905 #define current_eh_spec_block cp_function_chain->x_eh_spec_block
906
907 /* The `__in_chrg' parameter for the current function. Only used for
908 constructors and destructors. */
909
910 #define current_in_charge_parm cp_function_chain->x_in_charge_parm
911
912 /* The `__vtt_parm' parameter for the current function. Only used for
913 constructors and destructors. */
914
915 #define current_vtt_parm cp_function_chain->x_vtt_parm
916
917 /* Set to 0 at beginning of a function definition, set to 1 if
918 a return statement that specifies a return value is seen. */
919
920 #define current_function_returns_value cp_function_chain->returns_value
921
922 /* Set to 0 at beginning of a function definition, set to 1 if
923 a return statement with no argument is seen. */
924
925 #define current_function_returns_null cp_function_chain->returns_null
926
927 /* Set to 0 at beginning of a function definition, set to 1 if
928 a call to a noreturn function is seen. */
929
930 #define current_function_returns_abnormally \
931 cp_function_chain->returns_abnormally
932
933 /* Nonzero if we should generate RTL for functions that we process.
934 When this is zero, we just accumulate tree structure, without
935 interacting with the back end. */
936
937 #define expanding_p cp_function_chain->x_expanding_p
938
939 /* Nonzero if we are in the semantic analysis phase for the current
940 function. */
941
942 #define doing_semantic_analysis_p() (!expanding_p)
943
944 #define in_function_try_handler cp_function_chain->in_function_try_handler
945
946 /* Expression always returned from function, or error_mark_node
947 otherwise, for use by the automatic named return value optimization. */
948
949 #define current_function_return_value \
950 (cp_function_chain->x_return_value)
951
952 extern GTY(()) tree global_namespace;
953
954 #define ansi_opname(CODE) \
955 (operator_name_info[(int) (CODE)].identifier)
956 #define ansi_assopname(CODE) \
957 (assignment_operator_name_info[(int) (CODE)].identifier)
958
959 /* True if NODE is an erroneous expression. */
960
961 #define error_operand_p(NODE) \
962 ((NODE) == error_mark_node \
963 || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
964
965 /* INTERFACE_ONLY nonzero means that we are in an "interface"
966 section of the compiler. INTERFACE_UNKNOWN nonzero means
967 we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
968 is zero and INTERFACE_ONLY is zero, it means that we are responsible
969 for exporting definitions that others might need. */
970 extern int interface_only, interface_unknown;
971 \f
972 /* C++ language-specific tree codes. */
973 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
974 enum cplus_tree_code {
975 CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
976 #include "cp-tree.def"
977 LAST_CPLUS_TREE_CODE
978 };
979 #undef DEFTREECODE
980
981 enum languages { lang_c, lang_cplusplus, lang_java };
982
983 /* Macros to make error reporting functions' lives easier. */
984 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
985 #define TYPE_LINKAGE_IDENTIFIER(NODE) \
986 (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
987 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
988 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
989
990 #define TYPE_ASSEMBLER_NAME_STRING(NODE) \
991 (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
992 #define TYPE_ASSEMBLER_NAME_LENGTH(NODE) \
993 (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
994
995 /* Nonzero if NODE has no name for linkage purposes. */
996 #define TYPE_ANONYMOUS_P(NODE) \
997 (TAGGED_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
998
999 /* The _DECL for this _TYPE. */
1000 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
1001
1002 /* Nonzero if T is a class (or struct or union) type. Also nonzero
1003 for template type parameters, typename types, and instantiated
1004 template template parameters. Despite its name,
1005 this macro has nothing to do with the definition of aggregate given
1006 in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
1007 #define IS_AGGR_TYPE(T) \
1008 (TREE_CODE (T) == TEMPLATE_TYPE_PARM \
1009 || TREE_CODE (T) == TYPENAME_TYPE \
1010 || TREE_CODE (T) == TYPEOF_TYPE \
1011 || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \
1012 || TYPE_LANG_FLAG_5 (T))
1013
1014 /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
1015 union type. */
1016 #define SET_IS_AGGR_TYPE(T, VAL) \
1017 (TYPE_LANG_FLAG_5 (T) = (VAL))
1018
1019 /* Nonzero if T is a class type. Zero for template type parameters,
1020 typename types, and so forth. */
1021 #define CLASS_TYPE_P(T) \
1022 (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && IS_AGGR_TYPE (T))
1023
1024 #define IS_AGGR_TYPE_CODE(T) ((T) == RECORD_TYPE || (T) == UNION_TYPE)
1025 #define TAGGED_TYPE_P(T) \
1026 (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
1027 #define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
1028
1029 /* In a *_TYPE, nonzero means a built-in type. */
1030 #define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6 (NODE)
1031
1032 /* True if this a "Java" type, defined in 'extern "Java"'. */
1033 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
1034
1035 /* Nonzero if this type is const-qualified. */
1036 #define CP_TYPE_CONST_P(NODE) \
1037 ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
1038
1039 /* Nonzero if this type is volatile-qualified. */
1040 #define CP_TYPE_VOLATILE_P(NODE) \
1041 ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
1042
1043 /* Nonzero if this type is restrict-qualified. */
1044 #define CP_TYPE_RESTRICT_P(NODE) \
1045 ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
1046
1047 /* Nonzero if this type is const-qualified, but not
1048 volatile-qualified. Other qualifiers are ignored. This macro is
1049 used to test whether or not it is OK to bind an rvalue to a
1050 reference. */
1051 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
1052 ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
1053 == TYPE_QUAL_CONST)
1054
1055 #define FUNCTION_ARG_CHAIN(NODE) \
1056 TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
1057
1058 /* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
1059 which refers to a user-written parameter. */
1060 #define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
1061 skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
1062
1063 /* Similarly, but for DECL_ARGUMENTS. */
1064 #define FUNCTION_FIRST_USER_PARM(NODE) \
1065 skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
1066
1067 #define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \
1068 (((CODE) == TREE_CODE (NODE) \
1069 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
1070 || IS_AGGR_TYPE (NODE))
1071
1072 /* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
1073 ambiguity issues. */
1074 #define DERIVED_FROM_P(PARENT, TYPE) \
1075 lookup_base ((TYPE), PARENT, ba_any, NULL)
1076 /* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
1077 accessibility. */
1078 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
1079 lookup_base ((TYPE), (PARENT), ba_ignore | ba_quiet, NULL)
1080 /* Nonzero iff TYPE is accessible in the current scope and uniquely
1081 derived from PARENT. */
1082 #define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
1083 lookup_base ((TYPE), (PARENT), ba_check | ba_quiet, NULL)
1084 /* Nonzero iff TYPE is publicly & uniquely derived from PARENT. */
1085 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
1086 lookup_base ((TYPE), (PARENT), ba_not_special | ba_quiet, NULL)
1087 \f
1088 /* This is a few header flags for 'struct lang_type'. Actually,
1089 all but the first are used only for lang_type_class; they
1090 are put in this structure to save space. */
1091 struct lang_type_header GTY(())
1092 {
1093 unsigned is_lang_type_class : 1;
1094
1095 unsigned has_type_conversion : 1;
1096 unsigned has_init_ref : 1;
1097 unsigned has_default_ctor : 1;
1098 unsigned uses_multiple_inheritance : 1;
1099 unsigned const_needs_init : 1;
1100 unsigned ref_needs_init : 1;
1101 unsigned has_const_assign_ref : 1;
1102 };
1103
1104 /* This structure provides additional information above and beyond
1105 what is provide in the ordinary tree_type. In the past, we used it
1106 for the types of class types, template parameters types, typename
1107 types, and so forth. However, there can be many (tens to hundreds
1108 of thousands) of template parameter types in a compilation, and
1109 there's no need for this additional information in that case.
1110 Therefore, we now use this data structure only for class types.
1111
1112 In the past, it was thought that there would be relatively few
1113 class types. However, in the presence of heavy use of templates,
1114 many (i.e., thousands) of classes can easily be generated.
1115 Therefore, we should endeavor to keep the size of this structure to
1116 a minimum. */
1117 struct lang_type_class GTY(())
1118 {
1119 struct lang_type_header h;
1120
1121 unsigned char align;
1122
1123 unsigned has_mutable : 1;
1124 unsigned com_interface : 1;
1125 unsigned non_pod_class : 1;
1126 unsigned nearly_empty_p : 1;
1127 unsigned user_align : 1;
1128 unsigned has_assign_ref : 1;
1129 unsigned has_new : 1;
1130 unsigned has_array_new : 1;
1131
1132 unsigned gets_delete : 2;
1133 unsigned has_call_overloaded : 1;
1134 unsigned has_array_ref_overloaded : 1;
1135 unsigned has_arrow_overloaded : 1;
1136 unsigned interface_only : 1;
1137 unsigned interface_unknown : 1;
1138
1139 unsigned marks: 6;
1140 unsigned vec_new_uses_cookie : 1;
1141 unsigned declared_class : 1;
1142
1143 unsigned being_defined : 1;
1144 unsigned redefined : 1;
1145 unsigned debug_requested : 1;
1146 unsigned use_template : 2;
1147 unsigned got_semicolon : 1;
1148 unsigned ptrmemfunc_flag : 1;
1149 unsigned was_anonymous : 1;
1150
1151 unsigned has_real_assign_ref : 1;
1152 unsigned has_const_init_ref : 1;
1153 unsigned has_complex_init_ref : 1;
1154 unsigned has_complex_assign_ref : 1;
1155 unsigned has_abstract_assign_ref : 1;
1156 unsigned non_aggregate : 1;
1157 unsigned is_partial_instantiation : 1;
1158 unsigned java_interface : 1;
1159
1160 unsigned anon_aggr : 1;
1161 unsigned non_zero_init : 1;
1162 unsigned empty_p : 1;
1163 unsigned contains_empty_class_p : 1;
1164
1165 /* When adding a flag here, consider whether or not it ought to
1166 apply to a template instance if it applies to the template. If
1167 so, make sure to copy it in instantiate_class_template! */
1168
1169 /* There are some bits left to fill out a 32-bit word. Keep track
1170 of this by updating the size of this bitfield whenever you add or
1171 remove a flag. */
1172 unsigned dummy : 5;
1173
1174 tree primary_base;
1175 tree vfields;
1176 tree vcall_indices;
1177 tree vtables;
1178 tree typeinfo_var;
1179 tree vbases;
1180 tree tags;
1181 tree as_base;
1182 tree pure_virtuals;
1183 tree friend_classes;
1184 tree methods;
1185 tree decl_list;
1186 tree template_info;
1187 tree befriending_classes;
1188 };
1189
1190 struct lang_type_ptrmem GTY(())
1191 {
1192 struct lang_type_header h;
1193 tree record;
1194 };
1195
1196 struct lang_type GTY(())
1197 {
1198 union lang_type_u
1199 {
1200 struct lang_type_header GTY((tag ("2"))) h;
1201 struct lang_type_class GTY((tag ("1"))) c;
1202 struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
1203 } GTY((desc ("%h.h.is_lang_type_class"))) u;
1204 };
1205
1206 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
1207
1208 #define LANG_TYPE_CLASS_CHECK(NODE) \
1209 ({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
1210 if (! lt->u.h.is_lang_type_class) \
1211 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1212 &lt->u.c; })
1213
1214 #define LANG_TYPE_PTRMEM_CHECK(NODE) \
1215 ({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
1216 if (lt->u.h.is_lang_type_class) \
1217 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1218 &lt->u.ptrmem; })
1219
1220 #else
1221
1222 #define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
1223 #define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
1224
1225 #endif /* ENABLE_TREE_CHECKING */
1226
1227 /* Indicates whether or not (and how) a template was expanded for this class.
1228 0=no information yet/non-template class
1229 1=implicit template instantiation
1230 2=explicit template specialization
1231 3=explicit template instantiation */
1232 #define CLASSTYPE_USE_TEMPLATE(NODE) \
1233 (LANG_TYPE_CLASS_CHECK (NODE)->use_template)
1234
1235 /* Fields used for storing information before the class is defined.
1236 After the class is defined, these fields hold other information. */
1237
1238 /* List of friends which were defined inline in this class definition. */
1239 #define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE)
1240
1241 /* Nonzero for _CLASSTYPE means that operator delete is defined. */
1242 #define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
1243 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
1244
1245 /* Nonzero if `new NODE[x]' should cause the allocation of extra
1246 storage to indicate how many array elements are in use. */
1247 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
1248 (CLASS_TYPE_P (NODE) \
1249 && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
1250
1251 /* Nonzero means that this _CLASSTYPE node defines ways of converting
1252 itself to other types. */
1253 #define TYPE_HAS_CONVERSION(NODE) \
1254 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
1255
1256 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
1257 #define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref)
1258 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) \
1259 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref)
1260
1261 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
1262 #define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref)
1263 #define TYPE_HAS_CONST_INIT_REF(NODE) \
1264 (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref)
1265
1266 /* Nonzero if this class defines an overloaded operator new. (An
1267 operator new [] doesn't count.) */
1268 #define TYPE_HAS_NEW_OPERATOR(NODE) \
1269 (LANG_TYPE_CLASS_CHECK (NODE)->has_new)
1270
1271 /* Nonzero if this class defines an overloaded operator new[]. */
1272 #define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
1273 (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
1274
1275 /* Nonzero means that this type is being defined. I.e., the left brace
1276 starting the definition of this type has been seen. */
1277 #define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
1278 /* Nonzero means that this type has been redefined. In this case, if
1279 convenient, don't reprocess any methods that appear in its redefinition. */
1280 #define TYPE_REDEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->redefined)
1281
1282 /* Nonzero means that this _CLASSTYPE node overloads operator(). */
1283 #define TYPE_OVERLOADS_CALL_EXPR(NODE) \
1284 (LANG_TYPE_CLASS_CHECK (NODE)->has_call_overloaded)
1285
1286 /* Nonzero means that this _CLASSTYPE node overloads operator[]. */
1287 #define TYPE_OVERLOADS_ARRAY_REF(NODE) \
1288 (LANG_TYPE_CLASS_CHECK (NODE)->has_array_ref_overloaded)
1289
1290 /* Nonzero means that this _CLASSTYPE node overloads operator->. */
1291 #define TYPE_OVERLOADS_ARROW(NODE) \
1292 (LANG_TYPE_CLASS_CHECK (NODE)->has_arrow_overloaded)
1293
1294 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
1295 multiple inheritance. If this is 0 for the root of a type
1296 hierarchy, then we can use more efficient search techniques. */
1297 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) \
1298 (LANG_TYPE_CLASS_CHECK (NODE)->h.uses_multiple_inheritance)
1299
1300 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
1301 virtual base classes. If this is 0 for the root of a type
1302 hierarchy, then we can use more efficient search techniques. */
1303 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3 (NODE))
1304
1305 /* Vector member functions defined in this class. Each element is
1306 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
1307 functions with the same name end up in the same slot. The first
1308 two elements are for constructors, and destructors, respectively.
1309 All template conversion operators to innermost template dependent
1310 types are overloaded on the next slot, if they exist. Note, the
1311 names for these functions will not all be the same. The
1312 non-template conversion operators & templated conversions to
1313 non-innermost template types are next, followed by ordinary member
1314 functions. There may be empty entries at the end of the vector.
1315 The conversion operators are unsorted. The ordinary member
1316 functions are sorted, once the class is complete. */
1317 #define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
1318
1319 /* For class templates, this is a TREE_LIST of all member data,
1320 functions, types, and friends in the order of declaration.
1321 The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
1322 and the RECORD_TYPE for the class template otherwise. */
1323 #define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
1324
1325 /* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
1326 #define CLASSTYPE_CONSTRUCTOR_SLOT 0
1327
1328 /* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
1329 #define CLASSTYPE_DESTRUCTOR_SLOT 1
1330
1331 /* The first slot in the CLASSTYPE_METHOD_VEC where conversion
1332 operators can appear. */
1333 #define CLASSTYPE_FIRST_CONVERSION_SLOT 2
1334
1335 /* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
1336 are the constructors that take an in-charge parameter. */
1337 #define CLASSTYPE_CONSTRUCTORS(NODE) \
1338 (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT))
1339
1340 /* A FUNCTION_DECL for the destructor for NODE. These are the
1341 destructors that take an in-charge parameter. */
1342 #define CLASSTYPE_DESTRUCTORS(NODE) \
1343 (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT))
1344
1345 /* Mark bits for depth-first and breath-first searches. */
1346
1347 /* Get the value of the Nth mark bit. */
1348 #define CLASSTYPE_MARKED_N(NODE, N) \
1349 (((CLASS_TYPE_P (NODE) ? LANG_TYPE_CLASS_CHECK (NODE)->marks \
1350 : ((unsigned) TYPE_ALIAS_SET (NODE))) & (1 << (N))) != 0)
1351
1352 /* Set the Nth mark bit. */
1353 #define SET_CLASSTYPE_MARKED_N(NODE, N) \
1354 (CLASS_TYPE_P (NODE) \
1355 ? (void) (LANG_TYPE_CLASS_CHECK (NODE)->marks |= (1 << (N))) \
1356 : (void) (TYPE_ALIAS_SET (NODE) |= (1 << (N))))
1357
1358 /* Clear the Nth mark bit. */
1359 #define CLEAR_CLASSTYPE_MARKED_N(NODE, N) \
1360 (CLASS_TYPE_P (NODE) \
1361 ? (void) (LANG_TYPE_CLASS_CHECK (NODE)->marks &= ~(1 << (N))) \
1362 : (void) (TYPE_ALIAS_SET (NODE) &= ~(1 << (N))))
1363
1364 /* Get the value of the mark bits. */
1365 #define CLASSTYPE_MARKED(NODE) CLASSTYPE_MARKED_N (NODE, 0)
1366 #define CLASSTYPE_MARKED2(NODE) CLASSTYPE_MARKED_N (NODE, 1)
1367 #define CLASSTYPE_MARKED3(NODE) CLASSTYPE_MARKED_N (NODE, 2)
1368 #define CLASSTYPE_MARKED4(NODE) CLASSTYPE_MARKED_N (NODE, 3)
1369 #define CLASSTYPE_MARKED5(NODE) CLASSTYPE_MARKED_N (NODE, 4)
1370 #define CLASSTYPE_MARKED6(NODE) CLASSTYPE_MARKED_N (NODE, 5)
1371
1372 /* Macros to modify the above flags */
1373 #define SET_CLASSTYPE_MARKED(NODE) SET_CLASSTYPE_MARKED_N (NODE, 0)
1374 #define CLEAR_CLASSTYPE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 0)
1375 #define SET_CLASSTYPE_MARKED2(NODE) SET_CLASSTYPE_MARKED_N (NODE, 1)
1376 #define CLEAR_CLASSTYPE_MARKED2(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 1)
1377 #define SET_CLASSTYPE_MARKED3(NODE) SET_CLASSTYPE_MARKED_N (NODE, 2)
1378 #define CLEAR_CLASSTYPE_MARKED3(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 2)
1379 #define SET_CLASSTYPE_MARKED4(NODE) SET_CLASSTYPE_MARKED_N (NODE, 3)
1380 #define CLEAR_CLASSTYPE_MARKED4(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 3)
1381 #define SET_CLASSTYPE_MARKED5(NODE) SET_CLASSTYPE_MARKED_N (NODE, 4)
1382 #define CLEAR_CLASSTYPE_MARKED5(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 4)
1383 #define SET_CLASSTYPE_MARKED6(NODE) SET_CLASSTYPE_MARKED_N (NODE, 5)
1384 #define CLEAR_CLASSTYPE_MARKED6(NODE) CLEAR_CLASSTYPE_MARKED_N (NODE, 5)
1385
1386 /* A list of the nested tag-types (class, struct, union, or enum)
1387 found within this class. The TREE_PURPOSE of each node is the name
1388 of the type; the TREE_VALUE is the type itself. This list includes
1389 nested member class templates. */
1390 #define CLASSTYPE_TAGS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->tags)
1391
1392 /* Nonzero if NODE has a primary base class, i.e., a base class with
1393 which it shares the virtual function table pointer. */
1394 #define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
1395 (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
1396
1397 /* If non-NULL, this is the binfo for the primary base class, i.e.,
1398 the base class which contains the virtual function table pointer
1399 for this class. */
1400 #define CLASSTYPE_PRIMARY_BINFO(NODE) \
1401 (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
1402
1403 /* A chain of BINFOs for the direct and indirect virtual base classes
1404 that this type uses in a post-order depth-first left-to-right
1405 order. (In other words, these bases appear in the order that they
1406 should be initialized.) If a virtual base is primary, then the
1407 primary copy will appear on this list. Thus, the BINFOs on this
1408 list are all "real"; they are the same BINFOs that will be
1409 encountered when using dfs_unmarked_real_bases_queue_p and related
1410 functions. */
1411 #define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
1412
1413 /* For a non-virtual BINFO, the BINFO itself; for a virtual BINFO, the
1414 binfo_for_vbase. C is the most derived class for the hierarchy
1415 containing BINFO. */
1416 #define CANONICAL_BINFO(BINFO, C) \
1417 (TREE_VIA_VIRTUAL (BINFO) \
1418 ? binfo_for_vbase (BINFO_TYPE (BINFO), C) \
1419 : (BINFO))
1420
1421 /* Number of direct baseclasses of NODE. */
1422 #define CLASSTYPE_N_BASECLASSES(NODE) \
1423 (BINFO_N_BASETYPES (TYPE_BINFO (NODE)))
1424
1425 /* The type corresponding to NODE when NODE is used as a base class,
1426 i.e., NODE without virtual base classes. */
1427
1428 #define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
1429
1430 /* These are the size and alignment of the type without its virtual
1431 base classes, for when we use this type as a base itself. */
1432 #define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE))
1433 #define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE))
1434 #define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE))
1435 #define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE))
1436
1437 /* The alignment of NODE, without its virtual bases, in bytes. */
1438 #define CLASSTYPE_ALIGN_UNIT(NODE) \
1439 (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
1440
1441 /* True if this a Java interface type, declared with
1442 '__attribute__ ((java_interface))'. */
1443 #define TYPE_JAVA_INTERFACE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->java_interface)
1444
1445 /* A cons list of virtual functions which cannot be inherited by
1446 derived classes. When deriving from this type, the derived
1447 class must provide its own definition for each of these functions. */
1448 #define CLASSTYPE_PURE_VIRTUALS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
1449
1450 /* Nonzero means that this aggr type has been `closed' by a semicolon. */
1451 #define CLASSTYPE_GOT_SEMICOLON(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->got_semicolon)
1452
1453 /* Nonzero means that this type has an X() constructor. */
1454 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
1455 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
1456
1457 /* Nonzero means that this type contains a mutable member */
1458 #define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
1459 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1460
1461 /* Nonzero means that this class type is a non-POD class. */
1462 #define CLASSTYPE_NON_POD_P(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
1463
1464 /* Nonzero means that this class contains pod types whose default
1465 initialization is not a zero initialization (namely, pointers to
1466 data members). */
1467 #define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
1468 (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
1469
1470 /* Nonzero if this class is "empty" in the sense of the C++ ABI. */
1471 #define CLASSTYPE_EMPTY_P(NODE) \
1472 (LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
1473
1474 /* Nonzero if this class is "nearly empty", i.e., contains only a
1475 virtual function table pointer. */
1476 #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
1477 (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
1478
1479 /* Nonzero if this class contains an empty subobject. */
1480 #define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
1481 (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
1482
1483 /* A list of class types of which this type is a friend. The
1484 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1485 case of a template friend. */
1486 #define CLASSTYPE_FRIEND_CLASSES(NODE) \
1487 (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
1488
1489 /* A list of the classes which grant friendship to this class. */
1490 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1491 (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
1492
1493 /* Say whether this node was declared as a "class" or a "struct". */
1494 #define CLASSTYPE_DECLARED_CLASS(NODE) \
1495 (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
1496
1497 /* Nonzero if this class has const members
1498 which have no specified initialization. */
1499 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
1500 (TYPE_LANG_SPECIFIC (NODE) \
1501 ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
1502 #define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
1503 (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
1504
1505 /* Nonzero if this class has ref members
1506 which have no specified initialization. */
1507 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
1508 (TYPE_LANG_SPECIFIC (NODE) \
1509 ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
1510 #define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
1511 (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
1512
1513 /* Nonzero if this class is included from a header file which employs
1514 `#pragma interface', and it is not included in its implementation file. */
1515 #define CLASSTYPE_INTERFACE_ONLY(NODE) \
1516 (LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
1517
1518 /* True if we have already determined whether or not vtables, VTTs,
1519 typeinfo, and other similar per-class data should be emitted in
1520 this translation unit. This flag does not indicate whether or not
1521 these items should be emitted; it only indicates that we know one
1522 way or the other. */
1523 #define CLASSTYPE_INTERFACE_KNOWN(NODE) \
1524 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
1525 /* The opposite of CLASSTYPE_INTERFANCE_KNOWN. */
1526 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
1527 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
1528
1529 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
1530 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
1531 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
1532 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
1533 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
1534 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
1535
1536 /* Nonzero if a _DECL node requires us to output debug info for this class. */
1537 #define CLASSTYPE_DEBUG_REQUESTED(NODE) \
1538 (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
1539 \f
1540 /* Additional macros for inheritance information. */
1541
1542 /* The BINFO_INHERITANCE_CHAIN is used opposite to the description in
1543 gcc/tree.h. In particular if D is derived from B then the BINFO
1544 for B (in D) will have a BINFO_INHERITANCE_CHAIN pointing to
1545 D. In tree.h, this pointer is described as pointing in other
1546 direction. There is a different BINFO for each path to a virtual
1547 base; BINFOs for virtual bases are not shared.
1548
1549 We use TREE_VIA_PROTECTED and TREE_VIA_PUBLIC, but private
1550 inheritance is indicated by the absence of the other two flags, not
1551 by TREE_VIA_PRIVATE, which is unused. */
1552
1553 /* Mark the binfo, whether shared or not. Each instance of a virtual
1554 base can be separately marked. */
1555 #define BINFO_UNSHARED_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1556
1557 /* Nonzero means marked by DFS or BFS search. */
1558 #define BINFO_MARKED(NODE) \
1559 (TREE_VIA_VIRTUAL (NODE) \
1560 ? CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
1561 : TREE_LANG_FLAG_0 (NODE))
1562 /* Macros needed because of C compilers that don't allow conditional
1563 expressions to be lvalues. Grr! */
1564 #define SET_BINFO_MARKED(NODE) \
1565 (TREE_VIA_VIRTUAL(NODE) \
1566 ? SET_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
1567 : (void)(TREE_LANG_FLAG_0 (NODE) = 1))
1568 #define CLEAR_BINFO_MARKED(NODE) \
1569 (TREE_VIA_VIRTUAL (NODE) \
1570 ? CLEAR_CLASSTYPE_MARKED (BINFO_TYPE (NODE)) \
1571 : (void)(TREE_LANG_FLAG_0 (NODE) = 0))
1572
1573 /* Nonzero means that this class is on a path leading to a new vtable. */
1574 #define BINFO_VTABLE_PATH_MARKED(NODE) \
1575 (TREE_VIA_VIRTUAL (NODE) \
1576 ? CLASSTYPE_MARKED3 (BINFO_TYPE (NODE)) \
1577 : TREE_LANG_FLAG_3 (NODE))
1578 #define SET_BINFO_VTABLE_PATH_MARKED(NODE) \
1579 (TREE_VIA_VIRTUAL(NODE) \
1580 ? SET_CLASSTYPE_MARKED3 (BINFO_TYPE (NODE)) \
1581 : (TREE_LANG_FLAG_3 (NODE) = 1))
1582 #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) \
1583 (TREE_VIA_VIRTUAL (NODE) \
1584 ? CLEAR_CLASSTYPE_MARKED3 (BINFO_TYPE (NODE))\
1585 : (TREE_LANG_FLAG_3 (NODE) = 0))
1586
1587 /* Nonzero means B (a BINFO) has its own vtable. Under the old ABI,
1588 secondary vtables are sometimes shared. Any copies will not have
1589 this flag set.
1590
1591 B is part of the hierarchy dominated by C. */
1592 #define BINFO_NEW_VTABLE_MARKED(B, C) \
1593 (TREE_LANG_FLAG_4 (CANONICAL_BINFO (B, C)))
1594
1595 /* Any subobject that needs a new vtable must have a vptr and must not
1596 be a non-virtual primary base (since it would then use the vtable from a
1597 derived class and never become non-primary.) */
1598 #define SET_BINFO_NEW_VTABLE_MARKED(B, C) \
1599 (BINFO_NEW_VTABLE_MARKED (B, C) = 1, \
1600 my_friendly_assert (!BINFO_PRIMARY_P (B) \
1601 || TREE_VIA_VIRTUAL (B), 20000517), \
1602 my_friendly_assert (CLASSTYPE_VFIELDS (BINFO_TYPE (B)) != NULL_TREE, \
1603 20000517))
1604
1605 /* Nonzero means this class has done dfs_pushdecls. */
1606 #define BINFO_PUSHDECLS_MARKED(NODE) BINFO_VTABLE_PATH_MARKED (NODE)
1607 #define SET_BINFO_PUSHDECLS_MARKED(NODE) SET_BINFO_VTABLE_PATH_MARKED (NODE)
1608 #define CLEAR_BINFO_PUSHDECLS_MARKED(NODE) CLEAR_BINFO_VTABLE_PATH_MARKED (NODE)
1609
1610 /* Nonzero if this BINFO is a primary base class. Note, this can be
1611 set for non-canononical virtual bases. For a virtual primary base
1612 you might also need to check whether it is canonical. */
1613
1614 #define BINFO_PRIMARY_P(NODE) \
1615 (BINFO_PRIMARY_BASE_OF (NODE) != NULL_TREE)
1616
1617 /* The index in the VTT where this subobject's sub-VTT can be found.
1618 NULL_TREE if there is no sub-VTT. */
1619 #define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT (NODE, 8)
1620
1621 /* The index in the VTT where the vptr for this subobject can be
1622 found. NULL_TREE if there is no secondary vptr in the VTT. */
1623 #define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT (NODE, 9)
1624
1625 /* The binfo of which NODE is a primary base. (This is different from
1626 BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is
1627 sometimes a primary base for a class for which it is not an
1628 immediate base.) */
1629 #define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT (NODE, 10)
1630
1631 /* Nonzero if this binfo has lost its primary base binfo (because that
1632 is a nearly-empty virtual base that has been taken by some other
1633 base in the complete hierarchy. */
1634 #define BINFO_LOST_PRIMARY_P(NODE) TREE_LANG_FLAG_2 (NODE)
1635
1636 /* Nonzero if this binfo is an indirect primary base, i.e. a virtual
1637 base that is a primary base of some of other class in the
1638 hierarchy. */
1639 #define BINFO_INDIRECT_PRIMARY_P(NODE) TREE_USED (NODE)
1640
1641 /* Used by various search routines. */
1642 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1643 \f
1644 /* A TREE_LIST of the vcall indices associated with the class NODE.
1645 The TREE_PURPOSE of each node is a FUNCTION_DECL for a virtual
1646 function. The TREE_VALUE is the index into the virtual table where
1647 the vcall offset for that function is stored, when NODE is a
1648 virtual base. */
1649 #define CLASSTYPE_VCALL_INDICES(NODE) \
1650 (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
1651
1652 /* The various vtables for the class NODE. The primary vtable will be
1653 first, followed by the construction vtables and VTT, if any. */
1654 #define CLASSTYPE_VTABLES(NODE) \
1655 (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
1656
1657 /* The std::type_info variable representing this class, or NULL if no
1658 such variable has been created. This field is only set for the
1659 TYPE_MAIN_VARIANT of the class. */
1660 #define CLASSTYPE_TYPEINFO_VAR(NODE) \
1661 (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
1662
1663 /* Accessor macros for the vfield slots in structures. */
1664
1665 /* List of virtual table fields that this type contains (both the primary
1666 and secondaries). The TREE_VALUE is the class type where the vtable
1667 field was introduced. For a vtable field inherited from the primary
1668 base, or introduced by this class, the TREE_PURPOSE is NULL. For
1669 other vtable fields (those from non-primary bases), the
1670 TREE_PURPOSE is the BINFO of the base through which the vtable was
1671 inherited. */
1672 #define CLASSTYPE_VFIELDS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vfields)
1673
1674 /* Get the BINFO that introduced this vtable into the hierarchy (will
1675 be NULL for those created at this level, or from a primary
1676 hierarchy). */
1677 #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1678
1679 /* Get the TYPE that introduced this vtable into the hierarchy (always
1680 non-NULL). */
1681 #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1682
1683 /* Accessor macros for the BINFO_VIRTUALS list. */
1684
1685 /* The number of bytes by which to adjust the `this' pointer when
1686 calling this virtual function. Subtract this value from the this
1687 pointer. Always non-NULL, might be constant zero though. */
1688 #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
1689
1690 /* If non-NULL, the vtable index at which to find the vcall offset
1691 when calling this virtual function. Add the value at that vtable
1692 index to the this pointer. */
1693 #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
1694
1695 /* The function to call. */
1696 #define BV_FN(NODE) (TREE_VALUE (NODE))
1697
1698 \f
1699 /* Nonzero for TREE_LIST node means that this list of things
1700 is a list of parameters, as opposed to a list of expressions. */
1701 #define TREE_PARMLIST(NODE) (TREE_LANG_FLAG_2 (NODE))
1702
1703 /* Nonzero for a parmlist means that this parmlist ended in ... */
1704 #define PARMLIST_ELLIPSIS_P(NODE) TREE_LANG_FLAG_0 (NODE)
1705
1706 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1707 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
1708 will be NULL_TREE to indicate a throw specification of `()', or
1709 no exceptions allowed. */
1710 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_BINFO (NODE)
1711
1712 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
1713 #define TYPE_NOTHROW_P(NODE) \
1714 (TYPE_RAISES_EXCEPTIONS (NODE) \
1715 && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
1716
1717 /* The binding level associated with the namespace. */
1718 #define NAMESPACE_LEVEL(NODE) \
1719 (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level)
1720 \f
1721
1722 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
1723 a lang_decl (which has lang_decl_flags as its initial prefix).
1724 This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
1725 the full lang_decl, and not just lang_decl_flags. */
1726 #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
1727 (!(TREE_CODE (NODE) == VAR_DECL \
1728 || TREE_CODE (NODE) == CONST_DECL \
1729 || TREE_CODE (NODE) == FIELD_DECL \
1730 || TREE_CODE (NODE) == USING_DECL))
1731
1732 struct lang_decl_flags GTY(())
1733 {
1734 struct c_lang_decl base;
1735
1736 ENUM_BITFIELD(languages) language : 8;
1737
1738 unsigned operator_attr : 1;
1739 unsigned constructor_attr : 1;
1740 unsigned destructor_attr : 1;
1741 unsigned friend_attr : 1;
1742 unsigned static_function : 1;
1743 unsigned pure_virtual : 1;
1744 unsigned has_in_charge_parm_p : 1;
1745 unsigned has_vtt_parm_p : 1;
1746
1747 unsigned deferred : 1;
1748 unsigned use_template : 2;
1749 unsigned nonconverting : 1;
1750 unsigned not_really_extern : 1;
1751 unsigned needs_final_overrider : 1;
1752 unsigned initialized_in_class : 1;
1753 unsigned assignment_operator_p : 1;
1754
1755 unsigned global_ctor_p : 1;
1756 unsigned global_dtor_p : 1;
1757 unsigned anticipated_p : 1;
1758 unsigned template_conv_p : 1;
1759 unsigned u1sel : 1;
1760 unsigned u2sel : 1;
1761 unsigned can_be_full : 1;
1762 unsigned this_thunk_p : 1;
1763
1764 union lang_decl_u {
1765 /* In a FUNCTION_DECL, VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this
1766 is DECL_TEMPLATE_INFO. */
1767 tree GTY ((tag ("0"))) template_info;
1768
1769 /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
1770 struct cp_binding_level * GTY ((tag ("1"))) level;
1771 } GTY ((desc ("%1.u1sel"))) u;
1772
1773 union lang_decl_u2 {
1774 /* This is DECL_ACCESS. */
1775 tree GTY ((tag ("0"))) access;
1776
1777 /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
1778 int discriminator;
1779
1780 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
1781 THUNK_VIRTUAL_OFFSET. */
1782 tree GTY((tag ("2"))) virtual_offset;
1783 } GTY ((desc ("%1.u2sel"))) u2;
1784 };
1785
1786 struct lang_decl GTY(())
1787 {
1788 struct lang_decl_flags decl_flags;
1789
1790 union lang_decl_u4
1791 {
1792 struct full_lang_decl
1793 {
1794 tree befriending_classes;
1795
1796 /* For a non-virtual FUNCTION_DECL, this is
1797 DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
1798 DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
1799 this pointer and result pointer adjusting thunks are
1800 chained here. This pointer thunks to return pointer thunks
1801 will be chained on the return pointer thunk. */
1802 tree context;
1803
1804 /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */
1805 tree cloned_function;
1806
1807 /* In a FUNCTION_DECL for which THUNK_P holds, this is
1808 THUNK_FIXED_OFFSET. */
1809 HOST_WIDE_INT fixed_offset;
1810
1811 /* In an overloaded operator, this is the value of
1812 DECL_OVERLOADED_OPERATOR_P. */
1813 enum tree_code operator_code;
1814
1815 unsigned u3sel : 1;
1816 unsigned pending_inline_p : 1;
1817
1818 union lang_decl_u3
1819 {
1820 tree GTY ((tag ("0"))) sorted_fields;
1821 struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info;
1822 struct language_function * GTY ((tag ("1")))
1823 saved_language_function;
1824 } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u;
1825 } GTY ((tag ("1"))) f;
1826 } GTY ((desc ("%1.decl_flags.can_be_full"))) u;
1827 };
1828
1829 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
1830
1831 #define LANG_DECL_U2_CHECK(NODE, TF) \
1832 ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
1833 if (lt->decl_flags.u2sel != TF) \
1834 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1835 &lt->decl_flags.u2; })
1836
1837 #else
1838
1839 #define LANG_DECL_U2_CHECK(NODE, TF) \
1840 (&DECL_LANG_SPECIFIC (NODE)->decl_flags.u2)
1841
1842 #endif /* ENABLE_TREE_CHECKING */
1843
1844 /* DECL_NEEDED_P holds of a declaration when we need to emit its
1845 definition. This is true when the back-end tells us that
1846 the symbol has been referenced in the generated code. If, however,
1847 we are not generating code, then it is also true when a symbol has
1848 just been used somewhere, even if it's not really needed. We need
1849 anything that isn't comdat, but we don't know for sure whether or
1850 not something is comdat until end-of-file. */
1851 #define DECL_NEEDED_P(DECL) \
1852 ((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \
1853 || (DECL_ASSEMBLER_NAME_SET_P (DECL) \
1854 && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL))) \
1855 || (flag_syntax_only && TREE_USED (DECL)))
1856
1857 /* Nonzero iff DECL is memory-based. The DECL_RTL of
1858 certain const variables might be a CONST_INT, or a REG
1859 in some cases. We cannot use `memory_operand' as a test
1860 here because on most RISC machines, a variable's address
1861 is not, by itself, a legitimate address. */
1862 #define DECL_IN_MEMORY_P(NODE) \
1863 (DECL_RTL_SET_P (NODE) && GET_CODE (DECL_RTL (NODE)) == MEM)
1864
1865 /* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
1866 declaration. Some entities (like a member function in a local
1867 class, or a local variable) do not have linkage at all, and this
1868 macro should not be used in those cases.
1869
1870 Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
1871 created by language-independent code, and has C linkage. Most
1872 VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
1873 we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */
1874 #define DECL_LANGUAGE(NODE) \
1875 (DECL_LANG_SPECIFIC (NODE) \
1876 ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \
1877 : (TREE_CODE (NODE) == FUNCTION_DECL \
1878 ? lang_c : lang_cplusplus))
1879
1880 /* Set the language linkage for NODE to LANGUAGE. */
1881 #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
1882 (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE))
1883
1884 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
1885 #define DECL_CONSTRUCTOR_P(NODE) \
1886 (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr)
1887
1888 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
1889 object. */
1890 #define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
1891 (DECL_CONSTRUCTOR_P (NODE) \
1892 && DECL_NAME (NODE) == complete_ctor_identifier)
1893
1894 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
1895 object. */
1896 #define DECL_BASE_CONSTRUCTOR_P(NODE) \
1897 (DECL_CONSTRUCTOR_P (NODE) \
1898 && DECL_NAME (NODE) == base_ctor_identifier)
1899
1900 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
1901 specialized in-charge constructor or the specialized not-in-charge
1902 constructor. */
1903 #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
1904 (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
1905
1906 /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
1907 #define DECL_COPY_CONSTRUCTOR_P(NODE) \
1908 (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
1909
1910 /* Nonzero if NODE is a destructor. */
1911 #define DECL_DESTRUCTOR_P(NODE) \
1912 (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr)
1913
1914 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
1915 specialized in-charge constructor, in-charge deleting constructor,
1916 or the the base destructor. */
1917 #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
1918 (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
1919
1920 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
1921 object. */
1922 #define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
1923 (DECL_DESTRUCTOR_P (NODE) \
1924 && DECL_NAME (NODE) == complete_dtor_identifier)
1925
1926 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
1927 object. */
1928 #define DECL_BASE_DESTRUCTOR_P(NODE) \
1929 (DECL_DESTRUCTOR_P (NODE) \
1930 && DECL_NAME (NODE) == base_dtor_identifier)
1931
1932 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
1933 object that deletes the object after it has been destroyed. */
1934 #define DECL_DELETING_DESTRUCTOR_P(NODE) \
1935 (DECL_DESTRUCTOR_P (NODE) \
1936 && DECL_NAME (NODE) == deleting_dtor_identifier)
1937
1938 /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
1939 destructor. */
1940 #define DECL_CLONED_FUNCTION_P(NODE) \
1941 ((TREE_CODE (NODE) == FUNCTION_DECL \
1942 || TREE_CODE (NODE) == TEMPLATE_DECL) \
1943 && DECL_LANG_SPECIFIC (NODE) \
1944 && DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
1945
1946 /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
1947 cloned. */
1948 #define DECL_CLONED_FUNCTION(NODE) \
1949 (DECL_LANG_SPECIFIC (NODE)->u.f.cloned_function)
1950
1951 /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
1952 #define DECL_DISCRIMINATOR_P(NODE) \
1953 (TREE_CODE (NODE) == VAR_DECL \
1954 && DECL_FUNCTION_SCOPE_P (NODE))
1955
1956 /* Discriminator for name mangling. */
1957 #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
1958
1959 /* Nonzero if the VTT parm has been added to NODE. */
1960 #define DECL_HAS_VTT_PARM_P(NODE) \
1961 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_vtt_parm_p)
1962
1963 /* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is
1964 required. */
1965 #define DECL_NEEDS_VTT_PARM_P(NODE) \
1966 (TYPE_USES_VIRTUAL_BASECLASSES (DECL_CONTEXT (NODE)) \
1967 && (DECL_BASE_CONSTRUCTOR_P (NODE) \
1968 || DECL_BASE_DESTRUCTOR_P (NODE)))
1969
1970 /* Nonzero if NODE is a user-defined conversion operator. */
1971 #define DECL_CONV_FN_P(NODE) \
1972 (IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
1973
1974 /* Nonzero if NODE, which is a TEMPLATE_DECL, is a template
1975 conversion operator to a type dependent on the innermost template
1976 args. */
1977 #define DECL_TEMPLATE_CONV_FN_P(NODE) \
1978 (DECL_LANG_SPECIFIC (NODE)->decl_flags.template_conv_p)
1979
1980 /* Set the overloaded operator code for NODE to CODE. */
1981 #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
1982 (DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE))
1983
1984 /* If NODE is an overloaded operator, then this returns the TREE_CODE
1985 associcated with the overloaded operator.
1986 DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
1987 whether or not NODE is an assignment operator. If NODE is not an
1988 overloaded operator, ERROR_MARK is returned. Since the numerical
1989 value of ERROR_MARK is zero, this macro can be used as a predicate
1990 to test whether or not NODE is an overloaded operator. */
1991 #define DECL_OVERLOADED_OPERATOR_P(NODE) \
1992 (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
1993 ? DECL_LANG_SPECIFIC (NODE)->u.f.operator_code : ERROR_MARK)
1994
1995 /* Nonzero if NODE is an assignment operator. */
1996 #define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
1997 (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p)
1998
1999 /* For FUNCTION_DECLs: nonzero means that this function is a
2000 constructor or a destructor with an extra in-charge parameter to
2001 control whether or not virtual bases are constructed. */
2002 #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
2003 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p)
2004
2005 /* Nonzero if NODE is an overloaded `operator delete[]' function. */
2006 #define DECL_ARRAY_DELETE_OPERATOR_P(NODE) \
2007 (DECL_OVERLOADED_OPERATOR_P (NODE) == VEC_DELETE_EXPR)
2008
2009 /* Nonzero for _DECL means that this decl appears in (or will appear
2010 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
2011 detecting circularity in case members are multiply defined. In the
2012 case of a VAR_DECL, it is also used to determine how program storage
2013 should be allocated. */
2014 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
2015
2016 /* Nonzero for a VAR_DECL means that the variable's initialization has
2017 been processed. */
2018 #define DECL_INITIALIZED_P(NODE) \
2019 (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
2020
2021 /* Nonzero if the DECL was initialized in the class definition itself,
2022 rather than outside the class. */
2023 #define DECL_INITIALIZED_IN_CLASS_P(DECL) \
2024 (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class)
2025
2026 /* Nonzero for FUNCTION_DECL means that this decl is just a
2027 friend declaration, and should not be added to the list of
2028 member functions for this class. */
2029 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr)
2030
2031 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
2032 #define DECL_BEFRIENDING_CLASSES(NODE) \
2033 (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
2034
2035 /* Nonzero for FUNCTION_DECL means that this decl is a static
2036 member function. */
2037 #define DECL_STATIC_FUNCTION_P(NODE) \
2038 (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function)
2039
2040 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
2041 member function. */
2042 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
2043 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
2044
2045 /* Nonzero for FUNCTION_DECL means that this decl is a member function
2046 (static or non-static). */
2047 #define DECL_FUNCTION_MEMBER_P(NODE) \
2048 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
2049
2050 /* Nonzero for FUNCTION_DECL means that this member function
2051 has `this' as const X *const. */
2052 #define DECL_CONST_MEMFUNC_P(NODE) \
2053 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
2054 && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
2055 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2056
2057 /* Nonzero for FUNCTION_DECL means that this member function
2058 has `this' as volatile X *const. */
2059 #define DECL_VOLATILE_MEMFUNC_P(NODE) \
2060 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
2061 && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
2062 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2063
2064 /* Nonzero for a DECL means that this member is a non-static member. */
2065 #define DECL_NONSTATIC_MEMBER_P(NODE) \
2066 ((TREE_CODE (NODE) == FUNCTION_DECL \
2067 && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
2068 || TREE_CODE (NODE) == FIELD_DECL)
2069
2070 /* Nonzero for _DECL means that this member object type
2071 is mutable. */
2072 #define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
2073
2074 /* Nonzero for _DECL means that this constructor is a non-converting
2075 constructor. */
2076 #define DECL_NONCONVERTING_P(NODE) \
2077 (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting)
2078
2079 /* Nonzero for FUNCTION_DECL means that this member function is a pure
2080 virtual function. */
2081 #define DECL_PURE_VIRTUAL_P(NODE) \
2082 (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual)
2083
2084 /* Nonzero for FUNCTION_DECL means that this member function
2085 must be overridden by derived classes. */
2086 #define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) \
2087 (DECL_LANG_SPECIFIC (NODE)->decl_flags.needs_final_overrider)
2088
2089 /* The thunks associated with NODE, a FUNCTION_DECL. */
2090 #define DECL_THUNKS(NODE) \
2091 (DECL_LANG_SPECIFIC (NODE)->u.f.context)
2092
2093 /* Nonzero if NODE is a thunk, rather than an ordinary function. */
2094 #define DECL_THUNK_P(NODE) \
2095 (TREE_CODE (NODE) == FUNCTION_DECL \
2096 && DECL_LANG_FLAG_7 (NODE))
2097
2098 /* Nonzero if NODE is a this pointer adjusting thunk. */
2099 #define DECL_THIS_THUNK_P(NODE) \
2100 (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
2101
2102 /* Nonzero if NODE is a result pointer adjusting thunk. */
2103 #define DECL_RESULT_THUNK_P(NODE) \
2104 (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
2105
2106 /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
2107 #define DECL_NON_THUNK_FUNCTION_P(NODE) \
2108 (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
2109
2110 /* Nonzero if NODE is `extern "C"'. */
2111 #define DECL_EXTERN_C_P(NODE) \
2112 (DECL_LANGUAGE (NODE) == lang_c)
2113
2114 /* Nonzero if NODE is an `extern "C"' function. */
2115 #define DECL_EXTERN_C_FUNCTION_P(NODE) \
2116 (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
2117
2118 /* Set DECL_THUNK_P for node. */
2119 #define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
2120 (DECL_LANG_FLAG_7 (NODE) = 1, \
2121 DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1, \
2122 DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING))
2123
2124 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
2125 template function. */
2126 #define DECL_PRETTY_FUNCTION_P(NODE) \
2127 (TREE_LANG_FLAG_0 (NODE))
2128
2129 /* The _TYPE context in which this _DECL appears. This field holds the
2130 class where a virtual function instance is actually defined. */
2131 #define DECL_CLASS_CONTEXT(NODE) \
2132 (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
2133
2134 /* For a non-member friend function, the class (if any) in which this
2135 friend was defined. For example, given:
2136
2137 struct S { friend void f (); };
2138
2139 the DECL_FRIEND_CONTEXT for `f' will be `S'. */
2140 #define DECL_FRIEND_CONTEXT(NODE) \
2141 ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
2142 ? DECL_LANG_SPECIFIC (NODE)->u.f.context \
2143 : NULL_TREE)
2144
2145 /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
2146 #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
2147 (DECL_LANG_SPECIFIC (NODE)->u.f.context = (CONTEXT))
2148
2149 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
2150 #define CP_DECL_CONTEXT(NODE) \
2151 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
2152 #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
2153
2154 /* 1 iff NODE has namespace scope, including the global namespace. */
2155 #define DECL_NAMESPACE_SCOPE_P(NODE) \
2156 (!DECL_TEMPLATE_PARM_P (NODE) \
2157 && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
2158
2159 /* 1 iff NODE is a class member. */
2160 #define DECL_CLASS_SCOPE_P(NODE) \
2161 (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
2162
2163 /* 1 iff NODE is function-local. */
2164 #define DECL_FUNCTION_SCOPE_P(NODE) \
2165 (DECL_CONTEXT (NODE) \
2166 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
2167
2168 /* 1 iff NODE is function-local, but for types. */
2169 #define LOCAL_CLASS_P(NODE) \
2170 (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
2171
2172 /* For a NAMESPACE_DECL: the list of using namespace directives
2173 The PURPOSE is the used namespace, the value is the namespace
2174 that is the common ancestor. */
2175 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
2176
2177 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
2178 of a namespace, to record the transitive closure of using namespace. */
2179 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
2180
2181 /* In a NAMESPACE_DECL, points to the original namespace if this is
2182 a namespace alias. */
2183 #define DECL_NAMESPACE_ALIAS(NODE) \
2184 DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
2185 #define ORIGINAL_NAMESPACE(NODE) \
2186 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
2187
2188 /* Nonzero if NODE is the std namespace. */
2189 #define DECL_NAMESPACE_STD_P(NODE) \
2190 (TREE_CODE (NODE) == NAMESPACE_DECL \
2191 && CP_DECL_CONTEXT (NODE) == global_namespace \
2192 && DECL_NAME (NODE) == std_identifier)
2193
2194 /* In a non-local VAR_DECL with static storage duration, this is the
2195 initialization priority. If this value is zero, the NODE will be
2196 initialized at the DEFAULT_INIT_PRIORITY. */
2197 #define DECL_INIT_PRIORITY(NODE) (VAR_DECL_CHECK (NODE)->decl.u2.i)
2198
2199 /* In a TREE_LIST concatenating using directives, indicate indirect
2200 directives */
2201 #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
2202
2203 /* In a VAR_DECL for a variable declared in a for statement,
2204 this is the shadowed (local) variable. */
2205 #define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT_FLD(VAR_DECL_CHECK (NODE))
2206
2207 /* In a FUNCTION_DECL, this is nonzero if this function was defined in
2208 the class definition. We have saved away the text of the function,
2209 but have not yet processed it. */
2210 #define DECL_PENDING_INLINE_P(NODE) \
2211 (DECL_LANG_SPECIFIC (NODE)->u.f.pending_inline_p)
2212
2213 /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
2214 function. */
2215 #define DECL_PENDING_INLINE_INFO(NODE) \
2216 (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info)
2217
2218 /* For a TYPE_DECL: if this structure has many fields, we'll sort them
2219 and put them into a TREE_VEC. */
2220 #define DECL_SORTED_FIELDS(NODE) \
2221 (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields)
2222
2223 /* True if on the deferred_fns (see decl2.c) list. */
2224 #define DECL_DEFERRED_FN(DECL) \
2225 (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred)
2226
2227 /* For a VAR_DECL, FUNCTION_DECL, TYPE_DECL or TEMPLATE_DECL:
2228 template-specific information. */
2229 #define DECL_TEMPLATE_INFO(NODE) \
2230 (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
2231 ->decl_flags.u.template_info)
2232
2233 /* Template information for a RECORD_TYPE or UNION_TYPE. */
2234 #define CLASSTYPE_TEMPLATE_INFO(NODE) \
2235 (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
2236
2237 /* Template information for an ENUMERAL_TYPE. Although an enumeration may
2238 not be a primary template, it may be declared within the scope of a
2239 primary template and the enumeration constants may depend on
2240 non-type template parameters. */
2241 #define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
2242
2243 /* Template information for a template template parameter. */
2244 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
2245 (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
2246 ->template_info)
2247
2248 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2249 #define TYPE_TEMPLATE_INFO(NODE) \
2250 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2251 ? ENUM_TEMPLATE_INFO (NODE) : \
2252 (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
2253 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
2254 (TYPE_LANG_SPECIFIC (NODE) \
2255 ? CLASSTYPE_TEMPLATE_INFO (NODE) \
2256 : NULL_TREE)))
2257
2258 /* Set the template information for an ENUMERAL_, RECORD_, or
2259 UNION_TYPE to VAL. */
2260 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
2261 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2262 ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
2263 : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
2264
2265 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
2266 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
2267 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
2268
2269 /* We use TREE_VECs to hold template arguments. If there is only one
2270 level of template arguments, then the TREE_VEC contains the
2271 arguments directly. If there is more than one level of template
2272 arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
2273 containing the template arguments for a single level. The first
2274 entry in the outer TREE_VEC is the outermost level of template
2275 parameters; the last is the innermost.
2276
2277 It is incorrect to ever form a template argument vector containing
2278 only one level of arguments, but which is a TREE_VEC containing as
2279 its only entry the TREE_VEC for that level. */
2280
2281 /* Nonzero if the template arguments is actually a vector of vectors,
2282 rather than just a vector. */
2283 #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
2284 ((NODE) != NULL_TREE \
2285 && TREE_CODE (NODE) == TREE_VEC \
2286 && TREE_VEC_LENGTH (NODE) > 0 \
2287 && TREE_VEC_ELT (NODE, 0) != NULL_TREE \
2288 && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
2289
2290 /* The depth of a template argument vector. When called directly by
2291 the parser, we use a TREE_LIST rather than a TREE_VEC to represent
2292 template arguments. In fact, we may even see NULL_TREE if there
2293 are no template arguments. In both of those cases, there is only
2294 one level of template arguments. */
2295 #define TMPL_ARGS_DEPTH(NODE) \
2296 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
2297
2298 /* The LEVELth level of the template ARGS. The outermost level of
2299 args is level 1, not level 0. */
2300 #define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
2301 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
2302 ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
2303
2304 /* Set the LEVELth level of the template ARGS to VAL. This macro does
2305 not work with single-level argument vectors. */
2306 #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
2307 (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
2308
2309 /* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
2310 #define TMPL_ARG(ARGS, LEVEL, IDX) \
2311 (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
2312
2313 /* Set the IDXth element in the LEVELth level of ARGS to VAL. This
2314 macro does not work with single-level argument vectors. */
2315 #define SET_TMPL_ARG(ARGS, LEVEL, IDX, VAL) \
2316 (TREE_VEC_ELT (TREE_VEC_ELT ((ARGS), (LEVEL) - 1), (IDX)) = (VAL))
2317
2318 /* Given a single level of template arguments in NODE, return the
2319 number of arguments. */
2320 #define NUM_TMPL_ARGS(NODE) \
2321 ((NODE) == NULL_TREE ? 0 \
2322 : (TREE_CODE (NODE) == TREE_VEC \
2323 ? TREE_VEC_LENGTH (NODE) : list_length (NODE)))
2324
2325 /* Returns the innermost level of template arguments in ARGS. */
2326 #define INNERMOST_TEMPLATE_ARGS(NODE) \
2327 (get_innermost_template_args ((NODE), 1))
2328
2329 /* The number of levels of template parameters given by NODE. */
2330 #define TMPL_PARMS_DEPTH(NODE) \
2331 ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
2332
2333 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
2334 TEMPLATE_DECL will be the immediate parent, not the most general
2335 template. For example, in:
2336
2337 template <class T> struct S { template <class U> void f(U); }
2338
2339 the FUNCTION_DECL for S<int>::f<double> will have, as its
2340 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
2341
2342 As a special case, for a member friend template of a template
2343 class, this value will not be a TEMPLATE_DECL, but rather a
2344 LOOKUP_EXPR, IDENTIFIER_NODE or OVERLOAD indicating the name of
2345 the template and any explicit template arguments provided. For
2346 example, in:
2347
2348 template <class T> struct S { friend void f<int>(int, double); }
2349
2350 the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
2351 DECL_TI_ARGS will be {int}. */
2352 #define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
2353
2354 /* The template arguments used to obtain this decl from the most
2355 general form of DECL_TI_TEMPLATE. For the example given for
2356 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
2357 are always the full set of arguments required to instantiate this
2358 declaration from the most general template specialized here. */
2359 #define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
2360 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
2361 #define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
2362 #define ENUM_TI_TEMPLATE(NODE) \
2363 TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
2364 #define ENUM_TI_ARGS(NODE) \
2365 TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
2366
2367 /* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2368 #define TYPE_TI_TEMPLATE(NODE) \
2369 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
2370
2371 /* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
2372 #define TYPE_TI_ARGS(NODE) \
2373 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
2374
2375 #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE)
2376
2377 /* Nonzero if the NODE corresponds to the template parameters for a
2378 member template, whose inline definition is being processed after
2379 the class definition is complete. */
2380 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
2381
2382 /* In a FUNCTION_DECL, the saved language-specific per-function data. */
2383 #define DECL_SAVED_FUNCTION_DATA(NODE) \
2384 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \
2385 ->u.f.u.saved_language_function)
2386
2387 #define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
2388 #define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
2389 #define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
2390 #define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
2391
2392 /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
2393 constructor call, rather than an ordinary function call. */
2394 #define AGGR_INIT_VIA_CTOR_P(NODE) \
2395 TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
2396
2397 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
2398 TEMPLATE_DECL. This macro determines whether or not a given class
2399 type is really a template type, as opposed to an instantiation or
2400 specialization of one. */
2401 #define CLASSTYPE_IS_TEMPLATE(NODE) \
2402 (CLASSTYPE_TEMPLATE_INFO (NODE) \
2403 && !CLASSTYPE_USE_TEMPLATE (NODE) \
2404 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
2405
2406 /* The name used by the user to name the typename type. Typically,
2407 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
2408 corresponding TYPE_DECL. However, this may also be a
2409 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
2410 #define TYPENAME_TYPE_FULLNAME(NODE) (TYPE_FIELDS (NODE))
2411
2412 /* Nonzero if NODE is an implicit typename. */
2413 #define IMPLICIT_TYPENAME_P(NODE) \
2414 (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
2415
2416 /* Nonzero if NODE is a TYPE_DECL that should not be visible because
2417 it is from a dependent base class. */
2418 #define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE) \
2419 (TREE_CODE (NODE) == TYPE_DECL \
2420 && DECL_ARTIFICIAL (NODE) \
2421 && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
2422
2423 /* Nonzero in INTEGER_CST means that this int is negative by dint of
2424 using a twos-complement negated operand. */
2425 #define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
2426
2427 /* Nonzero in any kind of _TYPE where conversions to base-classes may
2428 involve pointer arithmetic. If this is zero, then converting to
2429 a base-class never requires changing the value of the pointer. */
2430 #define TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P(NODE) (TREE_LANG_FLAG_1 (NODE))
2431
2432 /* [class.virtual]
2433
2434 A class that declares or inherits a virtual function is called a
2435 polymorphic class. */
2436 #define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
2437
2438 /* Nonzero if this class has a virtual function table pointer. */
2439 #define TYPE_CONTAINS_VPTR_P(NODE) \
2440 (TYPE_POLYMORPHIC_P (NODE) \
2441 || TYPE_USES_VIRTUAL_BASECLASSES (NODE))
2442
2443 /* This flag is true of a local VAR_DECL if it was declared in a for
2444 statement, but we are no longer in the scope of the for. */
2445 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
2446
2447 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
2448 if we already emitted a warning about using it. */
2449 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
2450
2451 /* Nonzero if NODE is a FUNCTION_DECL (for a function with global
2452 scope) declared in a local scope. */
2453 #define DECL_LOCAL_FUNCTION_P(NODE) \
2454 DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
2455
2456 /* Nonzero if NODE is a FUNCTION_DECL for a built-in function, and we have
2457 not yet seen a prototype for that function. */
2458 #define DECL_ANTICIPATED(NODE) \
2459 (DECL_LANG_SPECIFIC (DECL_CHECK (NODE))->decl_flags.anticipated_p)
2460
2461 /* Record whether a typedef for type `int' was actually `signed int'. */
2462 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
2463
2464 /* Returns nonzero if DECL has external linkage, as specified by the
2465 language standard. (This predicate may hold even when the
2466 corresponding entity is not actually given external linkage in the
2467 object file; see decl_linkage for details.) */
2468 #define DECL_EXTERNAL_LINKAGE_P(DECL) \
2469 (decl_linkage (DECL) == lk_external)
2470
2471 #define INTEGRAL_CODE_P(CODE) \
2472 ((CODE) == INTEGER_TYPE || (CODE) == ENUMERAL_TYPE || (CODE) == BOOLEAN_TYPE)
2473
2474 /* [basic.fundamental]
2475
2476 Types bool, char, wchar_t, and the signed and unsigned integer types
2477 are collectively called integral types.
2478
2479 Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
2480 types as well, which is incorrect in C++. */
2481 #define CP_INTEGRAL_TYPE_P(TYPE) \
2482 (TREE_CODE (TYPE) == BOOLEAN_TYPE \
2483 || TREE_CODE (TYPE) == INTEGER_TYPE)
2484
2485 /* [basic.fundamental]
2486
2487 Integral and floating types are collectively called arithmetic
2488 types. */
2489 #define ARITHMETIC_TYPE_P(TYPE) \
2490 (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
2491
2492 /* [basic.types]
2493
2494 Arithmetic types, enumeration types, pointer types, and
2495 pointer-to-member types, are collectively called scalar types. */
2496 #define SCALAR_TYPE_P(TYPE) \
2497 (ARITHMETIC_TYPE_P (TYPE) \
2498 || TREE_CODE (TYPE) == ENUMERAL_TYPE \
2499 || TYPE_PTR_P (TYPE) \
2500 || TYPE_PTRMEM_P (TYPE) \
2501 || TYPE_PTRMEMFUNC_P (TYPE))
2502
2503 /* [dcl.init.aggr]
2504
2505 An aggregate is an array or a class with no user-declared
2506 constructors, no private or protected non-static data members, no
2507 base classes, and no virtual functions. */
2508 #define CP_AGGREGATE_TYPE_P(TYPE) \
2509 (TREE_CODE (TYPE) == ARRAY_TYPE \
2510 || (CLASS_TYPE_P (TYPE) \
2511 && !CLASSTYPE_NON_AGGREGATE (TYPE)))
2512
2513 /* Nonzero for a class type means that the class type has a
2514 user-declared constructor. */
2515 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
2516
2517 /* When appearing in an INDIRECT_REF, it means that the tree structure
2518 underneath is actually a call to a constructor. This is needed
2519 when the constructor must initialize local storage (which can
2520 be automatically destroyed), rather than allowing it to allocate
2521 space from the heap.
2522
2523 When appearing in a SAVE_EXPR, it means that underneath
2524 is a call to a constructor.
2525
2526 When appearing in a CONSTRUCTOR, it means that it was
2527 a GNU C constructor expression.
2528
2529 When appearing in a FIELD_DECL, it means that this field
2530 has been duly initialized in its constructor. */
2531 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
2532
2533 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
2534 && CONSTRUCTOR_ELTS (NODE) == NULL_TREE \
2535 && ! TREE_HAS_CONSTRUCTOR (NODE))
2536
2537 /* Nonzero for _TYPE means that the _TYPE defines a destructor. */
2538 #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2 (NODE))
2539
2540 /* Nonzero means that an object of this type can not be initialized using
2541 an initializer list. */
2542 #define CLASSTYPE_NON_AGGREGATE(NODE) \
2543 (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
2544 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
2545 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
2546
2547 /* Nonzero if there is a user-defined X::op=(x&) for this class. */
2548 #define TYPE_HAS_REAL_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_real_assign_ref)
2549 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
2550 #define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_abstract_assign_ref)
2551 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref)
2552
2553 /* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
2554
2555 A destructor is trivial if it is an implicitly declared
2556 destructor and if:
2557
2558 - all of the direct base classes of its class have trivial
2559 destructors,
2560
2561 - for all of the non-static data members of its class that are
2562 of class type (or array thereof), each such class has a
2563 trivial destructor. */
2564 #define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
2565 (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
2566
2567 /* Nonzero for _TYPE node means that this type does not have a trivial
2568 destructor. Therefore, destroying an object of this type will
2569 involve a call to a destructor. This can apply to objects of
2570 ARRAY_TYPE is the type of the elements needs a destructor. */
2571 #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
2572 (TYPE_LANG_FLAG_4 (NODE))
2573
2574 /* Nonzero for class type means that copy initialization of this type can use
2575 a bitwise copy. */
2576 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
2577 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
2578
2579 /* Nonzero for class type means that assignment of this type can use
2580 a bitwise copy. */
2581 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
2582 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
2583
2584 #define TYPE_PTRMEM_P(NODE) \
2585 (TREE_CODE (NODE) == POINTER_TYPE \
2586 && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
2587 #define TYPE_PTR_P(NODE) \
2588 (TREE_CODE (NODE) == POINTER_TYPE \
2589 && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
2590 #define TYPE_PTROB_P(NODE) \
2591 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
2592 && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
2593 #define TYPE_PTROBV_P(NODE) \
2594 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
2595 #define TYPE_PTRFN_P(NODE) \
2596 (TREE_CODE (NODE) == POINTER_TYPE \
2597 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2598 #define TYPE_REFFN_P(NODE) \
2599 (TREE_CODE (NODE) == REFERENCE_TYPE \
2600 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2601
2602 /* Nonzero for _TYPE node means that this type is a pointer to member
2603 function type. */
2604 #define TYPE_PTRMEMFUNC_P(NODE) \
2605 (TREE_CODE (NODE) == RECORD_TYPE \
2606 && TYPE_LANG_SPECIFIC (NODE) \
2607 && TYPE_PTRMEMFUNC_FLAG (NODE))
2608
2609 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
2610 (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
2611
2612 /* Indicates when overload resolution may resolve to a pointer to
2613 member function. [expr.unary.op]/3 */
2614 #define PTRMEM_OK_P(NODE) TREE_LANG_FLAG_0 (NODE)
2615
2616 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
2617 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
2618 before using this macro. */
2619 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
2620 (TREE_TYPE (TYPE_FIELDS (NODE)))
2621
2622 /* Returns `A' for a type like `int (A::*)(double)' */
2623 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
2624 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
2625
2626 /* These are use to manipulate the canonical RECORD_TYPE from the
2627 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
2628 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
2629 (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
2630 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
2631 do { \
2632 if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
2633 { \
2634 TYPE_LANG_SPECIFIC (NODE) = \
2635 ggc_alloc_cleared (sizeof (struct lang_type_ptrmem)); \
2636 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
2637 } \
2638 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
2639 } while (0)
2640 /* Returns the pfn field from a TYPE_PTRMEMFUNC_P. */
2641 #define PFN_FROM_PTRMEMFUNC(NODE) pfn_from_ptrmemfunc ((NODE))
2642
2643 /* For a pointer-to-member type of the form `T X::*', this is `X'.
2644 For a type like `void (X::*)() const', this type is `X', not `const
2645 X'. To get at the `const X' you have to look at the
2646 TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
2647 type `const X*'. */
2648 #define TYPE_PTRMEM_CLASS_TYPE(NODE) \
2649 (TYPE_PTRMEM_P (NODE) \
2650 ? TYPE_OFFSET_BASETYPE (TREE_TYPE (NODE)) \
2651 : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
2652
2653 /* For a pointer-to-member type of the form `T X::*', this is `T'. */
2654 #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
2655 (TYPE_PTRMEM_P (NODE) \
2656 ? TREE_TYPE (TREE_TYPE (NODE)) \
2657 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
2658
2659 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
2660 `X'. */
2661 #define PTRMEM_CST_CLASS(NODE) \
2662 TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
2663
2664 /* For a pointer-to-member constant `X::Y' this is the _DECL for
2665 `Y'. */
2666 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
2667
2668 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
2669 specified in its declaration. This can also be set for an
2670 erroneously declared PARM_DECL. */
2671 #define DECL_THIS_EXTERN(NODE) \
2672 DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
2673
2674 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
2675 specified in its declaration. This can also be set for an
2676 erroneously declared PARM_DECL. */
2677 #define DECL_THIS_STATIC(NODE) \
2678 DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
2679
2680 /* Nonzero if TYPE is an anonymous union or struct type. We have to use a
2681 flag for this because "A union for which objects or pointers are
2682 declared is not an anonymous union" [class.union]. */
2683 #define ANON_AGGR_TYPE_P(NODE) \
2684 (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
2685 #define SET_ANON_AGGR_TYPE_P(NODE) \
2686 (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
2687
2688 /* Nonzero if TYPE is an anonymous union type. */
2689 #define ANON_UNION_TYPE_P(NODE) \
2690 (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
2691
2692 #define UNKNOWN_TYPE LANG_TYPE
2693
2694 /* Define fields and accessors for nodes representing declared names. */
2695
2696 #define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
2697
2698 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
2699
2700 /* The format of each node in the DECL_FRIENDLIST is as follows:
2701
2702 The TREE_PURPOSE will be the name of a function, i.e., an
2703 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the
2704 list of functions with that name which are friends. The
2705 TREE_PURPOSE of each node in this sublist will be error_mark_node,
2706 if the function was declared a friend individually, in which case
2707 the TREE_VALUE will be the function_decl. If, however, all
2708 functions with a given name in a class were declared to be friends,
2709 the TREE_PUROSE will be the class type, and the TREE_VALUE will be
2710 NULL_TREE. */
2711 #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
2712 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
2713 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
2714
2715 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
2716 each node is a type; the TREE_VALUE is the access granted for this
2717 DECL in that type. The DECL_ACCESS is set by access declarations.
2718 For example, if a member that would normally be public in a
2719 derived class is made protected, then the derived class and the
2720 protected_access_node will appear in the DECL_ACCESS for the node. */
2721 #define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
2722
2723 /* Nonzero if the FUNCTION_DECL is a global constructor. */
2724 #define DECL_GLOBAL_CTOR_P(NODE) \
2725 (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p)
2726
2727 /* Nonzero if the FUNCTION_DECL is a global destructor. */
2728 #define DECL_GLOBAL_DTOR_P(NODE) \
2729 (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p)
2730
2731 /* Accessor macros for C++ template decl nodes. */
2732
2733 /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
2734 is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
2735 template parameters, with 1 being the outermost set of template
2736 parameters. The TREE_VALUE is a vector, whose elements are the
2737 template parameters at each level. Each element in the vector is a
2738 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
2739 non-type parameter), or a TYPE_DECL (if the parameter is a type
2740 parameter). The TREE_PURPOSE is the default value, if any. The
2741 TEMPLATE_PARM_INDEX for the parameter is avilable as the
2742 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
2743 TYPE_DECL). */
2744 #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS (NODE)
2745 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
2746 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
2747 #define DECL_NTPARMS(NODE) \
2748 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
2749 /* For function, method, class-data templates. */
2750 #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE)
2751 /* For a static member variable template, the
2752 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
2753 implicitly generated instantiations of the variable. There are no
2754 partial instantiations of static member variables, so all of these
2755 will be full instantiations.
2756
2757 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
2758 all instantiations and specializations of the class type, including
2759 partial instantiations and partial specializations.
2760
2761 In both cases, the TREE_PURPOSE of each node contains the arguments
2762 used; the TREE_VALUE contains the generated variable. The template
2763 arguments are always complete. For example, given:
2764
2765 template <class T> struct S1 {
2766 template <class U> struct S2 {};
2767 template <class U> struct S2<U*> {};
2768 };
2769
2770 the record for the partial specialization will contain, as its
2771 argument list, { {T}, {U*} }, and will be on the
2772 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
2773 <class U> struct S1<T>::S2'.
2774
2775 This list is not used for function templates. */
2776 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE)
2777 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
2778 contains all instantiations and specializations of the function,
2779 including partial instantiations. For a partial instantiation
2780 which is a specialization, this list holds only full
2781 specializations of the template that are instantiations of the
2782 partial instantiation. For example, given:
2783
2784 template <class T> struct S {
2785 template <class U> void f(U);
2786 template <> void f(T);
2787 };
2788
2789 the `S<int>::f<int>(int)' function will appear on the
2790 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
2791 template <class U> void S<T>::f(U)' and `template <class T> void
2792 S<int>::f(T)'. In the latter case, however, it will have only the
2793 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
2794 for the function declaration will point at the specialization, not
2795 the fully general template.
2796
2797 For a class template, this list contains the partial
2798 specializations of this template. (Full specializations are not
2799 recorded on this list.) The TREE_PURPOSE holds the innermost
2800 arguments used in the partial specialization (e.g., for `template
2801 <class T> struct S<T*, int>' this will be `T*'.) The TREE_VALUE
2802 holds the innermost template parameters for the specialization
2803 (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node
2804 for the partial specialization.
2805
2806 This list is not used for static variable templates. */
2807 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE)
2808
2809 /* Nonzero for a DECL which is actually a template parameter. */
2810 #define DECL_TEMPLATE_PARM_P(NODE) \
2811 (DECL_LANG_FLAG_0 (NODE) \
2812 && (TREE_CODE (NODE) == CONST_DECL \
2813 || TREE_CODE (NODE) == PARM_DECL \
2814 || TREE_CODE (NODE) == TYPE_DECL \
2815 || TREE_CODE (NODE) == TEMPLATE_DECL))
2816
2817 /* Mark NODE as a template parameter. */
2818 #define SET_DECL_TEMPLATE_PARM_P(NODE) \
2819 (DECL_LANG_FLAG_0 (NODE) = 1)
2820
2821 /* Nonzero if NODE is a template template parameter. */
2822 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
2823 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
2824
2825 #define DECL_FUNCTION_TEMPLATE_P(NODE) \
2826 (TREE_CODE (NODE) == TEMPLATE_DECL \
2827 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
2828
2829 /* Nonzero for a DECL that represents a template class. */
2830 #define DECL_CLASS_TEMPLATE_P(NODE) \
2831 (TREE_CODE (NODE) == TEMPLATE_DECL \
2832 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
2833 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
2834
2835 /* Nonzero if NODE which declares a type. */
2836 #define DECL_DECLARES_TYPE_P(NODE) \
2837 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
2838
2839 /* Nonzero if NODE is the typedef implicitly generated for a type when
2840 the type is declared. (In C++, `struct S {};' is roughly equivalent
2841 to `struct S {}; typedef struct S S;' in C. This macro will hold
2842 for the typedef indicated in this example. Note that in C++, there
2843 is a second implicit typedef for each class, in the scope of `S'
2844 itself, so that you can say `S::S'. This macro does *not* hold for
2845 those typedefs. */
2846 #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
2847 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
2848 #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
2849 (DECL_LANG_FLAG_2 (NODE) = 1)
2850
2851 /* A `primary' template is one that has its own template header. A
2852 member function of a class template is a template, but not primary.
2853 A member template is primary. Friend templates are primary, too. */
2854
2855 /* Returns the primary template corresponding to these parameters. */
2856 #define DECL_PRIMARY_TEMPLATE(NODE) \
2857 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
2858
2859 /* Returns nonzero if NODE is a primary template. */
2860 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
2861
2862 #define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
2863 (TREE_INT_CST_LOW (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
2864
2865 /* Indicates whether or not (and how) a template was expanded for this
2866 FUNCTION_DECL or VAR_DECL.
2867 0=normal declaration, e.g. int min (int, int);
2868 1=implicit template instantiation
2869 2=explicit template specialization, e.g. int min<int> (int, int);
2870 3=explicit template instantiation, e.g. template int min<int> (int, int); */
2871 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template)
2872
2873 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
2874 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
2875 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
2876
2877 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
2878 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
2879 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2880 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
2881 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
2882 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
2883
2884 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
2885 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
2886 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2887 (CLASSTYPE_USE_TEMPLATE (NODE) == 1)
2888 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
2889 (CLASSTYPE_USE_TEMPLATE (NODE) = 1)
2890
2891 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
2892 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
2893 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2894 (CLASSTYPE_USE_TEMPLATE (NODE) == 3)
2895 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
2896 (CLASSTYPE_USE_TEMPLATE (NODE) = 3)
2897
2898 /* Nonzero if DECL is a friend function which is an instantiation
2899 from the point of view of the compiler, but not from the point of
2900 view of the language. For example given:
2901 template <class T> struct S { friend void f(T) {}; };
2902 the declaration of `void f(int)' generated when S<int> is
2903 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
2904 a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
2905 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
2906 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
2907
2908 /* Nonzero if TYPE is a partial instantiation of a template class,
2909 i.e., an instantiation whose instantiation arguments involve
2910 template types. */
2911 #define PARTIAL_INSTANTIATION_P(TYPE) \
2912 (LANG_TYPE_CLASS_CHECK (TYPE)->is_partial_instantiation)
2913
2914 /* Nonzero iff we are currently processing a declaration for an
2915 entity with its own template parameter list, and which is not a
2916 full specialization. */
2917 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
2918 (processing_template_decl > template_class_depth (current_class_type))
2919
2920 /* This function may be a guiding decl for a template. */
2921 #define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
2922
2923 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
2924 instantiated, i.e. its definition has been generated from the
2925 pattern given in the the template. */
2926 #define DECL_TEMPLATE_INSTANTIATED(NODE) \
2927 DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
2928
2929 /* We know what we're doing with this decl now. */
2930 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
2931
2932 /* This function was declared inline. This flag controls the linkage
2933 semantics of 'inline'; whether or not the function is inlined is
2934 controlled by DECL_INLINE. */
2935 #define DECL_DECLARED_INLINE_P(NODE) \
2936 (DECL_LANG_SPECIFIC (NODE)->decl_flags.base.declared_inline)
2937
2938 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
2939 so that assemble_external will work properly. So we have this flag to
2940 tell us whether the decl is really not external. */
2941 #define DECL_NOT_REALLY_EXTERN(NODE) \
2942 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
2943
2944 #define DECL_REALLY_EXTERN(NODE) \
2945 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
2946
2947 /* A thunk is a stub function.
2948
2949 A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
2950 The address of the ordinary FUNCTION_DECL is given by the
2951 DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
2952 FUNCTION_DECL. The job of the thunk is to either adjust the this
2953 pointer before transferring control to the FUNCTION_DECL, or call
2954 FUNCTION_DECL and then adjust the result value. Note, the result
2955 pointer adjusting thunk must perform a call to the thunked
2956 function, (or be implemented via passing some invisible parameter
2957 to the thunked function, which is modified to perform the
2958 adjustment just before returning).
2959
2960 A thunk may perform either, or both, of the following operations:
2961
2962 o Adjust the this or result pointer by a constant offset.
2963 o Adjust the this or result pointer by looking up a vcall or vbase offset
2964 in the vtable.
2965
2966 A this pointer adjusting thunk converts from a base to a derived
2967 class, and hence adds the offsets. A result pointer adjusting thunk
2968 converts from a derived class to a base, and hence subtracts the
2969 offsets. If both operations are performed, then the constant
2970 adjument is performed first for this pointer adjustment and last
2971 for the result pointer adjustment.
2972
2973 The constant adjustment is given by THUNK_FIXED_OFFSET. If the
2974 vcall or vbase offset is required, the index into the vtable is given by
2975 THUNK_VIRTUAL_OFFSET. */
2976
2977 /* An integer indicating how many bytes should be subtracted from the
2978 this or result pointer when this function is called. */
2979 #define THUNK_FIXED_OFFSET(DECL) \
2980 (DECL_LANG_SPECIFIC (DECL)->u.f.fixed_offset)
2981
2982 /* A tree indicating how many bytes should be added to the
2983 vtable for the this or result pointer to find the vcall or vbase
2984 offset. (The vptr is always located at offset zero from the
2985 this or result pointer.) If NULL, then there is no virtual adjust. */
2986 #define THUNK_VIRTUAL_OFFSET(DECL) \
2987 (LANG_DECL_U2_CHECK (DECL, 0)->virtual_offset)
2988
2989 /* These macros provide convenient access to the various _STMT nodes
2990 created when parsing template declarations. */
2991 #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
2992 #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
2993
2994 #define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
2995 #define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
2996
2997 #define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
2998
2999 /* Nonzero if this try block is a function try block. */
3000 #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
3001 #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
3002 #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
3003 #define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
3004
3005 /* The parameters for a call-declarator. */
3006 #define CALL_DECLARATOR_PARMS(NODE) \
3007 (TREE_PURPOSE (TREE_OPERAND (NODE, 1)))
3008
3009 /* The cv-qualifiers for a call-declarator. */
3010 #define CALL_DECLARATOR_QUALS(NODE) \
3011 (TREE_VALUE (TREE_OPERAND (NODE, 1)))
3012
3013 /* The exception-specification for a call-declarator. */
3014 #define CALL_DECLARATOR_EXCEPTION_SPEC(NODE) \
3015 (TREE_TYPE (NODE))
3016
3017 /* An enumeration of the kind of tags that C++ accepts. */
3018 enum tag_types {
3019 none_type = 0, /* Not a tag type. */
3020 record_type, /* "struct" types. */
3021 class_type, /* "class" types. */
3022 union_type, /* "union" types. */
3023 enum_type, /* "enum" types. */
3024 typename_type /* "typename" types. */
3025 };
3026
3027 /* The various kinds of lvalues we distinguish. */
3028 typedef enum cp_lvalue_kind {
3029 clk_none = 0, /* Things that are not an lvalue. */
3030 clk_ordinary = 1, /* An ordinary lvalue. */
3031 clk_class = 2, /* An rvalue of class-type. */
3032 clk_bitfield = 4, /* An lvalue for a bit-field. */
3033 } cp_lvalue_kind;
3034
3035 /* The kinds of scopes we recognize. */
3036 typedef enum scope_kind {
3037 sk_template_parms, /* A scope for template parameters. */
3038 sk_template_spec /* A scope corresponding to a template
3039 specialization. There is never anything in
3040 this scope. */
3041 } scope_kind;
3042
3043 /* Various kinds of template specialization, instantiation, etc. */
3044 typedef enum tmpl_spec_kind {
3045 tsk_none, /* Not a template at all. */
3046 tsk_invalid_member_spec, /* An explicit member template
3047 specialization, but the enclosing
3048 classes have not all been explicitly
3049 specialized. */
3050 tsk_invalid_expl_inst, /* An explicit instantiation containing
3051 template parameter lists. */
3052 tsk_excessive_parms, /* A template declaration with too many
3053 template parameter lists. */
3054 tsk_insufficient_parms, /* A template declaration with too few
3055 parameter lists. */
3056 tsk_template, /* A template declaration. */
3057 tsk_expl_spec, /* An explicit specialization. */
3058 tsk_expl_inst /* An explicit instantiation. */
3059 } tmpl_spec_kind;
3060
3061 /* The various kinds of access. BINFO_ACCESS depends on these being
3062 two bit quantities. The numerical values are important; they are
3063 used to initialize RTTI data structures, so changing them changes
3064 the ABI. */
3065 typedef enum access_kind {
3066 ak_none = 0, /* Inaccessible. */
3067 ak_public = 1, /* Accessible, as a `public' thing. */
3068 ak_protected = 2, /* Accessible, as a `protected' thing. */
3069 ak_private = 3 /* Accessible, as a `private' thing. */
3070 } access_kind;
3071
3072 /* The various kinds of special functions. If you add to this list,
3073 you should update special_function_p as well. */
3074 typedef enum special_function_kind {
3075 sfk_none = 0, /* Not a special function. This enumeral
3076 must have value zero; see
3077 special_function_p. */
3078 sfk_constructor, /* A constructor. */
3079 sfk_copy_constructor, /* A copy constructor. */
3080 sfk_assignment_operator, /* An assignment operator. */
3081 sfk_destructor, /* A destructor. */
3082 sfk_complete_destructor, /* A destructor for complete objects. */
3083 sfk_base_destructor, /* A destructor for base subobjects. */
3084 sfk_deleting_destructor, /* A destructor for complete objects that
3085 deletes the object after it has been
3086 destroyed. */
3087 sfk_conversion /* A conversion operator. */
3088 } special_function_kind;
3089
3090 /* The various kinds of linkage. From [basic.link],
3091
3092 A name is said to have linkage when it might denote the same
3093 object, reference, function, type, template, namespace or value
3094 as a name introduced in another scope:
3095
3096 -- When a name has external linkage, the entity it denotes can
3097 be referred to from scopes of other translation units or from
3098 other scopes of the same translation unit.
3099
3100 -- When a name has internal linkage, the entity it denotes can
3101 be referred to by names from other scopes in the same
3102 translation unit.
3103
3104 -- When a name has no linkage, the entity it denotes cannot be
3105 referred to by names from other scopes. */
3106
3107 typedef enum linkage_kind {
3108 lk_none, /* No linkage. */
3109 lk_internal, /* Internal linkage. */
3110 lk_external /* External linkage. */
3111 } linkage_kind;
3112
3113 /* Bitmask flags to control type substitution. */
3114 typedef enum tsubst_flags_t {
3115 tf_none = 0, /* nothing special */
3116 tf_error = 1 << 0, /* give error messages */
3117 tf_warning = 1 << 1, /* give warnings too */
3118 tf_no_attributes = 1 << 2, /* ignore attributes on comparisons
3119 (instantiate_type use) */
3120 tf_ignore_bad_quals = 1 << 3, /* ignore bad cvr qualifiers */
3121 tf_keep_type_decl = 1 << 4, /* retain typedef type decls
3122 (make_typename_type use) */
3123 tf_ptrmem_ok = 1 << 5, /* pointers to member ok (internal
3124 instantiate_type use) */
3125 tf_parsing = 1 << 6 /* called from parser
3126 (make_typename_type use) */
3127 } tsubst_flags_t;
3128
3129 /* The kind of checking we can do looking in a class hierarchy. */
3130 typedef enum base_access {
3131 ba_any = 0, /* Do not check access, allow an ambiguous base,
3132 prefer a non-virtual base */
3133 ba_ignore = 1, /* Do not check access */
3134 ba_check = 2, /* Check access */
3135 ba_not_special = 3, /* Do not consider special privilege
3136 current_class_type might give. */
3137 ba_quiet = 4, /* Do not issue error messages (bit mask). */
3138 } base_access;
3139
3140 /* The kind of base we can find, looking in a class hierarchy.
3141 Values <0 indicate we failed. */
3142 typedef enum base_kind {
3143 bk_inaccessible = -3, /* The base is inaccessible */
3144 bk_ambig = -2, /* The base is ambiguous */
3145 bk_not_base = -1, /* It is not a base */
3146 bk_same_type = 0, /* It is the same type */
3147 bk_proper_base = 1, /* It is a proper base */
3148 bk_via_virtual = 2 /* It is a proper base, but via a virtual
3149 path. This might not be the canonical
3150 binfo. */
3151 } base_kind;
3152
3153 /* Set by add_implicitly_declared_members() to keep those members from
3154 being flagged as deprecated or reported as using deprecated
3155 types. */
3156 extern int adding_implicit_members;
3157
3158 /* in decl{2}.c */
3159 /* A node that is a list (length 1) of error_mark_nodes. */
3160 extern GTY(()) tree error_mark_list;
3161
3162 /* Node for "pointer to (virtual) function".
3163 This may be distinct from ptr_type_node so gdb can distinguish them. */
3164 #define vfunc_ptr_type_node vtable_entry_type
3165
3166
3167 /* For building calls to `delete'. */
3168 extern GTY(()) tree integer_two_node;
3169 extern GTY(()) tree integer_three_node;
3170
3171 extern GTY(()) tree anonymous_namespace_name;
3172
3173 /* The number of function bodies which we are currently processing.
3174 (Zero if we are at namespace scope, one inside the body of a
3175 function, two inside the body of a function in a local class, etc.) */
3176 extern int function_depth;
3177
3178 /* in pt.c */
3179
3180 /* These values are used for the `STRICT' parameter to type_unification and
3181 fn_type_unification. Their meanings are described with the
3182 documentation for fn_type_unification. */
3183
3184 typedef enum unification_kind_t {
3185 DEDUCE_CALL,
3186 DEDUCE_CONV,
3187 DEDUCE_EXACT,
3188 DEDUCE_ORDER
3189 } unification_kind_t;
3190
3191 /* Macros for operating on a template instantiation level node, represented
3192 by an EXPR_WITH_FILE_LOCATION. */
3193
3194 #define TINST_DECL(NODE) EXPR_WFL_NODE (NODE)
3195 #define TINST_LINE(NODE) EXPR_WFL_LINENO (NODE)
3196 #define TINST_FILE(NODE) EXPR_WFL_FILENAME (NODE)
3197
3198 /* in class.c */
3199
3200 extern int current_class_depth;
3201
3202 /* An array of all local classes present in this translation unit, in
3203 declaration order. */
3204 extern GTY(()) varray_type local_classes;
3205 \f
3206 /* Here's where we control how name mangling takes place. */
3207
3208 /* Cannot use '$' up front, because this confuses gdb
3209 (names beginning with '$' are gdb-local identifiers).
3210
3211 Note that all forms in which the '$' is significant are long enough
3212 for direct indexing (meaning that if we know there is a '$'
3213 at a particular location, we can index into the string at
3214 any other location that provides distinguishing characters). */
3215
3216 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
3217 doesn't allow '$' in symbol names. */
3218 #ifndef NO_DOLLAR_IN_LABEL
3219
3220 #define JOINER '$'
3221
3222 #define VPTR_NAME "$v"
3223 #define THROW_NAME "$eh_throw"
3224 #define AUTO_VTABLE_NAME "__vtbl$me__"
3225 #define AUTO_TEMP_NAME "_$tmp_"
3226 #define AUTO_TEMP_FORMAT "_$tmp_%d"
3227 #define VTABLE_BASE "$vb"
3228 #define VTABLE_NAME_PREFIX "__vt_"
3229 #define VFIELD_BASE "$vf"
3230 #define VFIELD_NAME "_vptr$"
3231 #define VFIELD_NAME_FORMAT "_vptr$%s"
3232 #define STATIC_NAME_FORMAT "_%s$%s"
3233 #define ANON_AGGRNAME_FORMAT "$_%d"
3234
3235 #else /* NO_DOLLAR_IN_LABEL */
3236
3237 #ifndef NO_DOT_IN_LABEL
3238
3239 #define JOINER '.'
3240
3241 #define VPTR_NAME ".v"
3242 #define THROW_NAME ".eh_throw"
3243 #define AUTO_VTABLE_NAME "__vtbl.me__"
3244 #define AUTO_TEMP_NAME "_.tmp_"
3245 #define AUTO_TEMP_FORMAT "_.tmp_%d"
3246 #define VTABLE_BASE ".vb"
3247 #define VTABLE_NAME_PREFIX "__vt_"
3248 #define VFIELD_BASE ".vf"
3249 #define VFIELD_NAME "_vptr."
3250 #define VFIELD_NAME_FORMAT "_vptr.%s"
3251 #define STATIC_NAME_FORMAT "_%s.%s"
3252
3253 #define ANON_AGGRNAME_FORMAT "._%d"
3254
3255 #else /* NO_DOT_IN_LABEL */
3256
3257 #define VPTR_NAME "__vptr"
3258 #define VPTR_NAME_P(ID_NODE) \
3259 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
3260 #define THROW_NAME "__eh_throw"
3261 #define IN_CHARGE_NAME "__in_chrg"
3262 #define AUTO_VTABLE_NAME "__vtbl_me__"
3263 #define AUTO_TEMP_NAME "__tmp_"
3264 #define TEMP_NAME_P(ID_NODE) \
3265 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
3266 sizeof (AUTO_TEMP_NAME) - 1))
3267 #define AUTO_TEMP_FORMAT "__tmp_%d"
3268 #define VTABLE_BASE "__vtb"
3269 #define VTABLE_NAME "__vt_"
3270 #define VTABLE_NAME_PREFIX "__vt_"
3271 #define VTABLE_NAME_P(ID_NODE) \
3272 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
3273 sizeof (VTABLE_NAME) - 1))
3274 #define VFIELD_BASE "__vfb"
3275 #define VFIELD_NAME "__vptr_"
3276 #define VFIELD_NAME_P(ID_NODE) \
3277 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
3278 sizeof (VFIELD_NAME) - 1))
3279 #define VFIELD_NAME_FORMAT "__vptr_%s"
3280 #define STATIC_NAME_FORMAT "__static_%s_%s"
3281
3282 #define ANON_AGGRNAME_PREFIX "__anon_"
3283 #define ANON_AGGRNAME_P(ID_NODE) \
3284 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
3285 sizeof (ANON_AGGRNAME_PREFIX) - 1))
3286 #define ANON_AGGRNAME_FORMAT "__anon_%d"
3287
3288 #endif /* NO_DOT_IN_LABEL */
3289 #endif /* NO_DOLLAR_IN_LABEL */
3290
3291 #define THIS_NAME "this"
3292 #define CTOR_NAME "__ct"
3293 #define DTOR_NAME "__dt"
3294
3295 #define IN_CHARGE_NAME "__in_chrg"
3296
3297 #define VTBL_PTR_TYPE "__vtbl_ptr_type"
3298 #define VTABLE_DELTA_NAME "__delta"
3299 #define VTABLE_PFN_NAME "__pfn"
3300
3301 #define EXCEPTION_CLEANUP_NAME "exception cleanup"
3302
3303 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
3304
3305 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3306 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
3307
3308 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
3309 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
3310 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
3311
3312 #define TEMP_NAME_P(ID_NODE) \
3313 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
3314 #define VFIELD_NAME_P(ID_NODE) \
3315 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
3316
3317 /* For anonymous aggregate types, we need some sort of name to
3318 hold on to. In practice, this should not appear, but it should
3319 not be harmful if it does. */
3320 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
3321 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
3322 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
3323
3324 /* Returns nonzero iff NODE is a declaration for the global function
3325 `main'. */
3326 #define DECL_MAIN_P(NODE) \
3327 (DECL_EXTERN_C_FUNCTION_P (NODE) \
3328 && DECL_NAME (NODE) != NULL_TREE \
3329 && MAIN_NAME_P (DECL_NAME (NODE)))
3330
3331 \f
3332 /* Nonzero if we're done parsing and into end-of-file activities. */
3333
3334 extern int at_eof;
3335
3336 /* Functions called along with real static constructors and destructors. */
3337
3338 extern GTY(()) tree static_ctors;
3339 extern GTY(()) tree static_dtors;
3340
3341 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
3342
3343 /* Some macros for char-based bitfields. */
3344 #define B_SET(A,X) ((A)[(X)>>3] |= (1 << ((X)&7)))
3345 #define B_CLR(A,X) ((A)[(X)>>3] &= ~(1 << ((X)&7)))
3346 #define B_TST(A,X) ((A)[(X)>>3] & (1 << ((X)&7)))
3347
3348 /* These are uses as bits in flags passed to build_method_call
3349 to control its error reporting behavior.
3350
3351 LOOKUP_PROTECT means flag access violations.
3352 LOOKUP_COMPLAIN mean complain if no suitable member function
3353 matching the arguments is found.
3354 LOOKUP_NORMAL is just a combination of these two.
3355 LOOKUP_NONVIRTUAL means make a direct call to the member function found
3356 LOOKUP_GLOBAL means search through the space of overloaded functions,
3357 as well as the space of member functions.
3358 LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
3359 DIRECT_BIND means that if a temporary is created, it should be created so
3360 that it lives as long as the current variable bindings; otherwise it
3361 only lives until the end of the complete-expression. It also forces
3362 direct-initialization in cases where other parts of the compiler have
3363 already generated a temporary, such as reference initialization and the
3364 catch parameter.
3365 LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
3366 after. Note, LOOKUP_COMPLAIN is checked and error messages printed
3367 before LOOKUP_SPECULATIVELY is checked.
3368 LOOKUP_NO_CONVERSION means that user-defined conversions are not
3369 permitted. Built-in conversions are permitted.
3370 LOOKUP_DESTRUCTOR means explicit call to destructor.
3371 LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references.
3372
3373 These are used in global lookup to support elaborated types and
3374 qualifiers.
3375
3376 LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
3377 LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
3378 LOOKUP_PREFER_BOTH means class-or-namespace-name.
3379 LOOKUP_TEMPLATES_EXPECTED means that class templates also count
3380 as types. */
3381
3382 #define LOOKUP_PROTECT (1)
3383 #define LOOKUP_COMPLAIN (2)
3384 #define LOOKUP_NORMAL (3)
3385 #define LOOKUP_NONVIRTUAL (8)
3386 #define LOOKUP_GLOBAL (16)
3387 #define LOOKUP_SPECULATIVELY (64)
3388 #define LOOKUP_ONLYCONVERTING (128)
3389 #define DIRECT_BIND (256)
3390 #define LOOKUP_NO_CONVERSION (512)
3391 #define LOOKUP_DESTRUCTOR (512)
3392 #define LOOKUP_NO_TEMP_BIND (1024)
3393 #define LOOKUP_PREFER_TYPES (2048)
3394 #define LOOKUP_PREFER_NAMESPACES (4096)
3395 #define LOOKUP_PREFER_BOTH (6144)
3396 #define LOOKUP_TEMPLATES_EXPECTED (8192)
3397
3398 #define LOOKUP_NAMESPACES_ONLY(F) \
3399 (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
3400 #define LOOKUP_TYPES_ONLY(F) \
3401 (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
3402 #define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH)
3403
3404
3405 /* These flags are used by the conversion code.
3406 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
3407 CONV_STATIC : Perform the explicit conversions for static_cast.
3408 CONV_CONST : Perform the explicit conversions for const_cast.
3409 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
3410 CONV_PRIVATE : Perform upcasts to private bases.
3411 CONV_FORCE_TEMP : Require a new temporary when converting to the same
3412 aggregate type. */
3413
3414 #define CONV_IMPLICIT 1
3415 #define CONV_STATIC 2
3416 #define CONV_CONST 4
3417 #define CONV_REINTERPRET 8
3418 #define CONV_PRIVATE 16
3419 /* #define CONV_NONCONVERTING 32 */
3420 #define CONV_FORCE_TEMP 64
3421 #define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
3422 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
3423 | CONV_REINTERPRET)
3424 #define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
3425 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
3426
3427 /* Used by build_expr_type_conversion to indicate which types are
3428 acceptable as arguments to the expression under consideration. */
3429
3430 #define WANT_INT 1 /* integer types, including bool */
3431 #define WANT_FLOAT 2 /* floating point types */
3432 #define WANT_ENUM 4 /* enumerated types */
3433 #define WANT_POINTER 8 /* pointer types */
3434 #define WANT_NULL 16 /* null pointer constant */
3435 #define WANT_ARITH (WANT_INT | WANT_FLOAT)
3436
3437 /* Used with comptypes, and related functions, to guide type
3438 comparison. */
3439
3440 #define COMPARE_STRICT 0 /* Just check if the types are the
3441 same. */
3442 #define COMPARE_BASE 1 /* Check to see if the second type is
3443 derived from the first, or if both
3444 are pointers (or references) and
3445 the types pointed to by the second
3446 type is derived from the pointed to
3447 by the first. */
3448 #define COMPARE_RELAXED 2 /* Like COMPARE_DERIVED, but in
3449 reverse. Also treat enmeration
3450 types as the same as integer types
3451 of the same width. */
3452 #define COMPARE_REDECLARATION 4 /* The comparsion is being done when
3453 another declaration of an existing
3454 entity is seen. */
3455 #define COMPARE_NO_ATTRIBUTES 8 /* The comparison should ignore
3456 extra-linguistic type attributes. */
3457
3458 /* Used with push_overloaded_decl. */
3459 #define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
3460 regardless of the current scope. */
3461 #define PUSH_LOCAL 1 /* Push the DECL into the current
3462 scope. */
3463 #define PUSH_USING 2 /* We are pushing this DECL as the
3464 result of a using declaration. */
3465
3466 /* Used with start function. */
3467 #define SF_DEFAULT 0 /* No flags. */
3468 #define SF_PRE_PARSED 1 /* The function declaration has
3469 already been parsed. */
3470 #define SF_INCLASS_INLINE 2 /* The function is an inline, defined
3471 in the class body. */
3472
3473 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
3474 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
3475 class derived from the type pointed to (referred to) by TYPE1. */
3476 #define same_or_base_type_p(TYPE1, TYPE2) \
3477 comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
3478
3479 /* These macros are used to access a TEMPLATE_PARM_INDEX. */
3480 #define TEMPLATE_PARM_INDEX_CAST(NODE) \
3481 ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
3482 #define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
3483 #define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
3484 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
3485 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
3486 #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
3487
3488 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
3489 TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
3490 #define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
3491 #define TEMPLATE_TYPE_IDX(NODE) \
3492 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3493 #define TEMPLATE_TYPE_LEVEL(NODE) \
3494 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3495 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
3496 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3497 #define TEMPLATE_TYPE_DECL(NODE) \
3498 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
3499
3500 /* These constants can used as bit flags in the process of tree formatting.
3501
3502 TFF_PLAIN_IDENTIFIER: unqualified part of a name.
3503 TFF_SCOPE: include the class and namespace scope of the name.
3504 TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
3505 TFF_DECL_SPECIFIERS: print decl-specifiers.
3506 TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
3507 a class-key (resp. `enum').
3508 TFF_RETURN_TYPE: include function return type.
3509 TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
3510 TFF_EXCEPTION_SPECIFICATION: show function exception specification.
3511 TFF_TEMPLATE_HEADER: show the template<...> header in a
3512 template-declaration.
3513 TFF_TEMPLATE_NAME: show only template-name.
3514 TFF_EXPR_IN_PARENS: Parenthesize expressions. */
3515
3516 #define TFF_PLAIN_IDENTIFIER (0)
3517 #define TFF_SCOPE (1)
3518 #define TFF_CHASE_TYPEDEF (1 << 1)
3519 #define TFF_DECL_SPECIFIERS (1 << 2)
3520 #define TFF_CLASS_KEY_OR_ENUM (1 << 3)
3521 #define TFF_RETURN_TYPE (1 << 4)
3522 #define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
3523 #define TFF_EXCEPTION_SPECIFICATION (1 << 6)
3524 #define TFF_TEMPLATE_HEADER (1 << 7)
3525 #define TFF_TEMPLATE_NAME (1 << 8)
3526 #define TFF_EXPR_IN_PARENS (1 << 9)
3527
3528 /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
3529 node. */
3530 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
3531 ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
3532 ? TYPE_TI_TEMPLATE (NODE) \
3533 : TYPE_NAME (NODE))
3534
3535 /* in lex.c */
3536
3537 extern void init_reswords PARAMS ((void));
3538
3539 /* Indexed by TREE_CODE, these tables give C-looking names to
3540 operators represented by TREE_CODES. For example,
3541 opname_tab[(int) MINUS_EXPR] == "-". */
3542 extern const char **opname_tab, **assignop_tab;
3543
3544 typedef struct operator_name_info_t
3545 {
3546 /* The IDENTIFIER_NODE for the operator. */
3547 tree identifier;
3548 /* The name of the operator. */
3549 const char *name;
3550 /* The mangled name of the operator. */
3551 const char *mangled_name;
3552 /* The arity of the operator. */
3553 int arity;
3554 } operator_name_info_t;
3555
3556 /* A mapping from tree codes to operator name information. */
3557 extern operator_name_info_t operator_name_info[];
3558 /* Similar, but for assignment operators. */
3559 extern operator_name_info_t assignment_operator_name_info[];
3560
3561 /* in call.c */
3562 extern bool check_dtor_name (tree, tree);
3563 extern int get_arglist_len_in_bytes PARAMS ((tree));
3564
3565 extern tree build_vfield_ref PARAMS ((tree, tree));
3566 extern tree build_scoped_method_call (tree, tree, tree, tree);
3567 extern tree build_conditional_expr PARAMS ((tree, tree, tree));
3568 extern tree build_addr_func (tree);
3569 extern tree build_call (tree, tree);
3570 extern tree build_method_call (tree, tree, tree, tree, int);
3571 extern bool null_ptr_cst_p (tree);
3572 extern bool sufficient_parms_p (tree);
3573 extern tree type_decays_to (tree);
3574 extern tree resolve_scoped_fn_name (tree, tree);
3575 extern tree build_user_type_conversion (tree, tree, int);
3576 extern tree build_new_function_call (tree, tree);
3577 extern tree build_new_method_call (tree, tree, tree, tree, int);
3578 extern tree build_special_member_call (tree, tree, tree, tree, int);
3579 extern tree build_new_op (enum tree_code, int, tree, tree, tree);
3580 extern tree build_op_delete_call (enum tree_code, tree, tree, int, tree);
3581 extern bool can_convert (tree, tree);
3582 extern bool can_convert_arg (tree, tree, tree);
3583 extern bool can_convert_arg_bad (tree, tree, tree);
3584 extern bool enforce_access (tree, tree);
3585 extern tree convert_default_arg (tree, tree, tree, int);
3586 extern tree convert_arg_to_ellipsis (tree);
3587 extern tree build_x_va_arg (tree, tree);
3588 extern tree cxx_type_promotes_to (tree);
3589 extern tree type_passed_as (tree);
3590 extern tree convert_for_arg_passing (tree, tree);
3591 extern tree cp_convert_parm_for_inlining PARAMS ((tree, tree, tree));
3592 extern bool is_properly_derived_from (tree, tree);
3593 extern tree initialize_reference (tree, tree);
3594 extern tree strip_top_quals (tree);
3595 extern tree perform_implicit_conversion (tree, tree);
3596 extern tree in_charge_arg_for_name (tree);
3597
3598 /* in class.c */
3599 extern tree build_base_path PARAMS ((enum tree_code, tree, tree, int));
3600 extern tree convert_to_base (tree, tree, bool);
3601 extern tree build_vtbl_ref PARAMS ((tree, tree));
3602 extern tree build_vfn_ref PARAMS ((tree, tree));
3603 extern tree get_vtable_decl PARAMS ((tree, int));
3604 extern void add_method PARAMS ((tree, tree, int));
3605 extern int currently_open_class PARAMS ((tree));
3606 extern tree currently_open_derived_class PARAMS ((tree));
3607 extern void duplicate_tag_error PARAMS ((tree));
3608 extern tree finish_struct PARAMS ((tree, tree));
3609 extern void finish_struct_1 PARAMS ((tree));
3610 extern int resolves_to_fixed_type_p PARAMS ((tree, int *));
3611 extern void init_class_processing PARAMS ((void));
3612 extern int is_empty_class PARAMS ((tree));
3613 extern void pushclass PARAMS ((tree, int));
3614 extern void popclass PARAMS ((void));
3615 extern void push_nested_class PARAMS ((tree, int));
3616 extern void pop_nested_class PARAMS ((void));
3617 extern int current_lang_depth PARAMS ((void));
3618 extern void push_lang_context PARAMS ((tree));
3619 extern void pop_lang_context PARAMS ((void));
3620 extern tree instantiate_type PARAMS ((tree, tree, tsubst_flags_t));
3621 extern void print_class_statistics PARAMS ((void));
3622 extern void cxx_print_statistics PARAMS ((void));
3623 extern void cxx_print_xnode PARAMS ((FILE *, tree, int));
3624 extern void cxx_print_decl PARAMS ((FILE *, tree, int));
3625 extern void cxx_print_type PARAMS ((FILE *, tree, int));
3626 extern void cxx_print_identifier PARAMS ((FILE *, tree, int));
3627 extern void cxx_print_error_function PARAMS ((struct diagnostic_context *,
3628 const char *));
3629 extern void build_self_reference PARAMS ((void));
3630 extern int same_signature_p PARAMS ((tree, tree));
3631 extern void warn_hidden PARAMS ((tree));
3632 extern void maybe_add_class_template_decl_list PARAMS ((tree, tree, int));
3633 extern tree get_enclosing_class PARAMS ((tree));
3634 int is_base_of_enclosing_class PARAMS ((tree, tree));
3635 extern void unreverse_member_declarations PARAMS ((tree));
3636 extern void invalidate_class_lookup_cache PARAMS ((void));
3637 extern void maybe_note_name_used_in_class PARAMS ((tree, tree));
3638 extern void note_name_declared_in_class PARAMS ((tree, tree));
3639 extern tree get_vtbl_decl_for_binfo PARAMS ((tree));
3640 extern tree get_vtt_name PARAMS ((tree));
3641 extern tree get_primary_binfo PARAMS ((tree));
3642
3643 /* in cvt.c */
3644 extern tree convert_to_reference PARAMS ((tree, tree, int, int, tree));
3645 extern tree convert_from_reference PARAMS ((tree));
3646 extern tree convert_lvalue PARAMS ((tree, tree));
3647 extern tree ocp_convert PARAMS ((tree, tree, int, int));
3648 extern tree cp_convert PARAMS ((tree, tree));
3649 extern tree convert_to_void PARAMS ((tree, const char */*implicit context*/));
3650 extern tree convert_force PARAMS ((tree, tree, int));
3651 extern tree build_type_conversion PARAMS ((tree, tree, int));
3652 extern tree build_expr_type_conversion PARAMS ((int, tree, int));
3653 extern tree type_promotes_to PARAMS ((tree));
3654 extern tree perform_qualification_conversions PARAMS ((tree, tree));
3655 extern void clone_function_decl PARAMS ((tree, int));
3656 extern void adjust_clone_args PARAMS ((tree));
3657
3658 /* decl.c */
3659 extern int global_bindings_p PARAMS ((void));
3660 extern int kept_level_p PARAMS ((void));
3661 extern tree getdecls PARAMS ((void));
3662 extern void pushlevel PARAMS ((int));
3663 extern tree poplevel PARAMS ((int,int, int));
3664 extern void insert_block PARAMS ((tree));
3665 extern void set_block PARAMS ((tree));
3666 extern tree pushdecl PARAMS ((tree));
3667 extern void cxx_init_decl_processing PARAMS ((void));
3668 enum cp_tree_node_structure_enum cp_tree_node_structure
3669 PARAMS ((union lang_tree_node *));
3670 extern void cxx_insert_default_attributes PARAMS ((tree));
3671 extern bool cxx_mark_addressable PARAMS ((tree));
3672 extern void cxx_push_function_context PARAMS ((struct function *));
3673 extern void cxx_pop_function_context PARAMS ((struct function *));
3674 extern void cxx_mark_function_context PARAMS ((struct function *));
3675 extern int toplevel_bindings_p PARAMS ((void));
3676 extern int namespace_bindings_p PARAMS ((void));
3677 extern void keep_next_level PARAMS ((int));
3678 extern int template_parm_scope_p PARAMS ((void));
3679 extern void set_class_shadows PARAMS ((tree));
3680 extern void maybe_push_cleanup_level PARAMS ((tree));
3681 extern void begin_scope PARAMS ((scope_kind));
3682 extern void finish_scope PARAMS ((void));
3683 extern void note_level_for_for PARAMS ((void));
3684 extern void note_level_for_try PARAMS ((void));
3685 extern void note_level_for_catch PARAMS ((void));
3686 extern void resume_level PARAMS ((struct cp_binding_level *));
3687 extern void delete_block PARAMS ((tree));
3688 extern void add_block_current_level PARAMS ((tree));
3689 extern void pushlevel_class PARAMS ((void));
3690 extern void poplevel_class PARAMS ((void));
3691 extern void print_binding_stack PARAMS ((void));
3692 extern void print_binding_level PARAMS ((struct cp_binding_level *));
3693 extern void push_namespace PARAMS ((tree));
3694 extern void pop_namespace PARAMS ((void));
3695 extern void push_nested_namespace PARAMS ((tree));
3696 extern void pop_nested_namespace PARAMS ((tree));
3697 extern void maybe_push_to_top_level PARAMS ((int));
3698 extern void push_to_top_level PARAMS ((void));
3699 extern void pop_from_top_level PARAMS ((void));
3700 extern void push_switch PARAMS ((tree));
3701 extern void pop_switch PARAMS ((void));
3702 extern tree identifier_type_value PARAMS ((tree));
3703 extern void set_identifier_type_value PARAMS ((tree, tree));
3704 extern void pop_everything PARAMS ((void));
3705 extern void pushtag PARAMS ((tree, tree, int));
3706 extern tree make_anon_name PARAMS ((void));
3707 extern void clear_anon_tags PARAMS ((void));
3708 extern int decls_match PARAMS ((tree, tree));
3709 extern int duplicate_decls PARAMS ((tree, tree));
3710 extern tree pushdecl_top_level PARAMS ((tree));
3711 extern void pushdecl_class_level PARAMS ((tree));
3712 extern tree pushdecl_namespace_level PARAMS ((tree));
3713 extern tree push_using_decl PARAMS ((tree, tree));
3714 extern tree push_using_directive PARAMS ((tree));
3715 extern void push_class_level_binding PARAMS ((tree, tree));
3716 extern tree implicitly_declare PARAMS ((tree));
3717 extern tree declare_local_label PARAMS ((tree));
3718 extern tree define_label PARAMS ((const char *, int, tree));
3719 extern void check_goto PARAMS ((tree));
3720 extern void define_case_label PARAMS ((void));
3721 extern tree binding_for_name PARAMS ((tree, tree));
3722 extern tree namespace_binding PARAMS ((tree, tree));
3723 extern void set_namespace_binding PARAMS ((tree, tree, tree));
3724 extern tree lookup_namespace_name PARAMS ((tree, tree));
3725 extern tree build_typename_type PARAMS ((tree, tree, tree, tree));
3726 extern tree make_typename_type PARAMS ((tree, tree, tsubst_flags_t));
3727 extern tree make_unbound_class_template PARAMS ((tree, tree, tsubst_flags_t));
3728 extern tree lookup_name_nonclass PARAMS ((tree));
3729 extern tree lookup_function_nonclass PARAMS ((tree, tree));
3730 extern tree lookup_qualified_name (tree, tree, bool, int);
3731 extern tree lookup_name PARAMS ((tree, int));
3732 extern tree lookup_name_current_level PARAMS ((tree));
3733 extern tree lookup_type_current_level PARAMS ((tree));
3734 extern tree lookup_name_namespace_only PARAMS ((tree));
3735 extern tree lookup_name_real (tree, int, int, int, int);
3736 extern void begin_only_namespace_names PARAMS ((void));
3737 extern void end_only_namespace_names PARAMS ((void));
3738 extern tree namespace_ancestor PARAMS ((tree, tree));
3739 extern tree unqualified_namespace_lookup PARAMS ((tree, int, tree *));
3740 extern tree check_for_out_of_scope_variable (tree);
3741 extern int lookup_using_namespace PARAMS ((tree, tree, tree, tree, int, tree *));
3742 extern int qualified_lookup_using_namespace PARAMS ((tree, tree, tree, int));
3743 extern tree build_library_fn PARAMS ((tree, tree));
3744 extern tree build_library_fn_ptr PARAMS ((const char *, tree));
3745 extern tree build_cp_library_fn_ptr PARAMS ((const char *, tree));
3746 extern tree push_library_fn PARAMS ((tree, tree));
3747 extern tree push_void_library_fn PARAMS ((tree, tree));
3748 extern tree push_throw_library_fn PARAMS ((tree, tree));
3749 extern int init_type_desc PARAMS ((void));
3750 extern tree check_tag_decl PARAMS ((tree));
3751 extern tree shadow_tag PARAMS ((tree));
3752 extern tree groktypename PARAMS ((tree));
3753 extern tree start_decl PARAMS ((tree, tree, int, tree, tree));
3754 extern void start_decl_1 PARAMS ((tree));
3755 extern void cp_finish_decl PARAMS ((tree, tree, tree, int));
3756 extern void finish_decl PARAMS ((tree, tree, tree));
3757 extern void maybe_inject_for_scope_var PARAMS ((tree));
3758 extern tree start_handler_parms PARAMS ((tree, tree));
3759 extern int complete_array_type PARAMS ((tree, tree, int));
3760 extern tree build_ptrmemfunc_type PARAMS ((tree));
3761 extern tree build_ptrmem_type (tree, tree);
3762 /* the grokdeclarator prototype is in decl.h */
3763 extern int parmlist_is_exprlist PARAMS ((tree));
3764 extern int copy_fn_p PARAMS ((tree));
3765 extern tree get_scope_of_declarator PARAMS ((tree));
3766 extern void grok_special_member_properties PARAMS ((tree));
3767 extern int grok_ctor_properties PARAMS ((tree, tree));
3768 extern void grok_op_properties PARAMS ((tree, int));
3769 extern tree xref_tag (enum tag_types, tree, tree, bool);
3770 extern tree xref_tag_from_type PARAMS ((tree, tree, int));
3771 extern void xref_basetypes PARAMS ((tree, tree));
3772 extern tree start_enum PARAMS ((tree));
3773 extern void finish_enum PARAMS ((tree));
3774 extern void build_enumerator PARAMS ((tree, tree, tree));
3775 extern int start_function PARAMS ((tree, tree, tree, int));
3776 extern tree begin_function_body PARAMS ((void));
3777 extern void finish_function_body PARAMS ((tree));
3778 extern tree finish_function PARAMS ((int));
3779 extern tree start_method PARAMS ((tree, tree, tree));
3780 extern tree finish_method PARAMS ((tree));
3781 extern void maybe_register_incomplete_var PARAMS ((tree));
3782 extern void complete_vars PARAMS ((tree));
3783 extern void finish_stmt PARAMS ((void));
3784 extern void print_other_binding_stack PARAMS ((struct cp_binding_level *));
3785 extern void revert_static_member_fn PARAMS ((tree));
3786 extern void fixup_anonymous_aggr PARAMS ((tree));
3787 extern int check_static_variable_definition PARAMS ((tree, tree));
3788 extern tree compute_array_index_type PARAMS ((tree, tree));
3789 extern void push_local_binding PARAMS ((tree, tree, int));
3790 extern int push_class_binding PARAMS ((tree, tree));
3791 extern tree check_default_argument PARAMS ((tree, tree));
3792 extern tree push_overloaded_decl PARAMS ((tree, int));
3793 extern void clear_identifier_class_values PARAMS ((void));
3794 extern void storetags PARAMS ((tree));
3795 extern int vtable_decl_p PARAMS ((tree, void *));
3796 extern int vtype_decl_p PARAMS ((tree, void *));
3797 extern int sigtable_decl_p PARAMS ((tree, void *));
3798 typedef int (*walk_globals_pred) PARAMS ((tree, void *));
3799 typedef int (*walk_globals_fn) PARAMS ((tree *, void *));
3800 extern int walk_globals PARAMS ((walk_globals_pred,
3801 walk_globals_fn,
3802 void *));
3803 extern int walk_vtables PARAMS ((walk_globals_pred,
3804 walk_globals_fn,
3805 void *));
3806 typedef int (*walk_namespaces_fn) PARAMS ((tree, void *));
3807 extern int walk_namespaces PARAMS ((walk_namespaces_fn,
3808 void *));
3809 extern int wrapup_globals_for_namespace PARAMS ((tree, void *));
3810 extern tree cp_namespace_decls PARAMS ((tree));
3811 extern tree create_implicit_typedef PARAMS ((tree, tree));
3812 extern tree maybe_push_decl PARAMS ((tree));
3813 extern tree build_target_expr_with_type PARAMS ((tree, tree));
3814 extern int local_variable_p PARAMS ((tree));
3815 extern int nonstatic_local_decl_p PARAMS ((tree));
3816 extern tree declare_global_var PARAMS ((tree, tree));
3817 extern void register_dtor_fn PARAMS ((tree));
3818 extern tmpl_spec_kind current_tmpl_spec_kind PARAMS ((int));
3819 extern tree cp_fname_init PARAMS ((const char *));
3820 extern bool have_extern_spec;
3821
3822 /* in decl2.c */
3823 extern int check_java_method PARAMS ((tree));
3824 extern int grok_method_quals PARAMS ((tree, tree, tree));
3825 extern void warn_if_unknown_interface PARAMS ((tree));
3826 extern void grok_x_components PARAMS ((tree));
3827 extern void maybe_retrofit_in_chrg PARAMS ((tree));
3828 extern void maybe_make_one_only PARAMS ((tree));
3829 extern void grokclassfn PARAMS ((tree, tree, enum overload_flags, tree));
3830 extern tree grok_array_decl PARAMS ((tree, tree));
3831 extern tree delete_sanity PARAMS ((tree, tree, int, int));
3832 extern tree check_classfn PARAMS ((tree, tree));
3833 extern void check_member_template PARAMS ((tree));
3834 extern tree grokfield PARAMS ((tree, tree, tree, tree, tree));
3835 extern tree grokbitfield PARAMS ((tree, tree, tree));
3836 extern tree groktypefield PARAMS ((tree, tree));
3837 extern tree grokoptypename PARAMS ((tree, tree, tree));
3838 extern void cplus_decl_attributes PARAMS ((tree *, tree, int));
3839 extern tree constructor_name_full PARAMS ((tree));
3840 extern tree constructor_name PARAMS ((tree));
3841 extern bool constructor_name_p (tree, tree);
3842 extern void defer_fn PARAMS ((tree));
3843 extern void finish_anon_union PARAMS ((tree));
3844 extern tree finish_table PARAMS ((tree, tree, tree, int));
3845 extern tree coerce_new_type PARAMS ((tree));
3846 extern tree coerce_delete_type PARAMS ((tree));
3847 extern void comdat_linkage PARAMS ((tree));
3848 extern void import_export_vtable PARAMS ((tree, tree, int));
3849 extern void import_export_decl PARAMS ((tree));
3850 extern void import_export_tinfo PARAMS ((tree, tree, int));
3851 extern tree build_cleanup PARAMS ((tree));
3852 extern void finish_file PARAMS ((void));
3853 extern tree reparse_absdcl_as_expr PARAMS ((tree, tree));
3854 extern tree reparse_absdcl_as_casts PARAMS ((tree, tree));
3855 extern tree build_expr_from_tree PARAMS ((tree));
3856 extern tree build_offset_ref_call_from_tree (tree, tree);
3857 extern tree build_call_from_tree (tree, tree, bool);
3858 extern tree reparse_decl_as_expr PARAMS ((tree, tree));
3859 extern tree finish_decl_parsing PARAMS ((tree));
3860 extern void set_decl_namespace PARAMS ((tree, tree, int));
3861 extern tree current_decl_namespace PARAMS ((void));
3862 extern void push_decl_namespace PARAMS ((tree));
3863 extern void pop_decl_namespace PARAMS ((void));
3864 extern void push_scope PARAMS ((tree));
3865 extern void pop_scope PARAMS ((tree));
3866 extern void do_namespace_alias PARAMS ((tree, tree));
3867 extern void do_toplevel_using_decl PARAMS ((tree));
3868 extern void do_local_using_decl PARAMS ((tree));
3869 extern tree do_class_using_decl PARAMS ((tree));
3870 extern void do_using_directive PARAMS ((tree));
3871 extern void check_default_args PARAMS ((tree));
3872 extern void mark_used PARAMS ((tree));
3873 extern tree handle_class_head (enum tag_types, tree, tree, tree, int, int *);
3874 extern tree lookup_arg_dependent PARAMS ((tree, tree, tree));
3875 extern void finish_static_data_member_decl PARAMS ((tree, tree, tree, int));
3876 extern tree cp_build_parm_decl PARAMS ((tree, tree));
3877 extern tree build_artificial_parm PARAMS ((tree, tree));
3878 extern tree get_guard PARAMS ((tree));
3879 extern tree get_guard_cond PARAMS ((tree));
3880 extern tree set_guard PARAMS ((tree));
3881
3882 extern void cp_error_at PARAMS ((const char *msgid, ...));
3883 extern void cp_warning_at PARAMS ((const char *msgid, ...));
3884 extern void cp_pedwarn_at PARAMS ((const char *msgid, ...));
3885
3886 /* XXX Not i18n clean. */
3887 #define cp_deprecated(STR) \
3888 do { \
3889 if (warn_deprecated) \
3890 warning ("%s is deprecated, please see the documentation for details", \
3891 (STR)); \
3892 } while (0)
3893
3894 /* in error.c */
3895 extern void init_error PARAMS ((void));
3896 extern const char *type_as_string PARAMS ((tree, int));
3897 extern const char *decl_as_string PARAMS ((tree, int));
3898 extern const char *expr_as_string PARAMS ((tree, int));
3899 extern const char *context_as_string PARAMS ((tree, int));
3900 extern const char *lang_decl_name PARAMS ((tree, int));
3901 extern const char *cp_file_of PARAMS ((tree));
3902 extern int cp_line_of PARAMS ((tree));
3903 extern const char *language_to_string PARAMS ((enum languages, int));
3904 extern void print_instantiation_context PARAMS ((void));
3905
3906 /* in except.c */
3907 extern void init_exception_processing PARAMS ((void));
3908 extern tree expand_start_catch_block PARAMS ((tree));
3909 extern void expand_end_catch_block PARAMS ((void));
3910 extern void expand_builtin_throw PARAMS ((void));
3911 extern void expand_eh_spec_block PARAMS ((tree));
3912 extern void expand_exception_blocks PARAMS ((void));
3913 extern tree build_exc_ptr PARAMS ((void));
3914 extern tree build_throw PARAMS ((tree));
3915 extern void mark_all_runtime_matches PARAMS ((void));
3916 extern int nothrow_libfn_p PARAMS ((tree));
3917 extern void check_handlers PARAMS ((tree));
3918 extern void choose_personality_routine PARAMS ((enum languages));
3919
3920 /* in expr.c */
3921 extern rtx cxx_expand_expr PARAMS ((tree, rtx,
3922 enum machine_mode,
3923 int));
3924 extern tree cplus_expand_constant PARAMS ((tree));
3925
3926 /* friend.c */
3927 extern int is_friend PARAMS ((tree, tree));
3928 extern void make_friend_class PARAMS ((tree, tree));
3929 extern void add_friend PARAMS ((tree, tree));
3930 extern tree do_friend PARAMS ((tree, tree, tree, tree, tree, enum overload_flags, tree, int));
3931
3932 /* in init.c */
3933 extern tree expand_member_init (tree, tree);
3934 extern void emit_mem_initializers (tree);
3935 extern tree build_aggr_init PARAMS ((tree, tree, int));
3936 extern tree build_init PARAMS ((tree, tree, int));
3937 extern int is_aggr_type PARAMS ((tree, int));
3938 extern tree get_aggr_from_typedef PARAMS ((tree, int));
3939 extern tree get_type_value PARAMS ((tree));
3940 extern tree build_zero_init (tree, bool);
3941 extern tree build_member_call PARAMS ((tree, tree, tree));
3942 extern tree build_offset_ref PARAMS ((tree, tree));
3943 extern tree resolve_offset_ref PARAMS ((tree));
3944 extern tree build_new PARAMS ((tree, tree, tree, int));
3945 extern tree build_vec_init PARAMS ((tree, tree, int));
3946 extern tree build_x_delete PARAMS ((tree, int, tree));
3947 extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int));
3948 extern void push_base_cleanups PARAMS ((void));
3949 extern tree build_vbase_delete PARAMS ((tree, tree));
3950 extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int));
3951 extern tree create_temporary_var PARAMS ((tree));
3952 extern void begin_init_stmts PARAMS ((tree *, tree *));
3953 extern tree finish_init_stmts PARAMS ((tree, tree));
3954 extern void initialize_vtbl_ptrs PARAMS ((tree));
3955 extern tree build_java_class_ref PARAMS ((tree));
3956
3957 /* in input.c */
3958
3959 /* in lex.c */
3960 extern void cxx_dup_lang_specific_decl PARAMS ((tree));
3961 extern tree make_pointer_declarator PARAMS ((tree, tree));
3962 extern tree make_reference_declarator PARAMS ((tree, tree));
3963 extern tree make_call_declarator PARAMS ((tree, tree, tree, tree));
3964 extern void set_quals_and_spec PARAMS ((tree, tree, tree));
3965 extern void print_parse_statistics PARAMS ((void));
3966 extern void do_pending_inlines PARAMS ((void));
3967 extern void yyungetc PARAMS ((int, int));
3968 extern void snarf_method PARAMS ((tree));
3969
3970 extern void note_got_semicolon PARAMS ((tree));
3971 extern void note_list_got_semicolon PARAMS ((tree));
3972 extern void do_pending_lang_change PARAMS ((void));
3973 extern void see_typename PARAMS ((void));
3974 extern void unqualified_name_lookup_error PARAMS ((tree));
3975 extern tree do_identifier PARAMS ((tree, int, tree));
3976 extern tree do_scoped_id PARAMS ((tree, tree));
3977 extern tree identifier_typedecl_value PARAMS ((tree));
3978 extern tree build_lang_decl PARAMS ((enum tree_code, tree, tree));
3979 extern void retrofit_lang_decl PARAMS ((tree));
3980 extern tree copy_decl PARAMS ((tree));
3981 extern tree copy_type PARAMS ((tree));
3982 extern tree cxx_make_type PARAMS ((enum tree_code));
3983 extern tree make_aggr_type PARAMS ((enum tree_code));
3984 extern void yyerror PARAMS ((const char *));
3985 extern void yyhook PARAMS ((int));
3986 extern int cp_type_qual_from_rid PARAMS ((tree));
3987 extern const char *cxx_init PARAMS ((const char *));
3988 extern void cxx_finish PARAMS ((void));
3989 extern void cxx_init_options PARAMS ((void));
3990
3991 /* in method.c */
3992 extern void init_method (void);
3993 extern void set_mangled_name_for_decl (tree);
3994 extern tree build_opfncall (enum tree_code, int, tree, tree, tree);
3995 extern tree hack_identifier (tree, tree);
3996 extern tree make_thunk (tree, bool, tree, tree);
3997 extern void finish_thunk (tree, tree, tree);
3998 extern void use_thunk (tree, bool);
3999 extern void synthesize_method (tree);
4000 extern tree implicitly_declare_fn (special_function_kind, tree, bool);
4001 extern tree skip_artificial_parms_for (tree, tree);
4002
4003 /* In optimize.c */
4004 extern void optimize_function (tree);
4005 extern bool calls_setjmp_p (tree);
4006 extern bool maybe_clone_body (tree);
4007
4008 /* in pt.c */
4009 extern void check_template_shadow PARAMS ((tree));
4010 extern tree get_innermost_template_args PARAMS ((tree, int));
4011 extern tree tsubst PARAMS ((tree, tree, tsubst_flags_t, tree));
4012 extern tree tsubst_expr PARAMS ((tree, tree, tsubst_flags_t, tree));
4013 extern tree tsubst_copy PARAMS ((tree, tree, tsubst_flags_t, tree));
4014 extern void maybe_begin_member_template_processing PARAMS ((tree));
4015 extern void maybe_end_member_template_processing PARAMS ((void));
4016 extern tree finish_member_template_decl PARAMS ((tree));
4017 extern void begin_template_parm_list PARAMS ((void));
4018 extern void begin_specialization PARAMS ((void));
4019 extern void reset_specialization PARAMS ((void));
4020 extern void end_specialization PARAMS ((void));
4021 extern void begin_explicit_instantiation PARAMS ((void));
4022 extern void end_explicit_instantiation PARAMS ((void));
4023 extern tree check_explicit_specialization PARAMS ((tree, tree, int, int));
4024 extern tree process_template_parm PARAMS ((tree, tree));
4025 extern tree end_template_parm_list PARAMS ((tree));
4026 extern void end_template_decl PARAMS ((void));
4027 extern tree current_template_args PARAMS ((void));
4028 extern tree push_template_decl PARAMS ((tree));
4029 extern tree push_template_decl_real PARAMS ((tree, int));
4030 extern void redeclare_class_template PARAMS ((tree, tree));
4031 extern tree lookup_template_class PARAMS ((tree, tree, tree, tree, int, tsubst_flags_t));
4032 extern tree lookup_template_function PARAMS ((tree, tree));
4033 extern int uses_template_parms PARAMS ((tree));
4034 extern tree instantiate_class_template PARAMS ((tree));
4035 extern tree instantiate_template PARAMS ((tree, tree));
4036 extern int fn_type_unification PARAMS ((tree, tree, tree, tree, tree, unification_kind_t, int));
4037 extern tree tinst_for_decl PARAMS ((void));
4038 extern void mark_decl_instantiated PARAMS ((tree, int));
4039 extern int more_specialized PARAMS ((tree, tree, int, int));
4040 extern void mark_class_instantiated PARAMS ((tree, int));
4041 extern void do_decl_instantiation (tree, tree);
4042 extern void do_type_instantiation PARAMS ((tree, tree, tsubst_flags_t));
4043 extern tree instantiate_decl PARAMS ((tree, int));
4044 extern tree get_bindings PARAMS ((tree, tree, tree));
4045 extern int push_tinst_level PARAMS ((tree));
4046 extern void pop_tinst_level PARAMS ((void));
4047 extern int more_specialized_class PARAMS ((tree, tree));
4048 extern int is_member_template PARAMS ((tree));
4049 extern int comp_template_parms PARAMS ((tree, tree));
4050 extern int template_class_depth PARAMS ((tree));
4051 extern int is_specialization_of PARAMS ((tree, tree));
4052 extern int comp_template_args PARAMS ((tree, tree));
4053 extern void maybe_process_partial_specialization PARAMS ((tree));
4054 extern void maybe_check_template_type PARAMS ((tree));
4055 extern tree most_specialized_instantiation PARAMS ((tree));
4056 extern void print_candidates PARAMS ((tree));
4057 extern int instantiate_pending_templates PARAMS ((void));
4058 extern tree tsubst_default_argument PARAMS ((tree, tree, tree));
4059 extern tree most_general_template PARAMS ((tree));
4060 extern tree get_mostly_instantiated_function_type PARAMS ((tree));
4061 extern int problematic_instantiation_changed PARAMS ((void));
4062 extern void record_last_problematic_instantiation PARAMS ((void));
4063 extern tree current_instantiation PARAMS ((void));
4064 extern tree maybe_get_template_decl_from_type_decl (tree);
4065 extern int processing_template_parmlist;
4066
4067 /* in repo.c */
4068 extern void repo_template_used PARAMS ((tree));
4069 extern void repo_template_instantiated PARAMS ((tree, int));
4070 extern void init_repo PARAMS ((const char *));
4071 extern void finish_repo PARAMS ((void));
4072
4073 /* in rtti.c */
4074 extern void init_rtti_processing PARAMS((void));
4075 extern tree build_typeid PARAMS((tree));
4076 extern tree get_tinfo_decl PARAMS((tree));
4077 extern tree get_typeid PARAMS((tree));
4078 extern tree build_dynamic_cast PARAMS((tree, tree));
4079 extern void emit_support_tinfos PARAMS((void));
4080 extern int unemitted_tinfo_decl_p PARAMS((tree, void *));
4081 extern int emit_tinfo_decl PARAMS((tree *, void *));
4082
4083 /* in search.c */
4084 extern tree lookup_base PARAMS ((tree, tree, base_access, base_kind *));
4085 extern int types_overlap_p PARAMS ((tree, tree));
4086 extern tree get_vbase PARAMS ((tree, tree));
4087 extern tree get_dynamic_cast_base_type PARAMS ((tree, tree));
4088 extern void type_access_control PARAMS ((tree, tree));
4089 extern int accessible_p PARAMS ((tree, tree));
4090 extern tree lookup_field PARAMS ((tree, tree, int, int));
4091 extern int lookup_fnfields_1 PARAMS ((tree, tree));
4092 extern tree lookup_fnfields PARAMS ((tree, tree, int));
4093 extern tree lookup_member PARAMS ((tree, tree, int, int));
4094 extern int look_for_overrides PARAMS ((tree, tree));
4095 extern void get_pure_virtuals PARAMS ((tree));
4096 extern void get_vbase_types PARAMS ((tree));
4097 extern void maybe_suppress_debug_info PARAMS ((tree));
4098 extern void note_debug_info_needed PARAMS ((tree));
4099 extern void push_class_decls PARAMS ((tree));
4100 extern void pop_class_decls PARAMS ((void));
4101 extern void unuse_fields PARAMS ((tree));
4102 extern void print_search_statistics PARAMS ((void));
4103 extern void init_search_processing PARAMS ((void));
4104 extern void reinit_search_statistics PARAMS ((void));
4105 extern tree current_scope PARAMS ((void));
4106 extern int at_function_scope_p PARAMS ((void));
4107 extern bool at_class_scope_p (void);
4108 extern tree context_for_name_lookup PARAMS ((tree));
4109 extern tree lookup_conversions PARAMS ((tree));
4110 extern tree binfo_for_vtable PARAMS ((tree));
4111 extern tree binfo_from_vbase PARAMS ((tree));
4112 extern tree look_for_overrides_here PARAMS ((tree, tree));
4113 extern int check_final_overrider PARAMS ((tree, tree));
4114 extern tree dfs_walk PARAMS ((tree,
4115 tree (*) (tree, void *),
4116 tree (*) (tree, void *),
4117 void *));
4118 extern tree dfs_walk_real PARAMS ((tree,
4119 tree (*) (tree, void *),
4120 tree (*) (tree, void *),
4121 tree (*) (tree, void *),
4122 void *));
4123 extern tree dfs_unmark PARAMS ((tree, void *));
4124 extern tree markedp PARAMS ((tree, void *));
4125 extern tree unmarkedp PARAMS ((tree, void *));
4126 extern tree dfs_unmarked_real_bases_queue_p PARAMS ((tree, void *));
4127 extern tree dfs_marked_real_bases_queue_p PARAMS ((tree, void *));
4128 extern tree dfs_skip_vbases PARAMS ((tree, void *));
4129 extern tree marked_vtable_pathp PARAMS ((tree, void *));
4130 extern tree unmarked_vtable_pathp PARAMS ((tree, void *));
4131 extern tree find_vbase_instance PARAMS ((tree, tree));
4132 extern tree binfo_for_vbase PARAMS ((tree, tree));
4133 extern tree binfo_via_virtual PARAMS ((tree, tree));
4134 extern tree build_baselink (tree, tree, tree, tree);
4135 extern tree adjust_result_of_qualified_name_lookup
4136 (tree, tree, tree);
4137 /* in semantics.c */
4138 extern void init_cp_semantics PARAMS ((void));
4139 extern tree finish_expr_stmt PARAMS ((tree));
4140 extern tree begin_if_stmt PARAMS ((void));
4141 extern void finish_if_stmt_cond PARAMS ((tree, tree));
4142 extern tree finish_then_clause PARAMS ((tree));
4143 extern void begin_else_clause PARAMS ((void));
4144 extern void finish_else_clause PARAMS ((tree));
4145 extern void finish_if_stmt PARAMS ((void));
4146 extern tree begin_while_stmt PARAMS ((void));
4147 extern void finish_while_stmt_cond PARAMS ((tree, tree));
4148 extern void finish_while_stmt PARAMS ((tree));
4149 extern tree begin_do_stmt PARAMS ((void));
4150 extern void finish_do_body PARAMS ((tree));
4151 extern void finish_do_stmt PARAMS ((tree, tree));
4152 extern tree finish_return_stmt PARAMS ((tree));
4153 extern tree begin_for_stmt PARAMS ((void));
4154 extern void finish_for_init_stmt PARAMS ((tree));
4155 extern void finish_for_cond PARAMS ((tree, tree));
4156 extern void finish_for_expr PARAMS ((tree, tree));
4157 extern void finish_for_stmt PARAMS ((tree));
4158 extern tree finish_break_stmt PARAMS ((void));
4159 extern tree finish_continue_stmt PARAMS ((void));
4160 extern tree begin_switch_stmt PARAMS ((void));
4161 extern void finish_switch_cond PARAMS ((tree, tree));
4162 extern void finish_switch_stmt PARAMS ((tree));
4163 extern tree finish_case_label PARAMS ((tree, tree));
4164 extern tree finish_goto_stmt PARAMS ((tree));
4165 extern tree begin_try_block PARAMS ((void));
4166 extern void finish_try_block PARAMS ((tree));
4167 extern tree begin_eh_spec_block PARAMS ((void));
4168 extern void finish_eh_spec_block PARAMS ((tree, tree));
4169 extern void finish_handler_sequence PARAMS ((tree));
4170 extern tree begin_function_try_block PARAMS ((void));
4171 extern void finish_function_try_block PARAMS ((tree));
4172 extern void finish_function_handler_sequence PARAMS ((tree));
4173 extern void finish_cleanup_try_block PARAMS ((tree));
4174 extern tree begin_handler PARAMS ((void));
4175 extern void finish_handler_parms PARAMS ((tree, tree));
4176 extern void begin_catch_block PARAMS ((tree));
4177 extern void finish_handler PARAMS ((tree));
4178 extern void finish_cleanup PARAMS ((tree, tree));
4179 extern tree begin_compound_stmt PARAMS ((int));
4180 extern tree finish_compound_stmt PARAMS ((int, tree));
4181 extern tree finish_asm_stmt PARAMS ((tree, tree, tree, tree, tree));
4182 extern tree finish_label_stmt PARAMS ((tree));
4183 extern void finish_label_decl PARAMS ((tree));
4184 extern void finish_subobject PARAMS ((tree));
4185 extern tree finish_parenthesized_expr PARAMS ((tree));
4186 extern tree finish_non_static_data_member PARAMS ((tree, tree));
4187 extern tree begin_stmt_expr PARAMS ((void));
4188 extern tree finish_stmt_expr PARAMS ((tree));
4189 extern tree finish_call_expr (tree, tree, bool);
4190 extern tree finish_increment_expr PARAMS ((tree, enum tree_code));
4191 extern tree finish_this_expr PARAMS ((void));
4192 extern tree finish_object_call_expr PARAMS ((tree, tree, tree));
4193 extern tree finish_qualified_object_call_expr PARAMS ((tree, tree, tree));
4194 extern tree finish_pseudo_destructor_expr (tree, tree, tree);
4195 extern tree finish_unary_op_expr PARAMS ((enum tree_code, tree));
4196 extern tree finish_id_expr PARAMS ((tree));
4197 extern tree finish_compound_literal (tree, tree);
4198 extern tree finish_fname (tree);
4199 extern void save_type_access_control PARAMS ((tree));
4200 extern void reset_type_access_control PARAMS ((void));
4201 extern void decl_type_access_control PARAMS ((tree));
4202 extern int begin_function_definition (tree, tree, tree);
4203 extern tree begin_constructor_declarator PARAMS ((tree, tree));
4204 extern tree finish_declarator PARAMS ((tree, tree, tree, tree, int));
4205 extern void finish_translation_unit PARAMS ((void));
4206 extern tree finish_template_type_parm PARAMS ((tree, tree));
4207 extern tree finish_template_template_parm PARAMS ((tree, tree));
4208 extern tree finish_parmlist PARAMS ((tree, int));
4209 extern tree begin_class_definition PARAMS ((tree));
4210 extern tree finish_class_definition PARAMS ((tree, tree, int, int));
4211 extern void finish_default_args PARAMS ((void));
4212 extern tree finish_member_class_template PARAMS ((tree));
4213 extern void finish_template_decl PARAMS ((tree));
4214 extern tree finish_template_type PARAMS ((tree, tree, int));
4215 extern void enter_scope_of PARAMS ((tree));
4216 extern tree finish_base_specifier PARAMS ((tree, tree));
4217 extern void finish_member_declaration PARAMS ((tree));
4218 extern void check_multiple_declarators PARAMS ((void));
4219 extern tree finish_typeof PARAMS ((tree));
4220 extern tree finish_sizeof PARAMS ((tree));
4221 extern tree finish_alignof PARAMS ((tree));
4222 extern void finish_decl_cleanup PARAMS ((tree, tree));
4223 extern void finish_eh_cleanup PARAMS ((tree));
4224 extern void finish_named_return_value PARAMS ((tree, tree));
4225 extern void expand_body PARAMS ((tree));
4226 extern tree nullify_returns_r PARAMS ((tree *, int *, void *));
4227 extern void do_pushlevel PARAMS ((void));
4228 extern tree do_poplevel PARAMS ((void));
4229 extern void begin_mem_initializers (void);
4230 extern void finish_mem_initializers PARAMS ((tree));
4231 extern void setup_vtbl_ptr PARAMS ((tree, tree));
4232 extern void clear_out_block PARAMS ((void));
4233 extern tree begin_global_stmt_expr PARAMS ((void));
4234 extern tree finish_global_stmt_expr PARAMS ((tree));
4235 extern tree check_template_template_default_arg (tree);
4236
4237 /* in tree.c */
4238 extern void lang_check_failed PARAMS ((const char *, int,
4239 const char *));
4240 extern tree stabilize_expr PARAMS ((tree, tree *));
4241 extern tree cxx_unsave_expr_now PARAMS ((tree));
4242 extern tree cxx_maybe_build_cleanup PARAMS ((tree));
4243 extern void init_tree PARAMS ((void));
4244 extern int pod_type_p PARAMS ((tree));
4245 extern int zero_init_p PARAMS ((tree));
4246 extern tree canonical_type_variant PARAMS ((tree));
4247 extern void unshare_base_binfos PARAMS ((tree));
4248 extern int member_p PARAMS ((tree));
4249 extern cp_lvalue_kind real_lvalue_p PARAMS ((tree));
4250 extern int non_cast_lvalue_p PARAMS ((tree));
4251 extern int non_cast_lvalue_or_else PARAMS ((tree, const char *));
4252 extern tree build_min PARAMS ((enum tree_code, tree,
4253 ...));
4254 extern tree build_min_nt PARAMS ((enum tree_code, ...));
4255 extern tree build_cplus_new PARAMS ((tree, tree));
4256 extern tree get_target_expr PARAMS ((tree));
4257 extern tree break_out_calls PARAMS ((tree));
4258 extern tree build_cplus_method_type PARAMS ((tree, tree, tree));
4259 extern tree build_cplus_staticfn_type PARAMS ((tree, tree, tree));
4260 extern tree build_cplus_array_type PARAMS ((tree, tree));
4261 extern tree hash_tree_cons PARAMS ((tree, tree, tree));
4262 extern tree hash_tree_chain PARAMS ((tree, tree));
4263 extern tree hash_chainon PARAMS ((tree, tree));
4264 extern tree make_binfo PARAMS ((tree, tree, tree, tree));
4265 extern tree reverse_path PARAMS ((tree));
4266 extern int count_functions PARAMS ((tree));
4267 extern int is_overloaded_fn PARAMS ((tree));
4268 extern tree get_first_fn PARAMS ((tree));
4269 extern int bound_pmf_p PARAMS ((tree));
4270 extern tree ovl_cons PARAMS ((tree, tree));
4271 extern tree build_overload PARAMS ((tree, tree));
4272 extern tree function_arg_chain PARAMS ((tree));
4273 extern int promotes_to_aggr_type PARAMS ((tree, enum tree_code));
4274 extern int is_aggr_type_2 PARAMS ((tree, tree));
4275 extern const char *cxx_printable_name PARAMS ((tree, int));
4276 extern tree build_exception_variant PARAMS ((tree, tree));
4277 extern tree bind_template_template_parm PARAMS ((tree, tree));
4278 extern tree array_type_nelts_total PARAMS ((tree));
4279 extern tree array_type_nelts_top PARAMS ((tree));
4280 extern tree break_out_target_exprs PARAMS ((tree));
4281 extern tree get_type_decl PARAMS ((tree));
4282 extern tree vec_binfo_member PARAMS ((tree, tree));
4283 extern tree decl_namespace_context PARAMS ((tree));
4284 extern tree lvalue_type PARAMS ((tree));
4285 extern tree error_type PARAMS ((tree));
4286 extern tree build_zc_wrapper PARAMS ((struct z_candidate *));
4287 extern tree build_srcloc_here PARAMS ((void));
4288 extern int varargs_function_p PARAMS ((tree));
4289 extern int really_overloaded_fn PARAMS ((tree));
4290 extern int cp_tree_equal PARAMS ((tree, tree));
4291 extern tree no_linkage_check PARAMS ((tree));
4292 extern void debug_binfo PARAMS ((tree));
4293 extern tree build_dummy_object PARAMS ((tree));
4294 extern tree maybe_dummy_object PARAMS ((tree, tree *));
4295 extern int is_dummy_object PARAMS ((tree));
4296 extern const struct attribute_spec cxx_attribute_table[];
4297 extern tree make_ptrmem_cst PARAMS ((tree, tree));
4298 extern tree cp_build_qualified_type_real PARAMS ((tree, int, tsubst_flags_t));
4299 #define cp_build_qualified_type(TYPE, QUALS) \
4300 cp_build_qualified_type_real ((TYPE), (QUALS), tf_error | tf_warning)
4301 extern tree build_shared_int_cst PARAMS ((int));
4302 extern special_function_kind special_function_p PARAMS ((tree));
4303 extern bool name_p (tree);
4304 extern int count_trees PARAMS ((tree));
4305 extern int char_type_p PARAMS ((tree));
4306 extern void verify_stmt_tree PARAMS ((tree));
4307 extern tree find_tree PARAMS ((tree, tree));
4308 extern linkage_kind decl_linkage PARAMS ((tree));
4309 extern tree cp_walk_subtrees PARAMS ((tree*, int*, walk_tree_fn,
4310 void*, void*));
4311 extern int cp_cannot_inline_tree_fn PARAMS ((tree*));
4312 extern tree cp_add_pending_fn_decls PARAMS ((void*,tree));
4313 extern int cp_is_overload_p PARAMS ((tree));
4314 extern int cp_auto_var_in_fn_p PARAMS ((tree,tree));
4315 extern tree cp_copy_res_decl_for_inlining PARAMS ((tree, tree, tree, void*,
4316 int*, tree));
4317 extern int cp_start_inlining PARAMS ((tree));
4318 extern void cp_end_inlining PARAMS ((tree));
4319
4320 /* in typeck.c */
4321 extern int string_conv_p PARAMS ((tree, tree, int));
4322 extern tree cp_truthvalue_conversion PARAMS ((tree));
4323 extern tree condition_conversion PARAMS ((tree));
4324 extern tree target_type PARAMS ((tree));
4325 extern tree require_complete_type PARAMS ((tree));
4326 extern tree complete_type PARAMS ((tree));
4327 extern tree complete_type_or_diagnostic PARAMS ((tree, tree, int));
4328 #define complete_type_or_else(T,V) (complete_type_or_diagnostic ((T), (V), 0))
4329 extern int type_unknown_p PARAMS ((tree));
4330 extern tree commonparms PARAMS ((tree, tree));
4331 extern tree original_type PARAMS ((tree));
4332 extern int comp_except_specs PARAMS ((tree, tree, int));
4333 extern int comptypes PARAMS ((tree, tree, int));
4334 extern int comp_target_types PARAMS ((tree, tree, int));
4335 extern int compparms PARAMS ((tree, tree));
4336 extern int comp_cv_qualification PARAMS ((tree, tree));
4337 extern int comp_cv_qual_signature PARAMS ((tree, tree));
4338 extern tree expr_sizeof PARAMS ((tree));
4339 extern tree cxx_sizeof_or_alignof_type PARAMS ((tree, enum tree_code, int));
4340 #define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false)
4341 extern tree inline_conversion PARAMS ((tree));
4342 extern tree decay_conversion PARAMS ((tree));
4343 extern tree build_class_member_access_expr (tree, tree, tree, bool);
4344 extern tree finish_class_member_access_expr (tree, tree);
4345 extern tree build_x_indirect_ref PARAMS ((tree, const char *));
4346 extern tree build_indirect_ref PARAMS ((tree, const char *));
4347 extern tree build_array_ref PARAMS ((tree, tree));
4348 extern tree get_member_function_from_ptrfunc PARAMS ((tree *, tree));
4349 extern tree build_function_call_real PARAMS ((tree, tree, int, int));
4350 extern tree build_function_call_maybe PARAMS ((tree, tree));
4351 extern tree convert_arguments PARAMS ((tree, tree, tree, int));
4352 extern tree build_x_binary_op PARAMS ((enum tree_code, tree, tree));
4353 extern tree build_x_unary_op PARAMS ((enum tree_code, tree));
4354 extern tree unary_complex_lvalue PARAMS ((enum tree_code, tree));
4355 extern tree build_x_conditional_expr PARAMS ((tree, tree, tree));
4356 extern tree build_x_compound_expr PARAMS ((tree));
4357 extern tree build_compound_expr PARAMS ((tree));
4358 extern tree build_static_cast PARAMS ((tree, tree));
4359 extern tree build_reinterpret_cast PARAMS ((tree, tree));
4360 extern tree build_const_cast PARAMS ((tree, tree));
4361 extern tree build_c_cast PARAMS ((tree, tree));
4362 extern tree build_x_modify_expr PARAMS ((tree, enum tree_code, tree));
4363 extern tree build_modify_expr PARAMS ((tree, enum tree_code, tree));
4364 extern tree dubious_conversion_warnings PARAMS ((tree, tree, const char *, tree, int));
4365 extern tree convert_for_initialization PARAMS ((tree, tree, tree, int, const char *, tree, int));
4366 extern int comp_ptr_ttypes PARAMS ((tree, tree));
4367 extern int ptr_reasonably_similar PARAMS ((tree, tree));
4368 extern tree build_ptrmemfunc PARAMS ((tree, tree, int));
4369 extern int cp_type_quals PARAMS ((tree));
4370 extern int cp_has_mutable_p PARAMS ((tree));
4371 extern int at_least_as_qualified_p PARAMS ((tree, tree));
4372 extern int more_qualified_p PARAMS ((tree, tree));
4373 extern tree build_ptrmemfunc1 PARAMS ((tree, tree, tree));
4374 extern void expand_ptrmemfunc_cst PARAMS ((tree, tree *, tree *));
4375 extern tree pfn_from_ptrmemfunc PARAMS ((tree));
4376 extern tree type_after_usual_arithmetic_conversions PARAMS ((tree, tree));
4377 extern tree composite_pointer_type PARAMS ((tree, tree, tree, tree,
4378 const char*));
4379 extern tree merge_types PARAMS ((tree, tree));
4380 extern tree check_return_expr PARAMS ((tree));
4381 #define cp_build_binary_op(code, arg1, arg2) \
4382 build_binary_op(code, arg1, arg2, 1)
4383 #define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
4384 #define cxx_alignof(T) cxx_sizeof_or_alignof_type (T, ALIGNOF_EXPR, true)
4385 extern tree build_ptrmemfunc_access_expr (tree, tree);
4386
4387 /* in typeck2.c */
4388 extern void require_complete_eh_spec_types PARAMS ((tree, tree));
4389 extern void cxx_incomplete_type_diagnostic PARAMS ((tree, tree, int));
4390 #undef cxx_incomplete_type_error
4391 extern void cxx_incomplete_type_error PARAMS ((tree, tree));
4392 #define cxx_incomplete_type_error(V,T) \
4393 (cxx_incomplete_type_diagnostic ((V), (T), 0))
4394 extern tree error_not_base_type PARAMS ((tree, tree));
4395 extern tree binfo_or_else PARAMS ((tree, tree));
4396 extern void readonly_error PARAMS ((tree, const char *, int));
4397 extern int abstract_virtuals_error PARAMS ((tree, tree));
4398
4399 extern tree store_init_value PARAMS ((tree, tree));
4400 extern tree digest_init PARAMS ((tree, tree, tree *));
4401 extern tree build_scoped_ref PARAMS ((tree, tree, tree *));
4402 extern tree build_x_arrow PARAMS ((tree));
4403 extern tree build_m_component_ref PARAMS ((tree, tree));
4404 extern tree build_functional_cast PARAMS ((tree, tree));
4405 extern void check_for_new_type PARAMS ((const char *, flagged_type_tree));
4406 extern tree add_exception_specifier PARAMS ((tree, tree, int));
4407 extern tree merge_exception_specifiers PARAMS ((tree, tree));
4408
4409 /* in mangle.c */
4410 extern void init_mangle PARAMS ((void));
4411 extern void mangle_decl PARAMS ((tree));
4412 extern const char *mangle_type_string PARAMS ((tree));
4413 extern tree mangle_type PARAMS ((tree));
4414 extern tree mangle_typeinfo_for_type PARAMS ((tree));
4415 extern tree mangle_typeinfo_string_for_type PARAMS ((tree));
4416 extern tree mangle_vtbl_for_type PARAMS ((tree));
4417 extern tree mangle_vtt_for_type PARAMS ((tree));
4418 extern tree mangle_ctor_vtbl_for_type PARAMS ((tree, tree));
4419 extern tree mangle_thunk PARAMS ((tree, int, tree, tree));
4420 extern tree mangle_conv_op_name_for_type PARAMS ((tree));
4421 extern tree mangle_guard_variable PARAMS ((tree));
4422 extern tree mangle_ref_init_variable PARAMS ((tree));
4423
4424 /* in dump.c */
4425 extern int cp_dump_tree PARAMS ((void *, tree));
4426
4427 /* -- end of C++ */
4428
4429 #endif /* ! GCC_CP_TREE_H */