]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cp/cp-tree.h
OpenACC host_data support.
[thirdparty/gcc.git] / gcc / cp / cp-tree.h
CommitLineData
8d08fdba 1/* Definitions for C++ parsing and type checking.
5624e564 2 Copyright (C) 1987-2015 Free Software Foundation, Inc.
06ceef4e 3 Contributed by Michael Tiemann (tiemann@cygnus.com)
8d08fdba 4
f5adbb8d 5This file is part of GCC.
8d08fdba 6
f5adbb8d 7GCC is free software; you can redistribute it and/or modify
8d08fdba 8it under the terms of the GNU General Public License as published by
e77f031d 9the Free Software Foundation; either version 3, or (at your option)
8d08fdba
MS
10any later version.
11
f5adbb8d 12GCC is distributed in the hope that it will be useful,
8d08fdba
MS
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
e77f031d
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
8d08fdba 20
8c6ae51f
GK
21#ifndef GCC_CP_TREE_H
22#define GCC_CP_TREE_H
23
83685514
AM
24#include "tm.h"
25#include "hard-reg-set.h"
83685514 26#include "function.h"
71205d17
MLI
27
28/* In order for the format checking to accept the C++ front end
29 diagnostic framework extensions, you must include this file before
718f9c0f 30 diagnostic-core.h, not after. We override the definition of GCC_DIAG_STYLE
71205d17
MLI
31 in c-common.h. */
32#undef GCC_DIAG_STYLE
33#define GCC_DIAG_STYLE __gcc_cxxdiag__
718f9c0f 34#if defined(GCC_DIAGNOSTIC_CORE_H) || defined (GCC_C_COMMON_H)
71205d17 35#error \
b5fa2870 36In order for the format checking to accept the C++ front end diagnostic \
718f9c0f 37framework extensions, you must include this file before diagnostic-core.h and \
59cc9210 38c-common.h, not after.
71205d17 39#endif
39dabefd 40#include "c-family/c-common.h"
718f9c0f 41#include "diagnostic.h"
59cc9210
SB
42
43#include "name-lookup.h"
7cb32822 44
cfdd0551 45/* Usage of TREE_LANG_FLAG_?:
809e3e7f 46 0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
cfdd0551
PB
47 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
48 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
8e1daa34 49 COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
f1dedc31 50 CLEANUP_P (in TRY_BLOCK)
e1376b00 51 AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
d816a3ba 52 PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF, SCOPE_REF)
7a8380ae 53 PAREN_STRING_LITERAL (in STRING_CST)
3048c0c7 54 CP_DECL_THREAD_LOCAL_P (in VAR_DECL)
6d80c4b9 55 KOENIG_LOOKUP_P (in CALL_EXPR)
325c3691
RH
56 STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST).
57 EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT)
c3e5898b 58 STMT_EXPR_NO_SCOPE (in STMT_EXPR)
5882f0f3 59 BIND_EXPR_TRY_BLOCK (in BIND_EXPR)
fc6a28d7 60 TYPENAME_IS_ENUM_P (in TYPENAME_TYPE)
d9a6bd32
JJ
61 OMP_FOR_GIMPLIFYING_P (in OMP_FOR, OMP_SIMD, OMP_DISTRIBUTE,
62 and OMP_TASKLOOP)
61e71a9e 63 BASELINK_QUALIFIED_P (in BASELINK)
c08cd4c1 64 TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
30bcc028 65 TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
6dc82110 66 TREE_INDIRECT_USING (in a TREE_LIST of using-directives)
a7f6bc8c 67 ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute)
f585f02f 68 ABI_TAG_IMPLICIT (in the TREE_LIST for the argument of abi_tag)
09357846 69 CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR)
d5f4eddd
JM
70 LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR)
71 DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE)
4de2f020 72 VEC_INIT_EXPR_IS_CONSTEXPR (in VEC_INIT_EXPR)
b5da71d4 73 DECL_OVERRIDE_P (in FUNCTION_DECL)
a4474a38 74 IMPLICIT_CONV_EXPR_DIRECT_INIT (in IMPLICIT_CONV_EXPR)
0a35513e 75 TRANSACTION_EXPR_IS_STMT (in TRANSACTION_EXPR)
c65b0607 76 CONVERT_EXPR_VBASE_PATH (in CONVERT_EXPR)
aef3a6b2 77 OVL_ARG_DEPENDENT (in OVERLOAD)
2297ab7d 78 PACK_EXPANSION_LOCAL_P (in *_PACK_EXPANSION)
0e75e41f 79 TINFO_HAS_ACCESS_ERRORS (in TEMPLATE_INFO)
0d23cf7a 80 SIZEOF_EXPR_TYPE_P (in SIZEOF_EXPR)
971e17ff
AS
81 COMPOUND_REQ_NOEXCEPT_P (in COMPOUND_REQ)
82 WILDCARD_PACK_P (in WILDCARD_DECL)
12d0d358 83 BLOCK_OUTER_CURLY_BRACE_P (in BLOCK)
378b307d 84 FOLD_EXPR_MODOP_P (*_FOLD_EXPR)
4684cd27 85 1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
cfdd0551 86 TI_PENDING_TEMPLATE_FLAG.
cfdd0551
PB
87 TEMPLATE_PARMS_FOR_INLINE.
88 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
89 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
27b8d0cd 90 ICS_ELLIPSIS_FLAG (in _CONV)
17bbb839 91 DECL_INITIALIZED_P (in VAR_DECL)
fc6a28d7 92 TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
ed3d0b14 93 STMT_IS_FULL_EXPR_P (in _STMT)
3f6079dd 94 TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR)
d5f4eddd 95 LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR)
b5da71d4 96 DECL_FINAL_P (in FUNCTION_DECL)
d816a3ba 97 QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
399bb2da 98 DECLTYPE_FOR_INIT_CAPTURE (in DECLTYPE_TYPE)
3e605b20 99 CONSTRUCTOR_NO_IMPLICIT_ZERO (in CONSTRUCTOR)
a2033ab1 100 TINFO_USED_TEMPLATE_ID (in TEMPLATE_INFO)
e3f8abd6 101 PACK_EXPANSION_SIZEOF_P (in *_PACK_EXPANSION)
4684cd27 102 2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
27b8d0cd 103 ICS_THIS_FLAG (in _CONV)
39703eb9 104 DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
325c3691 105 STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
4195a767 106 TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE)
37a7519a 107 TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR)
852497a3 108 FNDECL_USED_AUTO (in FUNCTION_DECL)
399bb2da 109 DECLTYPE_FOR_LAMBDA_PROXY (in DECLTYPE_TYPE)
96e780c0 110 REF_PARENTHESIZED_P (in COMPONENT_REF, INDIRECT_REF)
4561285b 111 AGGR_INIT_ZERO_FIRST (in AGGR_INIT_EXPR)
023d89c7 112 CONSTRUCTOR_MUTABLE_POISON (in CONSTRUCTOR)
5775a06a 113 3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
27b8d0cd 114 ICS_BAD_FLAG (in _CONV)
62409b39 115 FN_TRY_BLOCK_P (in TRY_BLOCK)
298d6f60 116 IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
5882f0f3 117 BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
6c06fbce 118 DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL)
4561285b 119 CALL_EXPR_LIST_INIT_P (in CALL_EXPR, AGGR_INIT_EXPR)
809e3e7f 120 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
0cbd7506 121 or FIELD_DECL).
421844e7 122 IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
4684cd27 123 DECL_TINFO_P (in VAR_DECL)
2eed8e37 124 FUNCTION_REF_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
0e5921e8 125 5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
d35543c0 126 DECL_VTABLE_OR_VTT_P (in VAR_DECL)
2eed8e37 127 FUNCTION_RVALUE_QUALIFIED (in FUNCTION_TYPE, METHOD_TYPE)
4684cd27 128 6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE)
505970fc 129 DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL)
3543e114 130 TYPE_MARKED_P (in _TYPE)
c5028d80 131 RANGE_FOR_IVDEP (in RANGE_FOR_STMT)
cfdd0551
PB
132
133 Usage of TYPE_LANG_FLAG_?:
5552b43c 134 0: TYPE_DEPENDENT_P
0fcedd9c 135 1: TYPE_HAS_USER_CONSTRUCTOR.
cab421f4 136 2: TYPE_HAS_LATE_RETURN_TYPE (in FUNCTION_TYPE, METHOD_TYPE)
1d7e2ec7 137 TYPE_PTRMEMFUNC_FLAG (in RECORD_TYPE)
ea419909 138 3: TYPE_FOR_JAVA.
834c6dff 139 4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
adf2edec 140 5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE)
4e3c0a15 141 ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE)
10c6dc8e 142 AUTO_IS_DECLTYPE (in TEMPLATE_TYPE_PARM)
593bcbb8 143 REFERENCE_VLA_OK (in REFERENCE_TYPE)
5552b43c 144 6: TYPE_DEPENDENT_P_VALID
cfdd0551
PB
145
146 Usage of DECL_LANG_FLAG_?:
147 0: DECL_ERROR_REPORTED (in VAR_DECL).
833aa4c4 148 DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
cd9f6678 149 DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
721c3b42 150 DECL_MUTABLE_P (in FIELD_DECL)
98ed9dae 151 DECL_DEPENDENT_P (in USING_DECL)
56632b27 152 LABEL_DECL_BREAK (in LABEL_DECL)
cfdd0551 153 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
fbf1c34b 154 DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
c7222c02 155 DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
0f8fa9b6 156 USING_DECL_TYPENAME_P (in USING_DECL)
593bcbb8 157 DECL_VLA_CAPTURE_P (in FIELD_DECL)
773ec47f 158 DECL_ARRAY_PARAMETER_P (in PARM_DECL)
56632b27 159 LABEL_DECL_CONTINUE (in LABEL_DECL)
cfdd0551 160 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
9188c363 161 DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
971e17ff 162 DECL_CONSTRAINT_VAR_P (in a PARM_DECL)
1a4cd2cd 163 TEMPLATE_DECL_COMPLEX_ALIAS_P (in TEMPLATE_DECL)
04eca83e 164 DECL_INSTANTIATING_NSDMI_P (in a FIELD_DECL)
cfdd0551 165 3: DECL_IN_AGGR_P.
17bbb839 166 4: DECL_C_BIT_FIELD (in a FIELD_DECL)
555551c2 167 DECL_ANON_UNION_VAR_P (in a VAR_DECL)
a3d87771 168 DECL_SELF_REFERENCE_P (in a TYPE_DECL)
878cbb73 169 DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL)
cfdd0551
PB
170 5: DECL_INTERFACE_KNOWN.
171 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
642124c6 172 DECL_FIELD_IS_BASE (in FIELD_DECL)
28704289 173 TYPE_DECL_ALIAS_P (in TYPE_DECL)
cfdd0551 174 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
cc057ef3 175 DECL_THUNK_P (in a member FUNCTION_DECL)
37a7519a 176 DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
32a58b37 177 8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL)
7ddedda4
MM
178
179 Usage of language-independent fields in a language-dependent manner:
911a71a7 180
7ddedda4
MM
181 TYPE_ALIAS_SET
182 This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
183 forth as a substitute for the mark bits provided in `lang_type'.
184 At present, only the six low-order bits are used.
185
95b4aca6 186 TYPE_LANG_SLOT_1
7ddedda4 187 For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
6d0a3f67 188 For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
0aafb128 189
9df2c88c 190 BINFO_VIRTUALS
bb5e8a7f
MM
191 For a binfo, this is a TREE_LIST. There is an entry for each
192 virtual function declared either in BINFO or its direct and
193 indirect primary bases.
194
195 The BV_DELTA of each node gives the amount by which to adjust the
196 `this' pointer when calling the function. If the method is an
4639c5c6 197 overridden version of a base class method, then it is assumed
bb5e8a7f
MM
198 that, prior to adjustment, the this pointer points to an object
199 of the base class.
174eceea 200
5e19c053 201 The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
19114537 202 index of the vcall offset for this entry.
c0bbf652 203
5e19c053 204 The BV_FN is the declaration for the virtual function itself.
5e19c053 205
02dea3ff
JM
206 If BV_LOST_PRIMARY is set, it means that this entry is for a lost
207 primary virtual base and can be left null in the vtable.
208
c35cce41 209 BINFO_VTABLE
3461fba7 210 This is an expression with POINTER_TYPE that gives the value
c35cce41 211 to which the vptr should be initialized. Use get_vtbl_decl_for_binfo
3461fba7 212 to extract the VAR_DECL for the complete vtable.
c35cce41 213
051e6fd7
MM
214 DECL_VINDEX
215 This field is NULL for a non-virtual function. For a virtual
216 function, it is eventually set to an INTEGER_CST indicating the
217 index in the vtable at which this function can be found. When
218 a virtual function is declared, but before it is known what
4639c5c6 219 function is overridden, this field is the error_mark_node.
051e6fd7 220
bb20cc46 221 Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
051e6fd7
MM
222 the virtual function this one overrides, and whose TREE_CHAIN is
223 the old DECL_VINDEX. */
cfdd0551 224
00a17e31 225/* Language-specific tree checkers. */
da8a66fc 226
086e3095
NS
227#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
228 TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL)
229
43f4447e
JM
230#define TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK(NODE) \
231 TREE_CHECK3(NODE,TYPE_DECL,TEMPLATE_DECL,FUNCTION_DECL)
232
233#define TYPE_FUNCTION_OR_TEMPLATE_DECL_P(NODE) \
234 (TREE_CODE (NODE) == TYPE_DECL || TREE_CODE (NODE) == TEMPLATE_DECL \
235 || TREE_CODE (NODE) == FUNCTION_DECL)
236
086e3095
NS
237#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
238 TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL)
239
240#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
241 TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
242
2598165f
JM
243#define VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK(NODE) \
244 TREE_CHECK5(NODE,VAR_DECL,FIELD_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
245
086e3095
NS
246#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
247 TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
d7e7759d 248
ea1763b1 249#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
ea1763b1 250#define THUNK_FUNCTION_CHECK(NODE) __extension__ \
58f9752a 251({ __typeof (NODE) const __t = (NODE); \
b97e8a14
JM
252 if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
253 || !__t->decl_common.lang_specific->u.fn.thunk_p) \
3db45ab5 254 tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
ea1763b1
NS
255 __t; })
256#else
ea1763b1
NS
257#define THUNK_FUNCTION_CHECK(NODE) (NODE)
258#endif
bbd15aac 259\f
8d08fdba
MS
260/* Language-dependent contents of an identifier. */
261
d1b38208 262struct GTY(()) lang_identifier {
e2500fed 263 struct c_common_identifier c_common;
af6fd53f
GDR
264 cxx_binding *namespace_bindings;
265 cxx_binding *bindings;
8d08fdba 266 tree class_template_info;
85209a3c 267 tree label_value;
8d08fdba
MS
268};
269
9dc6f476
GDR
270/* Return a typed pointer version of T if it designates a
271 C++ front-end identifier. */
272inline lang_identifier*
273identifier_p (tree t)
274{
275 if (TREE_CODE (t) == IDENTIFIER_NODE)
276 return (lang_identifier*) t;
277 return NULL;
278}
279
0e5921e8
ZW
280/* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
281 keyword. C_RID_CODE (node) is then the RID_* value of the keyword,
282 and C_RID_YYCODE is the token number wanted by Yacc. */
283
98e40e83 284#define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
0e5921e8 285
da8a66fc
ML
286#define LANG_IDENTIFIER_CAST(NODE) \
287 ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
288
a79683d5 289struct GTY(()) template_parm_index {
2bf105ab 290 struct tree_common common;
30bcc028
DG
291 int index;
292 int level;
293 int orig_level;
f84b4be9 294 tree decl;
406d77a4 295};
406d77a4 296
d1b38208 297struct GTY(()) ptrmem_cst {
2bf105ab 298 struct tree_common common;
61a127b3 299 tree member;
e2500fed
GK
300};
301typedef struct ptrmem_cst * ptrmem_cst_t;
61a127b3 302
30394414 303#define IDENTIFIER_GLOBAL_VALUE(NODE) \
98e40e83 304 namespace_binding ((NODE), global_namespace)
2c73f9f5 305#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
98e40e83 306 set_namespace_binding ((NODE), global_namespace, (VAL))
30394414 307#define IDENTIFIER_NAMESPACE_VALUE(NODE) \
98e40e83 308 namespace_binding ((NODE), current_namespace)
2c73f9f5 309#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
98e40e83 310 set_namespace_binding ((NODE), current_namespace, (VAL))
30394414 311
0cbd7506 312#define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
d7e7759d 313
5882f0f3
RH
314#define BIND_EXPR_TRY_BLOCK(NODE) \
315 TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE))
325c3691
RH
316
317/* Used to mark the block around the member initializers and cleanups. */
5882f0f3
RH
318#define BIND_EXPR_BODY_BLOCK(NODE) \
319 TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
86ad3aa9 320#define FUNCTION_NEEDS_BODY_BLOCK(NODE) \
61ca4737
JM
321 (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE) \
322 || LAMBDA_FUNCTION_P (NODE))
325c3691
RH
323
324#define STATEMENT_LIST_NO_SCOPE(NODE) \
325 TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
326#define STATEMENT_LIST_TRY_BLOCK(NODE) \
327 TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
328
12d0d358
JJ
329/* Mark the outer curly brace BLOCK. */
330#define BLOCK_OUTER_CURLY_BRACE_P(NODE) TREE_LANG_FLAG_0 (BLOCK_CHECK (NODE))
331
ed3d0b14
ILT
332/* Nonzero if this statement should be considered a full-expression,
333 i.e., if temporaries created during this statement should have
334 their destructors run at the end of this statement. */
335#define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
336
325c3691
RH
337/* Marks the result of a statement expression. */
338#define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
339 TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
340
c3e5898b
ILT
341/* Nonzero if this statement-expression does not have an associated scope. */
342#define STMT_EXPR_NO_SCOPE(NODE) \
343 TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
344
d7e7759d
BC
345/* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
346 sense of `same'. */
98e40e83 347#define same_type_p(TYPE1, TYPE2) \
96d84882 348 comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
d7e7759d 349
838dfd8a 350/* Returns nonzero iff NODE is a declaration for the global function
d7e7759d
BC
351 `main'. */
352#define DECL_MAIN_P(NODE) \
0cbd7506 353 (DECL_EXTERN_C_FUNCTION_P (NODE) \
d7e7759d 354 && DECL_NAME (NODE) != NULL_TREE \
7f7aa9e1
DE
355 && MAIN_NAME_P (DECL_NAME (NODE)) \
356 && flag_hosted)
d7e7759d 357
00a17e31 358/* The overloaded FUNCTION_DECL. */
98e40e83
GS
359#define OVL_FUNCTION(NODE) \
360 (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
361#define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
00a17e31 362/* Polymorphic access to FUNCTION and CHAIN. */
0cbd7506 363#define OVL_CURRENT(NODE) \
98e40e83 364 ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
0cbd7506 365#define OVL_NEXT(NODE) \
98e40e83 366 ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
2c73f9f5
ML
367/* If set, this was imported in a using declaration.
368 This is not to confuse with being used somewhere, which
00a17e31 369 is not important for this node. */
fb23b69e 370#define OVL_USED(NODE) TREE_USED (OVERLOAD_CHECK (NODE))
3a2cb4d0
JM
371/* If set, this OVERLOAD was created for argument-dependent lookup
372 and can be freed afterward. */
373#define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE))
2c73f9f5 374
d1b38208 375struct GTY(()) tree_overload {
2bf105ab 376 struct tree_common common;
2c73f9f5
ML
377 tree function;
378};
379
ad115a3c
JH
380struct GTY(()) tree_template_decl {
381 struct tree_decl_common common;
382 tree arguments;
383 tree result;
384};
385
50ad9642 386/* Returns true iff NODE is a BASELINK. */
4bb0968f 387#define BASELINK_P(NODE) \
50ad9642 388 (TREE_CODE (NODE) == BASELINK)
f8b0f44f
ER
389/* The BINFO indicating the base in which lookup found the
390 BASELINK_FUNCTIONS. */
4ba126e4 391#define BASELINK_BINFO(NODE) \
5dae1114 392 (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
50ad9642
MM
393/* The functions referred to by the BASELINK; either a FUNCTION_DECL,
394 a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */
da15dae6 395#define BASELINK_FUNCTIONS(NODE) \
5dae1114 396 (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
19114537
EC
397/* The BINFO in which the search for the functions indicated by this baselink
398 began. This base is used to determine the accessibility of functions
4ba126e4
MM
399 selected by overload resolution. */
400#define BASELINK_ACCESS_BINFO(NODE) \
5dae1114 401 (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
4ba126e4
MM
402/* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
403 to which the conversion should occur. This value is important if
404 the BASELINK_FUNCTIONS include a template conversion operator --
405 the BASELINK_OPTYPE can be used to determine what type the user
406 requested. */
407#define BASELINK_OPTYPE(NODE) \
50ad9642 408 (TREE_CHAIN (BASELINK_CHECK (NODE)))
3b426391 409/* Nonzero if this baselink was from a qualified lookup. */
61e71a9e
NS
410#define BASELINK_QUALIFIED_P(NODE) \
411 TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE))
4bb0968f 412
d1b38208 413struct GTY(()) tree_baselink {
5dae1114
MM
414 struct tree_common common;
415 tree binfo;
416 tree functions;
417 tree access_binfo;
418};
419
77880ae4 420/* The different kinds of ids that we encounter. */
b3445994 421
a79683d5 422enum cp_id_kind
b3445994
MM
423{
424 /* Not an id at all. */
425 CP_ID_KIND_NONE,
426 /* An unqualified-id that is not a template-id. */
427 CP_ID_KIND_UNQUALIFIED,
cd0be382 428 /* An unqualified-id that is a dependent name. */
10b1d5e7 429 CP_ID_KIND_UNQUALIFIED_DEPENDENT,
b3445994
MM
430 /* An unqualified template-id. */
431 CP_ID_KIND_TEMPLATE_ID,
432 /* A qualified-id. */
433 CP_ID_KIND_QUALIFIED
a79683d5 434};
b3445994 435
848f237b
SZ
436
437/* The various kinds of C++0x warnings we encounter. */
438
a79683d5 439enum cpp0x_warn_str
848f237b
SZ
440{
441 /* extended initializer lists */
442 CPP0X_INITIALIZER_LISTS,
443 /* explicit conversion operators */
444 CPP0X_EXPLICIT_CONVERSION,
445 /* variadic templates */
446 CPP0X_VARIADIC_TEMPLATES,
447 /* lambda expressions */
448 CPP0X_LAMBDA_EXPR,
449 /* C++0x auto */
450 CPP0X_AUTO,
451 /* scoped enums */
452 CPP0X_SCOPED_ENUMS,
453 /* defaulted and deleted functions */
bc2c4cb4
RRC
454 CPP0X_DEFAULTED_DELETED,
455 /* inline namespaces */
eda42c4f
VV
456 CPP0X_INLINE_NAMESPACES,
457 /* override controls, override/final */
0e5f8a59
JM
458 CPP0X_OVERRIDE_CONTROLS,
459 /* non-static data member initializers */
3ce4f9e4
ESR
460 CPP0X_NSDMI,
461 /* user defined literals */
238e471c
VV
462 CPP0X_USER_DEFINED_LITERALS,
463 /* delegating constructors */
e28d52cf 464 CPP0X_DELEGATING_CTORS,
85b5d65a
JM
465 /* inheriting constructors */
466 CPP0X_INHERITING_CTORS,
e28d52cf 467 /* C++11 attributes */
2eed8e37
BK
468 CPP0X_ATTRIBUTES,
469 /* ref-qualified member functions */
470 CPP0X_REF_QUALIFIER
a79683d5 471};
2eed8e37 472
c86818cf
SZ
473/* The various kinds of operation used by composite_pointer_type. */
474
a79683d5 475enum composite_pointer_operation
c86818cf
SZ
476{
477 /* comparison */
478 CPO_COMPARISON,
479 /* conversion */
480 CPO_CONVERSION,
481 /* conditional expression */
482 CPO_CONDITIONAL_EXPR
a79683d5 483};
848f237b 484
2f5b91f5 485/* Possible cases of expression list used by build_x_compound_expr_from_list. */
a79683d5 486enum expr_list_kind {
2f5b91f5
SZ
487 ELK_INIT, /* initializer */
488 ELK_MEM_INIT, /* member initializer */
489 ELK_FUNC_CAST /* functional cast */
a79683d5 490};
2f5b91f5
SZ
491
492/* Possible cases of implicit bad rhs conversions. */
a79683d5 493enum impl_conv_rhs {
2f5b91f5
SZ
494 ICR_DEFAULT_ARGUMENT, /* default argument */
495 ICR_CONVERTING, /* converting */
496 ICR_INIT, /* initialization */
497 ICR_ARGPASS, /* argument passing */
498 ICR_RETURN, /* return */
499 ICR_ASSIGN /* assignment */
a79683d5 500};
2f5b91f5 501
ebeb2c24 502/* Possible cases of implicit or explicit bad conversions to void. */
a79683d5 503enum impl_conv_void {
ebeb2c24
SZ
504 ICV_CAST, /* (explicit) conversion to void */
505 ICV_SECOND_OF_COND, /* second operand of conditional expression */
506 ICV_THIRD_OF_COND, /* third operand of conditional expression */
507 ICV_RIGHT_OF_COMMA, /* right operand of comma operator */
508 ICV_LEFT_OF_COMMA, /* left operand of comma operator */
509 ICV_STATEMENT, /* statement */
510 ICV_THIRD_IN_FOR /* for increment expression */
a79683d5 511};
ebeb2c24 512
2df663cc
JM
513/* Possible invalid uses of an abstract class that might not have a
514 specific associated declaration. */
a79683d5 515enum GTY(()) abstract_class_use {
2df663cc
JM
516 ACU_UNKNOWN, /* unknown or decl provided */
517 ACU_CAST, /* cast to abstract class */
518 ACU_NEW, /* new-expression of abstract class */
519 ACU_THROW, /* throw-expression of abstract class */
520 ACU_CATCH, /* catch-parameter of abstract class */
521 ACU_ARRAY, /* array of abstract class */
522 ACU_RETURN, /* return type of abstract class */
523 ACU_PARM /* parameter type of abstract class */
a79683d5 524};
2df663cc 525
8d08fdba
MS
526/* Macros for access to language-specific slots in an identifier. */
527
30394414 528#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
da8a66fc 529 (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
8d08fdba 530#define IDENTIFIER_TEMPLATE(NODE) \
da8a66fc 531 (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
8d08fdba 532
af6fd53f
GDR
533/* The IDENTIFIER_BINDING is the innermost cxx_binding for the
534 identifier. It's PREVIOUS is the next outermost binding. Each
147135cc 535 VALUE field is a DECL for the associated declaration. Thus,
f181d4ae
MM
536 name lookup consists simply of pulling off the node at the front
537 of the list (modulo oddities for looking up the names of types,
147135cc 538 and such.) You can use SCOPE field to determine the scope
ed3cf953 539 that bound the name. */
f181d4ae 540#define IDENTIFIER_BINDING(NODE) \
da8a66fc 541 (LANG_IDENTIFIER_CAST (NODE)->bindings)
f181d4ae 542
2c73f9f5
ML
543/* TREE_TYPE only indicates on local and class scope the current
544 type. For namespace scope, the presence of a type in any namespace
545 is indicated with global_type_node, and the real type behind must
00a17e31 546 be found through lookup. */
98e40e83
GS
547#define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
548#define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
549#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
2c73f9f5 550#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
8d08fdba 551
98e40e83 552#define IDENTIFIER_LABEL_VALUE(NODE) \
85209a3c 553 (LANG_IDENTIFIER_CAST (NODE)->label_value)
98e40e83 554#define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
85209a3c 555 IDENTIFIER_LABEL_VALUE (NODE) = (VALUE)
8d08fdba 556
cbb40945
NS
557/* Nonzero if this identifier is used as a virtual function name somewhere
558 (optimizes searches). */
98e40e83 559#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
8d08fdba 560
f71f87f9
MM
561/* Nonzero if this identifier is the prefix for a mangled C++ operator
562 name. */
98e40e83 563#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
8d08fdba 564
4c571114
MM
565/* Nonzero if this identifier is the name of a type-conversion
566 operator. */
421844e7 567#define IDENTIFIER_TYPENAME_P(NODE) \
98e40e83 568 TREE_LANG_FLAG_4 (NODE)
8d08fdba 569
298d6f60
MM
570/* Nonzero if this identifier is the name of a constructor or
571 destructor. */
572#define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
573 TREE_LANG_FLAG_3 (NODE)
574
4684cd27
MM
575/* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague
576 linkage which the prelinker has assigned to this translation
577 unit. */
578#define IDENTIFIER_REPO_CHOSEN(NAME) \
579 (TREE_LANG_FLAG_6 (NAME))
580
8d08fdba 581/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
5552b43c
MM
582#define C_TYPE_FIELDS_READONLY(TYPE) \
583 (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
e1cd6e56 584
a723baf1
MM
585/* The tokens stored in the default argument. */
586
587#define DEFARG_TOKENS(NODE) \
588 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
01ea1ea8
NS
589#define DEFARG_INSTANTIATIONS(NODE) \
590 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations)
a723baf1 591
d1b38208 592struct GTY (()) tree_default_arg {
a723baf1
MM
593 struct tree_common common;
594 struct cp_token_cache *tokens;
9771b263 595 vec<tree, va_gc> *instantiations;
a723baf1
MM
596};
597
10261728
JM
598
599#define DEFERRED_NOEXCEPT_PATTERN(NODE) \
600 (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->pattern)
601#define DEFERRED_NOEXCEPT_ARGS(NODE) \
602 (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->args)
603#define DEFERRED_NOEXCEPT_SPEC_P(NODE) \
604 ((NODE) && (TREE_PURPOSE (NODE)) \
b15ea309
JM
605 && (TREE_CODE (TREE_PURPOSE (NODE)) == DEFERRED_NOEXCEPT))
606#define UNEVALUATED_NOEXCEPT_SPEC_P(NODE) \
607 (DEFERRED_NOEXCEPT_SPEC_P (NODE) \
608 && DEFERRED_NOEXCEPT_PATTERN (TREE_PURPOSE (NODE)) == NULL_TREE)
10261728
JM
609
610struct GTY (()) tree_deferred_noexcept {
611 struct tree_base base;
612 tree pattern;
613 tree args;
614};
615
616
55a3debe
DG
617/* The condition associated with the static assertion. This must be
618 an integral constant expression. */
619#define STATIC_ASSERT_CONDITION(NODE) \
620 (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->condition)
621
622/* The message associated with the static assertion. This must be a
623 string constant, which will be emitted as an error message when the
624 static assert condition is false. */
625#define STATIC_ASSERT_MESSAGE(NODE) \
626 (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->message)
627
628/* Source location information for a static assertion. */
629#define STATIC_ASSERT_SOURCE_LOCATION(NODE) \
630 (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location)
631
d1b38208 632struct GTY (()) tree_static_assert {
55a3debe
DG
633 struct tree_common common;
634 tree condition;
635 tree message;
636 location_t location;
637};
638
d1b38208 639struct GTY (()) tree_argument_pack_select {
5d80a306
DG
640 struct tree_common common;
641 tree argument_pack;
642 int index;
643};
644
cb68ec50
PC
645/* The different kinds of traits that we encounter. */
646
a79683d5 647enum cp_trait_kind
cb68ec50 648{
4daba884
BK
649 CPTK_BASES,
650 CPTK_DIRECT_BASES,
cb68ec50
PC
651 CPTK_HAS_NOTHROW_ASSIGN,
652 CPTK_HAS_NOTHROW_CONSTRUCTOR,
653 CPTK_HAS_NOTHROW_COPY,
654 CPTK_HAS_TRIVIAL_ASSIGN,
655 CPTK_HAS_TRIVIAL_CONSTRUCTOR,
656 CPTK_HAS_TRIVIAL_COPY,
657 CPTK_HAS_TRIVIAL_DESTRUCTOR,
658 CPTK_HAS_VIRTUAL_DESTRUCTOR,
659 CPTK_IS_ABSTRACT,
660 CPTK_IS_BASE_OF,
661 CPTK_IS_CLASS,
cb68ec50
PC
662 CPTK_IS_EMPTY,
663 CPTK_IS_ENUM,
b3908fcc 664 CPTK_IS_FINAL,
a0d260fc 665 CPTK_IS_LITERAL_TYPE,
cb68ec50
PC
666 CPTK_IS_POD,
667 CPTK_IS_POLYMORPHIC,
971e17ff 668 CPTK_IS_SAME_AS,
c32097d8
JM
669 CPTK_IS_STD_LAYOUT,
670 CPTK_IS_TRIVIAL,
dd5d5481
JM
671 CPTK_IS_TRIVIALLY_ASSIGNABLE,
672 CPTK_IS_TRIVIALLY_CONSTRUCTIBLE,
b752325e 673 CPTK_IS_TRIVIALLY_COPYABLE,
a0d260fc
PC
674 CPTK_IS_UNION,
675 CPTK_UNDERLYING_TYPE
a79683d5 676};
cb68ec50
PC
677
678/* The types that we are processing. */
679#define TRAIT_EXPR_TYPE1(NODE) \
680 (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type1)
681
682#define TRAIT_EXPR_TYPE2(NODE) \
683 (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type2)
684
685/* The specific trait that we are processing. */
686#define TRAIT_EXPR_KIND(NODE) \
687 (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->kind)
688
d1b38208 689struct GTY (()) tree_trait_expr {
cb68ec50
PC
690 struct tree_common common;
691 tree type1;
692 tree type2;
693 enum cp_trait_kind kind;
694};
695
d5f4eddd
JM
696/* Based off of TYPE_ANONYMOUS_P. */
697#define LAMBDA_TYPE_P(NODE) \
5a706c32 698 (CLASS_TYPE_P (NODE) && CLASSTYPE_LAMBDA_EXPR (NODE))
d5f4eddd
JM
699
700/* Test if FUNCTION_DECL is a lambda function. */
701#define LAMBDA_FUNCTION_P(FNDECL) \
702 (DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \
703 && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL)))
704
705enum cp_lambda_default_capture_mode_type {
706 CPLD_NONE,
707 CPLD_COPY,
708 CPLD_REFERENCE
709};
710
711/* The method of default capture, if any. */
712#define LAMBDA_EXPR_DEFAULT_CAPTURE_MODE(NODE) \
713 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->default_capture_mode)
714
715/* The capture-list, including `this'. Each capture is stored as a FIELD_DECL
716 * so that the name, type, and field are all together, whether or not it has
717 * been added to the lambda's class type.
718 TREE_LIST:
719 TREE_PURPOSE: The FIELD_DECL for this capture.
720 TREE_VALUE: The initializer. This is part of a GNU extension. */
721#define LAMBDA_EXPR_CAPTURE_LIST(NODE) \
722 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list)
723
bc7d0e90
JM
724/* During parsing of the lambda-introducer, the node in the capture-list
725 that holds the 'this' capture. During parsing of the body, the
726 capture proxy for that node. */
d5f4eddd
JM
727#define LAMBDA_EXPR_THIS_CAPTURE(NODE) \
728 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture)
729
730/* Predicate tracking whether `this' is in the effective capture set. */
731#define LAMBDA_EXPR_CAPTURES_THIS_P(NODE) \
732 LAMBDA_EXPR_THIS_CAPTURE(NODE)
733
734/* Predicate tracking whether the lambda was declared 'mutable'. */
735#define LAMBDA_EXPR_MUTABLE_P(NODE) \
736 TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE))
737
d5f4eddd
JM
738/* The return type in the expression.
739 * NULL_TREE indicates that none was specified. */
740#define LAMBDA_EXPR_RETURN_TYPE(NODE) \
741 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->return_type)
742
743/* The source location of the lambda. */
744#define LAMBDA_EXPR_LOCATION(NODE) \
745 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus)
746
747/* The mangling scope for the lambda: FUNCTION_DECL, PARM_DECL, VAR_DECL,
748 FIELD_DECL or NULL_TREE. If this is NULL_TREE, we have no linkage. */
749#define LAMBDA_EXPR_EXTRA_SCOPE(NODE) \
750 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->extra_scope)
751
752/* If EXTRA_SCOPE, this is the number of the lambda within that scope. */
753#define LAMBDA_EXPR_DISCRIMINATOR(NODE) \
754 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator)
755
61ca4737
JM
756/* During parsing of the lambda, a vector of capture proxies which need
757 to be pushed once we're done processing a nested lambda. */
758#define LAMBDA_EXPR_PENDING_PROXIES(NODE) \
759 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->pending_proxies)
760
0e81aa85
JM
761/* The closure type of the lambda. Note that the TREE_TYPE of a
762 LAMBDA_EXPR is always NULL_TREE, because we need to instantiate the
763 LAMBDA_EXPR in order to instantiate the type. */
764#define LAMBDA_EXPR_CLOSURE(NODE) \
765 (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->closure)
766
d5f4eddd
JM
767struct GTY (()) tree_lambda_expr
768{
2cd8d506 769 struct tree_typed typed;
d5f4eddd
JM
770 tree capture_list;
771 tree this_capture;
772 tree return_type;
773 tree extra_scope;
0e81aa85 774 tree closure;
9771b263 775 vec<tree, va_gc> *pending_proxies;
2cd8d506
JM
776 location_t locus;
777 enum cp_lambda_default_capture_mode_type default_capture_mode;
d5f4eddd
JM
778 int discriminator;
779};
780
aa373032
DS
781/* A (typedef,context,usage location) triplet.
782 It represents a typedef used through a
783 context at a given source location.
784 e.g.
785 struct foo {
786 typedef int myint;
787 };
788
789 struct bar {
790 foo::myint v; // #1<-- this location.
791 };
792
793 In bar, the triplet will be (myint, foo, #1).
794 */
795struct GTY(()) qualified_typedef_usage_s {
796 tree typedef_decl;
797 tree context;
798 location_t locus;
799};
800typedef struct qualified_typedef_usage_s qualified_typedef_usage_t;
aa373032 801
0e69fdf0
PC
802/* Non-zero if this template specialization has access violations that
803 should be rechecked when the function is instantiated outside argument
804 deduction. */
742b0bcd 805#define TINFO_HAS_ACCESS_ERRORS(NODE) \
0e69fdf0 806 (TREE_LANG_FLAG_0 (TEMPLATE_INFO_CHECK (NODE)))
742b0bcd
JM
807#define FNDECL_HAS_ACCESS_ERRORS(NODE) \
808 (TINFO_HAS_ACCESS_ERRORS (DECL_TEMPLATE_INFO (NODE)))
0e69fdf0 809
a2033ab1
JM
810/* Non-zero if this variable template specialization was specified using a
811 template-id, so it's a partial or full specialization and not a definition
812 of the member template of a particular class specialization. */
813#define TINFO_USED_TEMPLATE_ID(NODE) \
814 (TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)))
815
aa373032
DS
816struct GTY(()) tree_template_info {
817 struct tree_common common;
9771b263 818 vec<qualified_typedef_usage_t, va_gc> *typedefs_needing_access_checking;
aa373032
DS
819};
820
971e17ff
AS
821// Constraint information for a C++ declaration. Constraint information is
822// comprised of:
823//
824// - a constraint expression introduced by the template header
825// - a constraint expression introduced by a function declarator
826// - the associated constraints, which are the conjunction of those,
827// and used for declaration matching
828// - the cached normalized associated constraints which are used
829// to support satisfaction and subsumption.
830// - assumptions which is the result of decomposing the normalized
831// constraints.
832//
833// The template and declarator requirements are kept to support pretty
834// printing constrained declarations.
835struct GTY(()) tree_constraint_info {
836 struct tree_base base;
837 tree template_reqs;
838 tree declarator_reqs;
839 tree associated_constr;
840 tree normalized_constr;
841 tree assumptions;
842};
843
844// Require that pointer P is non-null before returning.
845template<typename T>
846inline T*
847check_nonnull (T* p)
848{
849 gcc_assert (p);
850 return p;
851}
852
853// Returns true iff T is non-null and represents constraint info.
854inline tree_constraint_info *
855check_constraint_info (tree t)
856{
857 if (t && TREE_CODE (t) == CONSTRAINT_INFO)
858 return (tree_constraint_info *)t;
859 return NULL;
860}
861
862// Access the expression describing the template constraints. This may be
863// null if no constraints were introduced in the template parameter list,
864// a requirements clause after the template parameter list, or constraints
865// through a constrained-type-specifier.
866#define CI_TEMPLATE_REQS(NODE) \
867 check_constraint_info (check_nonnull(NODE))->template_reqs
868
869// Access the expression describing the trailing constraints. This is non-null
870// for any implicit instantiation of a constrained declaration. For a
871// templated declaration it is non-null only when a trailing requires-clause
872// was specified.
873#define CI_DECLARATOR_REQS(NODE) \
874 check_constraint_info (check_nonnull(NODE))->declarator_reqs
875
876// The computed associated constraint expression for a declaration.
877#define CI_ASSOCIATED_CONSTRAINTS(NODE) \
878 check_constraint_info (check_nonnull(NODE))->associated_constr
879
880// The normalized associated constraints.
881#define CI_NORMALIZED_CONSTRAINTS(NODE) \
882 check_constraint_info (check_nonnull(NODE))->normalized_constr
883
884// Get the set of assumptions associated with the constraint info node.
885#define CI_ASSUMPTIONS(NODE) \
886 check_constraint_info (check_nonnull(NODE))->assumptions
887
888// Access the logical constraints on the template parameters introduced
889// at a given template parameter list level indicated by NODE.
890#define TEMPLATE_PARMS_CONSTRAINTS(NODE) \
891 TREE_TYPE (TREE_LIST_CHECK (NODE))
892
893// Access the logical constraints on the template parameter declaration
894// indicated by NODE.
895#define TEMPLATE_PARM_CONSTRAINTS(NODE) \
896 TREE_TYPE (TREE_LIST_CHECK (NODE))
897
898/* Non-zero if the noexcept is present in a compound requirement. */
899#define COMPOUND_REQ_NOEXCEPT_P(NODE) \
900 TREE_LANG_FLAG_0 (TREE_CHECK (NODE, COMPOUND_REQ))
901
902/* The constraints on an 'auto' placeholder type, used in an argument deduction
903 constraint. */
904#define PLACEHOLDER_TYPE_CONSTRAINTS(NODE) \
905 DECL_SIZE_UNIT (TYPE_NAME (NODE))
906
907/* The expression evaluated by the predicate constraint. */
908#define PRED_CONSTR_EXPR(NODE) \
909 TREE_OPERAND (TREE_CHECK (NODE, PRED_CONSTR), 0)
910
911/* The expression validated by the predicate constraint. */
912#define EXPR_CONSTR_EXPR(NODE) \
913 TREE_OPERAND (TREE_CHECK (NODE, EXPR_CONSTR), 0)
914
915/* The type validated by the predicate constraint. */
916#define TYPE_CONSTR_TYPE(NODE) \
917 TREE_OPERAND (TREE_CHECK (NODE, TYPE_CONSTR), 0)
918
919/* In an implicit conversion constraint, the source expression. */
920#define ICONV_CONSTR_EXPR(NODE) \
921 TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 0)
922
923/* In an implicit conversion constraint, the target type. */
924#define ICONV_CONSTR_TYPE(NODE) \
925 TREE_OPERAND (TREE_CHECK (NODE, ICONV_CONSTR), 1)
926
927/* In an argument deduction constraint, the source expression. */
928#define DEDUCT_CONSTR_EXPR(NODE) \
929 TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 0)
930
931/* In an argument deduction constraint, the target type pattern. */
932#define DEDUCT_CONSTR_PATTERN(NODE) \
933 TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 1)
934
935/* In an argument deduction constraint, the list of placeholder nodes. */
936#define DEDUCT_CONSTR_PLACEHOLDER(NODE) \
937 TREE_OPERAND (TREE_CHECK (NODE, DEDUCT_CONSTR), 2)
938
939/* The expression of an exception constraint. */
940#define EXCEPT_CONSTR_EXPR(NODE) \
941 TREE_OPERAND (TREE_CHECK (NODE, EXCEPT_CONSTR), 0)
942
943/* In a parameterized constraint, the local parameters. */
944#define PARM_CONSTR_PARMS(NODE) \
945 TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 0)
946
947/* In a parameterized constraint, the operand. */
948#define PARM_CONSTR_OPERAND(NODE) \
949 TREE_OPERAND (TREE_CHECK (NODE, PARM_CONSTR), 1)
950
951/* Whether a PARM_DECL represents a local parameter in a
952 requires-expression. */
953#define CONSTRAINT_VAR_P(NODE) \
954 DECL_LANG_FLAG_2 (TREE_CHECK (NODE, PARM_DECL))
955
956/* The concept constraining this constrained template-parameter. */
957#define CONSTRAINED_PARM_CONCEPT(NODE) \
958 DECL_SIZE_UNIT (TYPE_DECL_CHECK (NODE))
959/* Any extra template arguments specified for a constrained
960 template-parameter. */
961#define CONSTRAINED_PARM_EXTRA_ARGS(NODE) \
962 DECL_SIZE (TYPE_DECL_CHECK (NODE))
963/* The first template parameter of CONSTRAINED_PARM_CONCEPT to be used as a
964 prototype for the constrained parameter in finish_shorthand_constraint,
965 attached for convenience. */
966#define CONSTRAINED_PARM_PROTOTYPE(NODE) \
967 DECL_INITIAL (TYPE_DECL_CHECK (NODE))
968
e2500fed 969enum cp_tree_node_structure_enum {
e2500fed
GK
970 TS_CP_GENERIC,
971 TS_CP_IDENTIFIER,
972 TS_CP_TPI,
973 TS_CP_PTRMEM,
974 TS_CP_BINDING,
975 TS_CP_OVERLOAD,
5dae1114 976 TS_CP_BASELINK,
ad115a3c 977 TS_CP_TEMPLATE_DECL,
e2500fed 978 TS_CP_WRAPPER,
a723baf1 979 TS_CP_DEFAULT_ARG,
10261728 980 TS_CP_DEFERRED_NOEXCEPT,
55a3debe 981 TS_CP_STATIC_ASSERT,
5d80a306 982 TS_CP_ARGUMENT_PACK_SELECT,
cb68ec50 983 TS_CP_TRAIT_EXPR,
d5f4eddd 984 TS_CP_LAMBDA_EXPR,
aa373032 985 TS_CP_TEMPLATE_INFO,
971e17ff 986 TS_CP_CONSTRAINT_INFO,
3ce4f9e4 987 TS_CP_USERDEF_LITERAL,
e2500fed
GK
988 LAST_TS_CP_ENUM
989};
990
991/* The resulting tree type. */
d1b38208 992union GTY((desc ("cp_tree_node_structure (&%h)"),
56300785 993 chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) lang_tree_node {
e2500fed
GK
994 union tree_node GTY ((tag ("TS_CP_GENERIC"),
995 desc ("tree_node_structure (&%h)"))) generic;
a79683d5 996 struct template_parm_index GTY ((tag ("TS_CP_TPI"))) tpi;
e2500fed 997 struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
e2500fed 998 struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
5dae1114 999 struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
ad115a3c 1000 struct tree_template_decl GTY ((tag ("TS_CP_TEMPLATE_DECL"))) template_decl;
a723baf1 1001 struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
10261728 1002 struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept;
e2500fed 1003 struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
55a3debe
DG
1004 struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT")))
1005 static_assertion;
5d80a306
DG
1006 struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT")))
1007 argument_pack_select;
cb68ec50
PC
1008 struct tree_trait_expr GTY ((tag ("TS_CP_TRAIT_EXPR")))
1009 trait_expression;
d5f4eddd
JM
1010 struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR")))
1011 lambda_expression;
aa373032
DS
1012 struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO")))
1013 template_info;
971e17ff
AS
1014 struct tree_constraint_info GTY ((tag ("TS_CP_CONSTRAINT_INFO")))
1015 constraint_info;
3ce4f9e4
ESR
1016 struct tree_userdef_literal GTY ((tag ("TS_CP_USERDEF_LITERAL")))
1017 userdef_literal;
e2500fed
GK
1018};
1019
1020\f
7f4edbcb
BS
1021enum cp_tree_index
1022{
e2d0a11c
MM
1023 CPTI_JAVA_BYTE_TYPE,
1024 CPTI_JAVA_SHORT_TYPE,
1025 CPTI_JAVA_INT_TYPE,
1026 CPTI_JAVA_LONG_TYPE,
1027 CPTI_JAVA_FLOAT_TYPE,
1028 CPTI_JAVA_DOUBLE_TYPE,
1029 CPTI_JAVA_CHAR_TYPE,
1030 CPTI_JAVA_BOOLEAN_TYPE,
1031
7f4edbcb
BS
1032 CPTI_WCHAR_DECL,
1033 CPTI_VTABLE_ENTRY_TYPE,
1034 CPTI_DELTA_TYPE,
c7e266a6 1035 CPTI_VTABLE_INDEX_TYPE,
b3ab27f3 1036 CPTI_CLEANUP_TYPE,
3ec6bad3 1037 CPTI_VTT_PARM_TYPE,
7f4edbcb 1038
7f4edbcb 1039 CPTI_CLASS_TYPE,
7f4edbcb 1040 CPTI_UNKNOWN_TYPE,
09357846 1041 CPTI_INIT_LIST_TYPE,
7f4edbcb
BS
1042 CPTI_VTBL_TYPE,
1043 CPTI_VTBL_PTR_TYPE,
1044 CPTI_STD,
2854d3c6 1045 CPTI_ABI,
db24eb1f 1046 CPTI_CONST_TYPE_INFO_TYPE,
d689a8f1 1047 CPTI_TYPE_INFO_PTR_TYPE,
7f4edbcb 1048 CPTI_ABORT_FNDECL,
4b054b80 1049 CPTI_AGGR_TAG,
7f4edbcb 1050
9cd64686 1051 CPTI_CTOR_IDENTIFIER,
9eb71d8c 1052 CPTI_COMPLETE_CTOR_IDENTIFIER,
d43829f9
MM
1053 CPTI_BASE_CTOR_IDENTIFIER,
1054 CPTI_DTOR_IDENTIFIER,
db9b2174 1055 CPTI_COMPLETE_DTOR_IDENTIFIER,
d43829f9
MM
1056 CPTI_BASE_DTOR_IDENTIFIER,
1057 CPTI_DELETING_DTOR_IDENTIFIER,
9cd64686 1058 CPTI_DELTA_IDENTIFIER,
9cd64686 1059 CPTI_IN_CHARGE_IDENTIFIER,
3ec6bad3 1060 CPTI_VTT_PARM_IDENTIFIER,
9cd64686
MM
1061 CPTI_NELTS_IDENTIFIER,
1062 CPTI_THIS_IDENTIFIER,
1063 CPTI_PFN_IDENTIFIER,
9cd64686 1064 CPTI_VPTR_IDENTIFIER,
1f6e1acc 1065 CPTI_STD_IDENTIFIER,
9cd64686
MM
1066
1067 CPTI_LANG_NAME_C,
1068 CPTI_LANG_NAME_CPLUSPLUS,
1069 CPTI_LANG_NAME_JAVA,
1070
1071 CPTI_EMPTY_EXCEPT_SPEC,
3a55fb4c
JM
1072 CPTI_NOEXCEPT_TRUE_SPEC,
1073 CPTI_NOEXCEPT_FALSE_SPEC,
9cd64686 1074 CPTI_JCLASS,
9cd64686 1075 CPTI_TERMINATE,
52a11cbf 1076 CPTI_CALL_UNEXPECTED,
46a9e521 1077 CPTI_ATEXIT_FN_PTR_TYPE,
f0105ed3 1078 CPTI_ATEXIT,
db4283a0 1079 CPTI_DSO_HANDLE,
059fa5e7 1080 CPTI_DCAST,
9cd64686 1081
9aad8f83 1082 CPTI_KEYED_CLASSES,
548502d3 1083
14c2101d 1084 CPTI_NULLPTR,
5116acc6 1085 CPTI_NULLPTR_TYPE,
14c2101d 1086
7f4edbcb
BS
1087 CPTI_MAX
1088};
8d08fdba 1089
e2500fed 1090extern GTY(()) tree cp_global_trees[CPTI_MAX];
7f4edbcb 1091
4d8a1dd6
MM
1092#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
1093#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
1094#define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
1095#define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
1096#define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
1097#define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
1098#define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
1099#define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
1100
7f4edbcb
BS
1101#define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
1102#define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
c7e266a6 1103/* The type used to represent an offset by which to adjust the `this'
c4372ef4 1104 pointer in pointer-to-member types. */
7f4edbcb 1105#define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
c7e266a6 1106/* The type used to represent an index into the vtable. */
0cbd7506 1107#define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
db1147b2 1108
7f4edbcb 1109#define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
7f4edbcb 1110#define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
09357846 1111#define init_list_type_node cp_global_trees[CPTI_INIT_LIST_TYPE]
7f4edbcb
BS
1112#define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
1113#define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
1114#define std_node cp_global_trees[CPTI_STD]
0cbd7506 1115#define abi_node cp_global_trees[CPTI_ABI]
db24eb1f 1116#define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
d689a8f1 1117#define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
7f4edbcb 1118#define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
4b054b80 1119#define current_aggr cp_global_trees[CPTI_AGGR_TAG]
14c2101d 1120#define nullptr_node cp_global_trees[CPTI_NULLPTR]
5116acc6 1121#define nullptr_type_node cp_global_trees[CPTI_NULLPTR_TYPE]
ea419909 1122
9cd64686
MM
1123/* We cache these tree nodes so as to call get_identifier less
1124 frequently. */
1125
9eb71d8c 1126/* The name of a constructor that takes an in-charge parameter to
db9b2174 1127 decide whether or not to construct virtual base classes. */
0cbd7506 1128#define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
9eb71d8c 1129/* The name of a constructor that constructs virtual base classes. */
0cbd7506 1130#define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
d43829f9 1131/* The name of a constructor that does not construct virtual base classes. */
0cbd7506 1132#define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
db9b2174
MM
1133/* The name of a destructor that takes an in-charge parameter to
1134 decide whether or not to destroy virtual base classes and whether
1135 or not to delete the object. */
0cbd7506 1136#define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
db9b2174 1137/* The name of a destructor that destroys virtual base classes. */
0cbd7506 1138#define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
d43829f9
MM
1139/* The name of a destructor that does not destroy virtual base
1140 classes. */
0cbd7506 1141#define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
d43829f9
MM
1142/* The name of a destructor that destroys virtual base classes, and
1143 then deletes the entire object. */
0cbd7506
MS
1144#define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
1145#define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
1146#define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
3ec6bad3
MM
1147/* The name of the parameter that contains a pointer to the VTT to use
1148 for this subobject constructor or destructor. */
0cbd7506
MS
1149#define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
1150#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
1151#define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
1152#define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
1153#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
1f6e1acc 1154/* The name of the std namespace. */
0cbd7506
MS
1155#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
1156#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
1157#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
1158#define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
9cd64686
MM
1159
1160/* Exception specifier used for throw(). */
0cbd7506 1161#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
3a55fb4c
JM
1162#define noexcept_true_spec cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC]
1163#define noexcept_false_spec cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC]
9cd64686 1164
00a17e31 1165/* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
0cbd7506 1166#define jclass_node cp_global_trees[CPTI_JCLASS]
9cd64686 1167
9cd64686 1168/* The declaration for `std::terminate'. */
0cbd7506 1169#define terminate_node cp_global_trees[CPTI_TERMINATE]
9cd64686 1170
52a11cbf 1171/* The declaration for "__cxa_call_unexpected". */
0cbd7506 1172#define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED]
52a11cbf 1173
46a9e521
MM
1174/* The type of the function-pointer argument to "__cxa_atexit" (or
1175 "std::atexit", if "__cxa_atexit" is not being used). */
1176#define atexit_fn_ptr_type_node cp_global_trees[CPTI_ATEXIT_FN_PTR_TYPE]
1177
db4283a0 1178/* A pointer to `std::atexit'. */
0cbd7506 1179#define atexit_node cp_global_trees[CPTI_ATEXIT]
f0105ed3 1180
db4283a0 1181/* A pointer to `__dso_handle'. */
0cbd7506 1182#define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
db4283a0 1183
059fa5e7 1184/* The declaration of the dynamic_cast runtime. */
0cbd7506 1185#define dynamic_cast_node cp_global_trees[CPTI_DCAST]
059fa5e7 1186
b3ab27f3 1187/* The type of a destructor. */
0cbd7506 1188#define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
b3ab27f3 1189
3ec6bad3
MM
1190/* The type of the vtt parameter passed to subobject constructors and
1191 destructors. */
0cbd7506 1192#define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
3ec6bad3 1193
9aad8f83
MA
1194/* A TREE_LIST of the dynamic classes whose vtables may have to be
1195 emitted in this translation unit. */
548502d3 1196
0cbd7506 1197#define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES]
548502d3 1198
dbbf88d1
NS
1199/* Node to indicate default access. This must be distinct from the
1200 access nodes in tree.h. */
1201
1202#define access_default_node null_node
1203
9cd64686
MM
1204/* Global state. */
1205
d1b38208 1206struct GTY(()) saved_scope {
9771b263 1207 vec<cxx_saved_binding, va_gc> *old_bindings;
9cd64686 1208 tree old_namespace;
9771b263 1209 vec<tree, va_gc> *decl_ns_list;
fc0e7bf5
MM
1210 tree class_name;
1211 tree class_type;
9cd64686 1212 tree access_specifier;
a8f73d4b 1213 tree function_decl;
9771b263 1214 vec<tree, va_gc> *lang_base;
9cd64686 1215 tree lang_name;
9cd64686 1216 tree template_parms;
2c140474 1217 cp_binding_level *x_previous_class_level;
6f80451c 1218 tree x_saved_tree;
fc0e7bf5 1219
417ae187
JM
1220 /* Only used for uses of this in trailing return type. */
1221 tree x_current_class_ptr;
1222 tree x_current_class_ref;
1223
30bcc028 1224 int x_processing_template_decl;
9cd64686 1225 int x_processing_specialization;
30bcc028
DG
1226 BOOL_BITFIELD x_processing_explicit_instantiation : 1;
1227 BOOL_BITFIELD need_pop_function_context : 1;
7d882b83
ILT
1228
1229 int unevaluated_operand;
1230 int inhibit_evaluation_warnings;
04bbdb1d 1231 int noexcept_operand;
acf0174b
JJ
1232 /* If non-zero, implicit "omp declare target" attribute is added into the
1233 attribute lists. */
1234 int omp_declare_target_attribute;
fc0e7bf5 1235
ae499cce 1236 struct stmt_tree_s x_stmt_tree;
fc0e7bf5 1237
2c140474
DN
1238 cp_binding_level *class_bindings;
1239 cp_binding_level *bindings;
fc0e7bf5 1240
39c8aaa4 1241 hash_map<tree, tree> *GTY((skip)) x_local_specializations;
f221dc81 1242
fc0e7bf5 1243 struct saved_scope *prev;
9cd64686
MM
1244};
1245
1b5695e6
JM
1246extern GTY(()) struct saved_scope *scope_chain;
1247
9cd64686
MM
1248/* The current open namespace. */
1249
1250#define current_namespace scope_chain->old_namespace
1251
00a17e31 1252/* The stack for namespaces of current declarations. */
ee8fc32b
JM
1253
1254#define decl_namespace_list scope_chain->decl_ns_list
1255
9cd64686
MM
1256/* IDENTIFIER_NODE: name of current class */
1257
1258#define current_class_name scope_chain->class_name
1259
1260/* _TYPE: the type of the current class */
1261
1262#define current_class_type scope_chain->class_type
1263
1264/* When parsing a class definition, the access specifier most recently
1265 given by the user, or, if no access specifier was given, the
1266 default value appropriate for the kind of class (i.e., struct,
1267 class, or union). */
1268
1269#define current_access_specifier scope_chain->access_specifier
1270
1271/* Pointer to the top of the language name stack. */
1272
9cd64686
MM
1273#define current_lang_base scope_chain->lang_base
1274#define current_lang_name scope_chain->lang_name
1275
cac4ddf0 1276/* When parsing a template declaration, a TREE_LIST represents the
a57a55de 1277 active template parameters. Each node in the list represents one
03c17ccd
MM
1278 level of template parameters. The innermost level is first in the
1279 list. The depth of each level is stored as an INTEGER_CST in the
1280 TREE_PURPOSE of each node. The parameters for that level are
1281 stored in the TREE_VALUE. */
9cd64686 1282
9cd64686
MM
1283#define current_template_parms scope_chain->template_parms
1284
1285#define processing_template_decl scope_chain->x_processing_template_decl
1286#define processing_specialization scope_chain->x_processing_specialization
1287#define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
1288
1b5695e6
JM
1289/* RAII sentinel to handle clearing processing_template_decl and restoring
1290 it when done. */
1291
1292struct processing_template_decl_sentinel
1293{
1294 int saved;
1295 processing_template_decl_sentinel (bool reset = true)
1296 : saved (processing_template_decl)
1297 {
1298 if (reset)
1299 processing_template_decl = 0;
1300 }
1301 ~processing_template_decl_sentinel()
1302 {
1303 processing_template_decl = saved;
1304 }
1305};
1306
6e4992ca
PC
1307/* RAII sentinel to disable certain warnings during template substitution
1308 and elsewhere. */
1309
1310struct warning_sentinel
1311{
1312 int &flag;
1313 int val;
1314 warning_sentinel(int& flag, bool suppress=true)
1315 : flag(flag), val(flag) { if (suppress) flag = 0; }
1316 ~warning_sentinel() { flag = val; }
1317};
1318
89b578be
MM
1319/* The cached class binding level, from the most recently exited
1320 class, or NULL if none. */
9cd64686 1321
89b578be 1322#define previous_class_level scope_chain->x_previous_class_level
9cd64686 1323
f221dc81
JM
1324/* A map from local variable declarations in the body of the template
1325 presently being instantiated to the corresponding instantiated
1326 local variables. */
1327
1328#define local_specializations scope_chain->x_local_specializations
1329
04bbdb1d
PC
1330/* Nonzero if we are parsing the operand of a noexcept operator. */
1331
1332#define cp_noexcept_operand scope_chain->noexcept_operand
1333
70adf8a9
JM
1334/* A list of private types mentioned, for deferred access checking. */
1335
2a22f99c 1336struct GTY((for_user)) cxx_int_tree_map {
10827cd8
JJ
1337 unsigned int uid;
1338 tree to;
1339};
1340
ca752f39 1341struct cxx_int_tree_map_hasher : ggc_ptr_hash<cxx_int_tree_map>
2a22f99c
TS
1342{
1343 static hashval_t hash (cxx_int_tree_map *);
1344 static bool equal (cxx_int_tree_map *, cxx_int_tree_map *);
1345};
1346
1347struct named_label_entry;
1348
ca752f39 1349struct named_label_hasher : ggc_ptr_hash<named_label_entry>
2a22f99c
TS
1350{
1351 static hashval_t hash (named_label_entry *);
1352 static bool equal (named_label_entry *, named_label_entry *);
1353};
10827cd8 1354
8012c983
MM
1355/* Global state pertinent to the current function. */
1356
d1b38208 1357struct GTY(()) language_function {
e2500fed 1358 struct c_language_function base;
ae499cce 1359
44d10c10 1360 tree x_cdtor_label;
4519c0a8
MM
1361 tree x_current_class_ptr;
1362 tree x_current_class_ref;
52a11cbf 1363 tree x_eh_spec_block;
2c146a76 1364 tree x_in_charge_parm;
e0fff4b3 1365 tree x_vtt_parm;
0d97bf4c 1366 tree x_return_value;
852497a3 1367 tree x_auto_return_pattern;
4519c0a8 1368
30bcc028
DG
1369 BOOL_BITFIELD returns_value : 1;
1370 BOOL_BITFIELD returns_null : 1;
1371 BOOL_BITFIELD returns_abnormally : 1;
20f18c3c 1372 BOOL_BITFIELD infinite_loop: 1;
ce5046bd
DN
1373 BOOL_BITFIELD x_in_function_try_handler : 1;
1374 BOOL_BITFIELD x_in_base_initializer : 1;
8012c983 1375
b2dd096b 1376 /* True if this function can throw an exception. */
1c62e7b2 1377 BOOL_BITFIELD can_throw : 1;
b2dd096b 1378
60813a46
JM
1379 BOOL_BITFIELD invalid_constexpr : 1;
1380
2a22f99c 1381 hash_table<named_label_hasher> *x_named_labels;
2c140474 1382 cp_binding_level *bindings;
9771b263 1383 vec<tree, va_gc> *x_local_names;
20f18c3c
JM
1384 /* Tracking possibly infinite loops. This is a vec<tree> only because
1385 vec<bool> doesn't work with gtype. */
1386 vec<tree, va_gc> *infinite_loops;
2a22f99c 1387 hash_table<cxx_int_tree_map_hasher> *extern_decl_map;
8012c983
MM
1388};
1389
99dccabc 1390/* The current C++-specific per-function global variables. */
8012c983 1391
e2500fed 1392#define cp_function_chain (cfun->language)
8012c983 1393
44d10c10 1394/* In a constructor destructor, the point at which all derived class
39a13be5 1395 destroying/construction has been done. I.e., just before a
77880ae4 1396 constructor returns, or before any base class destroying will be done
44d10c10 1397 in a destructor. */
8012c983 1398
44d10c10 1399#define cdtor_label cp_function_chain->x_cdtor_label
8012c983 1400
8012c983
MM
1401/* When we're processing a member function, current_class_ptr is the
1402 PARM_DECL for the `this' pointer. The current_class_ref is an
1403 expression for `*this'. */
1404
417ae187
JM
1405#define current_class_ptr \
1406 (*(cfun && cp_function_chain \
1407 ? &cp_function_chain->x_current_class_ptr \
1408 : &scope_chain->x_current_class_ptr))
1409#define current_class_ref \
1410 (*(cfun && cp_function_chain \
1411 ? &cp_function_chain->x_current_class_ref \
1412 : &scope_chain->x_current_class_ref))
8012c983 1413
52a11cbf 1414/* The EH_SPEC_BLOCK for the exception-specifiers for the current
2c146a76
MM
1415 function, if any. */
1416
52a11cbf 1417#define current_eh_spec_block cp_function_chain->x_eh_spec_block
2c146a76 1418
2c146a76 1419/* The `__in_chrg' parameter for the current function. Only used for
e0fff4b3 1420 constructors and destructors. */
2c146a76
MM
1421
1422#define current_in_charge_parm cp_function_chain->x_in_charge_parm
1423
e0fff4b3
JM
1424/* The `__vtt_parm' parameter for the current function. Only used for
1425 constructors and destructors. */
1426
1427#define current_vtt_parm cp_function_chain->x_vtt_parm
1428
8012c983
MM
1429/* Set to 0 at beginning of a function definition, set to 1 if
1430 a return statement that specifies a return value is seen. */
1431
1432#define current_function_returns_value cp_function_chain->returns_value
1433
1434/* Set to 0 at beginning of a function definition, set to 1 if
1435 a return statement with no argument is seen. */
1436
1437#define current_function_returns_null cp_function_chain->returns_null
1438
efe49da0
JM
1439/* Set to 0 at beginning of a function definition, set to 1 if
1440 a call to a noreturn function is seen. */
1441
1442#define current_function_returns_abnormally \
1443 cp_function_chain->returns_abnormally
1444
20f18c3c
JM
1445/* Set to 0 at beginning of a function definition, set to 1 if we see an
1446 obvious infinite loop. This can have false positives and false
1447 negatives, so it should only be used as a heuristic. */
1448
1449#define current_function_infinite_loop cp_function_chain->infinite_loop
1450
4de8668e 1451/* Nonzero if we are processing a base initializer. Zero elsewhere. */
ce5046bd 1452#define in_base_initializer cp_function_chain->x_in_base_initializer
1f5a253a 1453
ce5046bd 1454#define in_function_try_handler cp_function_chain->x_in_function_try_handler
8012c983 1455
0d97bf4c
JM
1456/* Expression always returned from function, or error_mark_node
1457 otherwise, for use by the automatic named return value optimization. */
1458
1459#define current_function_return_value \
1460 (cp_function_chain->x_return_value)
1461
852497a3
JM
1462/* A type involving 'auto' to be used for return type deduction. */
1463
1464#define current_function_auto_return_pattern \
1465 (cp_function_chain->x_auto_return_pattern)
1466
4546865e
MM
1467/* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
1468 new" or "operator delete". */
1469#define NEW_DELETE_OPNAME_P(NAME) \
0cbd7506
MS
1470 ((NAME) == ansi_opname (NEW_EXPR) \
1471 || (NAME) == ansi_opname (VEC_NEW_EXPR) \
1472 || (NAME) == ansi_opname (DELETE_EXPR) \
4546865e
MM
1473 || (NAME) == ansi_opname (VEC_DELETE_EXPR))
1474
596ea4e5
AS
1475#define ansi_opname(CODE) \
1476 (operator_name_info[(int) (CODE)].identifier)
1477#define ansi_assopname(CODE) \
1478 (assignment_operator_name_info[(int) (CODE)].identifier)
8d08fdba 1479
feea5b18
ILT
1480/* TRUE if a tree code represents a statement. */
1481extern bool statement_code_p[MAX_TREE_CODES];
1482
1483#define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
1484
fcad5cf5 1485enum languages { lang_c, lang_cplusplus, lang_java };
8d08fdba
MS
1486
1487/* Macros to make error reporting functions' lives easier. */
1951a1b6
JM
1488#define TYPE_LINKAGE_IDENTIFIER(NODE) \
1489 (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
8d08fdba
MS
1490#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
1491#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
1492
1951a1b6
JM
1493/* Nonzero if NODE has no name for linkage purposes. */
1494#define TYPE_ANONYMOUS_P(NODE) \
ee47f74e 1495 (OVERLOAD_TYPE_P (NODE) && anon_aggrname_p (TYPE_LINKAGE_IDENTIFIER (NODE)))
1951a1b6 1496
a4443a08 1497/* The _DECL for this _TYPE. */
d2e5ee5c 1498#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
a4443a08 1499
bab5167f
JM
1500/* Nonzero if T is a type that could resolve to any kind of concrete type
1501 at instantiation time. */
1502#define WILDCARD_TYPE_P(T) \
98e40e83
GS
1503 (TREE_CODE (T) == TEMPLATE_TYPE_PARM \
1504 || TREE_CODE (T) == TYPENAME_TYPE \
1505 || TREE_CODE (T) == TYPEOF_TYPE \
1506 || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \
bab5167f
JM
1507 || TREE_CODE (T) == DECLTYPE_TYPE)
1508
1509/* Nonzero if T is a class (or struct or union) type. Also nonzero
1510 for template type parameters, typename types, and instantiated
1511 template template parameters. Keep these checks in ascending code
1512 order. */
1513#define MAYBE_CLASS_TYPE_P(T) (WILDCARD_TYPE_P (T) || CLASS_TYPE_P (T))
7ddedda4 1514
9e1e64ec 1515/* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or
bb20cc46 1516 union type. */
9e1e64ec 1517#define SET_CLASS_TYPE_P(T, VAL) \
7ddedda4 1518 (TYPE_LANG_FLAG_5 (T) = (VAL))
c92366fb 1519
b80c4d77
MM
1520/* Nonzero if T is a class type. Zero for template type parameters,
1521 typename types, and so forth. */
98e40e83 1522#define CLASS_TYPE_P(T) \
9e1e64ec 1523 (RECORD_OR_UNION_CODE_P (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
c92366fb 1524
cb68ec50
PC
1525/* Nonzero if T is a class type but not an union. */
1526#define NON_UNION_CLASS_TYPE_P(T) \
1527 (CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE)
1528
38b3627d 1529/* Keep these checks in ascending code order. */
9e1e64ec 1530#define RECORD_OR_UNION_CODE_P(T) \
38b3627d 1531 ((T) == RECORD_TYPE || (T) == UNION_TYPE)
73243d63 1532#define OVERLOAD_TYPE_P(T) \
98e40e83 1533 (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
8d08fdba 1534
00a17e31 1535/* True if this a "Java" type, defined in 'extern "Java"'. */
98e40e83 1536#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
ea419909 1537
5552b43c
MM
1538/* True if this type is dependent. This predicate is only valid if
1539 TYPE_DEPENDENT_P_VALID is true. */
1540#define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
1541
1542/* True if dependent_type_p has been called for this type, with the
1543 result that TYPE_DEPENDENT_P is valid. */
1544#define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
1545
91063b51
MM
1546/* Nonzero if this type is const-qualified. */
1547#define CP_TYPE_CONST_P(NODE) \
89d684bb 1548 ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
91063b51
MM
1549
1550/* Nonzero if this type is volatile-qualified. */
1551#define CP_TYPE_VOLATILE_P(NODE) \
89d684bb 1552 ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
91063b51 1553
174bcdb9 1554/* Nonzero if this type is restrict-qualified. */
91063b51 1555#define CP_TYPE_RESTRICT_P(NODE) \
89d684bb 1556 ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
91063b51
MM
1557
1558/* Nonzero if this type is const-qualified, but not
1559 volatile-qualified. Other qualifiers are ignored. This macro is
1560 used to test whether or not it is OK to bind an rvalue to a
1561 reference. */
1562#define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
89d684bb 1563 ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
91063b51
MM
1564 == TYPE_QUAL_CONST)
1565
e0fff4b3 1566#define FUNCTION_ARG_CHAIN(NODE) \
98e40e83 1567 TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
e0fff4b3
JM
1568
1569/* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
1570 which refers to a user-written parameter. */
1571#define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
98e40e83 1572 skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
e0fff4b3
JM
1573
1574/* Similarly, but for DECL_ARGUMENTS. */
1575#define FUNCTION_FIRST_USER_PARM(NODE) \
98e40e83 1576 skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
e0fff4b3 1577
2db1ab2d
NS
1578/* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
1579 ambiguity issues. */
98e40e83 1580#define DERIVED_FROM_P(PARENT, TYPE) \
fb414939 1581 (lookup_base ((TYPE), (PARENT), ba_any, NULL, tf_none) != NULL_TREE)
d7afec4b
ND
1582
1583/* Gives the visibility specification for a class type. */
0871761b 1584#define CLASSTYPE_VISIBILITY(TYPE) \
a2b63a20 1585 DECL_VISIBILITY (TYPE_MAIN_DECL (TYPE))
0871761b 1586#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \
a2b63a20 1587 DECL_VISIBILITY_SPECIFIED (TYPE_MAIN_DECL (TYPE))
d7afec4b 1588
a79683d5 1589struct GTY (()) tree_pair_s {
0871761b
NS
1590 tree purpose;
1591 tree value;
a79683d5 1592};
0871761b 1593typedef tree_pair_s *tree_pair_p;
d7afec4b 1594
e2500fed
GK
1595/* This is a few header flags for 'struct lang_type'. Actually,
1596 all but the first are used only for lang_type_class; they
1597 are put in this structure to save space. */
d1b38208 1598struct GTY(()) lang_type_header {
1c62e7b2
KG
1599 BOOL_BITFIELD is_lang_type_class : 1;
1600
1601 BOOL_BITFIELD has_type_conversion : 1;
066ec0a4 1602 BOOL_BITFIELD has_copy_ctor : 1;
1c62e7b2 1603 BOOL_BITFIELD has_default_ctor : 1;
1c62e7b2
KG
1604 BOOL_BITFIELD const_needs_init : 1;
1605 BOOL_BITFIELD ref_needs_init : 1;
066ec0a4 1606 BOOL_BITFIELD has_const_copy_assign : 1;
5775a06a
NS
1607
1608 BOOL_BITFIELD spare : 1;
e2500fed
GK
1609};
1610
7ddedda4
MM
1611/* This structure provides additional information above and beyond
1612 what is provide in the ordinary tree_type. In the past, we used it
1613 for the types of class types, template parameters types, typename
1614 types, and so forth. However, there can be many (tens to hundreds
1615 of thousands) of template parameter types in a compilation, and
1616 there's no need for this additional information in that case.
1617 Therefore, we now use this data structure only for class types.
1618
1619 In the past, it was thought that there would be relatively few
1620 class types. However, in the presence of heavy use of templates,
1621 many (i.e., thousands) of classes can easily be generated.
1622 Therefore, we should endeavor to keep the size of this structure to
1623 a minimum. */
d1b38208 1624struct GTY(()) lang_type_class {
e2500fed 1625 struct lang_type_header h;
19114537 1626
8012c983
MM
1627 unsigned char align;
1628
5b0cec3b
MM
1629 unsigned has_mutable : 1;
1630 unsigned com_interface : 1;
1631 unsigned non_pod_class : 1;
1632 unsigned nearly_empty_p : 1;
46ccf50a 1633 unsigned user_align : 1;
066ec0a4 1634 unsigned has_copy_assign : 1;
834c6dff
MM
1635 unsigned has_new : 1;
1636 unsigned has_array_new : 1;
8012c983
MM
1637
1638 unsigned gets_delete : 2;
8012c983
MM
1639 unsigned interface_only : 1;
1640 unsigned interface_unknown : 1;
8fbc5ae7 1641 unsigned contains_empty_class_p : 1;
560ad596
MM
1642 unsigned anon_aggr : 1;
1643 unsigned non_zero_init : 1;
1644 unsigned empty_p : 1;
8012c983 1645
dbc957f1 1646 unsigned vec_new_uses_cookie : 1;
8012c983 1647 unsigned declared_class : 1;
3543e114
NS
1648 unsigned diamond_shaped : 1;
1649 unsigned repeated_base : 1;
8012c983 1650 unsigned being_defined : 1;
fae4f6aa 1651 unsigned java_interface : 1;
8012c983 1652 unsigned debug_requested : 1;
560ad596 1653 unsigned fields_readonly : 1;
c8094d83 1654
3543e114 1655 unsigned use_template : 2;
8012c983
MM
1656 unsigned ptrmemfunc_flag : 1;
1657 unsigned was_anonymous : 1;
508a1c9c
MM
1658 unsigned lazy_default_ctor : 1;
1659 unsigned lazy_copy_ctor : 1;
066ec0a4 1660 unsigned lazy_copy_assign : 1;
9f4faeae
MM
1661 unsigned lazy_destructor : 1;
1662
066ec0a4
JM
1663 unsigned has_const_copy_ctor : 1;
1664 unsigned has_complex_copy_ctor : 1;
1665 unsigned has_complex_copy_assign : 1;
8012c983 1666 unsigned non_aggregate : 1;
cb68ec50 1667 unsigned has_complex_dflt : 1;
09357846 1668 unsigned has_list_ctor : 1;
c32097d8 1669 unsigned non_std_layout : 1;
7ecbca9d 1670 unsigned is_literal : 1;
94e6e4c4 1671
ac177431
JM
1672 unsigned lazy_move_ctor : 1;
1673 unsigned lazy_move_assign : 1;
1674 unsigned has_complex_move_ctor : 1;
1675 unsigned has_complex_move_assign : 1;
3b49d762 1676 unsigned has_constexpr_ctor : 1;
ac177431 1677
8012c983
MM
1678 /* When adding a flag here, consider whether or not it ought to
1679 apply to a template instance if it applies to the template. If
1680 so, make sure to copy it in instantiate_class_template! */
1681
5b0cec3b
MM
1682 /* There are some bits left to fill out a 32-bit word. Keep track
1683 of this by updating the size of this bitfield whenever you add or
8012c983 1684 remove a flag. */
5b1e7435 1685 unsigned dummy : 3;
bb20cc46 1686
911a71a7 1687 tree primary_base;
9771b263 1688 vec<tree_pair_s, va_gc> *vcall_indices;
548502d3 1689 tree vtables;
a82d6da5 1690 tree typeinfo_var;
9771b263 1691 vec<tree, va_gc> *vbases;
5e0c54e5 1692 binding_table nested_udts;
17bbb839 1693 tree as_base;
9771b263 1694 vec<tree, va_gc> *pure_virtuals;
c35cce41 1695 tree friend_classes;
9771b263 1696 vec<tree, va_gc> * GTY((reorder ("resort_type_method_vec"))) methods;
9aad8f83 1697 tree key_method;
7088fca9 1698 tree decl_list;
c35cce41 1699 tree template_info;
6a629cac 1700 tree befriending_classes;
c7baa145
ZL
1701 /* In a RECORD_TYPE, information specific to Objective-C++, such
1702 as a list of adopted protocols or a pointer to a corresponding
1703 @interface. See objc/objc-act.h for details. */
1704 tree objc_info;
b97e8a14
JM
1705 /* sorted_fields is sorted based on a pointer, so we need to be able
1706 to resort it if pointers get rearranged. */
1707 struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields")))
1708 sorted_fields;
d5f4eddd
JM
1709 /* FIXME reuse another field? */
1710 tree lambda_expr;
8d08fdba
MS
1711};
1712
d1b38208 1713struct GTY(()) lang_type_ptrmem {
e2500fed
GK
1714 struct lang_type_header h;
1715 tree record;
1716};
1717
766090c2 1718struct GTY(()) lang_type {
19114537 1719 union lang_type_u
e2500fed 1720 {
165b54c3 1721 struct lang_type_header GTY((skip (""))) h;
e2500fed
GK
1722 struct lang_type_class GTY((tag ("1"))) c;
1723 struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
1724 } GTY((desc ("%h.h.is_lang_type_class"))) u;
1725};
1726
1727#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
1728
de94b46c 1729#define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \
e2500fed
GK
1730({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
1731 if (! lt->u.h.is_lang_type_class) \
1732 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1733 &lt->u.c; })
1734
de94b46c 1735#define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \
e2500fed
GK
1736({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
1737 if (lt->u.h.is_lang_type_class) \
1738 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
1739 &lt->u.ptrmem; })
1740
1741#else
1742
1743#define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
1744#define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
1745
1746#endif /* ENABLE_TREE_CHECKING */
1747
834c6dff 1748/* Nonzero for _CLASSTYPE means that operator delete is defined. */
e2500fed 1749#define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
a28e3c7f
MS
1750#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
1751
834c6dff 1752/* Nonzero if `new NODE[x]' should cause the allocation of extra
dbc957f1
MM
1753 storage to indicate how many array elements are in use. */
1754#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
1755 (CLASS_TYPE_P (NODE) \
e2500fed 1756 && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
8d08fdba 1757
8d08fdba
MS
1758/* Nonzero means that this _CLASSTYPE node defines ways of converting
1759 itself to other types. */
98e40e83 1760#define TYPE_HAS_CONVERSION(NODE) \
e2500fed 1761 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
8d08fdba 1762
508a1c9c
MM
1763/* Nonzero means that NODE (a class type) has a default constructor --
1764 but that it has not yet been declared. */
1765#define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \
1766 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor)
1767
1768/* Nonzero means that NODE (a class type) has a copy constructor --
1769 but that it has not yet been declared. */
1770#define CLASSTYPE_LAZY_COPY_CTOR(NODE) \
1771 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor)
1772
d5f4eddd
JM
1773/* Nonzero means that NODE (a class type) has a move constructor --
1774 but that it has not yet been declared. */
1775#define CLASSTYPE_LAZY_MOVE_CTOR(NODE) \
1776 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_ctor)
1777
fb232476
MM
1778/* Nonzero means that NODE (a class type) has an assignment operator
1779 -- but that it has not yet been declared. */
066ec0a4
JM
1780#define CLASSTYPE_LAZY_COPY_ASSIGN(NODE) \
1781 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_assign)
fb232476 1782
ac177431
JM
1783/* Nonzero means that NODE (a class type) has an assignment operator
1784 -- but that it has not yet been declared. */
1785#define CLASSTYPE_LAZY_MOVE_ASSIGN(NODE) \
1786 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_assign)
1787
9f4faeae
MM
1788/* Nonzero means that NODE (a class type) has a destructor -- but that
1789 it has not yet been declared. */
1790#define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
1791 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
c8094d83 1792
486d481b
VV
1793/* Nonzero means that NODE (a class type) is final */
1794#define CLASSTYPE_FINAL(NODE) \
5b1e7435 1795 TYPE_FINAL_P (NODE)
486d481b
VV
1796
1797
8d08fdba 1798/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
066ec0a4 1799#define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign)
aaaa46d2
MM
1800
1801/* True iff the class type NODE has an "operator =" whose parameter
1802 has a parameter of type "const X&". */
066ec0a4
JM
1803#define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \
1804 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign)
8d08fdba
MS
1805
1806/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
066ec0a4
JM
1807#define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor)
1808#define TYPE_HAS_CONST_COPY_CTOR(NODE) \
1809 (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor)
8d08fdba 1810
09357846
JM
1811/* Nonzero if this class has an X(initializer_list<T>) constructor. */
1812#define TYPE_HAS_LIST_CTOR(NODE) \
1813 (LANG_TYPE_CLASS_CHECK (NODE)->has_list_ctor)
1814
3b49d762
GDR
1815/* Nonzero if this class has a constexpr constructor other than a copy/move
1816 constructor. Note that a class can have constexpr constructors for
1817 static initialization even if it isn't a literal class. */
1818#define TYPE_HAS_CONSTEXPR_CTOR(NODE) \
1819 (LANG_TYPE_CLASS_CHECK (NODE)->has_constexpr_ctor)
1820
834c6dff
MM
1821/* Nonzero if this class defines an overloaded operator new. (An
1822 operator new [] doesn't count.) */
1823#define TYPE_HAS_NEW_OPERATOR(NODE) \
e2500fed 1824 (LANG_TYPE_CLASS_CHECK (NODE)->has_new)
834c6dff
MM
1825
1826/* Nonzero if this class defines an overloaded operator new[]. */
1827#define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
e2500fed 1828 (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
834c6dff 1829
8d08fdba
MS
1830/* Nonzero means that this type is being defined. I.e., the left brace
1831 starting the definition of this type has been seen. */
e2500fed 1832#define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
8d08fdba 1833
01628e54
JM
1834/* Nonzero means that this type is either complete or being defined, so we
1835 can do lookup in it. */
1836#define COMPLETE_OR_OPEN_TYPE_P(NODE) \
1837 (COMPLETE_TYPE_P (NODE) || (CLASS_TYPE_P (NODE) && TYPE_BEING_DEFINED (NODE)))
1838
3543e114
NS
1839/* Mark bits for repeated base checks. */
1840#define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
1841
1634705d 1842/* Nonzero if the class NODE has multiple paths to the same (virtual)
3543e114
NS
1843 base object. */
1844#define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \
1845 (LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped)
1846
1634705d 1847/* Nonzero if the class NODE has multiple instances of the same base
3543e114
NS
1848 type. */
1849#define CLASSTYPE_REPEATED_BASE_P(NODE) \
1850 (LANG_TYPE_CLASS_CHECK(NODE)->repeated_base)
1851
9aad8f83
MA
1852/* The member function with which the vtable will be emitted:
1853 the first noninline non-pure-virtual member function. NULL_TREE
1854 if there is no key function or if this is a class template */
1855#define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method)
1856
61a127b3 1857/* Vector member functions defined in this class. Each element is
03017874
MM
1858 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
1859 functions with the same name end up in the same slot. The first
61a127b3 1860 two elements are for constructors, and destructors, respectively.
5dd236e2
NS
1861 All template conversion operators to innermost template dependent
1862 types are overloaded on the next slot, if they exist. Note, the
1863 names for these functions will not all be the same. The
1864 non-template conversion operators & templated conversions to
1865 non-innermost template types are next, followed by ordinary member
1866 functions. There may be empty entries at the end of the vector.
1867 The conversion operators are unsorted. The ordinary member
1868 functions are sorted, once the class is complete. */
e2500fed 1869#define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
8d08fdba 1870
7088fca9
KL
1871/* For class templates, this is a TREE_LIST of all member data,
1872 functions, types, and friends in the order of declaration.
1873 The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
1874 and the RECORD_TYPE for the class template otherwise. */
1875#define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
1876
db9b2174
MM
1877/* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
1878#define CLASSTYPE_CONSTRUCTOR_SLOT 0
1879
1880/* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
1881#define CLASSTYPE_DESTRUCTOR_SLOT 1
1882
1883/* The first slot in the CLASSTYPE_METHOD_VEC where conversion
1884 operators can appear. */
1885#define CLASSTYPE_FIRST_CONVERSION_SLOT 2
1886
1887/* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
1888 are the constructors that take an in-charge parameter. */
1889#define CLASSTYPE_CONSTRUCTORS(NODE) \
9771b263 1890 ((*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_CONSTRUCTOR_SLOT])
db9b2174 1891
52682a1b 1892/* A FUNCTION_DECL for the destructor for NODE. These are the
9f4faeae
MM
1893 destructors that take an in-charge parameter. If
1894 CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL
1895 until the destructor is created with lazily_declare_fn. */
db9b2174 1896#define CLASSTYPE_DESTRUCTORS(NODE) \
9f4faeae 1897 (CLASSTYPE_METHOD_VEC (NODE) \
9771b263 1898 ? (*CLASSTYPE_METHOD_VEC (NODE))[CLASSTYPE_DESTRUCTOR_SLOT] \
9f4faeae 1899 : NULL_TREE)
e1cd6e56 1900
5e0c54e5
GDR
1901/* A dictionary of the nested user-defined-types (class-types, or enums)
1902 found within this class. This table includes nested member class
1903 templates. */
1904#define CLASSTYPE_NESTED_UTDS(NODE) \
1905 (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
8d08fdba 1906
3ef397c1 1907/* Nonzero if NODE has a primary base class, i.e., a base class with
0811ea8f 1908 which it shares the virtual function table pointer. */
3ef397c1 1909#define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
911a71a7 1910 (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
3ef397c1
MM
1911
1912/* If non-NULL, this is the binfo for the primary base class, i.e.,
1913 the base class which contains the virtual function table pointer
1914 for this class. */
5e19c053 1915#define CLASSTYPE_PRIMARY_BINFO(NODE) \
e2500fed 1916 (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
3ef397c1 1917
58c42dc2 1918/* A vector of BINFOs for the direct and indirect virtual base classes
c35cce41
MM
1919 that this type uses in a post-order depth-first left-to-right
1920 order. (In other words, these bases appear in the order that they
dbbf88d1 1921 should be initialized.) */
e2500fed 1922#define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
23381155 1923
17bbb839
MM
1924/* The type corresponding to NODE when NODE is used as a base class,
1925 i.e., NODE without virtual base classes. */
1926
1927#define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
1928
00bfffa4
JM
1929/* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */
1930
1931#define IS_FAKE_BASE_TYPE(NODE) \
1932 (TREE_CODE (NODE) == RECORD_TYPE \
1933 && TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \
1934 && CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE))
1935
2d926395
MM
1936/* These are the size and alignment of the type without its virtual
1937 base classes, for when we use this type as a base itself. */
17bbb839
MM
1938#define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE))
1939#define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE))
1940#define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE))
1941#define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE))
8d08fdba 1942
1b50716d
MM
1943/* The alignment of NODE, without its virtual bases, in bytes. */
1944#define CLASSTYPE_ALIGN_UNIT(NODE) \
1945 (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
1946
19114537 1947/* True if this a Java interface type, declared with
00a17e31 1948 '__attribute__ ((java_interface))'. */
585b44d3
NS
1949#define TYPE_JAVA_INTERFACE(NODE) \
1950 (LANG_TYPE_CLASS_CHECK (NODE)->java_interface)
60c87482 1951
9771b263 1952/* A vec<tree> of virtual functions which cannot be inherited by
8d08fdba
MS
1953 derived classes. When deriving from this type, the derived
1954 class must provide its own definition for each of these functions. */
585b44d3
NS
1955#define CLASSTYPE_PURE_VIRTUALS(NODE) \
1956 (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
8d08fdba 1957
94ccc95d
PC
1958/* Nonzero means that this type is an abstract class type. */
1959#define ABSTRACT_CLASS_TYPE_P(NODE) \
1960 (CLASS_TYPE_P (NODE) && CLASSTYPE_PURE_VIRTUALS(NODE))
1961
8d08fdba 1962/* Nonzero means that this type has an X() constructor. */
98e40e83 1963#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
e2500fed 1964 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
8d08fdba 1965
f4f206f4 1966/* Nonzero means that this type contains a mutable member. */
e2500fed 1967#define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
a7a7710d
NS
1968#define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1969
c32097d8
JM
1970/* Nonzero means that this class type is not POD for the purpose of layout
1971 (as defined in the ABI). This is different from the language's POD. */
1972#define CLASSTYPE_NON_LAYOUT_POD_P(NODE) \
1973 (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
1974
1975/* Nonzero means that this class type is a non-standard-layout class. */
1976#define CLASSTYPE_NON_STD_LAYOUT(NODE) \
1977 (LANG_TYPE_CLASS_CHECK (NODE)->non_std_layout)
52fb2769 1978
94e6e4c4
AO
1979/* Nonzero means that this class contains pod types whose default
1980 initialization is not a zero initialization (namely, pointers to
1981 data members). */
e2500fed
GK
1982#define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
1983 (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
94e6e4c4 1984
58731fd1
MM
1985/* Nonzero if this class is "empty" in the sense of the C++ ABI. */
1986#define CLASSTYPE_EMPTY_P(NODE) \
1987 (LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
1988
f9c528ea
MM
1989/* Nonzero if this class is "nearly empty", i.e., contains only a
1990 virtual function table pointer. */
1991#define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
e2500fed 1992 (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
f9c528ea 1993
5ec1192e
MM
1994/* Nonzero if this class contains an empty subobject. */
1995#define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
1996 (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
1997
6a629cac 1998/* A list of class types of which this type is a friend. The
ea4e080b
MM
1999 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
2000 case of a template friend. */
98e40e83 2001#define CLASSTYPE_FRIEND_CLASSES(NODE) \
e2500fed 2002 (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
8d08fdba 2003
6a629cac
MM
2004/* A list of the classes which grant friendship to this class. */
2005#define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
e2500fed 2006 (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
6a629cac 2007
d5f4eddd
JM
2008/* The associated LAMBDA_EXPR that made this class. */
2009#define CLASSTYPE_LAMBDA_EXPR(NODE) \
2010 (LANG_TYPE_CLASS_CHECK (NODE)->lambda_expr)
2011/* The extra mangling scope for this closure type. */
2012#define LAMBDA_TYPE_EXTRA_SCOPE(NODE) \
2013 (LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (NODE)))
2014
8d08fdba 2015/* Say whether this node was declared as a "class" or a "struct". */
98e40e83 2016#define CLASSTYPE_DECLARED_CLASS(NODE) \
e2500fed 2017 (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
8d08fdba 2018
6eb35968
DE
2019/* Nonzero if this class has const members
2020 which have no specified initialization. */
2021#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
2022 (TYPE_LANG_SPECIFIC (NODE) \
2023 ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
2024#define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
2025 (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
2026
2027/* Nonzero if this class has ref members
2028 which have no specified initialization. */
2029#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
2030 (TYPE_LANG_SPECIFIC (NODE) \
2031 ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
2032#define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
2033 (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
8d08fdba
MS
2034
2035/* Nonzero if this class is included from a header file which employs
2036 `#pragma interface', and it is not included in its implementation file. */
98e40e83 2037#define CLASSTYPE_INTERFACE_ONLY(NODE) \
e2500fed 2038 (LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
8d08fdba 2039
97458258
MM
2040/* True if we have already determined whether or not vtables, VTTs,
2041 typeinfo, and other similar per-class data should be emitted in
2042 this translation unit. This flag does not indicate whether or not
2043 these items should be emitted; it only indicates that we know one
2044 way or the other. */
2045#define CLASSTYPE_INTERFACE_KNOWN(NODE) \
e2500fed 2046 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
a692ad2e 2047/* The opposite of CLASSTYPE_INTERFACE_KNOWN. */
97458258 2048#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
e2500fed 2049 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
97458258
MM
2050
2051#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
e2500fed 2052 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
97458258 2053#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
e2500fed 2054 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
97458258 2055#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
e2500fed 2056 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
8d08fdba
MS
2057
2058/* Nonzero if a _DECL node requires us to output debug info for this class. */
98e40e83 2059#define CLASSTYPE_DEBUG_REQUESTED(NODE) \
e2500fed 2060 (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
8d08fdba
MS
2061\f
2062/* Additional macros for inheritance information. */
2063
8d08fdba 2064/* Nonzero means that this class is on a path leading to a new vtable. */
809e3e7f 2065#define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE)
dbbf88d1
NS
2066
2067/* Nonzero means B (a BINFO) has its own vtable. Any copies will not
9bcb9aae 2068 have this flag set. */
809e3e7f 2069#define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B))
23656158 2070
539ed333
NS
2071/* Compare a BINFO_TYPE with another type for equality. For a binfo,
2072 this is functionally equivalent to using same_type_p, but
2073 measurably faster. At least one of the arguments must be a
2074 BINFO_TYPE. The other can be a BINFO_TYPE or a regular type. If
2075 BINFO_TYPE(T) ever stops being the main variant of the class the
2076 binfo is for, this macro must change. */
2077#define SAME_BINFO_TYPE_P(A, B) ((A) == (B))
2078
23656158 2079/* Any subobject that needs a new vtable must have a vptr and must not
9965d119
NS
2080 be a non-virtual primary base (since it would then use the vtable from a
2081 derived class and never become non-primary.) */
dbbf88d1
NS
2082#define SET_BINFO_NEW_VTABLE_MARKED(B) \
2083 (BINFO_NEW_VTABLE_MARKED (B) = 1, \
4094f4d2
NS
2084 gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)), \
2085 gcc_assert (TYPE_VFIELD (BINFO_TYPE (B))))
8d08fdba 2086
dbbf88d1
NS
2087/* Nonzero if this binfo is for a dependent base - one that should not
2088 be searched. */
809e3e7f 2089#define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE)
dbbf88d1 2090
9965d119
NS
2091/* Nonzero if this binfo has lost its primary base binfo (because that
2092 is a nearly-empty virtual base that has been taken by some other
aba649ba 2093 base in the complete hierarchy. */
809e3e7f 2094#define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE)
db3d8cde 2095
fc6633e0
NS
2096/* Nonzero if this BINFO is a primary base class. */
2097#define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE)
911a71a7 2098
72c4a2a6
JM
2099/* Used by various search routines. */
2100#define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
8d08fdba 2101\f
9771b263 2102/* A vec<tree_pair_s> of the vcall indices associated with the class
0871761b
NS
2103 NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual
2104 function. The VALUE is the index into the virtual table where the
2105 vcall offset for that function is stored, when NODE is a virtual
2106 base. */
548502d3
MM
2107#define CLASSTYPE_VCALL_INDICES(NODE) \
2108 (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
2109
2110/* The various vtables for the class NODE. The primary vtable will be
2111 first, followed by the construction vtables and VTT, if any. */
2112#define CLASSTYPE_VTABLES(NODE) \
2113 (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
2114
a82d6da5
MM
2115/* The std::type_info variable representing this class, or NULL if no
2116 such variable has been created. This field is only set for the
2117 TYPE_MAIN_VARIANT of the class. */
2118#define CLASSTYPE_TYPEINFO_VAR(NODE) \
2119 (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
2120
00a17e31 2121/* Accessor macros for the BINFO_VIRTUALS list. */
c0bbf652
MM
2122
2123/* The number of bytes by which to adjust the `this' pointer when
03fc215c 2124 calling this virtual function. Subtract this value from the this
00a17e31 2125 pointer. Always non-NULL, might be constant zero though. */
5e19c053 2126#define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
c0bbf652
MM
2127
2128/* If non-NULL, the vtable index at which to find the vcall offset
03fc215c
NS
2129 when calling this virtual function. Add the value at that vtable
2130 index to the this pointer. */
5e19c053 2131#define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
c0bbf652
MM
2132
2133/* The function to call. */
5e19c053
MM
2134#define BV_FN(NODE) (TREE_VALUE (NODE))
2135
02dea3ff
JM
2136/* Whether or not this entry is for a lost primary virtual base. */
2137#define BV_LOST_PRIMARY(NODE) (TREE_LANG_FLAG_0 (NODE))
8d08fdba 2138\f
8d08fdba 2139/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
193306f7 2140 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
66a6250f 2141 will be NULL_TREE to indicate a throw specification of `()', or
3a55fb4c 2142 no exceptions allowed. For a noexcept specification, TREE_VALUE
b273cdb1
JM
2143 is NULL_TREE and TREE_PURPOSE is the constant-expression. For
2144 a deferred noexcept-specification, TREE_PURPOSE is a DEFERRED_NOEXCEPT
2145 (for templates) or an OVERLOAD list of functions (for implicitly
2146 declared functions). */
c4101929 2147#define TYPE_RAISES_EXCEPTIONS(NODE) \
7d27c734 2148 TYPE_LANG_SLOT_1 (FUNC_OR_METHOD_CHECK (NODE))
a9aedbc2 2149
3a55fb4c
JM
2150/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
2151 or noexcept(true). */
2152#define TYPE_NOTHROW_P(NODE) nothrow_spec_p (TYPE_RAISES_EXCEPTIONS (NODE))
7f477e81 2153
9feb3d6a
JM
2154/* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept. This is the
2155 case for things declared noexcept(true) and, with -fnothrow-opt, for
2156 throw() functions. */
3a55fb4c 2157#define TYPE_NOEXCEPT_P(NODE) type_noexcept_p (NODE)
9feb3d6a 2158
e92cc029 2159/* The binding level associated with the namespace. */
3ebc5c52 2160#define NAMESPACE_LEVEL(NODE) \
b97e8a14 2161 (LANG_DECL_NS_CHECK (NODE)->level)
8d08fdba 2162\f
b97e8a14 2163/* Flags shared by all forms of DECL_LANG_SPECIFIC.
6a629cac 2164
b97e8a14
JM
2165 Some of the flags live here only to make lang_decl_min/fn smaller. Do
2166 not make this struct larger than 32 bits; instead, make sel smaller. */
6a629cac 2167
b97e8a14
JM
2168struct GTY(()) lang_decl_base {
2169 unsigned selector : 16; /* Larger than necessary for faster access. */
4684cd27 2170 ENUM_BITFIELD(languages) language : 4;
b97e8a14
JM
2171 unsigned use_template : 2;
2172 unsigned not_really_extern : 1; /* var or fn */
2173 unsigned initialized_in_class : 1; /* var or fn */
2174 unsigned repo_available_p : 1; /* var or fn */
2175 unsigned threadprivate_or_deleted_p : 1; /* var or fn */
43f4447e 2176 unsigned anticipated_p : 1; /* fn, type or template */
d9a6bd32 2177 /* anticipated_p reused as DECL_OMP_PRIVATIZED_MEMBER in var */
3048c0c7 2178 unsigned friend_or_tls : 1; /* var, fn, type or template */
48326487 2179 unsigned template_conv_p : 1; /* var or template */
3146f36f 2180 unsigned odr_used : 1; /* var or fn */
b97e8a14 2181 unsigned u2sel : 1;
971e17ff
AS
2182 unsigned concept_p : 1; /* applies to vars and functions */
2183 /* 0 spare bits */
b97e8a14
JM
2184};
2185
2186/* True for DECL codes which have template info and access. */
2187#define LANG_DECL_HAS_MIN(NODE) \
5a6ccc94 2188 (VAR_OR_FUNCTION_DECL_P (NODE) \
b97e8a14 2189 || TREE_CODE (NODE) == FIELD_DECL \
b97e8a14
JM
2190 || TREE_CODE (NODE) == CONST_DECL \
2191 || TREE_CODE (NODE) == TYPE_DECL \
2192 || TREE_CODE (NODE) == TEMPLATE_DECL \
2193 || TREE_CODE (NODE) == USING_DECL)
2194
2195/* DECL_LANG_SPECIFIC for the above codes. */
2196
2197struct GTY(()) lang_decl_min {
2198 struct lang_decl_base base;
2199
2200 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
2201 THUNK_ALIAS.
2202 In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
2203 VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
2204 DECL_TEMPLATE_INFO. */
2205 tree template_info;
2206
2207 union lang_decl_u2 {
2208 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
2209 THUNK_VIRTUAL_OFFSET.
2210 Otherwise this is DECL_ACCESS. */
2211 tree GTY ((tag ("0"))) access;
2212
2213 /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
2214 int GTY ((tag ("1"))) discriminator;
2215 } GTY ((desc ("%0.u.base.u2sel"))) u2;
2216};
2217
2218/* Additional DECL_LANG_SPECIFIC information for functions. */
2219
2220struct GTY(()) lang_decl_fn {
2221 struct lang_decl_min min;
2222
2223 /* In an overloaded operator, this is the value of
2224 DECL_OVERLOADED_OPERATOR_P. */
2225 ENUM_BITFIELD (tree_code) operator_code : 16;
2226
4684cd27
MM
2227 unsigned global_ctor_p : 1;
2228 unsigned global_dtor_p : 1;
b97e8a14 2229 unsigned assignment_operator_p : 1;
8d08fdba 2230 unsigned static_function : 1;
fee7654e 2231 unsigned pure_virtual : 1;
b97e8a14
JM
2232 unsigned defaulted_p : 1;
2233
454fa7a7 2234 unsigned has_in_charge_parm_p : 1;
5daf7c0a 2235 unsigned has_vtt_parm_p : 1;
b97e8a14 2236 unsigned pending_inline_p : 1;
db5ae43f 2237 unsigned nonconverting : 1;
ea1763b1 2238 unsigned thunk_p : 1;
4977bab6 2239 unsigned this_thunk_p : 1;
d63d5d0c 2240 unsigned hidden_friend_p : 1;
acf0174b 2241 unsigned omp_declare_reduction_p : 1;
45410641 2242 /* 2 spare bits on 32-bit hosts, 34 on 64-bit hosts. */
8d08fdba 2243
b97e8a14
JM
2244 /* For a non-thunk function decl, this is a tree list of
2245 friendly classes. For a thunk function decl, it is the
2246 thunked to function decl. */
2247 tree befriending_classes;
3ebc5c52 2248
b97e8a14
JM
2249 /* For a non-virtual FUNCTION_DECL, this is
2250 DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
2251 DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
2252 this pointer and result pointer adjusting thunks are
2253 chained here. This pointer thunks to return pointer thunks
2254 will be chained on the return pointer thunk. */
2255 tree context;
af3b4e59 2256
b97e8a14
JM
2257 union lang_decl_u5
2258 {
2259 /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is
2260 DECL_CLONED_FUNCTION. */
2261 tree GTY ((tag ("0"))) cloned_function;
af3b4e59 2262
b97e8a14
JM
2263 /* In a FUNCTION_DECL for which THUNK_P holds this is the
2264 THUNK_FIXED_OFFSET. */
2265 HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset;
2266 } GTY ((desc ("%1.thunk_p"))) u5;
2267
2268 union lang_decl_u3
2269 {
2270 struct cp_token_cache * GTY ((tag ("1"))) pending_inline_info;
2271 struct language_function * GTY ((tag ("0")))
2272 saved_language_function;
2273 } GTY ((desc ("%1.pending_inline_p"))) u;
2274
2275};
2276
2277/* DECL_LANG_SPECIFIC for namespaces. */
2278
2279struct GTY(()) lang_decl_ns {
2280 struct lang_decl_base base;
2c140474 2281 cp_binding_level *level;
aaf8a23e
JH
2282 tree ns_using;
2283 tree ns_users;
8d08fdba
MS
2284};
2285
ad909c97
JM
2286/* DECL_LANG_SPECIFIC for parameters. */
2287
2288struct GTY(()) lang_decl_parm {
2289 struct lang_decl_base base;
67e18edb 2290 int level;
ad909c97
JM
2291 int index;
2292};
2293
b97e8a14
JM
2294/* DECL_LANG_SPECIFIC for all types. It would be nice to just make this a
2295 union rather than a struct containing a union as its only field, but
2296 tree.h declares it as a struct. */
17211ab5 2297
766090c2 2298struct GTY(()) lang_decl {
b97e8a14
JM
2299 union GTY((desc ("%h.base.selector"))) lang_decl_u {
2300 struct lang_decl_base GTY ((default)) base;
2301 struct lang_decl_min GTY((tag ("0"))) min;
2302 struct lang_decl_fn GTY ((tag ("1"))) fn;
2303 struct lang_decl_ns GTY((tag ("2"))) ns;
ad909c97 2304 struct lang_decl_parm GTY((tag ("3"))) parm;
b97e8a14 2305 } u;
e2500fed 2306};
9188c363 2307
b97e8a14
JM
2308/* Looks through a template (if present) to find what it declares. */
2309#define STRIP_TEMPLATE(NODE) \
2310 (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE)
2311
e2500fed 2312#if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
9188c363 2313
b97e8a14
JM
2314#define LANG_DECL_MIN_CHECK(NODE) __extension__ \
2315({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
2316 if (!LANG_DECL_HAS_MIN (NODE)) \
2317 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
2318 &lt->u.min; })
2319
2320/* We want to be able to check DECL_CONSTRUCTOR_P and such on a function
2321 template, not just on a FUNCTION_DECL. So when looking for things in
2322 lang_decl_fn, look down through a TEMPLATE_DECL into its result. */
2323#define LANG_DECL_FN_CHECK(NODE) __extension__ \
2324({ struct lang_decl *lt = DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE)); \
2325 if (!DECL_DECLARES_FUNCTION_P (NODE) || lt->u.base.selector != 1) \
2326 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
2327 &lt->u.fn; })
2328
2329#define LANG_DECL_NS_CHECK(NODE) __extension__ \
2330({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
2331 if (TREE_CODE (NODE) != NAMESPACE_DECL || lt->u.base.selector != 2) \
2332 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
2333 &lt->u.ns; })
2334
ad909c97
JM
2335#define LANG_DECL_PARM_CHECK(NODE) __extension__ \
2336({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
2337 if (TREE_CODE (NODE) != PARM_DECL) \
2338 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
2339 &lt->u.parm; })
2340
de94b46c 2341#define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \
e2500fed 2342({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
bfd6b23c 2343 if (!LANG_DECL_HAS_MIN (NODE) || lt->u.base.u2sel != TF) \
e2500fed 2344 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
b97e8a14 2345 &lt->u.min.u2; })
db9b2174 2346
e2500fed
GK
2347#else
2348
b97e8a14
JM
2349#define LANG_DECL_MIN_CHECK(NODE) \
2350 (&DECL_LANG_SPECIFIC (NODE)->u.min)
2351
2352#define LANG_DECL_FN_CHECK(NODE) \
8885e914 2353 (&DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE))->u.fn)
b97e8a14
JM
2354
2355#define LANG_DECL_NS_CHECK(NODE) \
2356 (&DECL_LANG_SPECIFIC (NODE)->u.ns)
2357
ad909c97
JM
2358#define LANG_DECL_PARM_CHECK(NODE) \
2359 (&DECL_LANG_SPECIFIC (NODE)->u.parm)
2360
e2500fed 2361#define LANG_DECL_U2_CHECK(NODE, TF) \
b97e8a14 2362 (&DECL_LANG_SPECIFIC (NODE)->u.min.u2)
e2500fed
GK
2363
2364#endif /* ENABLE_TREE_CHECKING */
8d08fdba 2365
5d2ed28c
MM
2366/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
2367 declaration. Some entities (like a member function in a local
2368 class, or a local variable) do not have linkage at all, and this
2369 macro should not be used in those cases.
19114537 2370
5d2ed28c
MM
2371 Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
2372 created by language-independent code, and has C linkage. Most
2373 VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
2374 we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */
0cbd7506
MS
2375#define DECL_LANGUAGE(NODE) \
2376 (DECL_LANG_SPECIFIC (NODE) \
b97e8a14 2377 ? DECL_LANG_SPECIFIC (NODE)->u.base.language \
5d2ed28c
MM
2378 : (TREE_CODE (NODE) == FUNCTION_DECL \
2379 ? lang_c : lang_cplusplus))
2380
2381/* Set the language linkage for NODE to LANGUAGE. */
2382#define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
b97e8a14 2383 (DECL_LANG_SPECIFIC (NODE)->u.base.language = (LANGUAGE))
8d08fdba 2384
0f9aaac7
JH
2385/* For FUNCTION_DECLs and TEMPLATE_DECLs: nonzero means that this function
2386 is a constructor. */
98e40e83 2387#define DECL_CONSTRUCTOR_P(NODE) \
0f9aaac7 2388 DECL_CXX_CONSTRUCTOR_P (STRIP_TEMPLATE (NODE))
aa45967f 2389
db9b2174
MM
2390/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
2391 object. */
2392#define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
bb20cc46 2393 (DECL_CONSTRUCTOR_P (NODE) \
db9b2174
MM
2394 && DECL_NAME (NODE) == complete_ctor_identifier)
2395
2396/* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
2397 object. */
2398#define DECL_BASE_CONSTRUCTOR_P(NODE) \
2399 (DECL_CONSTRUCTOR_P (NODE) \
2400 && DECL_NAME (NODE) == base_ctor_identifier)
2401
2402/* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
2403 specialized in-charge constructor or the specialized not-in-charge
2404 constructor. */
2405#define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
b97e8a14
JM
2406 (DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \
2407 && !DECL_CLONED_FUNCTION_P (NODE))
db9b2174 2408
454fa7a7
MM
2409/* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
2410#define DECL_COPY_CONSTRUCTOR_P(NODE) \
271e6f02 2411 (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
454fa7a7 2412
8af2fec4
RY
2413/* Nonzero if NODE (a FUNCTION_DECL) is a move constructor. */
2414#define DECL_MOVE_CONSTRUCTOR_P(NODE) \
2415 (DECL_CONSTRUCTOR_P (NODE) && move_fn_p (NODE))
2416
0f9aaac7
JH
2417/* Nonzero if NODE (a FUNCTION_DECL or TEMPLATE_DECL)
2418 is a destructor. */
aa45967f 2419#define DECL_DESTRUCTOR_P(NODE) \
0f9aaac7 2420 DECL_CXX_DESTRUCTOR_P (STRIP_TEMPLATE (NODE))
aa45967f 2421
db9b2174
MM
2422/* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
2423 specialized in-charge constructor, in-charge deleting constructor,
78dcd41a 2424 or the base destructor. */
db9b2174 2425#define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
b97e8a14
JM
2426 (DECL_DECLARES_FUNCTION_P (NODE) && DECL_DESTRUCTOR_P (NODE) \
2427 && !DECL_CLONED_FUNCTION_P (NODE))
db9b2174 2428
298d6f60
MM
2429/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
2430 object. */
2431#define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
bb20cc46 2432 (DECL_DESTRUCTOR_P (NODE) \
298d6f60
MM
2433 && DECL_NAME (NODE) == complete_dtor_identifier)
2434
2435/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
2436 object. */
2437#define DECL_BASE_DESTRUCTOR_P(NODE) \
2438 (DECL_DESTRUCTOR_P (NODE) \
2439 && DECL_NAME (NODE) == base_dtor_identifier)
2440
2441/* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
872f37f9 2442 object that deletes the object after it has been destroyed. */
298d6f60 2443#define DECL_DELETING_DESTRUCTOR_P(NODE) \
bb20cc46 2444 (DECL_DESTRUCTOR_P (NODE) \
298d6f60
MM
2445 && DECL_NAME (NODE) == deleting_dtor_identifier)
2446
db9b2174
MM
2447/* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
2448 destructor. */
b97e8a14 2449#define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
db9b2174
MM
2450
2451/* If DECL_CLONED_FUNCTION_P holds, this is the function that was
2452 cloned. */
b97e8a14 2453#define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false))
db9b2174 2454
4684cd27
MM
2455/* Perform an action for each clone of FN, if FN is a function with
2456 clones. This macro should be used like:
19114537 2457
4684cd27 2458 FOR_EACH_CLONE (clone, fn)
0cbd7506 2459 { ... }
4684cd27
MM
2460
2461 */
2462#define FOR_EACH_CLONE(CLONE, FN) \
2463 if (TREE_CODE (FN) == FUNCTION_DECL \
2464 && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \
2465 || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))) \
910ad8de 2466 for (CLONE = DECL_CHAIN (FN); \
4684cd27 2467 CLONE && DECL_CLONED_FUNCTION_P (CLONE); \
910ad8de 2468 CLONE = DECL_CHAIN (CLONE))
4684cd27 2469
8e4ce833
JJ
2470/* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
2471#define DECL_DISCRIMINATOR_P(NODE) \
5a6ccc94 2472 (VAR_P (NODE) && DECL_FUNCTION_SCOPE_P (NODE))
8e4ce833
JJ
2473
2474/* Discriminator for name mangling. */
e2500fed 2475#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
8e4ce833 2476
364f9c6b
JM
2477/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl. */
2478#define DECL_DISCRIMINATOR_SET_P(NODE) \
2479 (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1)
2480
ad909c97
JM
2481/* The index of a user-declared parameter in its function, starting at 1.
2482 All artificial parameters will have index 0. */
2483#define DECL_PARM_INDEX(NODE) \
2484 (LANG_DECL_PARM_CHECK (NODE)->index)
2485
67e18edb
JM
2486/* The level of a user-declared parameter in its function, starting at 1.
2487 A parameter of the function will have level 1; a parameter of the first
2488 nested function declarator (i.e. t in void f (void (*p)(T t))) will have
2489 level 2. */
2490#define DECL_PARM_LEVEL(NODE) \
2491 (LANG_DECL_PARM_CHECK (NODE)->level)
2492
838dfd8a 2493/* Nonzero if the VTT parm has been added to NODE. */
e0fff4b3 2494#define DECL_HAS_VTT_PARM_P(NODE) \
b97e8a14 2495 (LANG_DECL_FN_CHECK (NODE)->has_vtt_parm_p)
3ec6bad3 2496
838dfd8a 2497/* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is
3ec6bad3
MM
2498 required. */
2499#define DECL_NEEDS_VTT_PARM_P(NODE) \
5775a06a 2500 (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE)) \
3ec6bad3
MM
2501 && (DECL_BASE_CONSTRUCTOR_P (NODE) \
2502 || DECL_BASE_DESTRUCTOR_P (NODE)))
2503
838dfd8a 2504/* Nonzero if NODE is a user-defined conversion operator. */
421844e7 2505#define DECL_CONV_FN_P(NODE) \
5838eb91 2506 (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
711734a9 2507
ca90f3e1
MM
2508/* If FN is a conversion operator, the type to which it converts.
2509 Otherwise, NULL_TREE. */
2510#define DECL_CONV_FN_TYPE(FN) \
2511 (DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE)
2512
838dfd8a 2513/* Nonzero if NODE, which is a TEMPLATE_DECL, is a template
5dd236e2
NS
2514 conversion operator to a type dependent on the innermost template
2515 args. */
2516#define DECL_TEMPLATE_CONV_FN_P(NODE) \
b97e8a14 2517 (DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE))->u.base.template_conv_p)
5dd236e2 2518
48326487
JM
2519/* Nonzero if NODE, a static data member, was declared in its class as an
2520 array of unknown bound. */
2521#define VAR_HAD_UNKNOWN_BOUND(NODE) \
2522 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \
2523 ? DECL_LANG_SPECIFIC (NODE)->u.base.template_conv_p \
2524 : false)
2525#define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \
2526 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.template_conv_p = true)
2527
596ea4e5
AS
2528/* Set the overloaded operator code for NODE to CODE. */
2529#define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
b97e8a14 2530 (LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE))
596ea4e5
AS
2531
2532/* If NODE is an overloaded operator, then this returns the TREE_CODE
34cd5ae7 2533 associated with the overloaded operator.
596ea4e5
AS
2534 DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
2535 whether or not NODE is an assignment operator. If NODE is not an
2536 overloaded operator, ERROR_MARK is returned. Since the numerical
2537 value of ERROR_MARK is zero, this macro can be used as a predicate
2538 to test whether or not NODE is an overloaded operator. */
bb20cc46 2539#define DECL_OVERLOADED_OPERATOR_P(NODE) \
98e40e83 2540 (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
b97e8a14 2541 ? LANG_DECL_FN_CHECK (NODE)->operator_code : ERROR_MARK)
596ea4e5 2542
25614952 2543/* Nonzero if NODE is an assignment operator (including += and such). */
596ea4e5 2544#define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
b97e8a14 2545 (LANG_DECL_FN_CHECK (NODE)->assignment_operator_p)
f71f87f9 2546
454fa7a7
MM
2547/* For FUNCTION_DECLs: nonzero means that this function is a
2548 constructor or a destructor with an extra in-charge parameter to
2549 control whether or not virtual bases are constructed. */
2550#define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
b97e8a14 2551 (LANG_DECL_FN_CHECK (NODE)->has_in_charge_parm_p)
8d08fdba 2552
88a7beb7
MM
2553/* Nonzero if DECL is a declaration of __builtin_constant_p. */
2554#define DECL_IS_BUILTIN_CONSTANT_P(NODE) \
2555 (TREE_CODE (NODE) == FUNCTION_DECL \
2556 && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \
2557 && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P)
2558
8d08fdba
MS
2559/* Nonzero for _DECL means that this decl appears in (or will appear
2560 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
2561 detecting circularity in case members are multiply defined. In the
2562 case of a VAR_DECL, it is also used to determine how program storage
2563 should be allocated. */
98e40e83 2564#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
8d08fdba 2565
6c06fbce
MM
2566/* Nonzero for a VAR_DECL means that the variable's initialization (if
2567 any) has been processed. (In general, DECL_INITIALIZED_P is
7a7fc980 2568 !DECL_EXTERNAL, but static data members may be initialized even if
6c06fbce 2569 not defined.) */
17bbb839
MM
2570#define DECL_INITIALIZED_P(NODE) \
2571 (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
2572
7a7fc980
JM
2573/* Nonzero for a VAR_DECL iff an explicit initializer was provided
2574 or a non-trivial constructor is called. */
6c06fbce
MM
2575#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \
2576 (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
2577
39703eb9
MM
2578/* Nonzero for a VAR_DECL that was initialized with a
2579 constant-expression. */
2580#define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
2581 (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
2582
3febd123 2583/* Nonzero if the DECL was initialized in the class definition itself,
649fc72d 2584 rather than outside the class. This is used for both static member
39a13be5 2585 VAR_DECLS, and FUNCTION_DECLS that are defined in the class. */
3febd123 2586#define DECL_INITIALIZED_IN_CLASS_P(DECL) \
b97e8a14
JM
2587 (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
2588 ->u.base.initialized_in_class)
6ba89f8e 2589
3146f36f
JM
2590/* Nonzero if the DECL is used in the sense of 3.2 [basic.def.odr].
2591 Only available for decls with DECL_LANG_SPECIFIC. */
2592#define DECL_ODR_USED(DECL) \
2593 (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
2594 ->u.base.odr_used)
2595
d63d5d0c
ILT
2596/* Nonzero for DECL means that this decl is just a friend declaration,
2597 and should not be added to the list of members for this class. */
43f4447e
JM
2598#define DECL_FRIEND_P(NODE) \
2599 (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
3048c0c7
JM
2600 ->u.base.friend_or_tls)
2601
2602/* Nonzero if the thread-local variable was declared with __thread as
2603 opposed to thread_local. */
2604#define DECL_GNU_TLS_P(NODE) \
2605 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) \
2606 && DECL_LANG_SPECIFIC (NODE)->u.base.friend_or_tls)
2607#define SET_DECL_GNU_TLS_P(NODE) \
2608 (retrofit_lang_decl (VAR_DECL_CHECK (NODE)), \
2609 DECL_LANG_SPECIFIC (NODE)->u.base.friend_or_tls = true)
8d08fdba 2610
6a629cac
MM
2611/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
2612#define DECL_BEFRIENDING_CLASSES(NODE) \
b97e8a14 2613 (LANG_DECL_FN_CHECK (NODE)->befriending_classes)
6a629cac 2614
8d08fdba
MS
2615/* Nonzero for FUNCTION_DECL means that this decl is a static
2616 member function. */
98e40e83 2617#define DECL_STATIC_FUNCTION_P(NODE) \
b97e8a14 2618 (LANG_DECL_FN_CHECK (NODE)->static_function)
8d08fdba 2619
8857f91e
MM
2620/* Nonzero for FUNCTION_DECL means that this decl is a non-static
2621 member function. */
2622#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
2623 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
2624
8926095f
MS
2625/* Nonzero for FUNCTION_DECL means that this decl is a member function
2626 (static or non-static). */
2627#define DECL_FUNCTION_MEMBER_P(NODE) \
b97e8a14 2628 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
8926095f 2629
8d08fdba
MS
2630/* Nonzero for FUNCTION_DECL means that this member function
2631 has `this' as const X *const. */
0d9eb3ba
MM
2632#define DECL_CONST_MEMFUNC_P(NODE) \
2633 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
bb20cc46 2634 && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
0d9eb3ba 2635 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
8d08fdba 2636
1f6e1acc
AS
2637/* Nonzero for FUNCTION_DECL means that this member function
2638 has `this' as volatile X *const. */
2639#define DECL_VOLATILE_MEMFUNC_P(NODE) \
2640 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
2641 && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
2642 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2643
d6479fe7 2644/* Nonzero for a DECL means that this member is a non-static member. */
bb20cc46 2645#define DECL_NONSTATIC_MEMBER_P(NODE) \
8df7b2b6 2646 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
d6479fe7
MM
2647 || TREE_CODE (NODE) == FIELD_DECL)
2648
8d08fdba
MS
2649/* Nonzero for _DECL means that this member object type
2650 is mutable. */
721c3b42 2651#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
8d08fdba 2652
e57d93c6
JM
2653/* Nonzero for _DECL means that this constructor or conversion function is
2654 non-converting. */
98e40e83 2655#define DECL_NONCONVERTING_P(NODE) \
b97e8a14 2656 (LANG_DECL_FN_CHECK (NODE)->nonconverting)
db5ae43f 2657
fee7654e
MM
2658/* Nonzero for FUNCTION_DECL means that this member function is a pure
2659 virtual function. */
98e40e83 2660#define DECL_PURE_VIRTUAL_P(NODE) \
b97e8a14 2661 (LANG_DECL_FN_CHECK (NODE)->pure_virtual)
8d08fdba 2662
58ec3cc5
MM
2663/* True (in a FUNCTION_DECL) if NODE is a virtual function that is an
2664 invalid overrider for a function from a base class. Once we have
2665 complained about an invalid overrider we avoid complaining about it
2666 again. */
2667#define DECL_INVALID_OVERRIDER_P(NODE) \
2668 (DECL_LANG_FLAG_4 (NODE))
2669
b5da71d4
VV
2670/* True (in a FUNCTION_DECL) if NODE is a function declared with
2671 an override virt-specifier */
2672#define DECL_OVERRIDE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
2673
4977bab6 2674/* The thunks associated with NODE, a FUNCTION_DECL. */
bb5e8a7f 2675#define DECL_THUNKS(NODE) \
21a092a9
JM
2676 (DECL_VIRTUAL_P (NODE) ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE)
2677
2678/* Set DECL_THUNKS. */
2679#define SET_DECL_THUNKS(NODE,THUNKS) \
2680 (LANG_DECL_FN_CHECK (NODE)->context = (THUNKS))
bb5e8a7f 2681
85b5d65a
JM
2682/* If NODE, a FUNCTION_DECL, is a C++11 inheriting constructor, then this
2683 is the base it inherits from. */
2684#define DECL_INHERITED_CTOR_BASE(NODE) \
2685 (DECL_CONSTRUCTOR_P (NODE) ? LANG_DECL_FN_CHECK (NODE)->context : NULL_TREE)
2686
2687/* Set the inherited base. */
2688#define SET_DECL_INHERITED_CTOR_BASE(NODE,INH) \
2689 (LANG_DECL_FN_CHECK (NODE)->context = (INH))
2690
eb68cb58
MM
2691/* Nonzero if NODE is a thunk, rather than an ordinary function. */
2692#define DECL_THUNK_P(NODE) \
2693 (TREE_CODE (NODE) == FUNCTION_DECL \
ea1763b1 2694 && DECL_LANG_SPECIFIC (NODE) \
b97e8a14 2695 && LANG_DECL_FN_CHECK (NODE)->thunk_p)
c8094d83 2696
ea1763b1
NS
2697/* Set DECL_THUNK_P for node. */
2698#define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
b97e8a14
JM
2699 (LANG_DECL_FN_CHECK (NODE)->thunk_p = 1, \
2700 LANG_DECL_FN_CHECK (NODE)->this_thunk_p = (THIS_ADJUSTING))
eb68cb58 2701
4977bab6
ZW
2702/* Nonzero if NODE is a this pointer adjusting thunk. */
2703#define DECL_THIS_THUNK_P(NODE) \
b97e8a14 2704 (DECL_THUNK_P (NODE) && LANG_DECL_FN_CHECK (NODE)->this_thunk_p)
4977bab6
ZW
2705
2706/* Nonzero if NODE is a result pointer adjusting thunk. */
2707#define DECL_RESULT_THUNK_P(NODE) \
b97e8a14 2708 (DECL_THUNK_P (NODE) && !LANG_DECL_FN_CHECK (NODE)->this_thunk_p)
4977bab6 2709
eb68cb58
MM
2710/* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
2711#define DECL_NON_THUNK_FUNCTION_P(NODE) \
2712 (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
2713
2714/* Nonzero if NODE is `extern "C"'. */
2715#define DECL_EXTERN_C_P(NODE) \
2716 (DECL_LANGUAGE (NODE) == lang_c)
2717
2718/* Nonzero if NODE is an `extern "C"' function. */
2719#define DECL_EXTERN_C_FUNCTION_P(NODE) \
2720 (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
2721
4684cd27
MM
2722/* True iff DECL is an entity with vague linkage whose definition is
2723 available in this translation unit. */
2724#define DECL_REPO_AVAILABLE_P(NODE) \
b97e8a14 2725 (DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p)
4684cd27 2726
7ecbca9d
GDR
2727/* True if DECL is declared 'constexpr'. */
2728#define DECL_DECLARED_CONSTEXPR_P(DECL) \
3b49d762 2729 DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL)))
7ecbca9d 2730
971e17ff
AS
2731// True if NODE was declared as 'concept'. The flag implies that the
2732// declaration is constexpr, that the declaration cannot be specialized or
2733// refined, and that the result type must be convertible to bool.
2734#define DECL_DECLARED_CONCEPT_P(NODE) \
2735 (DECL_LANG_SPECIFIC (NODE)->u.base.concept_p)
2736
f9817201
MM
2737/* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
2738 template function. */
2739#define DECL_PRETTY_FUNCTION_P(NODE) \
fe230d3c
JM
2740 (DECL_NAME (NODE) \
2741 && !strcmp (IDENTIFIER_POINTER (DECL_NAME (NODE)), "__PRETTY_FUNCTION__"))
f9817201 2742
3048c0c7
JM
2743/* Nonzero if the variable was declared to be thread-local.
2744 We need a special C++ version of this test because the middle-end
2745 DECL_THREAD_LOCAL_P uses the symtab, so we can't use it for
2746 templates. */
2747#define CP_DECL_THREAD_LOCAL_P(NODE) \
b1db7f91
JM
2748 (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)))
2749
8926095f 2750/* The _TYPE context in which this _DECL appears. This field holds the
00a17e31 2751 class where a virtual function instance is actually defined. */
4f1c5b7d
MM
2752#define DECL_CLASS_CONTEXT(NODE) \
2753 (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
2754
2755/* For a non-member friend function, the class (if any) in which this
2756 friend was defined. For example, given:
bb20cc46 2757
4f1c5b7d
MM
2758 struct S { friend void f (); };
2759
2760 the DECL_FRIEND_CONTEXT for `f' will be `S'. */
2761#define DECL_FRIEND_CONTEXT(NODE) \
b97e8a14
JM
2762 ((DECL_DECLARES_FUNCTION_P (NODE) \
2763 && DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
2764 ? LANG_DECL_FN_CHECK (NODE)->context \
4f1c5b7d
MM
2765 : NULL_TREE)
2766
2767/* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
2768#define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
b97e8a14 2769 (LANG_DECL_FN_CHECK (NODE)->context = (CONTEXT))
cb0dbb9a 2770
cb0dbb9a 2771#define CP_DECL_CONTEXT(NODE) \
725214ac 2772 (!DECL_FILE_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
0ed5edac 2773#define CP_TYPE_CONTEXT(NODE) \
725214ac
RG
2774 (!TYPE_FILE_SCOPE_P (NODE) ? TYPE_CONTEXT (NODE) : global_namespace)
2775#define FROB_CONTEXT(NODE) \
2776 ((NODE) == global_namespace ? DECL_CONTEXT (NODE) : (NODE))
8d08fdba 2777
42c7b807 2778/* 1 iff NODE has namespace scope, including the global namespace. */
4f71f630
MM
2779#define DECL_NAMESPACE_SCOPE_P(NODE) \
2780 (!DECL_TEMPLATE_PARM_P (NODE) \
2781 && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
42c7b807 2782
ecc607fc
JM
2783#define TYPE_NAMESPACE_SCOPE_P(NODE) \
2784 (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL)
2785
20c202f3
DS
2786#define NAMESPACE_SCOPE_P(NODE) \
2787 ((DECL_P (NODE) && DECL_NAMESPACE_SCOPE_P (NODE)) \
2788 || (TYPE_P (NODE) && TYPE_NAMESPACE_SCOPE_P (NODE)))
2789
42c7b807 2790/* 1 iff NODE is a class member. */
6eb3bb27 2791#define DECL_CLASS_SCOPE_P(NODE) \
4f1c5b7d 2792 (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
42c7b807 2793
0ed5edac
JM
2794#define TYPE_CLASS_SCOPE_P(NODE) \
2795 (TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE)))
2796
2642b9bf
JM
2797/* 1 iff NODE is function-local. */
2798#define DECL_FUNCTION_SCOPE_P(NODE) \
2799 (DECL_CONTEXT (NODE) \
2800 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
1f6e1acc 2801
3930dbe9
JM
2802#define TYPE_FUNCTION_SCOPE_P(NODE) \
2803 (TYPE_CONTEXT (NODE) && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL)
2804
4684cd27
MM
2805/* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for
2806 both the primary typeinfo object and the associated NTBS name. */
2807#define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
2808
d35543c0
JH
2809/* 1 iff VAR_DECL node NODE is virtual table or VTT. */
2810#define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
2811
2eed8e37
BK
2812/* 1 iff FUNCTION_TYPE or METHOD_TYPE has a ref-qualifier (either & or &&). */
2813#define FUNCTION_REF_QUALIFIED(NODE) \
7d27c734 2814 TREE_LANG_FLAG_4 (FUNC_OR_METHOD_CHECK (NODE))
2eed8e37
BK
2815
2816/* 1 iff FUNCTION_TYPE or METHOD_TYPE has &&-ref-qualifier. */
2817#define FUNCTION_RVALUE_QUALIFIED(NODE) \
7d27c734 2818 TREE_LANG_FLAG_5 (FUNC_OR_METHOD_CHECK (NODE))
2eed8e37 2819
505970fc
MM
2820/* Returns 1 iff VAR_DECL is a construction virtual table.
2821 DECL_VTABLE_OR_VTT_P will be true in this case and must be checked
2822 before using this macro. */
2823#define DECL_CONSTRUCTION_VTABLE_P(NODE) \
2824 TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))
2825
881c6935
JM
2826/* 1 iff NODE is function-local, but for types. */
2827#define LOCAL_CLASS_P(NODE) \
495d26d6 2828 (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
881c6935 2829
2c73f9f5 2830/* For a NAMESPACE_DECL: the list of using namespace directives
30394414 2831 The PURPOSE is the used namespace, the value is the namespace
00a17e31 2832 that is the common ancestor. */
aaf8a23e 2833#define DECL_NAMESPACE_USING(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_using)
30394414
JM
2834
2835/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
00a17e31 2836 of a namespace, to record the transitive closure of using namespace. */
aaf8a23e 2837#define DECL_NAMESPACE_USERS(NODE) (LANG_DECL_NS_CHECK (NODE)->ns_users)
30394414 2838
86098eb8
JM
2839/* In a NAMESPACE_DECL, the list of namespaces which have associated
2840 themselves with this one. */
2841#define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
aaf8a23e 2842 DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
86098eb8 2843
3e3f722c
ML
2844/* In a NAMESPACE_DECL, points to the original namespace if this is
2845 a namespace alias. */
da8a66fc
ML
2846#define DECL_NAMESPACE_ALIAS(NODE) \
2847 DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
3e3f722c
ML
2848#define ORIGINAL_NAMESPACE(NODE) \
2849 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
2850
838dfd8a 2851/* Nonzero if NODE is the std namespace. */
1f6e1acc
AS
2852#define DECL_NAMESPACE_STD_P(NODE) \
2853 (TREE_CODE (NODE) == NAMESPACE_DECL \
2854 && CP_DECL_CONTEXT (NODE) == global_namespace \
2855 && DECL_NAME (NODE) == std_identifier)
2856
9df2c88c 2857/* In a TREE_LIST concatenating using directives, indicate indirect
30394414 2858 directives */
c1aaec5b 2859#define TREE_INDIRECT_USING(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
8d08fdba 2860
a7f6bc8c
JM
2861/* In a TREE_LIST in an attribute list, indicates that the attribute
2862 must be applied at instantiation time. */
c1aaec5b 2863#define ATTR_IS_DEPENDENT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
a7f6bc8c 2864
f585f02f
JM
2865/* In a TREE_LIST in the argument of attribute abi_tag, indicates that the tag
2866 was inherited from a template parameter, not explicitly indicated. */
2867#define ABI_TAG_IMPLICIT(NODE) TREE_LANG_FLAG_0 (TREE_LIST_CHECK (NODE))
2868
820cc88f
DB
2869extern tree decl_shadowed_for_var_lookup (tree);
2870extern void decl_shadowed_for_var_insert (tree, tree);
2871
98ed9dae
NS
2872/* Non zero if this is a using decl for a dependent scope. */
2873#define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
2874
2875/* The scope named in a using decl. */
2876#define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE))
2877
2878/* The decls named by a using decl. */
2879#define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
2880
0f8fa9b6
FC
2881/* Non zero if the using decl refers to a dependent type. */
2882#define USING_DECL_TYPENAME_P(NODE) DECL_LANG_FLAG_1 (USING_DECL_CHECK (NODE))
2883
820cc88f
DB
2884/* In a VAR_DECL, true if we have a shadowed local variable
2885 in the shadowed var table for this VAR_DECL. */
2886#define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \
2887 (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p)
2888
d2ad151f 2889/* In a VAR_DECL for a variable declared in a for statement,
e92cc029 2890 this is the shadowed (local) variable. */
820cc88f
DB
2891#define DECL_SHADOWED_FOR_VAR(NODE) \
2892 (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL)
2893
2894#define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \
2895 (decl_shadowed_for_var_insert (NODE, VAL))
d2ad151f 2896
59026e79
MM
2897/* In a FUNCTION_DECL, this is nonzero if this function was defined in
2898 the class definition. We have saved away the text of the function,
2899 but have not yet processed it. */
2900#define DECL_PENDING_INLINE_P(NODE) \
b97e8a14 2901 (LANG_DECL_FN_CHECK (NODE)->pending_inline_p)
bb20cc46 2902
59026e79
MM
2903/* If DECL_PENDING_INLINE_P holds, this is the saved text of the
2904 function. */
2905#define DECL_PENDING_INLINE_INFO(NODE) \
b97e8a14 2906 (LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info)
f90cdf34 2907
28704289
DS
2908/* Nonzero for TYPE_DECL means that it was written 'using name = type'. */
2909#define TYPE_DECL_ALIAS_P(NODE) \
2910 DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE))
2911
1a4cd2cd
JM
2912/* Nonzero for TEMPLATE_DECL means that it is a 'complex' alias template. */
2913#define TEMPLATE_DECL_COMPLEX_ALIAS_P(NODE) \
2914 DECL_LANG_FLAG_2 (TEMPLATE_DECL_CHECK (NODE))
2915
28704289
DS
2916/* Nonzero for a type which is an alias for another type; i.e, a type
2917 which declaration was written 'using name-of-type =
2918 another-type'. */
5cc66776
DS
2919#define TYPE_ALIAS_P(NODE) \
2920 (TYPE_P (NODE) \
2921 && TYPE_NAME (NODE) \
60ef5d4e 2922 && TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL \
28704289
DS
2923 && TYPE_DECL_ALIAS_P (TYPE_NAME (NODE)))
2924
b97e8a14 2925/* For a class type: if this structure has many fields, we'll sort them
00a17e31 2926 and put them into a TREE_VEC. */
b97e8a14
JM
2927#define CLASSTYPE_SORTED_FIELDS(NODE) \
2928 (LANG_TYPE_CLASS_CHECK (NODE)->sorted_fields)
8d08fdba 2929
4d0839ff 2930/* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
4e95268d 2931 TEMPLATE_DECL, the entity is either a template specialization (if
3b426391 2932 DECL_USE_TEMPLATE is nonzero) or the abstract instance of the
4e95268d
MM
2933 template itself.
2934
2935 In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose
2936 TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a
2937 specialization or abstract instance. The TREE_VALUE is the
2938 template arguments used to specialize the template.
2939
4d0839ff
MM
2940 Consider:
2941
2942 template <typename T> struct S { friend void f(T) {} };
2943
2944 In this case, S<int>::f is, from the point of view of the compiler,
2945 an instantiation of a template -- but, from the point of view of
2946 the language, each instantiation of S results in a wholly unrelated
4e95268d
MM
2947 global function f. In this case, DECL_TEMPLATE_INFO for S<int>::f
2948 will be non-NULL, but DECL_USE_TEMPLATE will be zero. */
3ebc5c52 2949#define DECL_TEMPLATE_INFO(NODE) \
2598165f 2950 (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK (NODE)) \
b97e8a14 2951 ->u.min.template_info)
ed44da02 2952
555551c2
MM
2953/* For a VAR_DECL, indicates that the variable is actually a
2954 non-static data member of anonymous union that has been promoted to
2955 variable status. */
2956#define DECL_ANON_UNION_VAR_P(NODE) \
772f8889
MM
2957 (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)))
2958
ed44da02 2959/* Template information for a RECORD_TYPE or UNION_TYPE. */
da8a66fc 2960#define CLASSTYPE_TEMPLATE_INFO(NODE) \
95b4aca6 2961 (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
ed44da02
MM
2962
2963/* Template information for an ENUMERAL_TYPE. Although an enumeration may
2964 not be a primary template, it may be declared within the scope of a
2965 primary template and the enumeration constants may depend on
2966 non-type template parameters. */
95b4aca6
NS
2967#define ENUM_TEMPLATE_INFO(NODE) \
2968 (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
ed44da02 2969
11e74ea6
KL
2970/* Template information for a template template parameter. */
2971#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
e2500fed 2972 (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
11e74ea6 2973 ->template_info)
7ddedda4 2974
60ef5d4e
DS
2975/* Template information for an ENUMERAL_, RECORD_, UNION_TYPE, or
2976 BOUND_TEMPLATE_TEMPLATE_PARM type. Note that if NODE is a
2977 specialization of an alias template, this accessor returns the
2978 template info for the alias template, not the one (if any) for the
2979 template of the underlying type. */
5cc66776 2980#define TYPE_TEMPLATE_INFO(NODE) \
1cb2b9a1
DS
2981 ((TYPE_ALIAS_P (NODE) && DECL_LANG_SPECIFIC (TYPE_NAME (NODE))) \
2982 ? (DECL_LANG_SPECIFIC (TYPE_NAME (NODE)) \
60ef5d4e
DS
2983 ? DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) \
2984 : NULL_TREE) \
2985 : ((TREE_CODE (NODE) == ENUMERAL_TYPE) \
2986 ? ENUM_TEMPLATE_INFO (NODE) \
2987 : ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
2988 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) \
2989 : (CLASS_TYPE_P (NODE) \
2990 ? CLASSTYPE_TEMPLATE_INFO (NODE) \
2991 : NULL_TREE))))
2992
ed44da02
MM
2993
2994/* Set the template information for an ENUMERAL_, RECORD_, or
2995 UNION_TYPE to VAL. */
28704289
DS
2996#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
2997 (TREE_CODE (NODE) == ENUMERAL_TYPE \
2998 ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
2999 : ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE)) \
3000 ? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)) \
3001 : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL))))
ed44da02 3002
aa373032
DS
3003#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
3004#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
824b9a4c 3005#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
1a048f82
DS
3006/* For a given TREE_VEC containing a template argument list,
3007 this property contains the number of arguments that are not
3008 defaulted. */
3009#define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE))
3010/* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT
3011 property. */
3012#define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \
3013 NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (NULL_TREE, INT_VALUE)
595278be 3014#if CHECKING_P
1a048f82
DS
3015#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
3016 int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE))
3017#else
3018#define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
3019 NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE) \
3020 ? int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)) \
3021 : TREE_VEC_LENGTH (INNERMOST_TEMPLATE_ARGS (NODE))
3022#endif
2eb25c98 3023/* The list of typedefs - used in the template - that need
a5aef1da
JM
3024 access checking at template instantiation time.
3025
3026 FIXME this should be associated with the TEMPLATE_DECL, not the
3027 TEMPLATE_INFO. */
aa373032
DS
3028#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) \
3029 ((struct tree_template_info*)TEMPLATE_INFO_CHECK \
3030 (NODE))->typedefs_needing_access_checking
ed44da02 3031
b5ac18ea
MM
3032/* We use TREE_VECs to hold template arguments. If there is only one
3033 level of template arguments, then the TREE_VEC contains the
3034 arguments directly. If there is more than one level of template
3035 arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
3036 containing the template arguments for a single level. The first
3037 entry in the outer TREE_VEC is the outermost level of template
bb20cc46 3038 parameters; the last is the innermost.
b5ac18ea
MM
3039
3040 It is incorrect to ever form a template argument vector containing
3041 only one level of arguments, but which is a TREE_VEC containing as
1a048f82
DS
3042 its only entry the TREE_VEC for that level.
3043
3044 For each TREE_VEC containing the template arguments for a single
3045 level, it's possible to get or set the number of non defaulted
3046 template arguments by using the accessor macros
3047 GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT or
3048 SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. */
b5ac18ea 3049
838dfd8a 3050/* Nonzero if the template arguments is actually a vector of vectors,
b5ac18ea 3051 rather than just a vector. */
da1512ad
PC
3052#define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
3053 (NODE && TREE_VEC_LENGTH (NODE) && TREE_VEC_ELT (NODE, 0) \
b5ac18ea
MM
3054 && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
3055
3056/* The depth of a template argument vector. When called directly by
3057 the parser, we use a TREE_LIST rather than a TREE_VEC to represent
3058 template arguments. In fact, we may even see NULL_TREE if there
3059 are no template arguments. In both of those cases, there is only
3060 one level of template arguments. */
3061#define TMPL_ARGS_DEPTH(NODE) \
3062 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
3063
27631dae 3064/* The LEVELth level of the template ARGS. The outermost level of
f9a7ae04 3065 args is level 1, not level 0. */
b5ac18ea 3066#define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
bb20cc46 3067 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
98e40e83 3068 ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
b5ac18ea
MM
3069
3070/* Set the LEVELth level of the template ARGS to VAL. This macro does
3071 not work with single-level argument vectors. */
3072#define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
98e40e83 3073 (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
b5ac18ea
MM
3074
3075/* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
3076#define TMPL_ARG(ARGS, LEVEL, IDX) \
3077 (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
3078
b5ac18ea
MM
3079/* Given a single level of template arguments in NODE, return the
3080 number of arguments. */
bb20cc46 3081#define NUM_TMPL_ARGS(NODE) \
bf12d54d 3082 (TREE_VEC_LENGTH (NODE))
b5ac18ea 3083
f9a7ae04
MM
3084/* Returns the innermost level of template arguments in ARGS. */
3085#define INNERMOST_TEMPLATE_ARGS(NODE) \
3086 (get_innermost_template_args ((NODE), 1))
3087
b5ac18ea
MM
3088/* The number of levels of template parameters given by NODE. */
3089#define TMPL_PARMS_DEPTH(NODE) \
ad6b1795 3090 ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
b5ac18ea 3091
36a117a5
MM
3092/* The TEMPLATE_DECL instantiated or specialized by NODE. This
3093 TEMPLATE_DECL will be the immediate parent, not the most general
3094 template. For example, in:
3095
3096 template <class T> struct S { template <class U> void f(U); }
3097
3098 the FUNCTION_DECL for S<int>::f<double> will have, as its
bb20cc46 3099 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
36a117a5
MM
3100
3101 As a special case, for a member friend template of a template
10b1d5e7
MM
3102 class, this value will not be a TEMPLATE_DECL, but rather an
3103 IDENTIFIER_NODE or OVERLOAD indicating the name of the template and
3104 any explicit template arguments provided. For example, in:
36a117a5
MM
3105
3106 template <class T> struct S { friend void f<int>(int, double); }
3107
10b1d5e7 3108 the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
2598165f
JM
3109 DECL_TI_ARGS will be {int}.
3110
3111 For a FIELD_DECL with a non-static data member initializer, this value
3112 is the FIELD_DECL it was instantiated from. */
5566b478 3113#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
ed44da02 3114
36a117a5
MM
3115/* The template arguments used to obtain this decl from the most
3116 general form of DECL_TI_TEMPLATE. For the example given for
3117 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
3118 are always the full set of arguments required to instantiate this
3119 declaration from the most general template specialized here. */
0cbd7506 3120#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
4e95268d
MM
3121
3122/* The TEMPLATE_DECL associated with NODE, a class type. Even if NODE
3123 will be generated from a partial specialization, the TEMPLATE_DECL
3124 referred to here will be the original template. For example,
3125 given:
3126
3127 template <typename T> struct S {};
3128 template <typename T> struct S<T*> {};
3129
3130 the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>. */
5566b478
MS
3131#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
3132#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
ed44da02 3133
ca099ac8 3134/* For a template instantiation TYPE, returns the TYPE corresponding
353b4fc0 3135 to the primary template. Otherwise returns TYPE itself. */
b54a07e8
NS
3136#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
3137 ((CLASSTYPE_USE_TEMPLATE ((TYPE)) \
3138 && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
3139 ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
3140 (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
353b4fc0 3141 : (TYPE))
ca099ac8 3142
4e95268d 3143/* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs. */
ed44da02
MM
3144#define TYPE_TI_TEMPLATE(NODE) \
3145 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
3146
59026e79 3147/* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
ed44da02
MM
3148#define TYPE_TI_ARGS(NODE) \
3149 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
3150
98e40e83 3151#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE)
5566b478 3152
c7222c02
MM
3153/* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the
3154 sense of [temp.mem]. */
3155#define DECL_MEMBER_TEMPLATE_P(NODE) \
3156 (DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE)))
3157
6ba89f8e
MM
3158/* Nonzero if the NODE corresponds to the template parameters for a
3159 member template, whose inline definition is being processed after
3160 the class definition is complete. */
cae40af6
JM
3161#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
3162
73f4e2d2
JM
3163/* Determine if a declaration (PARM_DECL or FIELD_DECL) is a pack. */
3164#define DECL_PACK_P(NODE) \
3165 (DECL_P (NODE) && PACK_EXPANSION_P (TREE_TYPE (NODE)))
5d80a306
DG
3166
3167/* Determines if NODE is an expansion of one or more parameter packs,
3168 e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */
3169#define PACK_EXPANSION_P(NODE) \
3170 (TREE_CODE (NODE) == TYPE_PACK_EXPANSION \
3171 || TREE_CODE (NODE) == EXPR_PACK_EXPANSION)
3172
3173/* Extracts the type or expression pattern from a TYPE_PACK_EXPANSION or
3174 EXPR_PACK_EXPANSION. */
3175#define PACK_EXPANSION_PATTERN(NODE) \
3176 (TREE_CODE (NODE) == TYPE_PACK_EXPANSION? TREE_TYPE (NODE) \
3177 : TREE_OPERAND (NODE, 0))
3178
3179/* Sets the type or expression pattern for a TYPE_PACK_EXPANSION or
3180 EXPR_PACK_EXPANSION. */
3181#define SET_PACK_EXPANSION_PATTERN(NODE,VALUE) \
3182 if (TREE_CODE (NODE) == TYPE_PACK_EXPANSION) \
3183 TREE_TYPE (NODE) = VALUE; \
3184 else \
3185 TREE_OPERAND (NODE, 0) = VALUE
3186
3187/* The list of parameter packs used in the PACK_EXPANSION_* node. The
3188 TREE_VALUE of each TREE_LIST contains the parameter packs. */
d26e5986
NF
3189#define PACK_EXPANSION_PARAMETER_PACKS(NODE) \
3190 *(TREE_CODE (NODE) == EXPR_PACK_EXPANSION \
3191 ? &TREE_OPERAND (NODE, 1) \
c67dd256
JM
3192 : &TYPE_MINVAL (TYPE_PACK_EXPANSION_CHECK (NODE)))
3193
3194/* Any additional template args to be applied when substituting into
3195 the pattern, set by tsubst_pack_expansion for partial instantiations. */
3196#define PACK_EXPANSION_EXTRA_ARGS(NODE) \
3197 *(TREE_CODE (NODE) == TYPE_PACK_EXPANSION \
3198 ? &TYPE_MAXVAL (NODE) \
3199 : &TREE_OPERAND ((NODE), 2))
5d80a306 3200
2297ab7d
JM
3201/* True iff this pack expansion is within a function context. */
3202#define PACK_EXPANSION_LOCAL_P(NODE) TREE_LANG_FLAG_0 (NODE)
3203
e3f8abd6
JM
3204/* True iff this pack expansion is for sizeof.... */
3205#define PACK_EXPANSION_SIZEOF_P(NODE) TREE_LANG_FLAG_1 (NODE)
3206
971e17ff
AS
3207/* True iff the wildcard can match a template parameter pack. */
3208#define WILDCARD_PACK_P(NODE) TREE_LANG_FLAG_0 (NODE)
3209
5d80a306
DG
3210/* Determine if this is an argument pack. */
3211#define ARGUMENT_PACK_P(NODE) \
3212 (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK \
3213 || TREE_CODE (NODE) == NONTYPE_ARGUMENT_PACK)
3214
3215/* The arguments stored in an argument pack. Arguments are stored in a
3216 TREE_VEC, which may have length zero. */
3217#define ARGUMENT_PACK_ARGS(NODE) \
3218 (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK? TREE_TYPE (NODE) \
3219 : TREE_OPERAND (NODE, 0))
3220
3221/* Set the arguments stored in an argument pack. VALUE must be a
3222 TREE_VEC. */
3223#define SET_ARGUMENT_PACK_ARGS(NODE,VALUE) \
3224 if (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK) \
3225 TREE_TYPE (NODE) = VALUE; \
3226 else \
3227 TREE_OPERAND (NODE, 0) = VALUE
3228
3229/* Whether the argument pack is "incomplete", meaning that more
3230 arguments can still be deduced. Incomplete argument packs are only
3231 used when the user has provided an explicit template argument list
3232 for a variadic function template. Some of the explicit template
3233 arguments will be placed into the beginning of the argument pack,
3234 but additional arguments might still be deduced. */
3235#define ARGUMENT_PACK_INCOMPLETE_P(NODE) \
c1aaec5b 3236 TREE_ADDRESSABLE (ARGUMENT_PACK_ARGS (NODE))
5d80a306
DG
3237
3238/* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
3239 arguments used to fill this pack. */
3240#define ARGUMENT_PACK_EXPLICIT_ARGS(NODE) \
3241 TREE_TYPE (ARGUMENT_PACK_ARGS (NODE))
3242
3243/* In an ARGUMENT_PACK_SELECT, the argument pack from which an
3244 argument will be selected. */
3245#define ARGUMENT_PACK_SELECT_FROM_PACK(NODE) \
3246 (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->argument_pack)
3247
3248/* In an ARGUMENT_PACK_SELECT, the index of the argument we want to
3249 select. */
3250#define ARGUMENT_PACK_SELECT_INDEX(NODE) \
3251 (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index)
3252
3253/* In an ARGUMENT_PACK_SELECT, the actual underlying argument that the
3254 ARGUMENT_PACK_SELECT represents. */
3255#define ARGUMENT_PACK_SELECT_ARG(NODE) \
3256 TREE_VEC_ELT (ARGUMENT_PACK_ARGS (ARGUMENT_PACK_SELECT_FROM_PACK (NODE)), \
6f3d1a5e 3257 ARGUMENT_PACK_SELECT_INDEX (NODE))
5d80a306 3258
378b307d
AS
3259#define FOLD_EXPR_CHECK(NODE) \
3260 TREE_CHECK4 (NODE, UNARY_LEFT_FOLD_EXPR, UNARY_RIGHT_FOLD_EXPR, \
3261 BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR)
3262
3263#define BINARY_FOLD_EXPR_CHECK(NODE) \
3264 TREE_CHECK2 (NODE, BINARY_LEFT_FOLD_EXPR, BINARY_RIGHT_FOLD_EXPR)
3265
3266/* True if NODE is UNARY_FOLD_EXPR or a BINARY_FOLD_EXPR */
3267#define FOLD_EXPR_P(NODE) \
3268 TREE_CODE (NODE) == UNARY_LEFT_FOLD_EXPR \
3269 || TREE_CODE (NODE) == UNARY_RIGHT_FOLD_EXPR \
3270 || TREE_CODE (NODE) == BINARY_LEFT_FOLD_EXPR \
3271 || TREE_CODE (NODE) == BINARY_RIGHT_FOLD_EXPR
3272
3273/* True when NODE is a fold over a compound assignment operator. */
3274#define FOLD_EXPR_MODIFY_P(NODE) \
3275 TREE_LANG_FLAG_0 (FOLD_EXPR_CHECK (NODE))
3276
3277/* An INTEGER_CST containing the tree code of the folded operator. */
3278#define FOLD_EXPR_OP(NODE) \
3279 TREE_OPERAND (FOLD_EXPR_CHECK (NODE), 0)
3280
3281/* The expression containing an unexpanded parameter pack. */
3282#define FOLD_EXPR_PACK(NODE) \
3283 TREE_OPERAND (FOLD_EXPR_CHECK (NODE), 1)
3284
3285/* In a binary fold expression, the argument with no unexpanded
3286 parameter packs. */
3287#define FOLD_EXPR_INIT(NODE) \
3288 TREE_OPERAND (BINARY_FOLD_EXPR_CHECK (NODE), 2)
3289
59026e79 3290/* In a FUNCTION_DECL, the saved language-specific per-function data. */
e2500fed 3291#define DECL_SAVED_FUNCTION_DATA(NODE) \
b97e8a14
JM
3292 (LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE)) \
3293 ->u.saved_language_function)
59026e79 3294
31e292c7
JM
3295/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference. */
3296#define REFERENCE_REF_P(NODE) \
98cf9ac9 3297 (INDIRECT_REF_P (NODE) \
31e292c7
JM
3298 && TREE_TYPE (TREE_OPERAND (NODE, 0)) \
3299 && (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0))) \
3300 == REFERENCE_TYPE))
db24eb1f 3301
593bcbb8
JM
3302/* True if NODE is a REFERENCE_TYPE which is OK to instantiate to be a
3303 reference to VLA type, because it's used for VLA capture. */
3304#define REFERENCE_VLA_OK(NODE) \
3305 (TYPE_LANG_FLAG_5 (REFERENCE_TYPE_CHECK (NODE)))
3306
a2982c1b
RK
3307#define NEW_EXPR_USE_GLOBAL(NODE) \
3308 TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
3309#define DELETE_EXPR_USE_GLOBAL(NODE) \
3310 TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE))
3311#define DELETE_EXPR_USE_VEC(NODE) \
3312 TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE))
8d08fdba 3313
8e1daa34
NS
3314/* Indicates that this is a non-dependent COMPOUND_EXPR which will
3315 resolve to a function call. */
a2982c1b
RK
3316#define COMPOUND_EXPR_OVERLOADED(NODE) \
3317 TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE))
8e1daa34 3318
6d80c4b9
MM
3319/* In a CALL_EXPR appearing in a template, true if Koenig lookup
3320 should be performed at instantiation time. */
a2982c1b 3321#define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
6d80c4b9 3322
4561285b
JM
3323/* True if CALL_EXPR expresses list-initialization of an object. */
3324#define CALL_EXPR_LIST_INIT_P(NODE) \
3325 TREE_LANG_FLAG_3 (TREE_CHECK2 ((NODE),CALL_EXPR,AGGR_INIT_EXPR))
3326
7a8380ae
NS
3327/* Indicates whether a string literal has been parenthesized. Such
3328 usages are disallowed in certain circumstances. */
3329
3330#define PAREN_STRING_LITERAL_P(NODE) \
3331 TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE))
3332
96e780c0
JM
3333/* Indicates whether a COMPONENT_REF has been parenthesized, or an
3334 INDIRECT_REF comes from parenthesizing a VAR_DECL. Currently only set
3335 some of the time in C++14 mode. */
0e4cf887
JM
3336
3337#define REF_PARENTHESIZED_P(NODE) \
96e780c0 3338 TREE_LANG_FLAG_2 (TREE_CHECK2 ((NODE), COMPONENT_REF, INDIRECT_REF))
0e4cf887 3339
e1376b00
MM
3340/* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
3341 constructor call, rather than an ordinary function call. */
da8a66fc
ML
3342#define AGGR_INIT_VIA_CTOR_P(NODE) \
3343 TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
e1376b00 3344
450a927a
JM
3345/* Nonzero if expanding this AGGR_INIT_EXPR should first zero-initialize
3346 the object. */
3347#define AGGR_INIT_ZERO_FIRST(NODE) \
3348 TREE_LANG_FLAG_2 (AGGR_INIT_EXPR_CHECK (NODE))
3349
5039610b
SL
3350/* AGGR_INIT_EXPR accessors. These are equivalent to the CALL_EXPR
3351 accessors, except for AGGR_INIT_EXPR_SLOT (which takes the place of
3352 CALL_EXPR_STATIC_CHAIN). */
3353
3354#define AGGR_INIT_EXPR_FN(NODE) TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 1)
3355#define AGGR_INIT_EXPR_SLOT(NODE) \
3356 TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 2)
3357#define AGGR_INIT_EXPR_ARG(NODE, I) \
3358 TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), (I) + 3)
3359#define aggr_init_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3)
3360
3361/* AGGR_INIT_EXPR_ARGP returns a pointer to the argument vector for NODE.
3362 We can't use &AGGR_INIT_EXPR_ARG (NODE, 0) because that will complain if
3363 the argument count is zero when checking is enabled. Instead, do
3364 the pointer arithmetic to advance past the 3 fixed operands in a
3365 AGGR_INIT_EXPR. That produces a valid pointer to just past the end of
3366 the operand array, even if it's not valid to dereference it. */
3367#define AGGR_INIT_EXPR_ARGP(NODE) \
3368 (&(TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 0)) + 3)
3369
3370/* Abstract iterators for AGGR_INIT_EXPRs. */
3371
3372/* Structure containing iterator state. */
a79683d5 3373struct aggr_init_expr_arg_iterator {
5039610b
SL
3374 tree t; /* the aggr_init_expr */
3375 int n; /* argument count */
3376 int i; /* next argument index */
a79683d5 3377};
5039610b
SL
3378
3379/* Initialize the abstract argument list iterator object ITER with the
3380 arguments from AGGR_INIT_EXPR node EXP. */
9173cf24 3381inline void
5039610b
SL
3382init_aggr_init_expr_arg_iterator (tree exp,
3383 aggr_init_expr_arg_iterator *iter)
3384{
3385 iter->t = exp;
3386 iter->n = aggr_init_expr_nargs (exp);
3387 iter->i = 0;
3388}
3389
3390/* Return the next argument from abstract argument list iterator object ITER,
3391 and advance its state. Return NULL_TREE if there are no more arguments. */
9173cf24 3392inline tree
5039610b
SL
3393next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter)
3394{
3395 tree result;
3396 if (iter->i >= iter->n)
3397 return NULL_TREE;
3398 result = AGGR_INIT_EXPR_ARG (iter->t, iter->i);
3399 iter->i++;
3400 return result;
3401}
3402
3403/* Initialize the abstract argument list iterator object ITER, then advance
3404 past and return the first argument. Useful in for expressions, e.g.
3405 for (arg = first_aggr_init_expr_arg (exp, &iter); arg;
3406 arg = next_aggr_init_expr_arg (&iter)) */
9173cf24 3407inline tree
5039610b
SL
3408first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter)
3409{
3410 init_aggr_init_expr_arg_iterator (exp, iter);
3411 return next_aggr_init_expr_arg (iter);
3412}
3413
3414/* Test whether there are more arguments in abstract argument list iterator
3415 ITER, without changing its state. */
9173cf24 3416inline bool
5039610b
SL
3417more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
3418{
3419 return (iter->i < iter->n);
3420}
3421
3422/* Iterate through each argument ARG of AGGR_INIT_EXPR CALL, using variable
3423 ITER (of type aggr_init_expr_arg_iterator) to hold the iteration state. */
3424#define FOR_EACH_AGGR_INIT_EXPR_ARG(arg, iter, call) \
3425 for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg); \
3426 (arg) = next_aggr_init_expr_arg (&(iter)))
3427
d5f4eddd 3428/* VEC_INIT_EXPR accessors. */
9c69dcea
JM
3429#define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0)
3430#define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1)
d5f4eddd 3431
4de2f020
JM
3432/* Indicates that a VEC_INIT_EXPR is a potential constant expression.
3433 Only set when the current function is constexpr. */
3434#define VEC_INIT_EXPR_IS_CONSTEXPR(NODE) \
3435 TREE_LANG_FLAG_0 (VEC_INIT_EXPR_CHECK (NODE))
3436
3437/* Indicates that a VEC_INIT_EXPR is expressing value-initialization. */
3438#define VEC_INIT_EXPR_VALUE_INIT(NODE) \
3439 TREE_LANG_FLAG_1 (VEC_INIT_EXPR_CHECK (NODE))
3440
f2162c3d
TR
3441/* The condition under which this MUST_NOT_THROW_EXPR actually blocks
3442 exceptions. NULL_TREE means 'true'. */
3443#define MUST_NOT_THROW_COND(NODE) \
3444 TREE_OPERAND (MUST_NOT_THROW_EXPR_CHECK (NODE), 1)
3445
6757edfe
MM
3446/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
3447 TEMPLATE_DECL. This macro determines whether or not a given class
3448 type is really a template type, as opposed to an instantiation or
3449 specialization of one. */
3450#define CLASSTYPE_IS_TEMPLATE(NODE) \
3451 (CLASSTYPE_TEMPLATE_INFO (NODE) \
3452 && !CLASSTYPE_USE_TEMPLATE (NODE) \
3453 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
3454
45869a6c
MM
3455/* The name used by the user to name the typename type. Typically,
3456 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
3457 corresponding TYPE_DECL. However, this may also be a
3458 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
51545682
NF
3459#define TYPENAME_TYPE_FULLNAME(NODE) \
3460 (TYPE_VALUES_RAW (TYPENAME_TYPE_CHECK (NODE)))
ca40b399 3461
fc6a28d7
MM
3462/* True if a TYPENAME_TYPE was declared as an "enum". */
3463#define TYPENAME_IS_ENUM_P(NODE) \
3464 (TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE)))
3465
3466/* True if a TYPENAME_TYPE was declared as a "class", "struct", or
3467 "union". */
3468#define TYPENAME_IS_CLASS_P(NODE) \
3469 (TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE)))
3470
4195a767
NS
3471/* True if a TYPENAME_TYPE is in the process of being resolved. */
3472#define TYPENAME_IS_RESOLVING_P(NODE) \
3473 (TREE_LANG_FLAG_2 (TYPENAME_TYPE_CHECK (NODE)))
3474
4c6b7393 3475/* [class.virtual]
8d08fdba 3476
4c6b7393
MM
3477 A class that declares or inherits a virtual function is called a
3478 polymorphic class. */
3479#define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
8d08fdba 3480
bbd15aac 3481/* Nonzero if this class has a virtual function table pointer. */
bb20cc46 3482#define TYPE_CONTAINS_VPTR_P(NODE) \
5775a06a 3483 (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE))
bbd15aac 3484
d2ad151f 3485/* This flag is true of a local VAR_DECL if it was declared in a for
e92cc029 3486 statement, but we are no longer in the scope of the for. */
da8a66fc 3487#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
d2ad151f
PB
3488
3489/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
3490 if we already emitted a warning about using it. */
da8a66fc 3491#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
d2ad151f 3492
cd9f6678
MM
3493/* Nonzero if NODE is a FUNCTION_DECL (for a function with global
3494 scope) declared in a local scope. */
3495#define DECL_LOCAL_FUNCTION_P(NODE) \
3496 DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
935d1834 3497
56632b27
JM
3498/* Nonzero if NODE is the target for genericization of 'break' stmts. */
3499#define LABEL_DECL_BREAK(NODE) \
3500 DECL_LANG_FLAG_0 (LABEL_DECL_CHECK (NODE))
3501
3502/* Nonzero if NODE is the target for genericization of 'continue' stmts. */
3503#define LABEL_DECL_CONTINUE(NODE) \
3504 DECL_LANG_FLAG_1 (LABEL_DECL_CHECK (NODE))
3505
852497a3
JM
3506/* True if NODE was declared with auto in its return type, but it has
3507 started compilation and so the return type might have been changed by
3508 return type deduction; its declared return type should be found in
3509 DECL_STRUCT_FUNCTION(NODE)->language->x_auto_return_pattern. */
3510#define FNDECL_USED_AUTO(NODE) \
3511 TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
3512
d63d5d0c
ILT
3513/* Nonzero if NODE is a DECL which we know about but which has not
3514 been explicitly declared, such as a built-in function or a friend
3515 declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P
3516 will be set. */
cc057ef3 3517#define DECL_ANTICIPATED(NODE) \
43f4447e
JM
3518 (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
3519 ->u.base.anticipated_p)
cd9f6678 3520
d9a6bd32
JJ
3521/* True for artificial decls added for OpenMP privatized non-static
3522 data members. */
3523#define DECL_OMP_PRIVATIZED_MEMBER(NODE) \
3524 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.anticipated_p)
3525
d63d5d0c
ILT
3526/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
3527 within a class but has not been declared in the surrounding scope.
3528 The function is invisible except via argument dependent lookup. */
3529#define DECL_HIDDEN_FRIEND_P(NODE) \
b97e8a14 3530 (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p)
d63d5d0c 3531
acf0174b
JJ
3532/* Nonzero if NODE is an artificial FUNCTION_DECL for
3533 #pragma omp declare reduction. */
3534#define DECL_OMP_DECLARE_REDUCTION_P(NODE) \
3535 (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->omp_declare_reduction_p)
3536
1799e5d5
RH
3537/* Nonzero if DECL has been declared threadprivate by
3538 #pragma omp threadprivate. */
3539#define CP_DECL_THREADPRIVATE_P(DECL) \
b97e8a14 3540 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p)
1799e5d5 3541
b87d79e6
JM
3542/* Nonzero if DECL was declared with '= delete'. */
3543#define DECL_DELETED_FN(DECL) \
f1ee5eaf 3544 (LANG_DECL_FN_CHECK (DECL)->min.base.threadprivate_or_deleted_p)
b87d79e6 3545
20f2653e 3546/* Nonzero if DECL was declared with '= default' (maybe implicitly). */
b87d79e6 3547#define DECL_DEFAULTED_FN(DECL) \
b97e8a14 3548 (LANG_DECL_FN_CHECK (DECL)->defaulted_p)
b87d79e6 3549
20f2653e
JM
3550/* Nonzero if DECL is explicitly defaulted in the class body. */
3551#define DECL_DEFAULTED_IN_CLASS_P(DECL) \
3552 (DECL_DEFAULTED_FN (DECL) && DECL_INITIALIZED_IN_CLASS_P (DECL))
3553/* Nonzero if DECL was defaulted outside the class body. */
3554#define DECL_DEFAULTED_OUTSIDE_CLASS_P(DECL) \
3555 (DECL_DEFAULTED_FN (DECL) \
3556 && !(DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL)))
3557
8d08fdba 3558/* Record whether a typedef for type `int' was actually `signed int'. */
98e40e83 3559#define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
8d08fdba 3560
838dfd8a 3561/* Returns nonzero if DECL has external linkage, as specified by the
ad50e811
MM
3562 language standard. (This predicate may hold even when the
3563 corresponding entity is not actually given external linkage in the
3564 object file; see decl_linkage for details.) */
3565#define DECL_EXTERNAL_LINKAGE_P(DECL) \
3566 (decl_linkage (DECL) == lk_external)
3567
b38a05d0 3568/* Keep these codes in ascending code order. */
38b3627d 3569
b38a05d0
RS
3570#define INTEGRAL_CODE_P(CODE) \
3571 ((CODE) == ENUMERAL_TYPE \
3572 || (CODE) == BOOLEAN_TYPE \
3573 || (CODE) == INTEGER_TYPE)
a7a64a77
MM
3574
3575/* [basic.fundamental]
3576
3577 Types bool, char, wchar_t, and the signed and unsigned integer types
bb20cc46 3578 are collectively called integral types.
a7a64a77
MM
3579
3580 Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
38b3627d 3581 types as well, which is incorrect in C++. Keep these checks in
b38a05d0 3582 ascending code order. */
bb20cc46 3583#define CP_INTEGRAL_TYPE_P(TYPE) \
98e40e83
GS
3584 (TREE_CODE (TYPE) == BOOLEAN_TYPE \
3585 || TREE_CODE (TYPE) == INTEGER_TYPE)
a7a64a77 3586
38b3627d
NS
3587/* Returns true if TYPE is an integral or enumeration name. Keep
3588 these checks in ascending code order. */
14d22dd6 3589#define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
38b3627d 3590 (TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE))
14d22dd6 3591
adf2edec
DG
3592/* Returns true if TYPE is an integral or unscoped enumeration type. */
3593#define INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P(TYPE) \
3594 (UNSCOPED_ENUM_P (TYPE) || CP_INTEGRAL_TYPE_P (TYPE))
3595
7ecbca9d
GDR
3596/* True if the class type TYPE is a literal type. */
3597#define CLASSTYPE_LITERAL_P(TYPE) \
3598 (LANG_TYPE_CLASS_CHECK (TYPE)->is_literal)
3599
a7a64a77
MM
3600/* [basic.fundamental]
3601
3602 Integral and floating types are collectively called arithmetic
b8063b29
MM
3603 types.
3604
3605 As a GNU extension, we also accept complex types.
3606
3607 Keep these checks in ascending code order. */
a7a64a77 3608#define ARITHMETIC_TYPE_P(TYPE) \
b8063b29
MM
3609 (CP_INTEGRAL_TYPE_P (TYPE) \
3610 || TREE_CODE (TYPE) == REAL_TYPE \
3611 || TREE_CODE (TYPE) == COMPLEX_TYPE)
2986ae00 3612
5116acc6 3613/* True iff TYPE is cv decltype(nullptr). */
1e85e720 3614#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE)
5116acc6 3615
5f261ba9
MM
3616/* [basic.types]
3617
14c2101d
JM
3618 Arithmetic types, enumeration types, pointer types,
3619 pointer-to-member types, and std::nullptr_t are collectively called
3620 scalar types.
b8063b29 3621
38b3627d 3622 Keep these checks in ascending code order. */
5f261ba9 3623#define SCALAR_TYPE_P(TYPE) \
66b1156a 3624 (TYPE_PTRDATAMEM_P (TYPE) \
5f261ba9 3625 || TREE_CODE (TYPE) == ENUMERAL_TYPE \
38b3627d 3626 || ARITHMETIC_TYPE_P (TYPE) \
5f261ba9 3627 || TYPE_PTR_P (TYPE) \
14c2101d 3628 || TYPE_PTRMEMFUNC_P (TYPE) \
5116acc6 3629 || NULLPTR_TYPE_P (TYPE))
5f261ba9 3630
adf2edec
DG
3631/* Determines whether this type is a C++0x scoped enumeration
3632 type. Scoped enumerations types are introduced via "enum class" or
3633 "enum struct", e.g.,
3634
3635 enum class Color {
3636 Red, Green, Blue
3637 };
3638
3639 Scoped enumeration types are different from normal (unscoped)
3640 enumeration types in several ways:
3641
3642 - The enumerators of a scoped enumeration type are only available
3643 within the scope of the enumeration type and not in the
3644 enclosing scope. For example, the Red color can be referred to
3645 with "Color::Red" but not "Red".
3646
3647 - Scoped enumerators and enumerations do not implicitly convert
3648 to integers or 'bool'.
3649
3650 - The underlying type of the enum is well-defined. */
3651#define SCOPED_ENUM_P(TYPE) \
5a2fa9e8 3652 (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_SCOPED (TYPE))
adf2edec
DG
3653
3654/* Determine whether this is an unscoped enumeration type. */
3655#define UNSCOPED_ENUM_P(TYPE) \
5a2fa9e8 3656 (TREE_CODE (TYPE) == ENUMERAL_TYPE && !ENUM_IS_SCOPED (TYPE))
adf2edec
DG
3657
3658/* Set the flag indicating whether an ENUMERAL_TYPE is a C++0x scoped
3659 enumeration type (1) or a normal (unscoped) enumeration type
3660 (0). */
3661#define SET_SCOPED_ENUM_P(TYPE, VAL) \
5a2fa9e8 3662 (ENUM_IS_SCOPED (TYPE) = (VAL))
adf2edec 3663
90ecaf87
RRC
3664#define SET_OPAQUE_ENUM_P(TYPE, VAL) \
3665 (ENUM_IS_OPAQUE (TYPE) = (VAL))
3666
3667#define OPAQUE_ENUM_P(TYPE) \
3668 (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_OPAQUE (TYPE))
3669
3670/* Determines whether an ENUMERAL_TYPE has an explicit
3671 underlying type. */
4e3c0a15 3672#define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE))
90ecaf87 3673
adf2edec
DG
3674/* Returns the underlying type of the given enumeration type. The
3675 underlying type is determined in different ways, depending on the
3676 properties of the enum:
3677
3678 - In C++0x, the underlying type can be explicitly specified, e.g.,
3679
3680 enum E1 : char { ... } // underlying type is char
3681
3682 - In a C++0x scoped enumeration, the underlying type is int
3683 unless otherwises specified:
3684
3685 enum class E2 { ... } // underlying type is int
3686
3687 - Otherwise, the underlying type is determined based on the
3688 values of the enumerators. In this case, the
3689 ENUM_UNDERLYING_TYPE will not be set until after the definition
3690 of the enumeration is completed by finish_enum. */
3691#define ENUM_UNDERLYING_TYPE(TYPE) \
3692 TREE_TYPE (ENUMERAL_TYPE_CHECK (TYPE))
3693
8e3df2de
MM
3694/* [dcl.init.aggr]
3695
ec3ebf45
OG
3696 An aggregate is an array or a class with no user-provided
3697 constructors, no brace-or-equal-initializers for non-static data
3698 members, no private or protected non-static data members, no
dbe85b80
JM
3699 base classes, and no virtual functions.
3700
38b3627d
NS
3701 As an extension, we also treat vectors as aggregates. Keep these
3702 checks in ascending code order. */
3703#define CP_AGGREGATE_TYPE_P(TYPE) \
3704 (TREE_CODE (TYPE) == VECTOR_TYPE \
3705 ||TREE_CODE (TYPE) == ARRAY_TYPE \
3706 || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
8e3df2de
MM
3707
3708/* Nonzero for a class type means that the class type has a
3709 user-declared constructor. */
0fcedd9c 3710#define TYPE_HAS_USER_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
8d08fdba 3711
cab421f4
PC
3712/* Nonzero means that the FUNCTION_TYPE or METHOD_TYPE has a
3713 late-specified return type. */
3714#define TYPE_HAS_LATE_RETURN_TYPE(NODE) \
3715 (TYPE_LANG_FLAG_2 (FUNC_OR_METHOD_CHECK (NODE)))
3716
8d08fdba
MS
3717/* When appearing in an INDIRECT_REF, it means that the tree structure
3718 underneath is actually a call to a constructor. This is needed
3719 when the constructor must initialize local storage (which can
3720 be automatically destroyed), rather than allowing it to allocate
3721 space from the heap.
3722
3723 When appearing in a SAVE_EXPR, it means that underneath
3724 is a call to a constructor.
3725
92a62aad
MM
3726 When appearing in a CONSTRUCTOR, the expression is a
3727 compound literal.
8d08fdba
MS
3728
3729 When appearing in a FIELD_DECL, it means that this field
3730 has been duly initialized in its constructor. */
98e40e83 3731#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
8d08fdba 3732
92a62aad
MM
3733/* True if NODE is a brace-enclosed initializer. */
3734#define BRACE_ENCLOSED_INITIALIZER_P(NODE) \
09357846 3735 (TREE_CODE (NODE) == CONSTRUCTOR && TREE_TYPE (NODE) == init_list_type_node)
92a62aad 3736
3b2db49f
MM
3737/* True if NODE is a compound-literal, i.e., a brace-enclosed
3738 initializer cast to a particular type. */
3739#define COMPOUND_LITERAL_P(NODE) \
3740 (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE))
3741
4038c495 3742#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
9771b263 3743 && vec_safe_is_empty(CONSTRUCTOR_ELTS(NODE))\
4038c495 3744 && !TREE_HAS_CONSTRUCTOR (NODE))
a3203465 3745
09357846
JM
3746/* True if NODE is a init-list used as a direct-initializer, i.e.
3747 B b{1,2}, not B b({1,2}) or B b = {1,2}. */
3748#define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE)))
3749
3e605b20
JM
3750/* True if an uninitialized element in NODE should not be treated as
3751 implicitly value-initialized. Only used in constexpr evaluation. */
3752#define CONSTRUCTOR_NO_IMPLICIT_ZERO(NODE) \
3753 (TREE_LANG_FLAG_1 (CONSTRUCTOR_CHECK (NODE)))
3754
023d89c7
JM
3755/* True if this CONSTRUCTOR should not be used as a variable initializer
3756 because it was loaded from a constexpr variable with mutable fields. */
3757#define CONSTRUCTOR_MUTABLE_POISON(NODE) \
3758 (TREE_LANG_FLAG_2 (CONSTRUCTOR_CHECK (NODE)))
3759
014397c2
PC
3760#define DIRECT_LIST_INIT_P(NODE) \
3761 (BRACE_ENCLOSED_INITIALIZER_P (NODE) && CONSTRUCTOR_IS_DIRECT_INIT (NODE))
3762
a4474a38
JM
3763/* True if NODE represents a conversion for direct-initialization in a
3764 template. Set by perform_implicit_conversion_flags. */
3765#define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \
3766 (TREE_LANG_FLAG_0 (IMPLICIT_CONV_EXPR_CHECK (NODE)))
3767
f30432d7
MS
3768/* Nonzero means that an object of this type can not be initialized using
3769 an initializer list. */
3770#define CLASSTYPE_NON_AGGREGATE(NODE) \
e2500fed 3771 (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
f30432d7 3772#define TYPE_NON_AGGREGATE_CLASS(NODE) \
3f50c846 3773 (CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
f30432d7 3774
066ec0a4
JM
3775/* Nonzero if there is a non-trivial X::op=(cv X&) for this class. */
3776#define TYPE_HAS_COMPLEX_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_assign)
cb68ec50 3777
066ec0a4
JM
3778/* Nonzero if there is a non-trivial X::X(cv X&) for this class. */
3779#define TYPE_HAS_COMPLEX_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_ctor)
8d08fdba 3780
ac177431
JM
3781/* Nonzero if there is a non-trivial X::op=(X&&) for this class. */
3782#define TYPE_HAS_COMPLEX_MOVE_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_assign)
3783
3784/* Nonzero if there is a non-trivial X::X(X&&) for this class. */
3785#define TYPE_HAS_COMPLEX_MOVE_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_ctor)
3786
a710f1f8 3787/* Nonzero if there is no trivial default constructor for this class. */
cb68ec50
PC
3788#define TYPE_HAS_COMPLEX_DFLT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_dflt)
3789
834c6dff 3790/* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
bb20cc46 3791
834c6dff
MM
3792 A destructor is trivial if it is an implicitly declared
3793 destructor and if:
3794
3795 - all of the direct base classes of its class have trivial
0cbd7506 3796 destructors,
834c6dff
MM
3797
3798 - for all of the non-static data members of its class that are
0cbd7506 3799 of class type (or array thereof), each such class has a
834c6dff
MM
3800 trivial destructor. */
3801#define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
3802 (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
3803
3804/* Nonzero for _TYPE node means that this type does not have a trivial
3805 destructor. Therefore, destroying an object of this type will
3806 involve a call to a destructor. This can apply to objects of
3807 ARRAY_TYPE is the type of the elements needs a destructor. */
3808#define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
98e40e83 3809 (TYPE_LANG_FLAG_4 (NODE))
8d08fdba 3810
cb68ec50
PC
3811/* Nonzero for class type means that the default constructor is trivial. */
3812#define TYPE_HAS_TRIVIAL_DFLT(NODE) \
3813 (TYPE_HAS_DEFAULT_CONSTRUCTOR (NODE) && ! TYPE_HAS_COMPLEX_DFLT (NODE))
3814
0830ae44 3815/* Nonzero for class type means that copy initialization of this type can use
e8abc66f 3816 a bitwise copy. */
066ec0a4
JM
3817#define TYPE_HAS_TRIVIAL_COPY_CTOR(NODE) \
3818 (TYPE_HAS_COPY_CTOR (NODE) && ! TYPE_HAS_COMPLEX_COPY_CTOR (NODE))
e8abc66f
MS
3819
3820/* Nonzero for class type means that assignment of this type can use
3821 a bitwise copy. */
066ec0a4
JM
3822#define TYPE_HAS_TRIVIAL_COPY_ASSIGN(NODE) \
3823 (TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE))
e8abc66f 3824
a5ac359a 3825/* Returns true if NODE is a pointer-to-data-member. */
66b1156a 3826#define TYPE_PTRDATAMEM_P(NODE) \
a5ac359a 3827 (TREE_CODE (NODE) == OFFSET_TYPE)
b6ab6892 3828/* Returns true if NODE is a pointer. */
a5ac359a
MM
3829#define TYPE_PTR_P(NODE) \
3830 (TREE_CODE (NODE) == POINTER_TYPE)
2b643eda
MM
3831
3832/* Returns true if NODE is an object type:
3833
3834 [basic.types]
3835
3836 An object type is a (possibly cv-qualified) type that is not a
3db45ab5 3837 function type, not a reference type, and not a void type.
2b643eda
MM
3838
3839 Keep these checks in ascending order, for speed. */
3840#define TYPE_OBJ_P(NODE) \
3841 (TREE_CODE (NODE) != REFERENCE_TYPE \
50e10fa8 3842 && !VOID_TYPE_P (NODE) \
2b643eda
MM
3843 && TREE_CODE (NODE) != FUNCTION_TYPE \
3844 && TREE_CODE (NODE) != METHOD_TYPE)
3845
38b3627d
NS
3846/* Returns true if NODE is a pointer to an object. Keep these checks
3847 in ascending tree code order. */
3848#define TYPE_PTROB_P(NODE) \
2b643eda
MM
3849 (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))
3850
38b3627d
NS
3851/* Returns true if NODE is a reference to an object. Keep these checks
3852 in ascending tree code order. */
3853#define TYPE_REF_OBJ_P(NODE) \
2b643eda
MM
3854 (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE)))
3855
38b3627d
NS
3856/* Returns true if NODE is a pointer to an object, or a pointer to
3857 void. Keep these checks in ascending tree code order. */
3858#define TYPE_PTROBV_P(NODE) \
0cbd7506 3859 (TYPE_PTR_P (NODE) \
38b3627d 3860 && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
0cbd7506 3861 || TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
2b643eda 3862
b65eff46 3863/* Returns true if NODE is a pointer to function type. */
c11b6f21 3864#define TYPE_PTRFN_P(NODE) \
50e10fa8 3865 (TYPE_PTR_P (NODE) \
c11b6f21 3866 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
2b643eda 3867
b65eff46 3868/* Returns true if NODE is a reference to function type. */
742a37d5
JM
3869#define TYPE_REFFN_P(NODE) \
3870 (TREE_CODE (NODE) == REFERENCE_TYPE \
3871 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
c11b6f21 3872
b65eff46 3873/* Returns true if NODE is a pointer to member function type. */
83e9506e 3874#define TYPE_PTRMEMFUNC_P(NODE) \
98e40e83 3875 (TREE_CODE (NODE) == RECORD_TYPE \
83e9506e
RH
3876 && TYPE_PTRMEMFUNC_FLAG (NODE))
3877
e08a8f45 3878#define TYPE_PTRMEMFUNC_FLAG(NODE) \
1d7e2ec7 3879 (TYPE_LANG_FLAG_2 (RECORD_TYPE_CHECK (NODE)))
e08a8f45 3880
a5ac359a 3881/* Returns true if NODE is a pointer-to-member. */
66b1156a
PC
3882#define TYPE_PTRMEM_P(NODE) \
3883 (TYPE_PTRDATAMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
3884
3885/* Returns true if NODE is a pointer or a pointer-to-member. */
3886#define TYPE_PTR_OR_PTRMEM_P(NODE) \
3887 (TYPE_PTR_P (NODE) || TYPE_PTRMEM_P (NODE))
a5ac359a 3888
19420d00
NS
3889/* Indicates when overload resolution may resolve to a pointer to
3890 member function. [expr.unary.op]/3 */
a2982c1b 3891#define PTRMEM_OK_P(NODE) \
d816a3ba 3892 TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), ADDR_EXPR, OFFSET_REF, SCOPE_REF))
19420d00 3893
8d08fdba
MS
3894/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
3895 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
e92cc029 3896 before using this macro. */
c7e266a6 3897#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
35abb8ed
JM
3898 (cp_build_qualified_type (TREE_TYPE (TYPE_FIELDS (NODE)),\
3899 cp_type_quals (NODE)))
3900
3901/* As above, but can be used in places that want an lvalue at the expense
3902 of not necessarily having the correct cv-qualifiers. */
3903#define TYPE_PTRMEMFUNC_FN_TYPE_RAW(NODE) \
1f84ec23 3904 (TREE_TYPE (TYPE_FIELDS (NODE)))
ceab47eb
MM
3905
3906/* Returns `A' for a type like `int (A::*)(double)' */
3907#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
3908 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
3909
38e01259 3910/* These are use to manipulate the canonical RECORD_TYPE from the
e92cc029 3911 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
98e40e83 3912#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
e2500fed
GK
3913 (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
3914#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
3915 do { \
3916 if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
3917 { \
766090c2
TS
3918 TYPE_LANG_SPECIFIC (NODE) \
3919 = (struct lang_type *) ggc_internal_cleared_alloc \
a9429e29 3920 (sizeof (struct lang_type_ptrmem)); \
e2500fed
GK
3921 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
3922 } \
3923 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
3924 } while (0)
8d08fdba 3925
24272dc0
MM
3926/* For a pointer-to-member type of the form `T X::*', this is `X'.
3927 For a type like `void (X::*)() const', this type is `X', not `const
3928 X'. To get at the `const X' you have to look at the
3929 TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
3930 type `const X*'. */
f71f87f9 3931#define TYPE_PTRMEM_CLASS_TYPE(NODE) \
66b1156a 3932 (TYPE_PTRDATAMEM_P (NODE) \
a5ac359a 3933 ? TYPE_OFFSET_BASETYPE (NODE) \
98e40e83 3934 : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
f71f87f9
MM
3935
3936/* For a pointer-to-member type of the form `T X::*', this is `T'. */
3937#define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
66b1156a 3938 (TYPE_PTRDATAMEM_P (NODE) \
a5ac359a 3939 ? TREE_TYPE (NODE) \
98e40e83 3940 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
f71f87f9 3941
61a127b3
MM
3942/* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
3943 `X'. */
f71f87f9 3944#define PTRMEM_CST_CLASS(NODE) \
da8a66fc 3945 TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
61a127b3 3946
bb20cc46 3947/* For a pointer-to-member constant `X::Y' this is the _DECL for
61a127b3 3948 `Y'. */
da8a66fc 3949#define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
61a127b3 3950
a2982c1b 3951/* The expression in question for a TYPEOF_TYPE. */
51545682 3952#define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE)))
a2982c1b 3953
a0d260fc
PC
3954/* The type in question for an UNDERLYING_TYPE. */
3955#define UNDERLYING_TYPE_TYPE(NODE) \
51545682 3956 (TYPE_VALUES_RAW (UNDERLYING_TYPE_CHECK (NODE)))
a0d260fc 3957
4daba884
BK
3958/* The type in question for BASES. */
3959#define BASES_TYPE(NODE) \
3960 (TYPE_VALUES_RAW (BASES_CHECK (NODE)))
3961
3962#define BASES_DIRECT(NODE) \
3963 TREE_LANG_FLAG_0 (BASES_CHECK (NODE))
3964
3ad6a8e1 3965/* The expression in question for a DECLTYPE_TYPE. */
51545682 3966#define DECLTYPE_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (DECLTYPE_TYPE_CHECK (NODE)))
3ad6a8e1
DG
3967
3968/* Whether the DECLTYPE_TYPE_EXPR of NODE was originally parsed as an
3969 id-expression or a member-access expression. When false, it was
3970 parsed as a full expression. */
3971#define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \
51545682 3972 (DECLTYPE_TYPE_CHECK (NODE))->type_common.string_flag
3ad6a8e1 3973
d5f4eddd 3974/* These flags indicate that we want different semantics from normal
399bb2da
JM
3975 decltype: lambda capture just drops references, init capture
3976 uses auto semantics, lambda proxies look through implicit dereference. */
d5f4eddd
JM
3977#define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \
3978 TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE))
399bb2da
JM
3979#define DECLTYPE_FOR_INIT_CAPTURE(NODE) \
3980 TREE_LANG_FLAG_1 (DECLTYPE_TYPE_CHECK (NODE))
40d55020
JM
3981#define DECLTYPE_FOR_LAMBDA_PROXY(NODE) \
3982 TREE_LANG_FLAG_2 (DECLTYPE_TYPE_CHECK (NODE))
d5f4eddd 3983
faae18ab 3984/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
07c88314
MM
3985 specified in its declaration. This can also be set for an
3986 erroneously declared PARM_DECL. */
da8a66fc 3987#define DECL_THIS_EXTERN(NODE) \
07c88314 3988 DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
8d08fdba 3989
faae18ab 3990/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
07c88314
MM
3991 specified in its declaration. This can also be set for an
3992 erroneously declared PARM_DECL. */
da8a66fc 3993#define DECL_THIS_STATIC(NODE) \
07c88314 3994 DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
faae18ab 3995
593bcbb8
JM
3996/* Nonzero for FIELD_DECL node means that this field is a lambda capture
3997 field for an array of runtime bound. */
3998#define DECL_VLA_CAPTURE_P(NODE) \
3999 DECL_LANG_FLAG_1 (FIELD_DECL_CHECK (NODE))
4000
773ec47f
MP
4001/* Nonzero for PARM_DECL node means that this is an array function
4002 parameter, i.e, a[] rather than *a. */
4003#define DECL_ARRAY_PARAMETER_P(NODE) \
4004 DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE))
4005
04eca83e
NS
4006/* Nonzero for a FIELD_DECL who's NSMDI is currently being
4007 instantiated. */
4008#define DECL_INSTANTIATING_NSDMI_P(NODE) \
4009 DECL_LANG_FLAG_2 (FIELD_DECL_CHECK (NODE))
4010
642124c6
RH
4011/* Nonzero for FIELD_DECL node means that this field is a base class
4012 of the parent object, as opposed to a member field. */
4013#define DECL_FIELD_IS_BASE(NODE) \
4014 DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
4015
37a7519a
JM
4016/* Nonzero for FIELD_DECL node means that this field is a simple (no
4017 explicit initializer) lambda capture field, making it invisible to
4018 name lookup in unevaluated contexts. */
4019#define DECL_NORMAL_CAPTURE_P(NODE) \
4020 DECL_LANG_FLAG_7 (FIELD_DECL_CHECK (NODE))
4021
6bdb8141
JM
4022/* Nonzero if TYPE is an anonymous union or struct type. We have to use a
4023 flag for this because "A union for which objects or pointers are
4024 declared is not an anonymous union" [class.union]. */
4025#define ANON_AGGR_TYPE_P(NODE) \
e2500fed 4026 (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
6bdb8141 4027#define SET_ANON_AGGR_TYPE_P(NODE) \
e2500fed 4028 (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
67ffc812 4029
1e30f9b4
MM
4030/* Nonzero if TYPE is an anonymous union type. */
4031#define ANON_UNION_TYPE_P(NODE) \
4032 (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
4033
8d08fdba
MS
4034/* Define fields and accessors for nodes representing declared names. */
4035
e2500fed 4036#define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
8d08fdba
MS
4037
4038/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
f84b4be9
JM
4039
4040/* The format of each node in the DECL_FRIENDLIST is as follows:
4041
4042 The TREE_PURPOSE will be the name of a function, i.e., an
436f8a4c
MM
4043 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose
4044 TREE_VALUEs are friends with the given name. */
8d08fdba 4045#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
6a629cac
MM
4046#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
4047#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
8d08fdba 4048
2036a15c
MM
4049/* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
4050 each node is a type; the TREE_VALUE is the access granted for this
4051 DECL in that type. The DECL_ACCESS is set by access declarations.
4052 For example, if a member that would normally be public in a
4053 derived class is made protected, then the derived class and the
4054 protected_access_node will appear in the DECL_ACCESS for the node. */
e2500fed 4055#define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
af3b4e59
MM
4056
4057/* Nonzero if the FUNCTION_DECL is a global constructor. */
4058#define DECL_GLOBAL_CTOR_P(NODE) \
b97e8a14 4059 (LANG_DECL_FN_CHECK (NODE)->global_ctor_p)
af3b4e59
MM
4060
4061/* Nonzero if the FUNCTION_DECL is a global destructor. */
4062#define DECL_GLOBAL_DTOR_P(NODE) \
b97e8a14 4063 (LANG_DECL_FN_CHECK (NODE)->global_dtor_p)
af3b4e59 4064
8d08fdba 4065/* Accessor macros for C++ template decl nodes. */
f84b4be9
JM
4066
4067/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
4890c2f4 4068 is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
36a117a5
MM
4069 template parameters, with 1 being the outermost set of template
4070 parameters. The TREE_VALUE is a vector, whose elements are the
4071 template parameters at each level. Each element in the vector is a
4072 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
4073 non-type parameter), or a TYPE_DECL (if the parameter is a type
4074 parameter). The TREE_PURPOSE is the default value, if any. The
34cd5ae7 4075 TEMPLATE_PARM_INDEX for the parameter is available as the
36a117a5 4076 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
ad115a3c
JH
4077 TYPE_DECL).
4078
4079 FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
4080 tree is converted to C++ class hiearchy. */
4ab013d9 4081#define DECL_TEMPLATE_PARMS(NODE) \
ad115a3c 4082 ((struct tree_template_decl *)CONST_CAST_TREE (TEMPLATE_DECL_CHECK (NODE)))->arguments
98c1c668
JM
4083#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
4084 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
4085#define DECL_NTPARMS(NODE) \
4086 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
ad115a3c
JH
4087/* For function, method, class-data templates.
4088
4089 FIXME: CONST_CAST_TREE is a hack that hopefully will go away after
4090 tree is converted to C++ class hiearchy. */
4ab013d9 4091#define DECL_TEMPLATE_RESULT(NODE) \
ad115a3c 4092 ((struct tree_template_decl *)CONST_CAST_TREE(TEMPLATE_DECL_CHECK (NODE)))->result
2b110bfc
JM
4093/* For a function template at namespace scope, DECL_TEMPLATE_INSTANTIATIONS
4094 lists all instantiations and specializations of the function so that
4095 tsubst_friend_function can reassign them to another template if we find
4096 that the namespace-scope template is really a partial instantiation of a
4097 friend template.
36a117a5
MM
4098
4099 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
4100 all instantiations and specializations of the class type, including
2b110bfc
JM
4101 partial instantiations and partial specializations, so that if we
4102 explicitly specialize a partial instantiation we can walk the list
4103 in maybe_process_partial_specialization and reassign them or complain
4104 as appropriate.
36a117a5
MM
4105
4106 In both cases, the TREE_PURPOSE of each node contains the arguments
4107 used; the TREE_VALUE contains the generated variable. The template
4108 arguments are always complete. For example, given:
4109
4110 template <class T> struct S1 {
0cbd7506 4111 template <class U> struct S2 {};
36a117a5
MM
4112 template <class U> struct S2<U*> {};
4113 };
4114
4115 the record for the partial specialization will contain, as its
4116 argument list, { {T}, {U*} }, and will be on the
4117 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
4118 <class U> struct S1<T>::S2'.
4119
2b110bfc 4120 This list is not used for other templates. */
4ab013d9 4121#define DECL_TEMPLATE_INSTANTIATIONS(NODE) \
aaf8a23e 4122 DECL_SIZE_UNIT (TEMPLATE_DECL_CHECK (NODE))
4ab013d9 4123
2b110bfc 4124/* For a class template, this list contains the partial
36a117a5 4125 specializations of this template. (Full specializations are not
916b63c3
MM
4126 recorded on this list.) The TREE_PURPOSE holds the arguments used
4127 in the partial specialization (e.g., for `template <class T> struct
4ca5c232
JM
4128 S<T*, int>' this will be `T*, int'.) The arguments will also include
4129 any outer template arguments. The TREE_VALUE holds the TEMPLATE_DECL
4130 for the partial specialization. The TREE_TYPE is the _TYPE node for
4131 the partial specialization.
36a117a5 4132
2b110bfc 4133 This list is not used for other templates. */
4ab013d9
JM
4134#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) \
4135 DECL_SIZE (TEMPLATE_DECL_CHECK (NODE))
5566b478 4136
38b3627d
NS
4137/* Nonzero for a DECL which is actually a template parameter. Keep
4138 these checks in ascending tree code order. */
bb20cc46 4139#define DECL_TEMPLATE_PARM_P(NODE) \
cd9f6678
MM
4140 (DECL_LANG_FLAG_0 (NODE) \
4141 && (TREE_CODE (NODE) == CONST_DECL \
833aa4c4 4142 || TREE_CODE (NODE) == PARM_DECL \
cd9f6678
MM
4143 || TREE_CODE (NODE) == TYPE_DECL \
4144 || TREE_CODE (NODE) == TEMPLATE_DECL))
4145
4146/* Mark NODE as a template parameter. */
4147#define SET_DECL_TEMPLATE_PARM_P(NODE) \
4148 (DECL_LANG_FLAG_0 (NODE) = 1)
50714e79 4149
cd9f6678 4150/* Nonzero if NODE is a template template parameter. */
73b0fce8 4151#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
50714e79 4152 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
73b0fce8 4153
5bc08e85
PC
4154/* Nonzero for a DECL that represents a function template. */
4155#define DECL_FUNCTION_TEMPLATE_P(NODE) \
4156 (TREE_CODE (NODE) == TEMPLATE_DECL \
4157 && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \
5566b478
MS
4158 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
4159
28704289
DS
4160/* Nonzero for a DECL that represents a class template or alias
4161 template. */
4162#define DECL_TYPE_TEMPLATE_P(NODE) \
c57801d4
JM
4163 (TREE_CODE (NODE) == TEMPLATE_DECL \
4164 && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE \
28704289
DS
4165 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL)
4166
4167/* Nonzero for a DECL that represents a class template. */
4168#define DECL_CLASS_TEMPLATE_P(NODE) \
4169 (DECL_TYPE_TEMPLATE_P (NODE) \
c57801d4 4170 && DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE)))
6757edfe 4171
28704289
DS
4172/* Nonzero for a TEMPLATE_DECL that represents an alias template. */
4173#define DECL_ALIAS_TEMPLATE_P(NODE) \
4174 (DECL_TYPE_TEMPLATE_P (NODE) \
4175 && !DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (NODE)))
4176
1f6dd97b 4177/* Nonzero for a NODE which declares a type. */
35acd3f2 4178#define DECL_DECLARES_TYPE_P(NODE) \
df947b0a 4179 (TREE_CODE (NODE) == TYPE_DECL || DECL_TYPE_TEMPLATE_P (NODE))
35acd3f2 4180
b97e8a14
JM
4181/* Nonzero if NODE declares a function. */
4182#define DECL_DECLARES_FUNCTION_P(NODE) \
4183 (TREE_CODE (NODE) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (NODE))
4184
9188c363 4185/* Nonzero if NODE is the typedef implicitly generated for a type when
a3d87771
MM
4186 the type is declared. In C++, `struct S {};' is roughly
4187 equivalent to `struct S {}; typedef struct S S;' in C.
4188 DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this
4189 example. In C++, there is a second implicit typedef for each
4190 class, in the scope of `S' itself, so that you can say `S::S'.
4191 DECL_SELF_REFERENCE_P will hold for that second typedef. */
9188c363 4192#define DECL_IMPLICIT_TYPEDEF_P(NODE) \
98e40e83 4193 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
9188c363 4194#define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
98e40e83 4195 (DECL_LANG_FLAG_2 (NODE) = 1)
a3d87771
MM
4196#define DECL_SELF_REFERENCE_P(NODE) \
4197 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE))
4198#define SET_DECL_SELF_REFERENCE_P(NODE) \
4199 (DECL_LANG_FLAG_4 (NODE) = 1)
9188c363 4200
4ca5c232
JM
4201/* A `primary' template is one that has its own template header and is not
4202 a partial specialization. A member function of a class template is a
4203 template, but not primary. A member template is primary. Friend
4204 templates are primary, too. */
6757edfe
MM
4205
4206/* Returns the primary template corresponding to these parameters. */
4207#define DECL_PRIMARY_TEMPLATE(NODE) \
4208 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
4209
838dfd8a 4210/* Returns nonzero if NODE is a primary template. */
98e40e83 4211#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
5566b478 4212
3b426391 4213/* Nonzero iff NODE is a specialization of a template. The value
4e95268d
MM
4214 indicates the type of specializations:
4215
4216 1=implicit instantiation
9ba7a2f2
MM
4217
4218 2=partial or explicit specialization, e.g.:
4219
4220 template <> int min<int> (int, int),
4221
4222 3=explicit instantiation, e.g.:
4223
4224 template int min<int> (int, int);
2b1e8a76 4225
4e95268d
MM
4226 Note that NODE will be marked as a specialization even if the
4227 template it is instantiating is not a primary template. For
4228 example, given:
4229
4230 template <typename T> struct O {
4231 void f();
4232 struct I {};
4233 };
4234
4235 both O<int>::f and O<int>::I will be marked as instantiations.
4236
3b426391 4237 If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also
2b1e8a76 4238 be non-NULL. */
b97e8a14 4239#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.use_template)
a0a33927 4240
4e95268d
MM
4241/* Like DECL_USE_TEMPLATE, but for class types. */
4242#define CLASSTYPE_USE_TEMPLATE(NODE) \
4243 (LANG_TYPE_CLASS_CHECK (NODE)->use_template)
4244
4245/* True if NODE is a specialization of a primary template. */
4246#define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \
4247 (CLASS_TYPE_P (NODE) \
4248 && CLASSTYPE_USE_TEMPLATE (NODE) \
f9329c35 4249 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
4e95268d 4250
a0a33927
MS
4251#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
4252#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
4253 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
4254
4255#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
4256#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
1ca939e5
MM
4257
4258/* Returns true for an explicit or partial specialization of a class
4259 template. */
370af2d5 4260#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
a0a33927 4261 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
370af2d5 4262#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
a0a33927
MS
4263 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
4264
4265#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
4266#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
4267#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
98e40e83 4268 (CLASSTYPE_USE_TEMPLATE (NODE) == 1)
a0a33927 4269#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
98e40e83 4270 (CLASSTYPE_USE_TEMPLATE (NODE) = 1)
a0a33927
MS
4271
4272#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
4273#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
4274#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
98e40e83 4275 (CLASSTYPE_USE_TEMPLATE (NODE) == 3)
a0a33927 4276#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
98e40e83 4277 (CLASSTYPE_USE_TEMPLATE (NODE) = 3)
7177d104 4278
838dfd8a 4279/* Nonzero if DECL is a friend function which is an instantiation
61289ca3
MM
4280 from the point of view of the compiler, but not from the point of
4281 view of the language. For example given:
4282 template <class T> struct S { friend void f(T) {}; };
4283 the declaration of `void f(int)' generated when S<int> is
4284 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
39a13be5 4285 a DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION. */
61289ca3
MM
4286#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
4287 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
4288
b432106b
JM
4289/* Nonzero if DECL is a function generated from a function 'temploid',
4290 i.e. template, member of class template, or dependent friend. */
4291#define DECL_TEMPLOID_INSTANTIATION(DECL) \
4292 (DECL_TEMPLATE_INSTANTIATION (DECL) \
4293 || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (DECL))
4294
4295/* Nonzero if DECL is either defined implicitly by the compiler or
4296 generated from a temploid. */
4297#define DECL_GENERATED_P(DECL) \
4298 (DECL_TEMPLOID_INSTANTIATION (DECL) || DECL_DEFAULTED_FN (DECL))
4299
838dfd8a 4300/* Nonzero iff we are currently processing a declaration for an
39c01e4c
MM
4301 entity with its own template parameter list, and which is not a
4302 full specialization. */
4303#define PROCESSING_REAL_TEMPLATE_DECL_P() \
f60a10e7 4304 (processing_template_decl > template_class_depth (current_scope ()))
39c01e4c 4305
fbf1c34b
MM
4306/* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
4307 instantiated, i.e. its definition has been generated from the
78dcd41a 4308 pattern given in the template. */
da8a66fc
ML
4309#define DECL_TEMPLATE_INSTANTIATED(NODE) \
4310 DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
fbf1c34b 4311
db5ae43f 4312/* We know what we're doing with this decl now. */
e3417fcd 4313#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
db5ae43f 4314
faae18ab
MS
4315/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
4316 so that assemble_external will work properly. So we have this flag to
dc472c59
JM
4317 tell us whether the decl is really not external.
4318
4319 This flag does not indicate whether or not the decl is defined in the
4320 current translation unit; it indicates whether or not we should emit the
4321 decl at the end of compilation if it is defined and needed. */
faae18ab 4322#define DECL_NOT_REALLY_EXTERN(NODE) \
b97e8a14 4323 (DECL_LANG_SPECIFIC (NODE)->u.base.not_really_extern)
db5ae43f 4324
6b5fbb55 4325#define DECL_REALLY_EXTERN(NODE) \
1cc1ac7f
JM
4326 (DECL_EXTERNAL (NODE) \
4327 && (!DECL_LANG_SPECIFIC (NODE) || !DECL_NOT_REALLY_EXTERN (NODE)))
6b5fbb55 4328
eb68cb58
MM
4329/* A thunk is a stub function.
4330
4331 A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
4332 The address of the ordinary FUNCTION_DECL is given by the
4333 DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
4977bab6
ZW
4334 FUNCTION_DECL. The job of the thunk is to either adjust the this
4335 pointer before transferring control to the FUNCTION_DECL, or call
4336 FUNCTION_DECL and then adjust the result value. Note, the result
4337 pointer adjusting thunk must perform a call to the thunked
4338 function, (or be implemented via passing some invisible parameter
4339 to the thunked function, which is modified to perform the
4340 adjustment just before returning).
19114537 4341
eb68cb58
MM
4342 A thunk may perform either, or both, of the following operations:
4343
4977bab6
ZW
4344 o Adjust the this or result pointer by a constant offset.
4345 o Adjust the this or result pointer by looking up a vcall or vbase offset
eb68cb58
MM
4346 in the vtable.
4347
4977bab6
ZW
4348 A this pointer adjusting thunk converts from a base to a derived
4349 class, and hence adds the offsets. A result pointer adjusting thunk
4350 converts from a derived class to a base, and hence subtracts the
4351 offsets. If both operations are performed, then the constant
34cd5ae7 4352 adjustment is performed first for this pointer adjustment and last
4977bab6 4353 for the result pointer adjustment.
eb68cb58 4354
4977bab6 4355 The constant adjustment is given by THUNK_FIXED_OFFSET. If the
e00853fd
NS
4356 vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is
4357 used. For this pointer adjusting thunks, it is the vcall offset
4358 into the vtable. For result pointer adjusting thunks it is the
4359 binfo of the virtual base to convert to. Use that binfo's vbase
4360 offset.
4361
4362 It is possible to have equivalent covariant thunks. These are
4363 distinct virtual covariant thunks whose vbase offsets happen to
4364 have the same value. THUNK_ALIAS is used to pick one as the
4365 canonical thunk, which will get all the this pointer adjusting
4366 thunks attached to it. */
eb68cb58 4367
c0bbf652 4368/* An integer indicating how many bytes should be subtracted from the
4977bab6
ZW
4369 this or result pointer when this function is called. */
4370#define THUNK_FIXED_OFFSET(DECL) \
b97e8a14 4371 (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.fn.u5.fixed_offset)
07fa4878
NS
4372
4373/* A tree indicating how to perform the virtual adjustment. For a this
4374 adjusting thunk it is the number of bytes to be added to the vtable
4375 to find the vcall offset. For a result adjusting thunk, it is the
3cfabe60
NS
4376 binfo of the relevant virtual base. If NULL, then there is no
4377 virtual adjust. (The vptr is always located at offset zero from
4378 the this or result pointer.) (If the covariant type is within the
bb885938 4379 class hierarchy being laid out, the vbase index is not yet known
3cfabe60
NS
4380 at the point we need to create the thunks, hence the need to use
4381 binfos.) */
4382
4977bab6 4383#define THUNK_VIRTUAL_OFFSET(DECL) \
a6c0a76c 4384 (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access)
07fa4878 4385
f4f206f4 4386/* A thunk which is equivalent to another thunk. */
e00853fd 4387#define THUNK_ALIAS(DECL) \
b97e8a14 4388 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.min.template_info)
bb885938 4389
742f25b3
NS
4390/* For thunk NODE, this is the FUNCTION_DECL thunked to. It is
4391 possible for the target to be a thunk too. */
07fa4878 4392#define THUNK_TARGET(NODE) \
b97e8a14 4393 (LANG_DECL_FN_CHECK (NODE)->befriending_classes)
c0bbf652 4394
02ed62dd
MM
4395/* True for a SCOPE_REF iff the "template" keyword was used to
4396 indicate that the qualified name denotes a template. */
4397#define QUALIFIED_NAME_IS_TEMPLATE(NODE) \
d816a3ba 4398 (TREE_LANG_FLAG_1 (SCOPE_REF_CHECK (NODE)))
02ed62dd 4399
1799e5d5 4400/* True for an OMP_ATOMIC that has dependent parameters. These are stored
4fe70b31 4401 as an expr in operand 1, and integer_zero_node in operand 0. */
1799e5d5 4402#define OMP_ATOMIC_DEPENDENT_P(NODE) \
4fe70b31 4403 (TREE_CODE (TREE_OPERAND (OMP_ATOMIC_CHECK (NODE), 0)) == INTEGER_CST)
1799e5d5
RH
4404
4405/* Used while gimplifying continue statements bound to OMP_FOR nodes. */
4406#define OMP_FOR_GIMPLIFYING_P(NODE) \
acf0174b 4407 (TREE_LANG_FLAG_0 (OMP_LOOP_CHECK (NODE)))
1799e5d5 4408
3db45ab5 4409/* A language-specific token attached to the OpenMP data clauses to
1799e5d5
RH
4410 hold code (or code fragments) related to ctors, dtors, and op=.
4411 See semantics.c for details. */
4412#define CP_OMP_CLAUSE_INFO(NODE) \
4413 TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
74bf76ed 4414 OMP_CLAUSE_LINEAR))
1799e5d5 4415
0a35513e
AH
4416/* Nonzero if this transaction expression's body contains statements. */
4417#define TRANSACTION_EXPR_IS_STMT(NODE) \
4418 TREE_LANG_FLAG_0 (TRANSACTION_EXPR_CHECK (NODE))
4419
ad321293
MM
4420/* These macros provide convenient access to the various _STMT nodes
4421 created when parsing template declarations. */
0cbd7506
MS
4422#define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
4423#define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
d7e7759d 4424
0cbd7506
MS
4425#define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
4426#define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
52a11cbf 4427
9da99f7d
NS
4428#define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
4429
62409b39 4430/* Nonzero if this try block is a function try block. */
0cbd7506
MS
4431#define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
4432#define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
4433#define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
1a6025b4 4434#define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
46e8c075 4435
5a508662
RH
4436/* CLEANUP_STMT accessors. The statement(s) covered, the cleanup to run
4437 and the VAR_DECL for which this cleanup exists. */
4438#define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
4439#define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
4440#define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2)
4441
4442/* IF_STMT accessors. These give access to the condition of the if
4443 statement, the then block of the if statement, and the else block
4444 of the if statement if it exists. */
0cbd7506
MS
4445#define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
4446#define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
4447#define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
545f261b 4448#define IF_SCOPE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 3)
5a508662 4449
fbc315db
ILT
4450/* WHILE_STMT accessors. These give access to the condition of the
4451 while statement and the body of the while statement, respectively. */
0cbd7506
MS
4452#define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
4453#define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
fbc315db
ILT
4454
4455/* DO_STMT accessors. These give access to the condition of the do
4456 statement and the body of the do statement, respectively. */
0cbd7506
MS
4457#define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
4458#define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
fbc315db
ILT
4459
4460/* FOR_STMT accessors. These give access to the init statement,
4461 condition, update expression, and body of the for statement,
4462 respectively. */
0cbd7506
MS
4463#define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
4464#define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
4465#define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
4466#define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
40e71fc7 4467#define FOR_SCOPE(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 4)
fbc315db 4468
f9132eb7 4469/* RANGE_FOR_STMT accessors. These give access to the declarator,
40e71fc7 4470 expression, body, and scope of the statement, respectively. */
f9132eb7
RRC
4471#define RANGE_FOR_DECL(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 0)
4472#define RANGE_FOR_EXPR(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 1)
4473#define RANGE_FOR_BODY(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 2)
40e71fc7 4474#define RANGE_FOR_SCOPE(NODE) TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 3)
c5028d80 4475#define RANGE_FOR_IVDEP(NODE) TREE_LANG_FLAG_6 (RANGE_FOR_STMT_CHECK (NODE))
f9132eb7 4476
fbc315db
ILT
4477#define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
4478#define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
4479#define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
1f18dbc6 4480#define SWITCH_STMT_SCOPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3)
fbc315db 4481
c3e5898b 4482/* STMT_EXPR accessor. */
0cbd7506 4483#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
c3e5898b 4484
934790cc
ILT
4485/* EXPR_STMT accessor. This gives the expression associated with an
4486 expression statement. */
0cbd7506 4487#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
934790cc 4488
c08cd4c1
JM
4489/* True if this TARGET_EXPR was created by build_cplus_new, and so we can
4490 discard it if it isn't useful. */
4491#define TARGET_EXPR_IMPLICIT_P(NODE) \
4492 TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE))
4493
3f6079dd
JM
4494/* True if this TARGET_EXPR is the result of list-initialization of a
4495 temporary. */
4496#define TARGET_EXPR_LIST_INIT_P(NODE) \
4497 TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE))
4498
37a7519a
JM
4499/* True if this TARGET_EXPR expresses direct-initialization of an object
4500 to be named later. */
4501#define TARGET_EXPR_DIRECT_INIT_P(NODE) \
4502 TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE))
4503
338976c2
JM
4504/* True if NODE is a TARGET_EXPR that just expresses a copy of its INITIAL; if
4505 the initializer has void type, it's doing something more complicated. */
4506#define SIMPLE_TARGET_EXPR_P(NODE) \
4507 (TREE_CODE (NODE) == TARGET_EXPR \
4508 && !VOID_TYPE_P (TREE_TYPE (TARGET_EXPR_INITIAL (NODE))))
4509
37a7519a
JM
4510/* True if EXPR expresses direct-initialization of a TYPE. */
4511#define DIRECT_INIT_EXPR_P(TYPE,EXPR) \
4512 (TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR) \
4513 && same_type_ignoring_top_level_qualifiers_p (TYPE, TREE_TYPE (EXPR)))
4514
c65b0607
JM
4515/* True if this CONVERT_EXPR is for a conversion to virtual base in
4516 an NSDMI, and should be re-evaluated when used in a constructor. */
4517#define CONVERT_EXPR_VBASE_PATH(NODE) \
4518 TREE_LANG_FLAG_0 (CONVERT_EXPR_CHECK (NODE))
4519
0d23cf7a
JJ
4520/* True if SIZEOF_EXPR argument is type. */
4521#define SIZEOF_EXPR_TYPE_P(NODE) \
4522 TREE_LANG_FLAG_0 (SIZEOF_EXPR_CHECK (NODE))
4523
8d08fdba 4524/* An enumeration of the kind of tags that C++ accepts. */
19114537 4525enum tag_types {
a723baf1
MM
4526 none_type = 0, /* Not a tag type. */
4527 record_type, /* "struct" types. */
4528 class_type, /* "class" types. */
4529 union_type, /* "union" types. */
4530 enum_type, /* "enum" types. */
4531 typename_type /* "typename" types. */
4532};
8d08fdba 4533
27b8d0cd 4534/* The various kinds of lvalues we distinguish. */
7e5487a2 4535enum cp_lvalue_kind_flags {
27b8d0cd
MM
4536 clk_none = 0, /* Things that are not an lvalue. */
4537 clk_ordinary = 1, /* An ordinary lvalue. */
b258592a
JM
4538 clk_rvalueref = 2,/* An xvalue (rvalue formed using an rvalue reference) */
4539 clk_class = 4, /* A prvalue of class-type. */
df5c89cb
JM
4540 clk_bitfield = 8, /* An lvalue for a bit-field. */
4541 clk_packed = 16 /* An lvalue for a packed field. */
32e8bb8e
ILT
4542};
4543
4544/* This type is used for parameters and variables which hold
7e5487a2 4545 combinations of the flags in enum cp_lvalue_kind_flags. */
32e8bb8e 4546typedef int cp_lvalue_kind;
27b8d0cd 4547
74b846e0 4548/* Various kinds of template specialization, instantiation, etc. */
a79683d5 4549enum tmpl_spec_kind {
0cbd7506 4550 tsk_none, /* Not a template at all. */
74b846e0
MM
4551 tsk_invalid_member_spec, /* An explicit member template
4552 specialization, but the enclosing
4553 classes have not all been explicitly
4554 specialized. */
4555 tsk_invalid_expl_inst, /* An explicit instantiation containing
4556 template parameter lists. */
0cbd7506 4557 tsk_excessive_parms, /* A template declaration with too many
74b846e0
MM
4558 template parameter lists. */
4559 tsk_insufficient_parms, /* A template declaration with too few
4560 parameter lists. */
0cbd7506
MS
4561 tsk_template, /* A template declaration. */
4562 tsk_expl_spec, /* An explicit specialization. */
4563 tsk_expl_inst /* An explicit instantiation. */
a79683d5 4564};
74b846e0 4565
c35cce41
MM
4566/* The various kinds of access. BINFO_ACCESS depends on these being
4567 two bit quantities. The numerical values are important; they are
509fc277 4568 used to initialize RTTI data structures, so changing them changes
9bcb9aae 4569 the ABI. */
a79683d5 4570enum access_kind {
0cbd7506
MS
4571 ak_none = 0, /* Inaccessible. */
4572 ak_public = 1, /* Accessible, as a `public' thing. */
4573 ak_protected = 2, /* Accessible, as a `protected' thing. */
4574 ak_private = 3 /* Accessible, as a `private' thing. */
a79683d5 4575};
c35cce41 4576
872f37f9
MM
4577/* The various kinds of special functions. If you add to this list,
4578 you should update special_function_p as well. */
a79683d5 4579enum special_function_kind {
0cbd7506 4580 sfk_none = 0, /* Not a special function. This enumeral
872f37f9
MM
4581 must have value zero; see
4582 special_function_p. */
0cbd7506 4583 sfk_constructor, /* A constructor. */
9eb71d8c 4584 sfk_copy_constructor, /* A copy constructor. */
d5f4eddd 4585 sfk_move_constructor, /* A move constructor. */
066ec0a4 4586 sfk_copy_assignment, /* A copy assignment operator. */
ac177431 4587 sfk_move_assignment, /* A move assignment operator. */
0cbd7506 4588 sfk_destructor, /* A destructor. */
872f37f9
MM
4589 sfk_complete_destructor, /* A destructor for complete objects. */
4590 sfk_base_destructor, /* A destructor for base subobjects. */
4591 sfk_deleting_destructor, /* A destructor for complete objects that
4592 deletes the object after it has been
4593 destroyed. */
85b5d65a
JM
4594 sfk_conversion, /* A conversion operator. */
4595 sfk_inheriting_constructor /* An inheriting constructor */
a79683d5 4596};
3dbc07b6 4597
19114537
EC
4598/* The various kinds of linkage. From [basic.link],
4599
ad50e811
MM
4600 A name is said to have linkage when it might denote the same
4601 object, reference, function, type, template, namespace or value
4602 as a name introduced in another scope:
4603
4604 -- When a name has external linkage, the entity it denotes can
0cbd7506 4605 be referred to from scopes of other translation units or from
ad50e811
MM
4606 other scopes of the same translation unit.
4607
4608 -- When a name has internal linkage, the entity it denotes can
0cbd7506 4609 be referred to by names from other scopes in the same
ad50e811
MM
4610 translation unit.
4611
4612 -- When a name has no linkage, the entity it denotes cannot be
0cbd7506 4613 referred to by names from other scopes. */
ad50e811 4614
a79683d5 4615enum linkage_kind {
0cbd7506
MS
4616 lk_none, /* No linkage. */
4617 lk_internal, /* Internal linkage. */
4618 lk_external /* External linkage. */
a79683d5 4619};
ad50e811 4620
a79683d5 4621enum duration_kind {
b95ca513
JM
4622 dk_static,
4623 dk_thread,
4624 dk_auto,
4625 dk_dynamic
a79683d5 4626};
b95ca513 4627
c2ea3a40 4628/* Bitmask flags to control type substitution. */
f87393f0 4629enum tsubst_flags {
248e1b22
MM
4630 tf_none = 0, /* nothing special */
4631 tf_error = 1 << 0, /* give error messages */
4632 tf_warning = 1 << 1, /* give warnings too */
4633 tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
4634 tf_keep_type_decl = 1 << 3, /* retain typedef type decls
4635 (make_typename_type use) */
4636 tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
4637 instantiate_type use) */
4638 tf_user = 1 << 5, /* found template must be a user template
4639 (lookup_template_class use) */
4640 tf_conv = 1 << 6, /* We are determining what kind of
4641 conversion might be permissible,
4642 not actually performing the
4643 conversion. */
57fcd4f4
JM
4644 tf_decltype = 1 << 7, /* We are the operand of decltype.
4645 Used to implement the special rules
4646 for calls in decltype (5.2.2/11). */
852497a3
JM
4647 tf_partial = 1 << 8, /* Doing initial explicit argument
4648 substitution in fn_type_unification. */
10f3742b 4649 /* Convenient substitution flags combinations. */
23fca1f5 4650 tf_warning_or_error = tf_warning | tf_error
f87393f0
ILT
4651};
4652
4653/* This type is used for parameters and variables which hold
4654 combinations of the flags in enum tsubst_flags. */
4655typedef int tsubst_flags_t;
5e76004e 4656
00a17e31 4657/* The kind of checking we can do looking in a class hierarchy. */
7e5487a2 4658enum base_access_flags {
18e4be85 4659 ba_any = 0, /* Do not check access, allow an ambiguous base,
338d90b8 4660 prefer a non-virtual base */
18e4be85
NS
4661 ba_unique = 1 << 0, /* Must be a unique base. */
4662 ba_check_bit = 1 << 1, /* Check access. */
4663 ba_check = ba_unique | ba_check_bit,
22854930 4664 ba_ignore_scope = 1 << 2 /* Ignore access allowed by local scope. */
a916d97f
ILT
4665};
4666
4667/* This type is used for parameters and variables which hold
7e5487a2 4668 combinations of the flags in enum base_access_flags. */
a916d97f 4669typedef int base_access;
338d90b8 4670
8d241e0b 4671/* The various kinds of access check during parsing. */
a79683d5 4672enum deferring_kind {
8d241e0b
KL
4673 dk_no_deferred = 0, /* Check access immediately */
4674 dk_deferred = 1, /* Deferred check */
4675 dk_no_check = 2 /* No access check */
a79683d5 4676};
8d241e0b 4677
aba649ba 4678/* The kind of base we can find, looking in a class hierarchy.
00a17e31 4679 Values <0 indicate we failed. */
a79683d5 4680enum base_kind {
338d90b8 4681 bk_inaccessible = -3, /* The base is inaccessible */
0cbd7506
MS
4682 bk_ambig = -2, /* The base is ambiguous */
4683 bk_not_base = -1, /* It is not a base */
4684 bk_same_type = 0, /* It is the same type */
4685 bk_proper_base = 1, /* It is a proper base */
4686 bk_via_virtual = 2 /* It is a proper base, but via a virtual
338d90b8 4687 path. This might not be the canonical
00a17e31 4688 binfo. */
a79683d5 4689};
338d90b8 4690
700f8a87 4691/* Node for "pointer to (virtual) function".
e92cc029 4692 This may be distinct from ptr_type_node so gdb can distinguish them. */
c4372ef4 4693#define vfunc_ptr_type_node vtable_entry_type
700f8a87 4694
8d08fdba 4695
8d08fdba 4696/* For building calls to `delete'. */
e2500fed 4697extern GTY(()) tree integer_two_node;
8d08fdba 4698
b2244c65
MM
4699/* The number of function bodies which we are currently processing.
4700 (Zero if we are at namespace scope, one inside the body of a
4701 function, two inside the body of a function in a local class, etc.) */
4702extern int function_depth;
4703
25976b7f
JM
4704/* Nonzero if we are inside eq_specializations, which affects comparison of
4705 PARM_DECLs in cp_tree_equal. */
4706extern int comparing_specializations;
4707
7d882b83
ILT
4708/* In parser.c. */
4709
4710/* Nonzero if we are parsing an unevaluated operand: an operand to
4711 sizeof, typeof, or alignof. This is a count since operands to
4712 sizeof can be nested. */
4713
4714extern int cp_unevaluated_operand;
4715
971e17ff
AS
4716/* RAII class used to inhibit the evaluation of operands during parsing
4717 and template instantiation. Evaluation warnings are also inhibited. */
4718
4719struct cp_unevaluated
4720{
4721 cp_unevaluated ();
4722 ~cp_unevaluated ();
4723};
4724
51c184be 4725/* in pt.c */
5566b478 4726
62e4a758 4727/* These values are used for the `STRICT' parameter to type_unification and
830bfa74
MM
4728 fn_type_unification. Their meanings are described with the
4729 documentation for fn_type_unification. */
4730
a79683d5 4731enum unification_kind_t {
830bfa74
MM
4732 DEDUCE_CALL,
4733 DEDUCE_CONV,
dda04398 4734 DEDUCE_EXACT
a79683d5 4735};
830bfa74 4736
971e17ff
AS
4737// An RAII class used to create a new pointer map for local
4738// specializations. When the stack goes out of scope, the
4739// previous pointer map is restored.
4740struct local_specialization_stack
4741{
4742 local_specialization_stack ();
4743 ~local_specialization_stack ();
4744
4745 hash_map<tree, tree> *saved;
4746};
4747
51c184be 4748/* in class.c */
61a127b3 4749
b4c4a9ec 4750extern int current_class_depth;
8d08fdba 4751
1f6e1acc
AS
4752/* An array of all local classes present in this translation unit, in
4753 declaration order. */
9771b263 4754extern GTY(()) vec<tree, va_gc> *local_classes;
8d08fdba
MS
4755\f
4756/* Here's where we control how name mangling takes place. */
4757
8d08fdba
MS
4758/* Cannot use '$' up front, because this confuses gdb
4759 (names beginning with '$' are gdb-local identifiers).
4760
4761 Note that all forms in which the '$' is significant are long enough
4762 for direct indexing (meaning that if we know there is a '$'
4763 at a particular location, we can index into the string at
4764 any other location that provides distinguishing characters). */
4765
d9781752
L
4766/* Define NO_DOT_IN_LABEL in your favorite tm file if your assembler
4767 doesn't allow '.' in symbol names. */
8d08fdba
MS
4768#ifndef NO_DOT_IN_LABEL
4769
4770#define JOINER '.'
4771
8d08fdba 4772#define AUTO_TEMP_NAME "_.tmp_"
8d08fdba
MS
4773#define VFIELD_BASE ".vf"
4774#define VFIELD_NAME "_vptr."
4775#define VFIELD_NAME_FORMAT "_vptr.%s"
8d08fdba 4776
8d08fdba
MS
4777#else /* NO_DOT_IN_LABEL */
4778
d9781752
L
4779#ifndef NO_DOLLAR_IN_LABEL
4780
4781#define JOINER '$'
4782
4783#define AUTO_TEMP_NAME "_$tmp_"
4784#define VFIELD_BASE "$vf"
4785#define VFIELD_NAME "_vptr$"
4786#define VFIELD_NAME_FORMAT "_vptr$%s"
d9781752
L
4787
4788#else /* NO_DOLLAR_IN_LABEL */
4789
8d08fdba
MS
4790#define AUTO_TEMP_NAME "__tmp_"
4791#define TEMP_NAME_P(ID_NODE) \
4792 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
4793 sizeof (AUTO_TEMP_NAME) - 1))
8d08fdba 4794#define VTABLE_NAME "__vt_"
8d08fdba
MS
4795#define VTABLE_NAME_P(ID_NODE) \
4796 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
4797 sizeof (VTABLE_NAME) - 1))
4798#define VFIELD_BASE "__vfb"
4799#define VFIELD_NAME "__vptr_"
4800#define VFIELD_NAME_P(ID_NODE) \
4801 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
4802 sizeof (VFIELD_NAME) - 1))
dc8ad298 4803#define VFIELD_NAME_FORMAT "__vptr_%s"
8d08fdba 4804
8d08fdba 4805#endif /* NO_DOLLAR_IN_LABEL */
d9781752 4806#endif /* NO_DOT_IN_LABEL */
8d08fdba
MS
4807
4808#define THIS_NAME "this"
8d08fdba
MS
4809
4810#define IN_CHARGE_NAME "__in_chrg"
4811
4812#define VTBL_PTR_TYPE "__vtbl_ptr_type"
4813#define VTABLE_DELTA_NAME "__delta"
8d08fdba 4814#define VTABLE_PFN_NAME "__pfn"
8d08fdba 4815
d5f4eddd
JM
4816#define LAMBDANAME_PREFIX "__lambda"
4817#define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d"
d5f4eddd 4818
c865f923 4819#define UDLIT_OP_ANSI_PREFIX "operator\"\""
3ce4f9e4
ESR
4820#define UDLIT_OP_ANSI_FORMAT UDLIT_OP_ANSI_PREFIX "%s"
4821#define UDLIT_OP_MANGLED_PREFIX "li"
4822#define UDLIT_OP_MANGLED_FORMAT UDLIT_OP_MANGLED_PREFIX "%s"
4823#define UDLIT_OPER_P(ID_NODE) \
4824 (!strncmp (IDENTIFIER_POINTER (ID_NODE), \
4825 UDLIT_OP_ANSI_PREFIX, \
4826 sizeof (UDLIT_OP_ANSI_PREFIX) - 1))
4827#define UDLIT_OP_SUFFIX(ID_NODE) \
4828 (IDENTIFIER_POINTER (ID_NODE) + sizeof (UDLIT_OP_ANSI_PREFIX) - 1)
4829
8d08fdba
MS
4830#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
4831
8d08fdba
MS
4832#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
4833 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
4834 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
4835
98e40e83
GS
4836#define TEMP_NAME_P(ID_NODE) \
4837 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
4838#define VFIELD_NAME_P(ID_NODE) \
4839 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
8d08fdba 4840
8d08fdba 4841#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
35680744 4842
8d08fdba 4843\f
e5e58dbe
JM
4844/* Nonzero if we're done parsing and into end-of-file activities.
4845 Two if we're done with front-end processing. */
5566b478
MS
4846
4847extern int at_eof;
4848
ec5a0fe0
JJ
4849/* True if note_mangling_alias should enqueue mangling aliases for
4850 later generation, rather than emitting them right away. */
4851
4852extern bool defer_mangling_aliases;
4853
170b020f
MM
4854/* A list of namespace-scope objects which have constructors or
4855 destructors which reside in the global scope. The decl is stored
4856 in the TREE_VALUE slot and the initializer is stored in the
4857 TREE_PURPOSE slot. */
4858extern GTY(()) tree static_aggregates;
7c424acd
JM
4859/* Likewise, for thread local storage. */
4860extern GTY(()) tree tls_aggregates;
170b020f 4861
ee18fe39 4862enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
8d08fdba 4863
105d72c5
MM
4864/* These are uses as bits in flags passed to various functions to
4865 control their behavior. Despite the LOOKUP_ prefix, many of these
4866 do not control name lookup. ??? Functions using these flags should
4867 probably be modified to accept explicit boolean flags for the
4868 behaviors relevant to them. */
4869/* Check for access violations. */
644d1951 4870#define LOOKUP_PROTECT (1 << 0)
4b978f96 4871#define LOOKUP_NORMAL (LOOKUP_PROTECT)
105d72c5
MM
4872/* Even if the function found by lookup is a virtual function, it
4873 should be called directly. */
4b978f96 4874#define LOOKUP_NONVIRTUAL (1 << 1)
e57d93c6
JM
4875/* Non-converting (i.e., "explicit") constructors are not tried. This flag
4876 indicates that we are not performing direct-initialization. */
4b978f96 4877#define LOOKUP_ONLYCONVERTING (1 << 2)
e57d93c6 4878#define LOOKUP_IMPLICIT (LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING)
105d72c5
MM
4879/* If a temporary is created, it should be created so that it lives
4880 as long as the current variable bindings; otherwise it only lives
4881 until the end of the complete-expression. It also forces
4882 direct-initialization in cases where other parts of the compiler
4883 have already generated a temporary, such as reference
4884 initialization and the catch parameter. */
4b978f96 4885#define DIRECT_BIND (1 << 3)
404f08f8
JM
4886/* We're performing a user-defined conversion, so more user-defined
4887 conversions are not permitted (only built-in conversions). */
4b978f96 4888#define LOOKUP_NO_CONVERSION (1 << 4)
105d72c5
MM
4889/* The user has explicitly called a destructor. (Therefore, we do
4890 not need to check that the object is non-NULL before calling the
4891 destructor.) */
4b978f96 4892#define LOOKUP_DESTRUCTOR (1 << 5)
105d72c5 4893/* Do not permit references to bind to temporaries. */
4b978f96 4894#define LOOKUP_NO_TEMP_BIND (1 << 6)
105d72c5 4895/* Do not accept objects, and possibly namespaces. */
4b978f96 4896#define LOOKUP_PREFER_TYPES (1 << 7)
105d72c5 4897/* Do not accept objects, and possibly types. */
4b978f96 4898#define LOOKUP_PREFER_NAMESPACES (1 << 8)
105d72c5 4899/* Accept types or namespaces. */
644d1951 4900#define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES)
85661c41 4901/* Return friend declarations and un-declared builtin functions.
105d72c5
MM
4902 (Normally, these entities are registered in the symbol table, but
4903 not found by lookup.) */
6f4fd536 4904#define LOOKUP_HIDDEN (LOOKUP_PREFER_NAMESPACES << 1)
8af2fec4
RY
4905/* Prefer that the lvalue be treated as an rvalue. */
4906#define LOOKUP_PREFER_RVALUE (LOOKUP_HIDDEN << 1)
09357846
JM
4907/* We're inside an init-list, so narrowing conversions are ill-formed. */
4908#define LOOKUP_NO_NARROWING (LOOKUP_PREFER_RVALUE << 1)
11c71a22
JM
4909/* We're looking up a constructor for list-initialization. */
4910#define LOOKUP_LIST_INIT_CTOR (LOOKUP_NO_NARROWING << 1)
e57d93c6 4911/* This is the first parameter of a copy constructor. */
11c71a22 4912#define LOOKUP_COPY_PARM (LOOKUP_LIST_INIT_CTOR << 1)
d451d5b2
JM
4913/* We only want to consider list constructors. */
4914#define LOOKUP_LIST_ONLY (LOOKUP_COPY_PARM << 1)
ac177431
JM
4915/* Return after determining which function to call and checking access.
4916 Used by sythesized_method_walk to determine which functions will
4917 be called to initialize subobjects, in order to determine exception
4918 specification and possible implicit delete.
0e69fdf0 4919 This is kind of a hack, but exiting early avoids problems with trying
ac177431
JM
4920 to perform argument conversions when the class isn't complete yet. */
4921#define LOOKUP_SPECULATIVE (LOOKUP_LIST_ONLY << 1)
b8bf6ad9
JM
4922/* Used by calls from defaulted functions to limit the overload set to avoid
4923 cycles trying to declare them (core issue 1092). */
4924#define LOOKUP_DEFAULTED (LOOKUP_SPECULATIVE << 1)
fa2200cb
JM
4925/* Used in calls to store_init_value to suppress its usual call to
4926 digest_init. */
b8bf6ad9 4927#define LOOKUP_ALREADY_DIGESTED (LOOKUP_DEFAULTED << 1)
2e1df0f0
DN
4928/* An instantiation with explicit template arguments. */
4929#define LOOKUP_EXPLICIT_TMPL_ARGS (LOOKUP_ALREADY_DIGESTED << 1)
dbbc379e
JM
4930/* Like LOOKUP_NO_TEMP_BIND, but also prevent binding to xvalues. */
4931#define LOOKUP_NO_RVAL_BIND (LOOKUP_EXPLICIT_TMPL_ARGS << 1)
715a572a
PC
4932/* Used by case_conversion to disregard non-integral conversions. */
4933#define LOOKUP_NO_NON_INTEGRAL (LOOKUP_NO_RVAL_BIND << 1)
a624d5fe
PC
4934/* Used for delegating constructors in order to diagnose self-delegation. */
4935#define LOOKUP_DELEGATING_CONS (LOOKUP_NO_NON_INTEGRAL << 1)
52c11ef6 4936
98e40e83
GS
4937#define LOOKUP_NAMESPACES_ONLY(F) \
4938 (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
4939#define LOOKUP_TYPES_ONLY(F) \
4940 (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
4941#define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH)
bb20cc46 4942
8d08fdba 4943
a4443a08
MS
4944/* These flags are used by the conversion code.
4945 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
4946 CONV_STATIC : Perform the explicit conversions for static_cast.
4947 CONV_CONST : Perform the explicit conversions for const_cast.
4948 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
6060a796 4949 CONV_PRIVATE : Perform upcasts to private bases.
8ccc31eb 4950 CONV_FORCE_TEMP : Require a new temporary when converting to the same
bb20cc46 4951 aggregate type. */
a4443a08
MS
4952
4953#define CONV_IMPLICIT 1
4954#define CONV_STATIC 2
4955#define CONV_CONST 4
4956#define CONV_REINTERPRET 8
4957#define CONV_PRIVATE 16
faf5394a 4958/* #define CONV_NONCONVERTING 32 */
8ccc31eb 4959#define CONV_FORCE_TEMP 64
a4443a08
MS
4960#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
4961 | CONV_REINTERPRET)
4962#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
8ccc31eb 4963 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
a4443a08 4964
b7484fbe
MS
4965/* Used by build_expr_type_conversion to indicate which types are
4966 acceptable as arguments to the expression under consideration. */
4967
4968#define WANT_INT 1 /* integer types, including bool */
4969#define WANT_FLOAT 2 /* floating point types */
4970#define WANT_ENUM 4 /* enumerated types */
4971#define WANT_POINTER 8 /* pointer types */
4972#define WANT_NULL 16 /* null pointer constant */
1ff6b2c8
JM
4973#define WANT_VECTOR_OR_COMPLEX 32 /* vector or complex types */
4974#define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR_OR_COMPLEX)
b7484fbe 4975
96d84882 4976/* Used with comptypes, and related functions, to guide type
3bfdc719
MM
4977 comparison. */
4978
0cbd7506 4979#define COMPARE_STRICT 0 /* Just check if the types are the
3bfdc719 4980 same. */
0cbd7506 4981#define COMPARE_BASE 1 /* Check to see if the second type is
c8a209ca 4982 derived from the first. */
0cbd7506 4983#define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in
c8a209ca 4984 reverse. */
34cd5ae7 4985#define COMPARE_REDECLARATION 4 /* The comparison is being done when
3bfdc719
MM
4986 another declaration of an existing
4987 entity is seen. */
06d40de8
DG
4988#define COMPARE_STRUCTURAL 8 /* The comparison is intended to be
4989 structural. The actual comparison
4990 will be identical to
4991 COMPARE_STRICT. */
3bfdc719 4992
7bdbfa05 4993/* Used with push_overloaded_decl. */
0cbd7506 4994#define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
7bdbfa05 4995 regardless of the current scope. */
0cbd7506 4996#define PUSH_LOCAL 1 /* Push the DECL into the current
7bdbfa05 4997 scope. */
0cbd7506 4998#define PUSH_USING 2 /* We are pushing this DECL as the
7bdbfa05
MM
4999 result of a using declaration. */
5000
a8f73d4b 5001/* Used with start function. */
0cbd7506
MS
5002#define SF_DEFAULT 0 /* No flags. */
5003#define SF_PRE_PARSED 1 /* The function declaration has
a8f73d4b
MM
5004 already been parsed. */
5005#define SF_INCLASS_INLINE 2 /* The function is an inline, defined
5006 in the class body. */
9edc3913 5007
4ad610c9
JM
5008/* Used with start_decl's initialized parameter. */
5009#define SD_UNINITIALIZED 0
5010#define SD_INITIALIZED 1
5011#define SD_DEFAULTED 2
5012#define SD_DELETED 3
5013
3bfdc719
MM
5014/* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
5015 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
5016 class derived from the type pointed to (referred to) by TYPE1. */
98e40e83 5017#define same_or_base_type_p(TYPE1, TYPE2) \
96d84882 5018 comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
3bfdc719 5019
f84b4be9 5020/* These macros are used to access a TEMPLATE_PARM_INDEX. */
da8a66fc
ML
5021#define TEMPLATE_PARM_INDEX_CAST(NODE) \
5022 ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
5023#define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
5024#define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
f84b4be9 5025#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
da8a66fc
ML
5026#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
5027#define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
30bcc028
DG
5028#define TEMPLATE_PARM_PARAMETER_PACK(NODE) \
5029 (TREE_LANG_FLAG_0 (TEMPLATE_PARM_INDEX_CHECK (NODE)))
f84b4be9 5030
bb20cc46 5031/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
a1281f45 5032 TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
51545682
NF
5033#define TEMPLATE_TYPE_PARM_INDEX(NODE) \
5034 (TYPE_VALUES_RAW (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, \
5035 TEMPLATE_TEMPLATE_PARM, \
5036 BOUND_TEMPLATE_TEMPLATE_PARM)))
f84b4be9
JM
5037#define TEMPLATE_TYPE_IDX(NODE) \
5038 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
5039#define TEMPLATE_TYPE_LEVEL(NODE) \
5040 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
5041#define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
5042 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
5043#define TEMPLATE_TYPE_DECL(NODE) \
5044 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
5d80a306
DG
5045#define TEMPLATE_TYPE_PARAMETER_PACK(NODE) \
5046 (TEMPLATE_PARM_PARAMETER_PACK (TEMPLATE_TYPE_PARM_INDEX (NODE)))
8d08fdba 5047
971e17ff
AS
5048/* Contexts in which auto deduction occurs. These flags are
5049 used to control diagnostics in do_auto_deduction. */
5050
5051enum auto_deduction_context
5052{
5053 adc_unspecified, /* Not given */
5054 adc_variable_type, /* Variable initializer deduction */
5055 adc_return_type, /* Return type deduction */
5056 adc_requirement /* Argument dedution constraint */
5057};
5058
10c6dc8e
JM
5059/* True iff this TEMPLATE_TYPE_PARM represents decltype(auto). */
5060#define AUTO_IS_DECLTYPE(NODE) \
5061 (TYPE_LANG_FLAG_5 (TEMPLATE_TYPE_PARM_CHECK (NODE)))
5062
761f0855
GDR
5063/* These constants can used as bit flags in the process of tree formatting.
5064
5065 TFF_PLAIN_IDENTIFIER: unqualified part of a name.
749ced52 5066 TFF_SCOPE: include the class and namespace scope of the name.
761f0855
GDR
5067 TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
5068 TFF_DECL_SPECIFIERS: print decl-specifiers.
5069 TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
5070 a class-key (resp. `enum').
5071 TFF_RETURN_TYPE: include function return type.
5072 TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
5073 TFF_EXCEPTION_SPECIFICATION: show function exception specification.
aab8454a 5074 TFF_TEMPLATE_HEADER: show the template<...> header in a
761f0855 5075 template-declaration.
761f0855 5076 TFF_TEMPLATE_NAME: show only template-name.
303357a7 5077 TFF_EXPR_IN_PARENS: parenthesize expressions.
a0ad3539
MM
5078 TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments.
5079 TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the
b5b8b0ac
AO
5080 top-level entity.
5081 TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments
3579964b
JM
5082 identical to their defaults.
5083 TFF_NO_TEMPLATE_BINDINGS: do not print information about the template
985acf5a
PC
5084 arguments for a function template specialization.
5085 TFF_POINTER: we are printing a pointer type. */
761f0855 5086
0cbd7506
MS
5087#define TFF_PLAIN_IDENTIFIER (0)
5088#define TFF_SCOPE (1)
5089#define TFF_CHASE_TYPEDEF (1 << 1)
5090#define TFF_DECL_SPECIFIERS (1 << 2)
5091#define TFF_CLASS_KEY_OR_ENUM (1 << 3)
5092#define TFF_RETURN_TYPE (1 << 4)
5093#define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
5094#define TFF_EXCEPTION_SPECIFICATION (1 << 6)
5095#define TFF_TEMPLATE_HEADER (1 << 7)
5096#define TFF_TEMPLATE_NAME (1 << 8)
5097#define TFF_EXPR_IN_PARENS (1 << 9)
5098#define TFF_NO_FUNCTION_ARGUMENTS (1 << 10)
a0ad3539 5099#define TFF_UNQUALIFIED_NAME (1 << 11)
b5b8b0ac 5100#define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS (1 << 12)
3579964b 5101#define TFF_NO_TEMPLATE_BINDINGS (1 << 13)
985acf5a 5102#define TFF_POINTER (1 << 14)
9e93bc9d 5103
1899c3a4
KL
5104/* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
5105 node. */
bb20cc46 5106#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
a1281f45 5107 ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
bb20cc46 5108 ? TYPE_TI_TEMPLATE (NODE) \
1899c3a4
KL
5109 : TYPE_NAME (NODE))
5110
51c184be 5111/* in lex.c */
f5e99456 5112
b2f29cd9 5113extern void init_reswords (void);
f5e99456 5114
d1b38208 5115typedef struct GTY(()) operator_name_info_t {
596ea4e5
AS
5116 /* The IDENTIFIER_NODE for the operator. */
5117 tree identifier;
5118 /* The name of the operator. */
5119 const char *name;
5120 /* The mangled name of the operator. */
5121 const char *mangled_name;
3fa3c4bd
MM
5122 /* The arity of the operator. */
5123 int arity;
596ea4e5
AS
5124} operator_name_info_t;
5125
5126/* A mapping from tree codes to operator name information. */
17211ab5 5127extern GTY(()) operator_name_info_t operator_name_info
c0ed0531 5128 [(int) MAX_TREE_CODES];
596ea4e5 5129/* Similar, but for assignment operators. */
17211ab5 5130extern GTY(()) operator_name_info_t assignment_operator_name_info
c0ed0531 5131 [(int) MAX_TREE_CODES];
596ea4e5 5132
3c01e5df
MM
5133/* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
5134 constants. */
5135
5136typedef int cp_cv_quals;
5137
b5da71d4
VV
5138/* Non-static member functions have an optional virt-specifier-seq.
5139 There is a VIRT_SPEC value for each virt-specifier.
5140 They can be combined by bitwise-or to form the complete set of
5141 virt-specifiers for a member function. */
5142enum virt_specifier
5143 {
5144 VIRT_SPEC_UNSPECIFIED = 0x0,
5145 VIRT_SPEC_FINAL = 0x1,
5146 VIRT_SPEC_OVERRIDE = 0x2
5147 };
5148
5149/* A type-qualifier, or bitmask therefore, using the VIRT_SPEC
5150 constants. */
5151
5152typedef int cp_virt_specifiers;
5153
2eed8e37
BK
5154/* Wherever there is a function-cv-qual, there could also be a ref-qualifier:
5155
5156 [dcl.fct]
5157 The return type, the parameter-type-list, the ref-qualifier, and
5158 the cv-qualifier-seq, but not the default arguments or the exception
5159 specification, are part of the function type.
5160
5161 REF_QUAL_NONE Ordinary member function with no ref-qualifier
5162 REF_QUAL_LVALUE Member function with the &-ref-qualifier
5163 REF_QUAL_RVALUE Member function with the &&-ref-qualifier */
5164
5165enum cp_ref_qualifier {
5166 REF_QUAL_NONE = 0,
5167 REF_QUAL_LVALUE = 1,
5168 REF_QUAL_RVALUE = 2
5169};
5170
62d1db17
MM
5171/* A storage class. */
5172
a79683d5 5173enum cp_storage_class {
62d1db17
MM
5174 /* sc_none must be zero so that zeroing a cp_decl_specifier_seq
5175 sets the storage_class field to sc_none. */
5176 sc_none = 0,
5177 sc_auto,
5178 sc_register,
5179 sc_static,
5180 sc_extern,
5e7752d2 5181 sc_mutable
a79683d5 5182};
62d1db17 5183
0b2c4be5
DS
5184/* An individual decl-specifier. This is used to index the array of
5185 locations for the declspecs in struct cp_decl_specifier_seq
5186 below. */
62d1db17 5187
a79683d5 5188enum cp_decl_spec {
62d1db17
MM
5189 ds_first,
5190 ds_signed = ds_first,
5191 ds_unsigned,
5192 ds_short,
5193 ds_long,
5194 ds_const,
5195 ds_volatile,
5196 ds_restrict,
5197 ds_inline,
5198 ds_virtual,
5199 ds_explicit,
5200 ds_friend,
5201 ds_typedef,
28704289 5202 ds_alias,
7ecbca9d 5203 ds_constexpr,
62d1db17
MM
5204 ds_complex,
5205 ds_thread,
0b2c4be5
DS
5206 ds_type_spec,
5207 ds_redefined_builtin_type_spec,
5208 ds_attribute,
e28d52cf 5209 ds_std_attribute,
0b2c4be5
DS
5210 ds_storage_class,
5211 ds_long_long,
971e17ff 5212 ds_concept,
0b2c4be5 5213 ds_last /* This enumerator must always be the last one. */
a79683d5 5214};
62d1db17
MM
5215
5216/* A decl-specifier-seq. */
5217
a79683d5 5218struct cp_decl_specifier_seq {
0b2c4be5
DS
5219 /* An array of locations for the declaration sepecifiers, indexed by
5220 enum cp_decl_spec_word. */
5221 source_location locations[ds_last];
62d1db17
MM
5222 /* The primary type, if any, given by the decl-specifier-seq.
5223 Modifiers, like "short", "const", and "unsigned" are not
5224 reflected here. This field will be a TYPE, unless a typedef-name
5225 was used, in which case it will be a TYPE_DECL. */
5226 tree type;
5227 /* The attributes, if any, provided with the specifier sequence. */
5228 tree attributes;
e28d52cf
DS
5229 /* The c++11 attributes that follows the type specifier. */
5230 tree std_attributes;
62d1db17
MM
5231 /* If non-NULL, a built-in type that the user attempted to redefine
5232 to some other type. */
5233 tree redefined_builtin_type;
5234 /* The storage class specified -- or sc_none if no storage class was
5235 explicitly specified. */
5236 cp_storage_class storage_class;
78a7c317
DD
5237 /* For the __intN declspec, this stores the index into the int_n_* arrays. */
5238 int int_n_idx;
d9cdfea5
JM
5239 /* True iff TYPE_SPEC defines a class or enum. */
5240 BOOL_BITFIELD type_definition_p : 1;
62d1db17
MM
5241 /* True iff multiple types were (erroneously) specified for this
5242 decl-specifier-seq. */
5243 BOOL_BITFIELD multiple_types_p : 1;
5244 /* True iff multiple storage classes were (erroneously) specified
26106542
LM
5245 for this decl-specifier-seq or a combination of a storage class
5246 with a typedef specifier. */
5247 BOOL_BITFIELD conflicting_specifiers_p : 1;
62d1db17
MM
5248 /* True iff at least one decl-specifier was found. */
5249 BOOL_BITFIELD any_specifiers_p : 1;
67dc1f24
JM
5250 /* True iff at least one type-specifier was found. */
5251 BOOL_BITFIELD any_type_specifiers_p : 1;
62d1db17
MM
5252 /* True iff "int" was explicitly provided. */
5253 BOOL_BITFIELD explicit_int_p : 1;
78a7c317
DD
5254 /* True iff "__intN" was explicitly provided. */
5255 BOOL_BITFIELD explicit_intN_p : 1;
62d1db17
MM
5256 /* True iff "char" was explicitly provided. */
5257 BOOL_BITFIELD explicit_char_p : 1;
b1db7f91
JM
5258 /* True iff ds_thread is set for __thread, not thread_local. */
5259 BOOL_BITFIELD gnu_thread_keyword_p : 1;
186ad798
PC
5260 /* True iff the type is a decltype. */
5261 BOOL_BITFIELD decltype_p : 1;
a79683d5 5262};
62d1db17 5263
058b15c1
MM
5264/* The various kinds of declarators. */
5265
a79683d5 5266enum cp_declarator_kind {
058b15c1
MM
5267 cdk_id,
5268 cdk_function,
5269 cdk_array,
5270 cdk_pointer,
5271 cdk_reference,
5272 cdk_ptrmem,
5273 cdk_error
a79683d5 5274};
058b15c1
MM
5275
5276/* A declarator. */
5277
5278typedef struct cp_declarator cp_declarator;
5279
5280typedef struct cp_parameter_declarator cp_parameter_declarator;
5281
5282/* A parameter, before it has been semantically analyzed. */
5283struct cp_parameter_declarator {
5284 /* The next parameter, or NULL_TREE if none. */
5285 cp_parameter_declarator *next;
5286 /* The decl-specifiers-seq for the parameter. */
62d1db17 5287 cp_decl_specifier_seq decl_specifiers;
058b15c1
MM
5288 /* The declarator for the parameter. */
5289 cp_declarator *declarator;
5290 /* The default-argument expression, or NULL_TREE, if none. */
5291 tree default_argument;
026c3cfd 5292 /* True iff this is a template parameter pack. */
5c4e8e5c 5293 bool template_parameter_pack_p;
058b15c1
MM
5294};
5295
5296/* A declarator. */
5297struct cp_declarator {
5298 /* The kind of declarator. */
30bcc028
DG
5299 ENUM_BITFIELD (cp_declarator_kind) kind : 4;
5300 /* Whether we parsed an ellipsis (`...') just before the declarator,
5301 to indicate this is a parameter pack. */
5302 BOOL_BITFIELD parameter_pack_p : 1;
673c6299 5303 location_t id_loc; /* Currently only set for cdk_id and cdk_function. */
e28d52cf
DS
5304 /* GNU Attributes that apply to this declarator. If the declarator
5305 is a pointer or a reference, these attribute apply to the type
5306 pointed to. */
058b15c1 5307 tree attributes;
e28d52cf
DS
5308 /* Standard C++11 attributes that apply to this declarator. If the
5309 declarator is a pointer or a reference, these attributes apply
5310 to the pointer, rather than to the type pointed to. */
5311 tree std_attributes;
058b15c1
MM
5312 /* For all but cdk_id and cdk_error, the contained declarator. For
5313 cdk_id and cdk_error, guaranteed to be NULL. */
5314 cp_declarator *declarator;
5315 union {
5316 /* For identifiers. */
5317 struct {
2f2bc524 5318 /* If non-NULL, the qualifying scope (a NAMESPACE_DECL or
0cbd7506 5319 *_TYPE) for this identifier. */
1d786913
MM
5320 tree qualifying_scope;
5321 /* The unqualified name of the entity -- an IDENTIFIER_NODE,
5322 BIT_NOT_EXPR, or TEMPLATE_ID_EXPR. */
5323 tree unqualified_name;
058b15c1
MM
5324 /* If this is the name of a function, what kind of special
5325 function (if any). */
5326 special_function_kind sfk;
5327 } id;
5328 /* For functions. */
5329 struct {
b344d949
JM
5330 /* The parameters to the function as a TREE_LIST of decl/default. */
5331 tree parameters;
058b15c1 5332 /* The cv-qualifiers for the function. */
3c01e5df 5333 cp_cv_quals qualifiers;
b5da71d4
VV
5334 /* The virt-specifiers for the function. */
5335 cp_virt_specifiers virt_specifiers;
2eed8e37
BK
5336 /* The ref-qualifier for the function. */
5337 cp_ref_qualifier ref_qualifier;
b8fd7909
JM
5338 /* The transaction-safety qualifier for the function. */
5339 tree tx_qualifier;
058b15c1
MM
5340 /* The exception-specification for the function. */
5341 tree exception_specification;
f57ca1ea
JM
5342 /* The late-specified return type, if any. */
5343 tree late_return_type;
971e17ff
AS
5344 /* The trailing requires-clause, if any. */
5345 tree requires_clause;
058b15c1
MM
5346 } function;
5347 /* For arrays. */
5348 struct {
5349 /* The bounds to the array. */
5350 tree bounds;
5351 } array;
8af2fec4 5352 /* For cdk_pointer and cdk_ptrmem. */
058b15c1
MM
5353 struct {
5354 /* The cv-qualifiers for the pointer. */
3c01e5df 5355 cp_cv_quals qualifiers;
058b15c1
MM
5356 /* For cdk_ptrmem, the class type containing the member. */
5357 tree class_type;
5358 } pointer;
8af2fec4
RY
5359 /* For cdk_reference */
5360 struct {
5361 /* The cv-qualifiers for the reference. These qualifiers are
5362 only used to diagnose ill-formed code. */
5363 cp_cv_quals qualifiers;
5364 /* Whether this is an rvalue reference */
5365 bool rvalue_ref;
5366 } reference;
058b15c1
MM
5367 } u;
5368};
5369
e2c3721c 5370/* A level of template instantiation. */
a608debe 5371struct GTY((chain_next ("%h.next"))) tinst_level {
e2c3721c
PB
5372 /* The immediately deeper level in the chain. */
5373 struct tinst_level *next;
5374
5375 /* The original node. Can be either a DECL (for a function or static
5376 data member) or a TYPE (for a class), depending on what we were
5377 asked to instantiate. */
5378 tree decl;
5379
5380 /* The location where the template is instantiated. */
5381 location_t locus;
5382
4904b64b
JM
5383 /* errorcount+sorrycount when we pushed this level. */
5384 int errors;
5385
e2c3721c
PB
5386 /* True if the location is in a system header. */
5387 bool in_system_header_p;
5388};
5389
0b2c4be5
DS
5390bool decl_spec_seq_has_spec_p (const cp_decl_specifier_seq *, cp_decl_spec);
5391
7e1352fe
NF
5392/* Return the type of the `this' parameter of FNTYPE. */
5393
9173cf24 5394inline tree
7e1352fe
NF
5395type_of_this_parm (const_tree fntype)
5396{
5397 function_args_iterator iter;
5398 gcc_assert (TREE_CODE (fntype) == METHOD_TYPE);
5399 function_args_iter_init (&iter, fntype);
5400 return function_args_iter_cond (&iter);
5401}
5402
5403/* Return the class of the `this' parameter of FNTYPE. */
5404
9173cf24 5405inline tree
7e1352fe
NF
5406class_of_this_parm (const_tree fntype)
5407{
5408 return TREE_TYPE (type_of_this_parm (fntype));
5409}
5410
971e17ff 5411/* True iff T is a variable template declaration. */
4a4f287d
BO
5412inline bool
5413variable_template_p (tree t)
5414{
5415 if (TREE_CODE (t) != TEMPLATE_DECL)
5416 return false;
5e0231c2
JM
5417 if (!PRIMARY_TEMPLATE_P (t))
5418 return false;
4a4f287d
BO
5419 if (tree r = DECL_TEMPLATE_RESULT (t))
5420 return VAR_P (r);
5421 return false;
5422}
5423
971e17ff
AS
5424/* True iff T is a variable concept definition. That is, T is
5425 a variable template declared with the concept specifier. */
5426inline bool
5427variable_concept_p (tree t)
5428{
5429 if (TREE_CODE (t) != TEMPLATE_DECL)
5430 return false;
5431 if (tree r = DECL_TEMPLATE_RESULT (t))
5432 return VAR_P (r) && DECL_DECLARED_CONCEPT_P (r);
5433 return false;
5434}
5435
5436/* True iff T is a concept definition. That is, T is a variable or function
5437 template declared with the concept specifier. */
5438inline bool
5439concept_template_p (tree t)
5440{
5441 if (TREE_CODE (t) != TEMPLATE_DECL)
5442 return false;
5443 if (tree r = DECL_TEMPLATE_RESULT (t))
5444 return VAR_OR_FUNCTION_DECL_P (r) && DECL_DECLARED_CONCEPT_P (r);
5445 return false;
5446}
5447
058b15c1
MM
5448/* A parameter list indicating for a function with no parameters,
5449 e.g "int f(void)". */
5450extern cp_parameter_declarator *no_parameters;
5451
359b8672
AH
5452/* True if we saw "#pragma GCC java_exceptions". */
5453extern bool pragma_java_exceptions;
5454
cda0a029
JM
5455/* Data structure for a mapping from tree to tree that's only used as a cache;
5456 we don't GC-mark trees in the map, and we clear the map when collecting
5457 garbage. Global variables of this type must be marked
5458 GTY((cache,deletable)) so that the gt_cleare_cache function is called by
5459 ggc_collect but we don't try to load the map pointer from a PCH.
5460
5461 FIXME improve to use keep_cache_entry. */
5462class cache_map
5463{
5464 /* Use a lazily initialized pointer rather than a map member since a
5465 hash_map can't be constructed in a static initializer. */
5466 hash_map<tree, tree> *map;
5467
5468public:
5469 tree get (tree key)
5470 {
5471 if (map)
5472 if (tree *slot = map->get (key))
5473 return *slot;
5474 return NULL_TREE;
5475 }
5476
5477 bool put (tree key, tree val)
5478 {
5479 if (!map)
5480 map = new hash_map<tree, tree>;
5481 return map->put (key, val);
5482 }
5483
5484 friend inline void gt_cleare_cache (cache_map &cm)
5485 {
5486 if (cm.map)
5487 cm.map->empty();
5488 }
5489};
5490
51c184be 5491/* in call.c */
0cbd7506 5492extern bool check_dtor_name (tree, tree);
1141ed3f 5493bool magic_varargs_p (tree);
158991b7 5494
4cbc4bd7 5495extern tree build_conditional_expr (location_t, tree, tree, tree,
5ade1ed2 5496 tsubst_flags_t);
89fcabaf 5497extern tree build_addr_func (tree, tsubst_flags_t);
5507a6c3 5498extern void set_flags_from_callee (tree);
94a0dd7b
SL
5499extern tree build_call_a (tree, int, tree*);
5500extern tree build_call_n (tree, int, ...);
0cbd7506 5501extern bool null_ptr_cst_p (tree);
e90abaa0 5502extern bool null_member_pointer_value_p (tree);
58f9752a 5503extern bool sufficient_parms_p (const_tree);
0cbd7506 5504extern tree type_decays_to (tree);
b40e334f
PC
5505extern tree build_user_type_conversion (tree, tree, int,
5506 tsubst_flags_t);
9771b263 5507extern tree build_new_function_call (tree, vec<tree, va_gc> **, bool,
5ade1ed2 5508 tsubst_flags_t);
9771b263 5509extern tree build_operator_new_call (tree, vec<tree, va_gc> **, tree *,
4a84253c 5510 tree *, tree, tree *,
b40e334f 5511 tsubst_flags_t);
9771b263 5512extern tree build_new_method_call (tree, tree, vec<tree, va_gc> **,
c166b898
ILT
5513 tree, int, tree *,
5514 tsubst_flags_t);
9771b263 5515extern tree build_special_member_call (tree, tree, vec<tree, va_gc> **,
c166b898 5516 tree, int, tsubst_flags_t);
4fe977f2
PC
5517extern tree build_new_op (location_t, enum tree_code,
5518 int, tree, tree, tree, tree *,
5ade1ed2 5519 tsubst_flags_t);
9771b263 5520extern tree build_op_call (tree, vec<tree, va_gc> **,
c166b898 5521 tsubst_flags_t);
20b06add 5522extern bool non_placement_deallocation_fn_p (tree);
4b978f96
PC
5523extern tree build_op_delete_call (enum tree_code, tree, tree,
5524 bool, tree, tree,
5525 tsubst_flags_t);
b40e334f 5526extern bool can_convert (tree, tree, tsubst_flags_t);
53db1bc0 5527extern bool can_convert_standard (tree, tree, tsubst_flags_t);
b40e334f
PC
5528extern bool can_convert_arg (tree, tree, tree, int,
5529 tsubst_flags_t);
5530extern bool can_convert_arg_bad (tree, tree, tree, int,
5531 tsubst_flags_t);
0e69fdf0
PC
5532extern bool enforce_access (tree, tree, tree,
5533 tsubst_flags_t);
4c66d85a
JM
5534extern void push_defarg_context (tree);
5535extern void pop_defarg_context (void);
b40e334f
PC
5536extern tree convert_default_arg (tree, tree, tree, int,
5537 tsubst_flags_t);
5538extern tree convert_arg_to_ellipsis (tree, tsubst_flags_t);
e42d0630 5539extern tree build_x_va_arg (source_location, tree, tree);
0cbd7506
MS
5540extern tree cxx_type_promotes_to (tree);
5541extern tree type_passed_as (tree);
b40e334f 5542extern tree convert_for_arg_passing (tree, tree, tsubst_flags_t);
0cbd7506 5543extern bool is_properly_derived_from (tree, tree);
b25dd954 5544extern tree initialize_reference (tree, tree, int,
e495f6b0 5545 tsubst_flags_t);
9771b263 5546extern tree extend_ref_init_temps (tree, tree, vec<tree, va_gc>**);
0cbd7506 5547extern tree make_temporary_var_for_ref_to_temp (tree, tree);
99c4346a 5548extern bool type_has_extended_temps (tree);
0cbd7506 5549extern tree strip_top_quals (tree);
e7f1930f 5550extern bool reference_related_p (tree, tree);
5ade1ed2 5551extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t);
e57d93c6 5552extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int);
61f8d165 5553extern tree build_integral_nontype_arg_conv (tree, tree, tsubst_flags_t);
5ade1ed2
DG
5554extern tree perform_direct_initialization_if_possible (tree, tree, bool,
5555 tsubst_flags_t);
0cbd7506 5556extern tree in_charge_arg_for_name (tree);
e2e03032
PC
5557extern tree build_cxx_call (tree, int, tree *,
5558 tsubst_flags_t);
09357846
JM
5559extern bool is_std_init_list (tree);
5560extern bool is_list_ctor (tree);
0cbd7506 5561extern void validate_conversion_obstack (void);
beb42d20
ST
5562extern void mark_versions_used (tree);
5563extern tree get_function_version_dispatcher (tree);
8d08fdba 5564
51c184be 5565/* in class.c */
2650d9e1 5566extern tree build_vfield_ref (tree, tree);
0cbd7506 5567extern tree build_base_path (enum tree_code, tree,
a271590a 5568 tree, int, tsubst_flags_t);
798ec807
JM
5569extern tree convert_to_base (tree, tree, bool, bool,
5570 tsubst_flags_t);
0cbd7506 5571extern tree convert_to_base_statically (tree, tree);
b2f29cd9
NN
5572extern tree build_vtbl_ref (tree, tree);
5573extern tree build_vfn_ref (tree, tree);
0cbd7506
MS
5574extern tree get_vtable_decl (tree, int);
5575extern void resort_type_method_vec (void *, void *,
5576 gt_pointer_operator, void *);
b77fe7b4 5577extern bool add_method (tree, tree, tree);
971e17ff 5578extern tree currently_open_class (tree);
b2f29cd9 5579extern tree currently_open_derived_class (tree);
2d7d7f0f 5580extern tree outermost_open_class (void);
a6846853 5581extern tree current_nonlambda_class_type (void);
b2f29cd9
NN
5582extern tree finish_struct (tree, tree);
5583extern void finish_struct_1 (tree);
5584extern int resolves_to_fixed_type_p (tree, int *);
5585extern void init_class_processing (void);
5586extern int is_empty_class (tree);
2588c9e9 5587extern bool is_really_empty_class (tree);
29370796 5588extern void pushclass (tree);
b2f29cd9 5589extern void popclass (void);
14d22dd6 5590extern void push_nested_class (tree);
b2f29cd9
NN
5591extern void pop_nested_class (void);
5592extern int current_lang_depth (void);
5593extern void push_lang_context (tree);
5594extern void pop_lang_context (void);
5595extern tree instantiate_type (tree, tree, tsubst_flags_t);
0cbd7506 5596extern void print_class_statistics (void);
b2f29cd9 5597extern void build_self_reference (void);
58f9752a 5598extern int same_signature_p (const_tree, const_tree);
b2f29cd9 5599extern void maybe_add_class_template_decl_list (tree, tree, int);
0cbd7506
MS
5600extern void unreverse_member_declarations (tree);
5601extern void invalidate_class_lookup_cache (void);
5602extern void maybe_note_name_used_in_class (tree, tree);
5603extern void note_name_declared_in_class (tree, tree);
5604extern tree get_vtbl_decl_for_binfo (tree);
bb885938 5605extern void debug_class (tree);
0cbd7506 5606extern void debug_thunks (tree);
0cbd7506
MS
5607extern void set_linkage_according_to_type (tree, tree);
5608extern void determine_key_method (tree);
5609extern void check_for_override (tree, tree);
3db45ab5
MS
5610extern void push_class_stack (void);
5611extern void pop_class_stack (void);
8c95264b 5612extern bool type_has_user_nondefault_constructor (tree);
6ad86a5b 5613extern tree in_class_defaulted_default_constructor (tree);
20f2653e 5614extern bool user_provided_p (tree);
b87d79e6 5615extern bool type_has_user_provided_constructor (tree);
a3320d62 5616extern bool type_has_user_provided_or_explicit_constructor (tree);
a710f1f8 5617extern bool type_has_non_user_provided_default_constructor (tree);
32bfcf80 5618extern bool vbase_has_user_provided_move_assign (tree);
6132bdd7 5619extern tree default_init_uninitialized_part (tree);
fd3faf2b 5620extern bool trivial_default_constructor_is_constexpr (tree);
91ea6df3 5621extern bool type_has_constexpr_default_constructor (tree);
46408846 5622extern bool type_has_virtual_destructor (tree);
ac177431
JM
5623extern bool type_has_move_constructor (tree);
5624extern bool type_has_move_assign (tree);
a2e70335
JM
5625extern bool type_has_user_declared_move_constructor (tree);
5626extern bool type_has_user_declared_move_assign(tree);
95552437 5627extern bool type_build_ctor_call (tree);
eca7fc57 5628extern bool type_build_dtor_call (tree);
f732fa7b 5629extern void explain_non_literal_class (tree);
e9305042 5630extern void inherit_targ_abi_tags (tree);
20f2653e
JM
5631extern void defaulted_late_check (tree);
5632extern bool defaultable_fn_check (tree);
7cb73573 5633extern void check_abi_tags (tree);
d0940d56 5634extern void fixup_type_variants (tree);
8943989d 5635extern void fixup_attribute_variants (tree);
b97e8a14 5636extern tree* decl_cloned_function_p (const_tree, bool);
2650d9e1
SZ
5637extern void clone_function_decl (tree, int);
5638extern void adjust_clone_args (tree);
593a0835 5639extern void deduce_noexcept_on_destructor (tree);
cba0366c 5640extern void insert_late_enum_def_into_classtype_sorted_fields (tree, tree);
22854930
PC
5641extern bool uniquely_derived_from_p (tree, tree);
5642extern bool publicly_uniquely_derived_p (tree, tree);
3a6a88c8 5643extern tree common_enclosing_class (tree, tree);
8d08fdba 5644
51c184be 5645/* in cvt.c */
4b978f96
PC
5646extern tree convert_to_reference (tree, tree, int, int, tree,
5647 tsubst_flags_t);
0cbd7506 5648extern tree convert_from_reference (tree);
574cfaa4 5649extern tree force_rvalue (tree, tsubst_flags_t);
4b978f96
PC
5650extern tree ocp_convert (tree, tree, int, int,
5651 tsubst_flags_t);
5652extern tree cp_convert (tree, tree, tsubst_flags_t);
5653extern tree cp_convert_and_check (tree, tree, tsubst_flags_t);
9771799c 5654extern tree cp_fold_convert (tree, tree);
ebeb2c24
SZ
5655extern tree convert_to_void (tree, impl_conv_void,
5656 tsubst_flags_t);
4b978f96
PC
5657extern tree convert_force (tree, tree, int,
5658 tsubst_flags_t);
0cbd7506
MS
5659extern tree build_expr_type_conversion (int, tree, bool);
5660extern tree type_promotes_to (tree);
5661extern tree perform_qualification_conversions (tree, tree);
b8fd7909
JM
5662extern bool tx_safe_fn_type_p (tree);
5663extern tree tx_unsafe_fn_variant (tree);
5664extern bool can_convert_tx_safety (tree, tree);
8d08fdba 5665
2650d9e1 5666/* in name-lookup.c */
b2f29cd9 5667extern tree pushdecl (tree);
d63d5d0c 5668extern tree pushdecl_maybe_friend (tree, bool);
2650d9e1
SZ
5669extern void maybe_push_cleanup_level (tree);
5670extern tree pushtag (tree, tree, tag_scope);
5671extern tree make_anon_name (void);
5672extern tree pushdecl_top_level_maybe_friend (tree, bool);
5673extern tree pushdecl_top_level_and_finish (tree, tree);
5674extern tree check_for_out_of_scope_variable (tree);
7b3b6ae4
LC
5675extern void dump (cp_binding_level &ref);
5676extern void dump (cp_binding_level *ptr);
2c140474 5677extern void print_other_binding_stack (cp_binding_level *);
2650d9e1 5678extern tree maybe_push_decl (tree);
ae099258 5679extern tree current_decl_namespace (void);
2650d9e1
SZ
5680
5681/* decl.c */
5682extern tree poplevel (int, int, int);
b2f29cd9 5683extern void cxx_init_decl_processing (void);
19114537 5684enum cp_tree_node_structure_enum cp_tree_node_structure
0cbd7506 5685 (union lang_tree_node *);
0cbd7506 5686extern void finish_scope (void);
b2f29cd9
NN
5687extern void push_switch (tree);
5688extern void pop_switch (void);
d5f4eddd 5689extern tree make_lambda_name (void);
b2f29cd9 5690extern int decls_match (tree, tree);
d63d5d0c 5691extern tree duplicate_decls (tree, tree, bool);
0cbd7506 5692extern tree declare_local_label (tree);
5b030314 5693extern tree define_label (location_t, tree);
b2f29cd9 5694extern void check_goto (tree);
1799e5d5 5695extern bool check_omp_return (void);
fc6a28d7 5696extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t);
b939a023 5697extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t);
fafa0521
JH
5698extern tree build_library_fn_ptr (const char *, tree, int);
5699extern tree build_cp_library_fn_ptr (const char *, tree, int);
5700extern tree push_library_fn (tree, tree, tree, int);
5701extern tree push_void_library_fn (tree, tree, int);
b2f29cd9 5702extern tree push_throw_library_fn (tree, tree);
e28d52cf
DS
5703extern void warn_misplaced_attr_for_class_type (source_location location,
5704 tree class_type);
5705extern tree check_tag_decl (cp_decl_specifier_seq *, bool);
62d1db17 5706extern tree shadow_tag (cp_decl_specifier_seq *);
0d9c0892 5707extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *, bool);
4514aa8c 5708extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
e92fb501 5709extern void start_decl_1 (tree, bool);
23bee8f4 5710extern bool check_array_initializer (tree, tree, tree);
d174af6c 5711extern void cp_finish_decl (tree, tree, bool, tree, int);
aab038d5 5712extern int cp_complete_array_type (tree *, tree, bool);
80c6dcf5 5713extern int cp_complete_array_type_or_error (tree *, tree, bool, tsubst_flags_t);
b2f29cd9 5714extern tree build_ptrmemfunc_type (tree);
0cbd7506 5715extern tree build_ptrmem_type (tree, tree);
f30432d7 5716/* the grokdeclarator prototype is in decl.h */
3db45ab5 5717extern tree build_this_parm (tree, cp_cv_quals);
971e17ff 5718extern tree grokparms (tree, tree *);
58f9752a
KG
5719extern int copy_fn_p (const_tree);
5720extern bool move_fn_p (const_tree);
8f5a5a8e 5721extern bool move_signature_fn_p (const_tree);
0cbd7506 5722extern tree get_scope_of_declarator (const cp_declarator *);
b2f29cd9 5723extern void grok_special_member_properties (tree);
58f9752a 5724extern int grok_ctor_properties (const_tree, const_tree);
398cd199 5725extern bool grok_op_properties (tree, bool);
29ef83de
KL
5726extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
5727extern tree xref_tag_from_type (tree, tree, tag_scope);
72f8fc59 5728extern bool xref_basetypes (tree, tree);
90ecaf87
RRC
5729extern tree start_enum (tree, tree, tree, bool, bool *);
5730extern void finish_enum_value_list (tree);
b2f29cd9 5731extern void finish_enum (tree);
fd5c817a 5732extern void build_enumerator (tree, tree, tree, tree, location_t);
adf2edec 5733extern tree lookup_enumerator (tree, tree);
5fde62e2
PC
5734extern bool start_preparsed_function (tree, tree, int);
5735extern bool start_function (cp_decl_specifier_seq *,
5736 const cp_declarator *, tree);
b2f29cd9
NN
5737extern tree begin_function_body (void);
5738extern void finish_function_body (tree);
a68ab351 5739extern tree outer_curly_brace_block (tree);
b2f29cd9 5740extern tree finish_function (int);
02c5ff73 5741extern tree grokmethod (cp_decl_specifier_seq *, const cp_declarator *, tree);
0cbd7506 5742extern void maybe_register_incomplete_var (tree);
68017cb4 5743extern void maybe_commonize_var (tree);
b2f29cd9 5744extern void complete_vars (tree);
7bead48f 5745extern tree static_fn_type (tree);
0cbd7506
MS
5746extern void revert_static_member_fn (tree);
5747extern void fixup_anonymous_aggr (tree);
fa2200cb 5748extern tree compute_array_index_type (tree, tree, tsubst_flags_t);
4004afb3 5749extern tree check_default_argument (tree, tree, tsubst_flags_t);
0cbd7506
MS
5750typedef int (*walk_namespaces_fn) (tree, void *);
5751extern int walk_namespaces (walk_namespaces_fn,
5752 void *);
5753extern int wrapup_globals_for_namespace (tree, void *);
5754extern tree create_implicit_typedef (tree, tree);
ac7d7749 5755extern int local_variable_p (const_tree);
0cbd7506
MS
5756extern tree register_dtor_fn (tree);
5757extern tmpl_spec_kind current_tmpl_spec_kind (int);
bb885938 5758extern tree cp_fname_init (const char *, tree *);
c79efc4d 5759extern tree cxx_builtin_function (tree decl);
5779e713 5760extern tree cxx_builtin_function_ext_scope (tree decl);
0cbd7506
MS
5761extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
5762extern void warn_extern_redeclared_static (tree, tree);
fc26fae3 5763extern tree cxx_comdat_group (tree);
6de9cd9a 5764extern bool cp_missing_noreturn_ok_p (tree);
9771b263 5765extern void initialize_artificial_var (tree, vec<constructor_elt, va_gc> *);
0cbd7506 5766extern tree check_var_type (tree, tree);
754af126 5767extern tree reshape_init (tree, tree, tsubst_flags_t);
d4b5fb22 5768extern tree next_initializable_field (tree);
79d8a272
JM
5769extern tree fndecl_declared_return_type (tree);
5770extern bool undeduced_auto_decl (tree);
5771extern void require_deduced_type (tree);
47aa0df4 5772
3368cdd3 5773extern bool defer_mark_used_calls;
9771b263 5774extern GTY(()) vec<tree, va_gc> *deferred_mark_used_calls;
c2255bc4 5775extern tree finish_case_label (location_t, tree, tree);
574cfaa4 5776extern tree cxx_maybe_build_cleanup (tree, tsubst_flags_t);
3368cdd3 5777
51c184be 5778/* in decl2.c */
613aba20 5779extern void note_mangling_alias (tree, tree);
ec5a0fe0 5780extern void generate_mangling_aliases (void);
0cbd7506 5781extern bool check_java_method (tree);
2eed8e37
BK
5782extern tree build_memfn_type (tree, tree, cp_cv_quals, cp_ref_qualifier);
5783extern tree build_pointer_ptrmemfn_type (tree);
643d4cd6 5784extern tree change_return_type (tree, tree);
0cbd7506
MS
5785extern void maybe_retrofit_in_chrg (tree);
5786extern void maybe_make_one_only (tree);
d6dcdbd5 5787extern bool vague_linkage_p (tree);
0cbd7506 5788extern void grokclassfn (tree, tree,
e2537f2c 5789 enum overload_flags);
e59baf05 5790extern tree grok_array_decl (location_t, tree, tree, bool);
574cfaa4 5791extern tree delete_sanity (tree, tree, bool, int, tsubst_flags_t);
0cbd7506
MS
5792extern tree check_classfn (tree, tree, tree);
5793extern void check_member_template (tree);
5794extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
d174af6c 5795 tree, bool, tree, tree);
0cbd7506 5796extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
a6d9bc9d 5797 tree, tree);
5dc11954 5798extern tree cp_reconstruct_complex_type (tree, tree);
404c2aea 5799extern bool attributes_naming_typedef_ok (tree);
0cbd7506
MS
5800extern void cplus_decl_attributes (tree *, tree, int);
5801extern void finish_anon_union (tree);
d7438551 5802extern void cxx_post_compilation_parsing_cleanups (void);
0cbd7506
MS
5803extern tree coerce_new_type (tree);
5804extern tree coerce_delete_type (tree);
5805extern void comdat_linkage (tree);
5806extern void determine_visibility (tree);
b9e75696 5807extern void constrain_class_visibility (tree);
944b63db
JM
5808extern void reset_type_linkage (tree);
5809extern void tentative_decl_linkage (tree);
0cbd7506 5810extern void import_export_decl (tree);
c38e9817 5811extern tree build_cleanup (tree);
9771b263 5812extern tree build_offset_ref_call_from_tree (tree, vec<tree, va_gc> **,
18140454 5813 tsubst_flags_t);
aef4a215
JM
5814extern bool decl_constant_var_p (tree);
5815extern bool decl_maybe_constant_var_p (tree);
944b63db 5816extern void no_linkage_error (tree);
0cbd7506 5817extern void check_default_args (tree);
9965f21f 5818extern bool mark_used (tree);
2e649151 5819extern bool mark_used (tree, tsubst_flags_t);
d174af6c 5820extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
0cbd7506
MS
5821extern tree cp_build_parm_decl (tree, tree);
5822extern tree get_guard (tree);
e93ca5ca 5823extern tree get_guard_cond (tree, bool);
0cbd7506 5824extern tree set_guard (tree);
7c424acd 5825extern tree get_tls_wrapper_fn (tree);
0cbd7506
MS
5826extern void mark_needed (tree);
5827extern bool decl_needed_p (tree);
5828extern void note_vague_linkage_fn (tree);
5e0231c2 5829extern void note_variable_template_instantiation (tree);
3db45ab5 5830extern tree build_artificial_parm (tree, tree);
4847609e 5831extern bool possibly_inlined_p (tree);
448545cb 5832extern int parm_index (tree);
2077db1b
CT
5833extern tree vtv_start_verification_constructor_init_function (void);
5834extern tree vtv_finish_verification_constructor_init_function (tree);
acf0174b 5835extern bool cp_omp_mappable_type (tree);
8d08fdba 5836
824b9a4c 5837/* in error.c */
b2f29cd9 5838extern const char *type_as_string (tree, int);
f41c4af3 5839extern const char *type_as_string_translate (tree, int);
b2f29cd9 5840extern const char *decl_as_string (tree, int);
f41c4af3 5841extern const char *decl_as_string_translate (tree, int);
7496cd5b 5842extern const char *decl_as_dwarf_string (tree, int);
b2f29cd9 5843extern const char *expr_as_string (tree, int);
f41c4af3 5844extern const char *lang_decl_name (tree, int, bool);
7496cd5b 5845extern const char *lang_decl_dwarf_name (tree, int, bool);
0cbd7506
MS
5846extern const char *language_to_string (enum languages);
5847extern const char *class_key_or_enum_as_string (tree);
5d80a306 5848extern void maybe_warn_variadic_templates (void);
848f237b 5849extern void maybe_warn_cpp0x (cpp0x_warn_str str);
59cc9210 5850extern bool pedwarn_cxx98 (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
501c95ff 5851extern location_t location_of (tree);
993acb36
NF
5852extern void qualified_name_lookup_error (tree, tree, tree,
5853 location_t);
824b9a4c 5854
51c184be 5855/* in except.c */
b2f29cd9
NN
5856extern void init_exception_processing (void);
5857extern tree expand_start_catch_block (tree);
5858extern void expand_end_catch_block (void);
b2f29cd9
NN
5859extern tree build_exc_ptr (void);
5860extern tree build_throw (tree);
58f9752a 5861extern int nothrow_libfn_p (const_tree);
b2f29cd9 5862extern void check_handlers (tree);
59f9c2ed 5863extern tree finish_noexcept_expr (tree, tsubst_flags_t);
6eaade31 5864extern bool expr_noexcept_p (tree, tsubst_flags_t);
2c5df20f 5865extern void perform_deferred_noexcept_checks (void);
3a55fb4c
JM
5866extern bool nothrow_spec_p (const_tree);
5867extern bool type_noexcept_p (const_tree);
5868extern bool type_throw_all_p (const_tree);
5869extern tree build_noexcept_spec (tree, int);
b2f29cd9 5870extern void choose_personality_routine (enum languages);
f2162c3d 5871extern tree build_must_not_throw_expr (tree,tree);
6cad4e17 5872extern tree eh_type_info (tree);
2650d9e1
SZ
5873extern tree begin_eh_spec_block (void);
5874extern void finish_eh_spec_block (tree, tree);
f9417da1 5875extern tree build_eh_type_type (tree);
3b06d379 5876extern tree cp_protect_cleanup_actions (void);
12893402 5877extern tree create_try_catch_expr (tree, tree);
8d08fdba 5878
51c184be 5879/* in expr.c */
0cbd7506 5880extern tree cplus_expand_constant (tree);
1807ffc1
MS
5881extern tree mark_rvalue_use (tree,
5882 location_t = UNKNOWN_LOCATION,
5883 bool = true);
03a904b5
JJ
5884extern tree mark_lvalue_use (tree);
5885extern tree mark_type_use (tree);
5886extern void mark_exp_read (tree);
8d08fdba 5887
bd6dd845 5888/* friend.c */
b2f29cd9 5889extern int is_friend (tree, tree);
19db77ce 5890extern void make_friend_class (tree, tree, bool);
0cbd7506 5891extern void add_friend (tree, tree, bool);
e2537f2c 5892extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool);
bd6dd845 5893
51c184be 5894/* in init.c */
1f5a253a 5895extern tree expand_member_init (tree);
2282d28d 5896extern void emit_mem_initializers (tree);
5ade1ed2
DG
5897extern tree build_aggr_init (tree, tree, int,
5898 tsubst_flags_t);
9e1e64ec 5899extern int is_class_type (tree, int);
b2f29cd9 5900extern tree get_type_value (tree);
0cbd7506 5901extern tree build_zero_init (tree, tree, bool);
309714d4
JM
5902extern tree build_value_init (tree, tsubst_flags_t);
5903extern tree build_value_init_noctor (tree, tsubst_flags_t);
b15ea309 5904extern tree get_nsdmi (tree, bool);
a378996b
PC
5905extern tree build_offset_ref (tree, tree, bool,
5906 tsubst_flags_t);
7d5e76c8 5907extern tree throw_bad_array_new_length (void);
9771b263
DN
5908extern tree build_new (vec<tree, va_gc> **, tree, tree,
5909 vec<tree, va_gc> **, int,
5ade1ed2 5910 tsubst_flags_t);
fe5b5c36 5911extern tree get_temp_regvar (tree, tree);
5ade1ed2
DG
5912extern tree build_vec_init (tree, tree, tree, bool, int,
5913 tsubst_flags_t);
0cbd7506
MS
5914extern tree build_delete (tree, tree,
5915 special_function_kind,
574cfaa4 5916 int, int, tsubst_flags_t);
b2f29cd9 5917extern void push_base_cleanups (void);
0cbd7506 5918extern tree build_vec_delete (tree, tree,
574cfaa4
JM
5919 special_function_kind, int,
5920 tsubst_flags_t);
0cbd7506
MS
5921extern tree create_temporary_var (tree);
5922extern void initialize_vtbl_ptrs (tree);
5923extern tree build_java_class_ref (tree);
69eb4fde
JM
5924extern tree scalar_constant_value (tree);
5925extern tree decl_really_constant_value (tree);
40bb78ad 5926extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool);
2077db1b 5927extern tree build_vtbl_address (tree);
8d08fdba 5928
51c184be 5929/* in lex.c */
b2f29cd9 5930extern void cxx_dup_lang_specific_decl (tree);
b2f29cd9 5931extern void yyungetc (int, int);
b2f29cd9 5932
0cbd7506
MS
5933extern tree unqualified_name_lookup_error (tree);
5934extern tree unqualified_fn_lookup_error (tree);
b2f29cd9 5935extern tree build_lang_decl (enum tree_code, tree, tree);
4cc2a722 5936extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree);
b2f29cd9 5937extern void retrofit_lang_decl (tree);
0cbd7506
MS
5938extern tree copy_decl (tree);
5939extern tree copy_type (tree);
b2f29cd9 5940extern tree cxx_make_type (enum tree_code);
9e1e64ec 5941extern tree make_class_type (enum tree_code);
4bfec483 5942extern bool cxx_init (void);
0cbd7506 5943extern void cxx_finish (void);
61172206 5944extern bool in_main_input_context (void);
8d08fdba 5945
51c184be 5946/* in method.c */
0cbd7506
MS
5947extern void init_method (void);
5948extern tree make_thunk (tree, bool, tree, tree);
5949extern void finish_thunk (tree);
5950extern void use_thunk (tree, bool);
ac177431 5951extern bool trivial_fn_p (tree);
dd5d5481 5952extern bool is_trivially_xible (enum tree_code, tree, tree);
b15ea309
JM
5953extern tree get_defaulted_eh_spec (tree);
5954extern tree unevaluated_noexcept_spec (void);
5955extern void after_nsdmi_defaulted_late_checks (tree);
ac177431 5956extern bool maybe_explain_implicit_delete (tree);
f732fa7b 5957extern void explain_implicit_non_constexpr (tree);
85b5d65a 5958extern void deduce_inheriting_ctor (tree);
0cbd7506 5959extern void synthesize_method (tree);
0cbd7506
MS
5960extern tree lazily_declare_fn (special_function_kind,
5961 tree);
58f9752a
KG
5962extern tree skip_artificial_parms_for (const_tree, tree);
5963extern int num_artificial_parms_for (const_tree);
0cbd7506 5964extern tree make_alias_for (tree, tree);
4577f730 5965extern tree get_copy_ctor (tree, tsubst_flags_t);
ac177431
JM
5966extern tree get_copy_assign (tree);
5967extern tree get_default_ctor (tree);
4577f730 5968extern tree get_dtor (tree, tsubst_flags_t);
5af1876c 5969extern tree get_inherited_ctor (tree);
ac177431 5970extern tree locate_ctor (tree);
593a0835 5971extern tree implicitly_declare_fn (special_function_kind, tree,
85b5d65a 5972 bool, tree, tree);
8d08fdba 5973
46e8c075 5974/* In optimize.c */
0cbd7506 5975extern bool maybe_clone_body (tree);
46e8c075 5976
b15ea309
JM
5977/* In parser.c */
5978extern tree cp_convert_range_for (tree, tree, tree, bool);
5979extern bool parsing_nsdmi (void);
5980extern void inject_this_parameter (tree, cp_cv_quals);
5981
51c184be 5982/* in pt.c */
157b0647 5983extern bool check_template_shadow (tree);
0cbd7506 5984extern tree get_innermost_template_args (tree, int);
b2f29cd9
NN
5985extern void maybe_begin_member_template_processing (tree);
5986extern void maybe_end_member_template_processing (void);
0cbd7506 5987extern tree finish_member_template_decl (tree);
b2f29cd9 5988extern void begin_template_parm_list (void);
9b910171 5989extern bool begin_specialization (void);
0cbd7506
MS
5990extern void reset_specialization (void);
5991extern void end_specialization (void);
5992extern void begin_explicit_instantiation (void);
5993extern void end_explicit_instantiation (void);
5994extern tree check_explicit_specialization (tree, tree, int, int);
1dec70fa
PC
5995extern int num_template_headers_for_class (tree);
5996extern void check_template_variable (tree);
86a09a9e 5997extern tree make_auto (void);
79d8a272 5998extern tree make_decltype_auto (void);
971e17ff
AS
5999extern tree do_auto_deduction (tree, tree, tree);
6000extern tree do_auto_deduction (tree, tree, tree,
6001 tsubst_flags_t,
6002 auto_deduction_context);
86a09a9e 6003extern tree type_uses_auto (tree);
1a11a94f 6004extern tree type_uses_auto_or_concept (tree);
aa373032
DS
6005extern void append_type_to_template_for_access_check (tree, tree, tree,
6006 location_t);
91f1c208 6007extern tree convert_generic_types_to_packs (tree, int, int);
f57ca1ea 6008extern tree splice_late_return_type (tree, tree);
86a09a9e 6009extern bool is_auto (const_tree);
1a11a94f 6010extern bool is_auto_or_concept (const_tree);
c2255bc4 6011extern tree process_template_parm (tree, location_t, tree,
9ae8d9df 6012 bool, bool);
b2f29cd9 6013extern tree end_template_parm_list (tree);
971e17ff 6014extern void end_template_parm_list (void);
b2f29cd9 6015extern void end_template_decl (void);
04daa92b 6016extern tree maybe_update_decl_type (tree, tree);
86d4e13f 6017extern bool check_default_tmpl_args (tree, tree, bool, bool, int);
b2f29cd9 6018extern tree push_template_decl (tree);
d63d5d0c 6019extern tree push_template_decl_real (tree, bool);
85b5d65a 6020extern tree add_inherited_template_parms (tree, tree);
971e17ff 6021extern bool redeclare_class_template (tree, tree, tree);
0cbd7506
MS
6022extern tree lookup_template_class (tree, tree, tree, tree,
6023 int, tsubst_flags_t);
6024extern tree lookup_template_function (tree, tree);
4a4f287d 6025extern tree lookup_template_variable (tree, tree);
b2f29cd9 6026extern int uses_template_parms (tree);
a459b07f 6027extern bool uses_template_parms_level (tree, int);
e0e1b357 6028extern bool in_template_function (void);
b2f29cd9 6029extern tree instantiate_class_template (tree);
3e4a3562 6030extern tree instantiate_template (tree, tree, tsubst_flags_t);
cd057e3a 6031extern tree fn_type_unification (tree, tree, tree,
c166b898 6032 const tree *, unsigned int,
3d2f6864 6033 tree, unification_kind_t, int,
2b24855e 6034 bool, bool);
b2f29cd9 6035extern void mark_decl_instantiated (tree, int);
dda04398 6036extern int more_specialized_fn (tree, tree, int);
eb8845be 6037extern void do_decl_instantiation (tree, tree);
b2f29cd9 6038extern void do_type_instantiation (tree, tree, tsubst_flags_t);
15305a73 6039extern bool always_instantiate_p (tree);
10261728 6040extern void maybe_instantiate_noexcept (tree);
eba839f9 6041extern tree instantiate_decl (tree, int, bool);
58f9752a 6042extern int comp_template_parms (const_tree, const_tree);
5d80a306 6043extern bool uses_parameter_packs (tree);
58f9752a 6044extern bool template_parameter_pack_p (const_tree);
d40a19da
DS
6045extern bool function_parameter_pack_p (const_tree);
6046extern bool function_parameter_expanded_from_pack_p (tree, tree);
5d80a306 6047extern tree make_pack_expansion (tree);
7b3e2d46 6048extern bool check_for_bare_parameter_packs (tree);
aa373032 6049extern tree build_template_info (tree, tree);
f9329c35 6050extern tree get_template_info (const_tree);
9771b263 6051extern vec<qualified_typedef_usage_t, va_gc> *get_types_needing_access_check (tree);
0cbd7506
MS
6052extern int template_class_depth (tree);
6053extern int is_specialization_of (tree, tree);
6054extern bool is_specialization_of_friend (tree, tree);
5f5babf1 6055extern tree get_pattern_parm (tree, tree);
0cbd7506 6056extern int comp_template_args (tree, tree);
9ce387d9 6057extern tree maybe_process_partial_specialization (tree);
0cbd7506
MS
6058extern tree most_specialized_instantiation (tree);
6059extern void print_candidates (tree);
6060extern void instantiate_pending_templates (int);
4004afb3
PC
6061extern tree tsubst_default_argument (tree, tree, tree,
6062 tsubst_flags_t);
d5c8be27 6063extern tree tsubst (tree, tree, tsubst_flags_t, tree);
0cbd7506 6064extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t,
015c2c66 6065 tree, bool, bool);
971e17ff
AS
6066extern tree tsubst_expr (tree, tree, tsubst_flags_t,
6067 tree, bool);
6068extern tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree);
b2f29cd9
NN
6069extern tree most_general_template (tree);
6070extern tree get_mostly_instantiated_function_type (tree);
75a0d320 6071extern bool problematic_instantiation_changed (void);
b2f29cd9 6072extern void record_last_problematic_instantiation (void);
e2c3721c 6073extern struct tinst_level *current_instantiation(void);
b4d5e41f 6074extern bool instantiating_current_function_p (void);
a723baf1 6075extern tree maybe_get_template_decl_from_type_decl (tree);
67ffc812 6076extern int processing_template_parmlist;
0cbd7506 6077extern bool dependent_type_p (tree);
1cb801bc 6078extern bool dependent_scope_p (tree);
58f9752a 6079extern bool any_dependent_template_arguments_p (const_tree);
0cbd7506
MS
6080extern bool dependent_template_p (tree);
6081extern bool dependent_template_id_p (tree, tree);
6082extern bool type_dependent_expression_p (tree);
9771b263 6083extern bool any_type_dependent_arguments_p (const vec<tree, va_gc> *);
d95f258e 6084extern bool any_type_dependent_elements_p (const_tree);
5094a795 6085extern bool type_dependent_expression_p_push (tree);
0cbd7506 6086extern bool value_dependent_expression_p (tree);
2c905502 6087extern bool instantiation_dependent_expression_p (tree);
58f9752a 6088extern bool any_value_dependent_elements_p (const_tree);
a68ab351 6089extern bool dependent_omp_for_p (tree, tree, tree, tree);
0cbd7506
MS
6090extern tree resolve_typename_type (tree, bool);
6091extern tree template_for_substitution (tree);
6092extern tree build_non_dependent_expr (tree);
9771b263 6093extern void make_args_non_dependent (vec<tree, va_gc> *);
0cbd7506 6094extern bool reregister_specialization (tree, tree, tree);
234bef96
PC
6095extern tree instantiate_non_dependent_expr (tree);
6096extern tree instantiate_non_dependent_expr_sfinae (tree, tsubst_flags_t);
1b5695e6 6097extern tree instantiate_non_dependent_expr_internal (tree, tsubst_flags_t);
8de8fdb4 6098extern bool variable_template_specialization_p (tree);
28704289 6099extern bool alias_type_or_template_p (tree);
1cb2b9a1 6100extern bool alias_template_specialization_p (const_tree);
31cb2db0 6101extern bool dependent_alias_template_spec_p (const_tree);
9ba7a2f2 6102extern bool explicit_class_specialization_p (tree);
75a0d320
PC
6103extern bool push_tinst_level (tree);
6104extern bool push_tinst_level_loc (tree, location_t);
2a3dbebf 6105extern void pop_tinst_level (void);
e2c3721c 6106extern struct tinst_level *outermost_tinst_level(void);
2b110bfc 6107extern void init_template_processing (void);
7dcfe861 6108extern void print_template_statistics (void);
f9329c35 6109bool template_template_parameter_p (const_tree);
74788b80 6110bool template_type_parameter_p (const_tree);
58926110 6111extern bool primary_template_instantiation_p (const_tree);
f9329c35 6112extern tree get_primary_template_innermost_parameters (const_tree);
3910807d 6113extern tree get_template_parms_at_level (tree, int);
f9329c35
DS
6114extern tree get_template_innermost_arguments (const_tree);
6115extern tree get_template_argument_pack_elems (const_tree);
ccb05613
JM
6116extern tree get_function_template_decl (const_tree);
6117extern tree resolve_nondeduced_context (tree);
c41095db 6118extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
971e17ff
AS
6119extern tree coerce_template_parms (tree, tree, tree);
6120extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t);
6121extern void register_local_specialization (tree, tree);
6122extern tree retrieve_local_specialization (tree);
6123extern tree extract_fnparm_pack (tree, tree *);
6124extern tree template_parm_to_arg (tree);
ccb05613 6125
824b9a4c 6126/* in repo.c */
0cbd7506
MS
6127extern void init_repo (void);
6128extern int repo_emit_p (tree);
58f9752a 6129extern bool repo_export_class_p (const_tree);
0cbd7506 6130extern void finish_repo (void);
824b9a4c
MS
6131
6132/* in rtti.c */
94214953 6133/* A vector of all tinfo decls that haven't been emitted yet. */
9771b263 6134extern GTY(()) vec<tree, va_gc> *unemitted_tinfo_decls;
a260bce6 6135
0cbd7506 6136extern void init_rtti_processing (void);
795801d6 6137extern tree build_typeid (tree, tsubst_flags_t);
0cbd7506 6138extern tree get_tinfo_decl (tree);
795801d6 6139extern tree get_typeid (tree, tsubst_flags_t);
6f06d231 6140extern tree build_headof (tree);
5ade1ed2 6141extern tree build_dynamic_cast (tree, tree, tsubst_flags_t);
0cbd7506
MS
6142extern void emit_support_tinfos (void);
6143extern bool emit_tinfo_decl (tree);
8d08fdba 6144
51c184be 6145/* in search.c */
0cbd7506 6146extern bool accessible_base_p (tree, tree, bool);
22854930
PC
6147extern tree lookup_base (tree, tree, base_access,
6148 base_kind *, tsubst_flags_t);
0cbd7506
MS
6149extern tree dcast_base_hint (tree, tree);
6150extern int accessible_p (tree, tree, bool);
cf3c30d3 6151extern int accessible_in_template_p (tree, tree);
0cbd7506 6152extern tree lookup_field_1 (tree, tree, bool);
86ac0575 6153extern tree lookup_field (tree, tree, int, bool);
0cbd7506 6154extern int lookup_fnfields_1 (tree, tree);
ac177431 6155extern tree lookup_fnfields_slot (tree, tree);
fa4ba4af 6156extern tree lookup_fnfields_slot_nolazy (tree, tree);
0cbd7506 6157extern int class_method_index_for_fn (tree, tree);
b2f29cd9 6158extern tree lookup_fnfields (tree, tree, int);
db422ace
PC
6159extern tree lookup_member (tree, tree, int, bool,
6160 tsubst_flags_t);
8ece8dfb 6161extern tree lookup_member_fuzzy (tree, tree, bool);
b2f29cd9 6162extern int look_for_overrides (tree, tree);
0cbd7506 6163extern void get_pure_virtuals (tree);
b2f29cd9
NN
6164extern void maybe_suppress_debug_info (tree);
6165extern void note_debug_info_needed (tree);
b2f29cd9 6166extern void print_search_statistics (void);
b2f29cd9
NN
6167extern void reinit_search_statistics (void);
6168extern tree current_scope (void);
0cbd7506
MS
6169extern int at_function_scope_p (void);
6170extern bool at_class_scope_p (void);
6171extern bool at_namespace_scope_p (void);
b2f29cd9 6172extern tree context_for_name_lookup (tree);
9c7d5cae 6173extern tree lookup_conversions (tree);
b2f29cd9 6174extern tree binfo_from_vbase (tree);
58c42dc2 6175extern tree binfo_for_vbase (tree, tree);
b2f29cd9 6176extern tree look_for_overrides_here (tree, tree);
5d5a519f
NS
6177#define dfs_skip_bases ((tree)1)
6178extern tree dfs_walk_all (tree, tree (*) (tree, void *),
6179 tree (*) (tree, void *), void *);
6180extern tree dfs_walk_once (tree, tree (*) (tree, void *),
6181 tree (*) (tree, void *), void *);
0cbd7506
MS
6182extern tree binfo_via_virtual (tree, tree);
6183extern tree build_baselink (tree, tree, tree, tree);
9e259dd1 6184extern tree adjust_result_of_qualified_name_lookup
0cbd7506 6185 (tree, tree, tree);
dbbf88d1
NS
6186extern tree copied_binfo (tree, tree);
6187extern tree original_binfo (tree, tree);
0cbd7506 6188extern int shared_member_p (tree);
dbbf88d1 6189
d6b418fa
SM
6190/* The representation of a deferred access check. */
6191
a79683d5 6192struct GTY(()) deferred_access_check {
d6b418fa
SM
6193 /* The base class in which the declaration is referenced. */
6194 tree binfo;
6195 /* The declaration whose access must be checked. */
6196 tree decl;
6197 /* The declaration that should be used in the error message. */
6198 tree diag_decl;
b3ff651a
JM
6199 /* The location of this access. */
6200 location_t loc;
a79683d5 6201};
d6b418fa 6202
ad321293 6203/* in semantics.c */
8d241e0b 6204extern void push_deferring_access_checks (deferring_kind);
cf22909c
KL
6205extern void resume_deferring_access_checks (void);
6206extern void stop_deferring_access_checks (void);
6207extern void pop_deferring_access_checks (void);
9771b263 6208extern vec<deferred_access_check, va_gc> *get_deferred_access_checks (void);
0ef08a81 6209extern void reopen_deferring_access_checks (vec<deferred_access_check, va_gc> *);
0cbd7506 6210extern void pop_to_parent_deferring_access_checks (void);
9771b263 6211extern bool perform_access_checks (vec<deferred_access_check, va_gc> *,
0e69fdf0
PC
6212 tsubst_flags_t);
6213extern bool perform_deferred_access_checks (tsubst_flags_t);
6214extern bool perform_or_defer_access_check (tree, tree, tree,
6215 tsubst_flags_t);
971e17ff
AS
6216
6217/* RAII sentinel to ensures that deferred access checks are popped before
6218 a function returns. */
6219
6220struct deferring_access_check_sentinel
6221{
6222 deferring_access_check_sentinel ()
6223 {
6224 push_deferring_access_checks (dk_deferred);
6225 }
6226 ~deferring_access_check_sentinel ()
6227 {
6228 pop_deferring_access_checks ();
6229 }
6230};
6231
ed3d0b14 6232extern int stmts_are_full_exprs_p (void);
0cbd7506 6233extern void init_cp_semantics (void);
20aff0b3 6234extern tree do_poplevel (tree);
20f18c3c 6235extern void break_maybe_infinite_loop (void);
350fae66 6236extern void add_decl_expr (tree);
14a3430e 6237extern tree maybe_cleanup_point_expr_void (tree);
0cbd7506
MS
6238extern tree finish_expr_stmt (tree);
6239extern tree begin_if_stmt (void);
6240extern void finish_if_stmt_cond (tree, tree);
6241extern tree finish_then_clause (tree);
325c3691 6242extern void begin_else_clause (tree);
0cbd7506
MS
6243extern void finish_else_clause (tree);
6244extern void finish_if_stmt (tree);
6245extern tree begin_while_stmt (void);
c5028d80 6246extern void finish_while_stmt_cond (tree, tree, bool);
0cbd7506
MS
6247extern void finish_while_stmt (tree);
6248extern tree begin_do_stmt (void);
6249extern void finish_do_body (tree);
c5028d80 6250extern void finish_do_stmt (tree, tree, bool);
0cbd7506 6251extern tree finish_return_stmt (tree);
3f43ac31
RRC
6252extern tree begin_for_scope (tree *);
6253extern tree begin_for_stmt (tree, tree);
0cbd7506 6254extern void finish_for_init_stmt (tree);
c5028d80 6255extern void finish_for_cond (tree, tree, bool);
0cbd7506
MS
6256extern void finish_for_expr (tree, tree);
6257extern void finish_for_stmt (tree);
3f43ac31 6258extern tree begin_range_for_stmt (tree, tree);
f9132eb7
RRC
6259extern void finish_range_for_decl (tree, tree, tree);
6260extern void finish_range_for_stmt (tree);
0cbd7506
MS
6261extern tree finish_break_stmt (void);
6262extern tree finish_continue_stmt (void);
6263extern tree begin_switch_stmt (void);
6264extern void finish_switch_cond (tree, tree);
6265extern void finish_switch_stmt (tree);
0cbd7506
MS
6266extern tree finish_goto_stmt (tree);
6267extern tree begin_try_block (void);
6268extern void finish_try_block (tree);
0cbd7506 6269extern void finish_handler_sequence (tree);
eaf6fb90 6270extern tree begin_function_try_block (tree *);
0cbd7506 6271extern void finish_function_try_block (tree);
eaf6fb90 6272extern void finish_function_handler_sequence (tree, tree);
0cbd7506
MS
6273extern void finish_cleanup_try_block (tree);
6274extern tree begin_handler (void);
6275extern void finish_handler_parms (tree, tree);
6276extern void finish_handler (tree);
6277extern void finish_cleanup (tree, tree);
2d76680f 6278extern bool is_this_parameter (tree);
325c3691
RH
6279
6280enum {
b8fd7909 6281 BCS_NORMAL = 0,
325c3691
RH
6282 BCS_NO_SCOPE = 1,
6283 BCS_TRY_BLOCK = 2,
b8fd7909
JM
6284 BCS_FN_BODY = 4,
6285 BCS_TRANSACTION = 8
325c3691 6286};
0cbd7506 6287extern tree begin_compound_stmt (unsigned int);
325c3691 6288
0cbd7506 6289extern void finish_compound_stmt (tree);
1c384bf1
RH
6290extern tree finish_asm_stmt (int, tree, tree, tree, tree,
6291 tree);
0cbd7506
MS
6292extern tree finish_label_stmt (tree);
6293extern void finish_label_decl (tree);
6294extern tree finish_parenthesized_expr (tree);
10c6dc8e 6295extern tree force_paren_expr (tree);
a3f10e50 6296extern tree finish_non_static_data_member (tree, tree, tree);
0cbd7506
MS
6297extern tree begin_stmt_expr (void);
6298extern tree finish_stmt_expr_expr (tree, tree);
6299extern tree finish_stmt_expr (tree, bool);
c2acde1e 6300extern tree stmt_expr_value_expr (tree);
9af66ed1 6301bool empty_expr_stmt_p (tree);
cdc23b1b 6302extern tree perform_koenig_lookup (tree, vec<tree, va_gc> *,
94df301f 6303 tsubst_flags_t);
9771b263 6304extern tree finish_call_expr (tree, vec<tree, va_gc> **, bool,
c166b898 6305 bool, tsubst_flags_t);
dc062b49 6306extern tree finish_template_variable (tree, tsubst_flags_t = tf_warning_or_error);
0cbd7506
MS
6307extern tree finish_increment_expr (tree, enum tree_code);
6308extern tree finish_this_expr (void);
c564f42d 6309extern tree finish_pseudo_destructor_expr (tree, tree, tree, location_t);
e59baf05
JM
6310extern tree finish_unary_op_expr (location_t, enum tree_code, tree,
6311 tsubst_flags_t);
834aa426 6312extern tree finish_compound_literal (tree, tree, tsubst_flags_t);
0cbd7506
MS
6313extern tree finish_fname (tree);
6314extern void finish_translation_unit (void);
6315extern tree finish_template_type_parm (tree, tree);
b2f29cd9 6316extern tree finish_template_template_parm (tree, tree);
e3c888eb 6317extern tree begin_class_definition (tree);
0cbd7506
MS
6318extern void finish_template_decl (tree);
6319extern tree finish_template_type (tree, tree, int);
6320extern tree finish_base_specifier (tree, tree, bool);
6321extern void finish_member_declaration (tree);
548cb3d7
JM
6322extern bool outer_automatic_var_p (tree);
6323extern tree process_outer_var_ref (tree, tsubst_flags_t);
0cbd7506 6324extern tree finish_id_expression (tree, tree, tree,
02ed62dd 6325 cp_id_kind *,
19114537 6326 bool, bool, bool *,
02ed62dd 6327 bool, bool, bool, bool,
2b7a3abf
DS
6328 const char **,
6329 location_t);
b2f29cd9 6330extern tree finish_typeof (tree);
a0d260fc 6331extern tree finish_underlying_type (tree);
4daba884
BK
6332extern tree calculate_bases (tree);
6333extern tree finish_bases (tree, bool);
6334extern tree calculate_direct_bases (tree);
8591575f 6335extern tree finish_offsetof (tree, location_t);
0cbd7506
MS
6336extern void finish_decl_cleanup (tree, tree);
6337extern void finish_eh_cleanup (tree);
e89d6010 6338extern void emit_associated_thunks (tree);
0cbd7506 6339extern void finish_mem_initializers (tree);
8ba658ee 6340extern tree check_template_template_default_arg (tree);
b2583345 6341extern bool expand_or_defer_fn_1 (tree);
8cd2462c 6342extern void expand_or_defer_fn (tree);
aa373032
DS
6343extern void add_typedef_to_current_template_for_access_check (tree, tree,
6344 location_t);
ee76b931 6345extern void check_accessibility_of_qualified_id (tree, tree, tree);
02ed62dd 6346extern tree finish_qualified_id_expr (tree, tree, bool, bool,
a378996b 6347 bool, bool, tsubst_flags_t);
9eeb200f 6348extern void simplify_aggr_init_expr (tree *);
6de9cd9a 6349extern void finalize_nrv (tree *, tree, tree);
acf0174b
JJ
6350extern tree omp_reduction_id (enum tree_code, tree, tree);
6351extern tree cp_remove_omp_priv_cleanup_stmt (tree *, int *, void *);
6352extern void cp_check_omp_declare_reduction (tree);
d9a6bd32
JJ
6353extern void finish_omp_declare_simd_methods (tree);
6354extern tree finish_omp_clauses (tree, bool, bool = false);
6355extern tree push_omp_privatization_clauses (bool);
6356extern void pop_omp_privatization_clauses (tree);
6357extern void save_omp_privatization_clauses (vec<tree> &);
6358extern void restore_omp_privatization_clauses (vec<tree> &);
1799e5d5
RH
6359extern void finish_omp_threadprivate (tree);
6360extern tree begin_omp_structured_block (void);
6361extern tree finish_omp_structured_block (tree);
41dbbb37 6362extern tree finish_oacc_data (tree, tree);
37d5ad46 6363extern tree finish_oacc_host_data (tree, tree);
88bae6f4 6364extern tree finish_omp_construct (enum tree_code, tree, tree);
1799e5d5
RH
6365extern tree begin_omp_parallel (void);
6366extern tree finish_omp_parallel (tree, tree);
a68ab351
JJ
6367extern tree begin_omp_task (void);
6368extern tree finish_omp_task (tree, tree);
acf0174b
JJ
6369extern tree finish_omp_for (location_t, enum tree_code,
6370 tree, tree, tree, tree, tree,
e01d41e5 6371 tree, tree, vec<tree> *, tree);
20906c66 6372extern void finish_omp_atomic (enum tree_code, enum tree_code,
acf0174b
JJ
6373 tree, tree, tree, tree, tree,
6374 bool);
1799e5d5
RH
6375extern void finish_omp_barrier (void);
6376extern void finish_omp_flush (void);
a68ab351 6377extern void finish_omp_taskwait (void);
acf0174b
JJ
6378extern void finish_omp_taskyield (void);
6379extern void finish_omp_cancel (tree);
6380extern void finish_omp_cancellation_point (tree);
e01d41e5 6381extern tree omp_privatize_field (tree, bool);
0a35513e 6382extern tree begin_transaction_stmt (location_t, tree *, int);
f0f3286a
TR
6383extern void finish_transaction_stmt (tree, tree, int, tree);
6384extern tree build_transaction_expr (location_t, tree, int, tree);
acf0174b
JJ
6385extern bool cxx_omp_create_clause_info (tree, tree, bool, bool,
6386 bool, bool);
eff3a276 6387extern tree baselink_for_fns (tree);
55a3debe
DG
6388extern void finish_static_assert (tree, tree, location_t,
6389 bool);
5b97c77f 6390extern tree finish_decltype_type (tree, bool, tsubst_flags_t);
cb68ec50 6391extern tree finish_trait_expr (enum cp_trait_kind, tree, tree);
d5f4eddd
JM
6392extern tree build_lambda_expr (void);
6393extern tree build_lambda_object (tree);
6394extern tree begin_lambda_type (tree);
399bb2da 6395extern tree lambda_capture_field_type (tree, bool);
d5f4eddd 6396extern tree lambda_return_type (tree);
40d55020 6397extern tree lambda_proxy_type (tree);
d5f4eddd 6398extern tree lambda_function (tree);
852497a3 6399extern void apply_deduced_return_type (tree, tree);
37a7519a 6400extern tree add_capture (tree, tree, tree, bool, bool);
d5f4eddd 6401extern tree add_default_capture (tree, tree, tree);
61ca4737 6402extern tree build_capture_proxy (tree);
4eefc795 6403extern void insert_capture_proxy (tree);
61ca4737
JM
6404extern void insert_pending_capture_proxies (void);
6405extern bool is_capture_proxy (tree);
6406extern bool is_normal_capture_proxy (tree);
19030d77 6407extern void register_capture_members (tree);
0b360a07
MV
6408extern tree lambda_expr_this_capture (tree, bool);
6409extern tree maybe_resolve_dummy (tree, bool);
2bf492a1 6410extern tree current_nonlambda_function (void);
a6846853 6411extern tree nonlambda_method_basetype (void);
18c4fa8e 6412extern tree current_nonlambda_scope (void);
b77068f2 6413extern void maybe_add_lambda_conv_op (tree);
61ca4737 6414extern bool is_lambda_ignored_entity (tree);
35b1567d 6415
51c184be 6416/* in tree.c */
d26e5986 6417extern int cp_tree_operand_length (const_tree);
4537ec0c 6418void cp_free_lang_data (tree t);
574cfaa4
JM
6419extern tree force_target_expr (tree, tree, tsubst_flags_t);
6420extern tree build_target_expr_with_type (tree, tree, tsubst_flags_t);
b2f29cd9 6421extern void lang_check_failed (const char *, int,
82e5a12a 6422 const char *) ATTRIBUTE_NORETURN;
b2f29cd9 6423extern tree stabilize_expr (tree, tree *);
6de9cd9a
DN
6424extern void stabilize_call (tree, tree *);
6425extern bool stabilize_init (tree, tree *);
40aac948 6426extern tree add_stmt_to_compound (tree, tree);
0cbd7506 6427extern void init_tree (void);
c32097d8
JM
6428extern bool pod_type_p (const_tree);
6429extern bool layout_pod_type_p (const_tree);
6430extern bool std_layout_type_p (const_tree);
6431extern bool trivial_type_p (const_tree);
46408846 6432extern bool trivially_copyable_p (const_tree);
11f35925 6433extern bool scalarish_type_p (const_tree);
c32097d8
JM
6434extern bool type_has_nontrivial_default_init (const_tree);
6435extern bool type_has_nontrivial_copy_init (const_tree);
ac7d7749 6436extern bool class_tmpl_impl_spec_p (const_tree);
58f9752a 6437extern int zero_init_p (const_tree);
7dbb85a7 6438extern bool check_abi_tag_redeclaration (const_tree, const_tree, const_tree);
7cb73573 6439extern bool check_abi_tag_args (tree, tree);
b71983a5
JM
6440extern tree strip_typedefs (tree, bool * = NULL);
6441extern tree strip_typedefs_expr (tree, bool * = NULL);
48b45647
NS
6442extern tree copy_binfo (tree, tree, tree,
6443 tree *, int);
58f9752a 6444extern int member_p (const_tree);
4e9ca9b0
JM
6445extern cp_lvalue_kind real_lvalue_p (const_tree);
6446extern cp_lvalue_kind lvalue_kind (const_tree);
df5c89cb 6447extern bool lvalue_or_rvalue_with_address_p (const_tree);
04398fa8 6448extern bool xvalue_p (const_tree);
58f9752a 6449extern bool builtin_valid_in_constant_expr_p (const_tree);
8e1daa34 6450extern tree build_min (enum tree_code, tree, ...);
f330f599
PC
6451extern tree build_min_nt_loc (location_t, enum tree_code,
6452 ...);
8e1daa34 6453extern tree build_min_non_dep (enum tree_code, tree, ...);
9771b263 6454extern tree build_min_non_dep_call_vec (tree, tree, vec<tree, va_gc> *);
362115a9 6455extern tree build_cplus_new (tree, tree, tsubst_flags_t);
094484e7 6456extern tree build_aggr_init_expr (tree, tree);
b2f29cd9 6457extern tree get_target_expr (tree);
574cfaa4 6458extern tree get_target_expr_sfinae (tree, tsubst_flags_t);
b2f29cd9 6459extern tree build_cplus_array_type (tree, tree);
09357846 6460extern tree build_array_of_n_type (tree, int);
0138d6b2 6461extern bool array_of_runtime_bound_p (tree);
d5f4eddd 6462extern tree build_array_copy (tree);
9c69dcea 6463extern tree build_vec_init_expr (tree, tree, tsubst_flags_t);
262a7d6b 6464extern void diagnose_non_constexpr_vec_init (tree);
b2f29cd9
NN
6465extern tree hash_tree_cons (tree, tree, tree);
6466extern tree hash_tree_chain (tree, tree);
3db45ab5 6467extern tree build_qualified_name (tree, tree, tree, bool);
2eed8e37 6468extern tree build_ref_qualified_type (tree, cp_ref_qualifier);
b2f29cd9 6469extern int is_overloaded_fn (tree);
4b6aaa99 6470extern tree dependent_name (tree);
294e855f 6471extern tree get_fns (tree);
b2f29cd9 6472extern tree get_first_fn (tree);
0cbd7506
MS
6473extern tree ovl_cons (tree, tree);
6474extern tree build_overload (tree, tree);
aef3a6b2 6475extern tree ovl_scope (tree);
73452ce7 6476extern bool non_static_member_function_p (tree);
b2f29cd9 6477extern const char *cxx_printable_name (tree, int);
f41c4af3 6478extern const char *cxx_printable_name_translate (tree, int);
b2f29cd9
NN
6479extern tree build_exception_variant (tree, tree);
6480extern tree bind_template_template_parm (tree, tree);
6481extern tree array_type_nelts_total (tree);
6482extern tree array_type_nelts_top (tree);
6483extern tree break_out_target_exprs (tree);
3e605b20
JM
6484extern tree build_ctor_subob_ref (tree, tree, tree);
6485extern tree replace_placeholders (tree, tree);
b2f29cd9 6486extern tree get_type_decl (tree);
b2f29cd9 6487extern tree decl_namespace_context (tree);
58f9752a 6488extern bool decl_anon_ns_mem_p (const_tree);
b2f29cd9
NN
6489extern tree lvalue_type (tree);
6490extern tree error_type (tree);
58f9752a 6491extern int varargs_function_p (const_tree);
eff3a276 6492extern bool really_overloaded_fn (tree);
c8a209ca 6493extern bool cp_tree_equal (tree, tree);
4684cd27 6494extern tree no_linkage_check (tree, bool);
b2f29cd9
NN
6495extern void debug_binfo (tree);
6496extern tree build_dummy_object (tree);
6497extern tree maybe_dummy_object (tree, tree *);
58f9752a 6498extern int is_dummy_object (const_tree);
349ae713 6499extern const struct attribute_spec cxx_attribute_table[];
0cbd7506 6500extern tree make_ptrmem_cst (tree, tree);
e9525111 6501extern tree cp_build_type_attribute_variant (tree, tree);
8af2fec4 6502extern tree cp_build_reference_type (tree, bool);
d5f4eddd 6503extern tree move (tree);
0cbd7506 6504extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
adecb3f4 6505#define cp_build_qualified_type(TYPE, QUALS) \
23fca1f5 6506 cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
36c37128 6507extern bool cv_qualified_p (const_tree);
164247b0 6508extern tree cv_unqualified (tree);
58f9752a 6509extern special_function_kind special_function_p (const_tree);
0cbd7506
MS
6510extern int count_trees (tree);
6511extern int char_type_p (tree);
6512extern void verify_stmt_tree (tree);
0cbd7506 6513extern linkage_kind decl_linkage (tree);
b95ca513 6514extern duration_kind decl_storage_duration (tree);
b2f29cd9 6515extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
6e2830c3 6516 void*, hash_set<tree> *);
ddf72901
JM
6517#define cp_walk_tree(tp,func,data,pset) \
6518 walk_tree_1 (tp, func, data, pset, cp_walk_subtrees)
6519#define cp_walk_tree_without_duplicates(tp,func,data) \
6520 walk_tree_without_duplicates_1 (tp, func, data, cp_walk_subtrees)
3db45ab5 6521extern tree rvalue (tree);
e1039697 6522extern tree convert_bitfield_to_declared_type (tree);
3db45ab5 6523extern tree cp_save_expr (tree);
015c2c66 6524extern bool cast_valid_in_integral_constant_expression_p (tree);
2dff8956 6525extern bool cxx_type_hash_eq (const_tree, const_tree);
3db45ab5 6526
2650d9e1 6527extern void cxx_print_statistics (void);
30b07d03 6528extern bool maybe_warn_zero_as_null_pointer_constant (tree, location_t);
2650d9e1
SZ
6529
6530/* in ptree.c */
6531extern void cxx_print_xnode (FILE *, tree, int);
6532extern void cxx_print_decl (FILE *, tree, int);
6533extern void cxx_print_type (FILE *, tree, int);
6534extern void cxx_print_identifier (FILE *, tree, int);
1ebe4b4f 6535extern void cxx_print_error_function (diagnostic_context *,
2650d9e1
SZ
6536 const char *,
6537 struct diagnostic_info *);
6538
51c184be 6539/* in typeck.c */
2650d9e1 6540extern bool cxx_mark_addressable (tree);
58f9752a 6541extern int string_conv_p (const_tree, const_tree, int);
b2f29cd9
NN
6542extern tree cp_truthvalue_conversion (tree);
6543extern tree condition_conversion (tree);
b2f29cd9 6544extern tree require_complete_type (tree);
79fe346e 6545extern tree require_complete_type_sfinae (tree, tsubst_flags_t);
b2f29cd9 6546extern tree complete_type (tree);
be20e673 6547extern tree complete_type_or_else (tree, tree);
309714d4 6548extern tree complete_type_or_maybe_complain (tree, tree, tsubst_flags_t);
58f9752a 6549extern int type_unknown_p (const_tree);
3a55fb4c
JM
6550enum { ce_derived, ce_normal, ce_exact };
6551extern bool comp_except_specs (const_tree, const_tree, int);
96d84882 6552extern bool comptypes (tree, tree, int);
10746f37 6553extern bool same_type_ignoring_top_level_qualifiers_p (tree, tree);
58f9752a
KG
6554extern bool compparms (const_tree, const_tree);
6555extern int comp_cv_qualification (const_tree, const_tree);
d02f620d 6556extern int comp_cv_qualification (int, int);
0cbd7506 6557extern int comp_cv_qual_signature (tree, tree);
5ade1ed2 6558extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code, bool);
0cbd7506 6559extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
e28d52cf 6560extern tree cxx_alignas_expr (tree);
5ade1ed2 6561extern tree cxx_sizeof_nowarn (tree);
58f9752a
KG
6562extern tree is_bitfield_expr_with_lowered_type (const_tree);
6563extern tree unlowered_expr_type (const_tree);
1807ffc1
MS
6564extern tree decay_conversion (tree,
6565 tsubst_flags_t,
6566 bool = true);
5ade1ed2
DG
6567extern tree build_class_member_access_expr (tree, tree, tree, bool,
6568 tsubst_flags_t);
6569extern tree finish_class_member_access_expr (tree, tree, bool,
6570 tsubst_flags_t);
4fe977f2
PC
6571extern tree build_x_indirect_ref (location_t, tree,
6572 ref_operator, tsubst_flags_t);
dd865ef6 6573extern tree cp_build_indirect_ref (tree, ref_operator,
5ade1ed2 6574 tsubst_flags_t);
3a11c665
JM
6575extern tree build_array_ref (location_t, tree, tree);
6576extern tree cp_build_array_ref (location_t, tree, tree,
73647d75 6577 tsubst_flags_t);
89fcabaf 6578extern tree get_member_function_from_ptrfunc (tree *, tree, tsubst_flags_t);
450f4293
NF
6579extern tree cp_build_function_call_nary (tree, tsubst_flags_t, ...)
6580 ATTRIBUTE_SENTINEL;
9771b263 6581extern tree cp_build_function_call_vec (tree, vec<tree, va_gc> **,
c166b898 6582 tsubst_flags_t);
4fe977f2
PC
6583extern tree build_x_binary_op (location_t,
6584 enum tree_code, tree,
2a67bec2 6585 enum tree_code, tree,
6904f4b4 6586 enum tree_code, tree *,
5ade1ed2 6587 tsubst_flags_t);
f330f599
PC
6588extern tree build_x_array_ref (location_t, tree, tree,
6589 tsubst_flags_t);
4fe977f2
PC
6590extern tree build_x_unary_op (location_t,
6591 enum tree_code, tree,
5ade1ed2 6592 tsubst_flags_t);
93c0e0bb 6593extern tree cp_build_addr_expr (tree, tsubst_flags_t);
5ade1ed2
DG
6594extern tree cp_build_unary_op (enum tree_code, tree, int,
6595 tsubst_flags_t);
b2f29cd9 6596extern tree unary_complex_lvalue (enum tree_code, tree);
f330f599 6597extern tree build_x_conditional_expr (location_t, tree, tree, tree,
5ade1ed2 6598 tsubst_flags_t);
d555b1c7
PC
6599extern tree build_x_compound_expr_from_list (tree, expr_list_kind,
6600 tsubst_flags_t);
9771b263
DN
6601extern tree build_x_compound_expr_from_vec (vec<tree, va_gc> *,
6602 const char *, tsubst_flags_t);
f330f599
PC
6603extern tree build_x_compound_expr (location_t, tree, tree,
6604 tsubst_flags_t);
c2255bc4 6605extern tree build_compound_expr (location_t, tree, tree);
525521b6 6606extern tree cp_build_compound_expr (tree, tree, tsubst_flags_t);
5ade1ed2
DG
6607extern tree build_static_cast (tree, tree, tsubst_flags_t);
6608extern tree build_reinterpret_cast (tree, tree, tsubst_flags_t);
6609extern tree build_const_cast (tree, tree, tsubst_flags_t);
c2255bc4 6610extern tree build_c_cast (location_t, tree, tree);
525521b6 6611extern tree cp_build_c_cast (tree, tree, tsubst_flags_t);
f330f599
PC
6612extern tree build_x_modify_expr (location_t, tree,
6613 enum tree_code, tree,
5ade1ed2
DG
6614 tsubst_flags_t);
6615extern tree cp_build_modify_expr (tree, enum tree_code, tree,
6616 tsubst_flags_t);
0cbd7506 6617extern tree convert_for_initialization (tree, tree, tree, int,
2f5b91f5 6618 impl_conv_rhs, tree, int,
5ade1ed2 6619 tsubst_flags_t);
b2f29cd9 6620extern int comp_ptr_ttypes (tree, tree);
3db45ab5 6621extern bool comp_ptr_ttypes_const (tree, tree);
d4684c00 6622extern bool error_type_p (const_tree);
3f2d352c 6623extern bool ptr_reasonably_similar (const_tree, const_tree);
135d47df
PC
6624extern tree build_ptrmemfunc (tree, tree, int, bool,
6625 tsubst_flags_t);
ac7d7749 6626extern int cp_type_quals (const_tree);
2872152c 6627extern int type_memfn_quals (const_tree);
2eed8e37
BK
6628extern cp_ref_qualifier type_memfn_rqual (const_tree);
6629extern tree apply_memfn_quals (tree, cp_cv_quals, cp_ref_qualifier);
58f9752a
KG
6630extern bool cp_has_mutable_p (const_tree);
6631extern bool at_least_as_qualified_p (const_tree, const_tree);
0cbd7506
MS
6632extern void cp_apply_type_quals_to_decl (int, tree);
6633extern tree build_ptrmemfunc1 (tree, tree, tree);
6634extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
b2f29cd9 6635extern tree type_after_usual_arithmetic_conversions (tree, tree);
98f2f3a2 6636extern tree common_pointer_type (tree, tree);
0cbd7506 6637extern tree composite_pointer_type (tree, tree, tree, tree,
c86818cf
SZ
6638 composite_pointer_operation,
6639 tsubst_flags_t);
b2f29cd9 6640extern tree merge_types (tree, tree);
48326487 6641extern tree strip_array_domain (tree);
0c9b182b 6642extern tree check_return_expr (tree, bool *);
ba47d38d
AH
6643extern tree cp_build_binary_op (location_t,
6644 enum tree_code, tree, tree,
5ade1ed2 6645 tsubst_flags_t);
bedc293e
MG
6646extern tree build_x_vec_perm_expr (location_t,
6647 tree, tree, tree,
6648 tsubst_flags_t);
ea793912 6649#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
0138d6b2 6650extern tree build_simple_component_ref (tree, tree);
0cbd7506
MS
6651extern tree build_ptrmemfunc_access_expr (tree, tree);
6652extern tree build_address (tree);
6653extern tree build_nop (tree, tree);
6654extern tree non_reference (tree);
6655extern tree lookup_anon_field (tree, tree);
d3ea4c06
MLI
6656extern bool invalid_nonstatic_memfn_p (location_t, tree,
6657 tsubst_flags_t);
89fcabaf 6658extern tree convert_member_func_to_ptr (tree, tree, tsubst_flags_t);
135d47df
PC
6659extern tree convert_ptrmem (tree, tree, bool, bool,
6660 tsubst_flags_t);
4af9e878 6661extern int lvalue_or_else (tree, enum lvalue_use,
5ade1ed2 6662 tsubst_flags_t);
2650d9e1 6663extern void check_template_keyword (tree);
3ce4f9e4
ESR
6664extern bool check_raw_literal_operator (const_tree decl);
6665extern bool check_literal_operator_args (const_tree, bool *, bool *);
04398fa8 6666extern void maybe_warn_about_useless_cast (tree, tree, tsubst_flags_t);
4b978f96 6667extern tree cp_perform_integral_promotions (tree, tsubst_flags_t);
8d08fdba 6668
378b307d
AS
6669extern tree finish_left_unary_fold_expr (tree, int);
6670extern tree finish_right_unary_fold_expr (tree, int);
6671extern tree finish_binary_fold_expr (tree, tree, int);
6672
51c184be 6673/* in typeck2.c */
b2f29cd9 6674extern void require_complete_eh_spec_types (tree, tree);
71205d17 6675extern void cxx_incomplete_type_diagnostic (const_tree, const_tree, diagnostic_t);
23b4deba 6676#undef cxx_incomplete_type_error
ac7d7749 6677extern void cxx_incomplete_type_error (const_tree, const_tree);
23b4deba 6678#define cxx_incomplete_type_error(V,T) \
71205d17 6679 (cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
bdb5a9a3 6680extern void cxx_incomplete_type_inform (const_tree);
b2f29cd9
NN
6681extern tree error_not_base_type (tree, tree);
6682extern tree binfo_or_else (tree, tree);
4816c593 6683extern void cxx_readonly_error (tree, enum lvalue_use);
7fb213d8 6684extern void complete_type_check_abstract (tree);
b2f29cd9 6685extern int abstract_virtuals_error (tree, tree);
2df663cc 6686extern int abstract_virtuals_error (abstract_class_use, tree);
2b8497cd 6687extern int abstract_virtuals_error_sfinae (tree, tree, tsubst_flags_t);
2df663cc 6688extern int abstract_virtuals_error_sfinae (abstract_class_use, tree, tsubst_flags_t);
b2f29cd9 6689
9771b263 6690extern tree store_init_value (tree, tree, vec<tree, va_gc>**, int);
89631a43 6691extern tree split_nonconstant_init (tree, tree);
6a6bdc3d 6692extern bool check_narrowing (tree, tree, tsubst_flags_t);
754af126 6693extern tree digest_init (tree, tree, tsubst_flags_t);
e57d93c6 6694extern tree digest_init_flags (tree, tree, int);
f4cd9c51 6695extern tree digest_nsdmi_init (tree, tree);
b2f29cd9 6696extern tree build_scoped_ref (tree, tree, tree *);
4fe977f2
PC
6697extern tree build_x_arrow (location_t, tree,
6698 tsubst_flags_t);
89fcabaf 6699extern tree build_m_component_ref (tree, tree, tsubst_flags_t);
5ade1ed2 6700extern tree build_functional_cast (tree, tree, tsubst_flags_t);
0cbd7506 6701extern tree add_exception_specifier (tree, tree, int);
b15ea309 6702extern tree merge_exception_specifiers (tree, tree);
8d08fdba 6703
1f6e1acc 6704/* in mangle.c */
64bec774 6705extern bool maybe_remove_implicit_alias (tree);
0cbd7506
MS
6706extern void init_mangle (void);
6707extern void mangle_decl (tree);
52669d59 6708extern const char *mangle_type_string (tree);
0cbd7506
MS
6709extern tree mangle_typeinfo_for_type (tree);
6710extern tree mangle_typeinfo_string_for_type (tree);
6711extern tree mangle_vtbl_for_type (tree);
6712extern tree mangle_vtt_for_type (tree);
6713extern tree mangle_ctor_vtbl_for_type (tree, tree);
6714extern tree mangle_thunk (tree, int, tree, tree);
6715extern tree mangle_conv_op_name_for_type (tree);
6716extern tree mangle_guard_variable (tree);
7c424acd
JM
6717extern tree mangle_tls_init_fn (tree);
6718extern tree mangle_tls_wrapper_fn (tree);
6719extern bool decl_tls_wrapper_p (tree);
0cbd7506 6720extern tree mangle_ref_init_variable (tree);
2077db1b 6721extern char * get_mangled_vtable_map_var_name (tree);
7cb73573 6722extern bool mangle_return_type_p (tree);
1f6e1acc 6723
0a7394bc 6724/* in dump.c */
0cbd7506 6725extern bool cp_dump_tree (void *, tree);
0a7394bc 6726
e58a9aa1
ZL
6727/* In cp/cp-objcp-common.c. */
6728
4862826d 6729extern alias_set_type cxx_get_alias_set (tree);
ac7d7749 6730extern bool cxx_warn_unused_global_decl (const_tree);
0cbd7506
MS
6731extern size_t cp_tree_size (enum tree_code);
6732extern bool cp_var_mod_type_p (tree, tree);
1ebe4b4f 6733extern void cxx_initialize_diagnostics (diagnostic_context *);
0cbd7506 6734extern int cxx_types_compatible_p (tree, tree);
3ed8593d 6735extern void init_shadowed_var_for_decl (void);
88cd0e88 6736extern bool cxx_block_may_fallthru (const_tree);
e58a9aa1 6737
78dcd41a 6738/* in cp-gimplify.c */
726a989a
RB
6739extern int cp_gimplify_expr (tree *, gimple_seq *,
6740 gimple_seq *);
5a508662 6741extern void cp_genericize (tree);
20906c66 6742extern bool cxx_omp_const_qual_no_mutable (tree);
2650d9e1
SZ
6743extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
6744extern tree cxx_omp_clause_default_ctor (tree, tree, tree);
6745extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
6746extern tree cxx_omp_clause_assign_op (tree, tree, tree);
6747extern tree cxx_omp_clause_dtor (tree, tree);
f014c653 6748extern void cxx_omp_finish_clause (tree, gimple_seq *);
2650d9e1 6749extern bool cxx_omp_privatize_by_reference (const_tree);
d9a6bd32 6750extern bool cxx_omp_disregard_value_expr (tree, bool);
cda0a029 6751extern tree cp_fully_fold (tree);
6de9cd9a 6752
501c95ff 6753/* in name-lookup.c */
557831a9
FC
6754extern void suggest_alternatives_for (location_t, tree);
6755extern tree strip_using_decl (tree);
501c95ff 6756
971e17ff
AS
6757/* in constraint.cc */
6758extern void init_constraint_processing ();
6759extern bool constraint_p (tree);
6760extern tree make_predicate_constraint (tree);
6761extern tree conjoin_constraints (tree, tree);
6762extern tree conjoin_constraints (tree);
6763extern bool valid_constraints_p (tree);
6764extern tree get_constraints (tree);
6765extern void set_constraints (tree, tree);
6766extern void remove_constraints (tree);
6767extern tree current_template_constraints (void);
6768extern tree associate_classtype_constraints (tree);
6769extern tree build_constraints (tree, tree);
6770extern tree get_shorthand_constraints (tree);
6771extern tree build_concept_check (tree, tree, tree = NULL_TREE);
6772extern tree build_constrained_parameter (tree, tree, tree = NULL_TREE);
6773extern tree make_constrained_auto (tree, tree);
4fea442d
JM
6774extern void placeholder_extract_concept_and_args (tree, tree&, tree&);
6775extern bool equivalent_placeholder_constraints (tree, tree);
6776extern hashval_t hash_placeholder_constraint (tree);
971e17ff
AS
6777extern bool deduce_constrained_parameter (tree, tree&, tree&);
6778extern tree resolve_constraint_check (tree);
6779extern tree check_function_concept (tree);
6780extern tree finish_template_introduction (tree, tree);
6781extern bool valid_requirements_p (tree);
6782extern tree finish_concept_name (tree);
6783extern tree finish_shorthand_constraint (tree, tree);
6784extern tree finish_requires_expr (tree, tree);
6785extern tree finish_simple_requirement (tree);
6786extern tree finish_type_requirement (tree);
6787extern tree finish_compound_requirement (tree, tree, bool);
6788extern tree finish_nested_requirement (tree);
6789extern void check_constrained_friend (tree, tree);
6790extern tree tsubst_requires_expr (tree, tree, tsubst_flags_t, tree);
6791extern tree tsubst_constraint (tree, tree, tsubst_flags_t, tree);
6792extern tree tsubst_constraint_info (tree, tree, tsubst_flags_t, tree);
6793extern bool function_concept_check_p (tree);
6794
6795extern tree evaluate_constraints (tree, tree);
6796extern tree evaluate_function_concept (tree, tree);
6797extern tree evaluate_variable_concept (tree, tree);
6798extern tree evaluate_constraint_expression (tree, tree);
6799extern bool constraints_satisfied_p (tree);
6800extern bool constraints_satisfied_p (tree, tree);
6801
6802extern bool equivalent_constraints (tree, tree);
6803extern bool equivalently_constrained (tree, tree);
6804extern bool subsumes_constraints (tree, tree);
6805extern int more_constrained (tree, tree);
6806
6807extern void diagnose_constraints (location_t, tree, tree);
6808
6809/* in logic.cc */
6810extern tree decompose_assumptions (tree);
6811extern tree decompose_conclusions (tree);
6812extern bool subsumes (tree, tree);
6813
2077db1b
CT
6814/* in vtable-class-hierarchy.c */
6815extern void vtv_compute_class_hierarchy_transitive_closure (void);
6816extern void vtv_generate_init_routine (void);
6817extern void vtv_save_class_info (tree);
6818extern void vtv_recover_class_info (void);
6819extern void vtv_build_vtable_verify_fndecl (void);
6820
c02065fc
AH
6821/* In cp-cilkplus.c. */
6822extern bool cpp_validate_cilk_plus_loop (tree);
6823
2ce86d2e
BI
6824/* In cp/cp-array-notations.c */
6825extern tree expand_array_notation_exprs (tree);
6826bool cilkplus_an_triplet_types_ok_p (location_t, tree, tree, tree,
6827 tree);
2d76680f
PC
6828
6829/* In constexpr.c */
6830extern bool literal_type_p (tree);
6831extern tree register_constexpr_fundef (tree, tree);
6832extern bool check_constexpr_ctor_body (tree, tree, bool);
6833extern tree ensure_literal_type_for_constexpr_object (tree);
6834extern bool potential_constant_expression (tree);
69eb4fde 6835extern bool potential_static_init_expression (tree);
2d76680f
PC
6836extern bool potential_rvalue_constant_expression (tree);
6837extern bool require_potential_constant_expression (tree);
6838extern bool require_potential_rvalue_constant_expression (tree);
3e605b20
JM
6839extern tree cxx_constant_value (tree, tree = NULL_TREE);
6840extern tree maybe_constant_value (tree, tree = NULL_TREE);
6841extern tree maybe_constant_init (tree, tree = NULL_TREE);
234bef96 6842extern tree fold_non_dependent_expr (tree);
cda0a029 6843extern tree fold_simple (tree);
2d76680f
PC
6844extern bool is_sub_constant_expr (tree);
6845extern bool reduced_constant_expression_p (tree);
6846extern bool is_instantiation_of_constexpr (tree);
6847extern bool var_in_constexpr_fn (tree);
6848extern void explain_invalid_constexpr_fn (tree);
6849extern vec<tree> cx_error_context (void);
cda0a029 6850extern tree fold_sizeof_expr (tree);
2d76680f 6851
12893402
BI
6852/* In c-family/cilk.c */
6853extern bool cilk_valid_spawn (tree);
6854
35228ac7
JJ
6855/* In cp-ubsan.c */
6856extern void cp_ubsan_maybe_instrument_member_call (tree);
6857extern void cp_ubsan_instrument_member_accesses (tree *);
62775f0d 6858extern tree cp_ubsan_maybe_instrument_downcast (location_t, tree, tree, tree);
35228ac7
JJ
6859extern tree cp_ubsan_maybe_instrument_cast_to_vbase (location_t, tree, tree);
6860
8d08fdba
MS
6861/* -- end of C++ */
6862
88657302 6863#endif /* ! GCC_CP_TREE_H */