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