xref: /dragonfly/contrib/gcc-4.7/gcc/cp/cp-tree.h (revision 95d28233)
1e4b17023SJohn Marino /* Definitions for C++ parsing and type checking.
2e4b17023SJohn Marino    Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3e4b17023SJohn Marino    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4e4b17023SJohn Marino    Free Software Foundation, Inc.
5e4b17023SJohn Marino    Contributed by Michael Tiemann (tiemann@cygnus.com)
6e4b17023SJohn Marino 
7e4b17023SJohn Marino This file is part of GCC.
8e4b17023SJohn Marino 
9e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify
10e4b17023SJohn Marino it under the terms of the GNU General Public License as published by
11e4b17023SJohn Marino the Free Software Foundation; either version 3, or (at your option)
12e4b17023SJohn Marino any later version.
13e4b17023SJohn Marino 
14e4b17023SJohn Marino GCC is distributed in the hope that it will be useful,
15e4b17023SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
16e4b17023SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17e4b17023SJohn Marino GNU General Public License for more details.
18e4b17023SJohn Marino 
19e4b17023SJohn Marino You should have received a copy of the GNU General Public License
20e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
21e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
22e4b17023SJohn Marino 
23e4b17023SJohn Marino #ifndef GCC_CP_TREE_H
24e4b17023SJohn Marino #define GCC_CP_TREE_H
25e4b17023SJohn Marino 
26e4b17023SJohn Marino #include "ggc.h"
27e4b17023SJohn Marino #include "function.h"
28e4b17023SJohn Marino #include "hashtab.h"
29e4b17023SJohn Marino #include "vec.h"
30e4b17023SJohn Marino 
31e4b17023SJohn Marino /* In order for the format checking to accept the C++ front end
32e4b17023SJohn Marino    diagnostic framework extensions, you must include this file before
33e4b17023SJohn Marino    diagnostic-core.h, not after.  We override the definition of GCC_DIAG_STYLE
34e4b17023SJohn Marino    in c-common.h.  */
35e4b17023SJohn Marino #undef GCC_DIAG_STYLE
36e4b17023SJohn Marino #define GCC_DIAG_STYLE __gcc_cxxdiag__
37e4b17023SJohn Marino #if defined(GCC_DIAGNOSTIC_CORE_H) || defined (GCC_C_COMMON_H)
38e4b17023SJohn Marino #error \
39e4b17023SJohn Marino In order for the format checking to accept the C++ front end diagnostic \
40e4b17023SJohn Marino framework extensions, you must include this file before diagnostic-core.h and \
41e4b17023SJohn Marino c-common.h, not after.
42e4b17023SJohn Marino #endif
43e4b17023SJohn Marino #include "c-family/c-common.h"
44e4b17023SJohn Marino #include "diagnostic.h"
45e4b17023SJohn Marino 
46e4b17023SJohn Marino #include "name-lookup.h"
47e4b17023SJohn Marino 
48e4b17023SJohn Marino /* Usage of TREE_LANG_FLAG_?:
49e4b17023SJohn Marino    0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
50e4b17023SJohn Marino       NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
51e4b17023SJohn Marino       DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
52e4b17023SJohn Marino       COMPOUND_EXPR_OVERLOADED (in COMPOUND_EXPR).
53e4b17023SJohn Marino       TREE_INDIRECT_USING (in NAMESPACE_DECL).
54e4b17023SJohn Marino       CLEANUP_P (in TRY_BLOCK)
55e4b17023SJohn Marino       AGGR_INIT_VIA_CTOR_P (in AGGR_INIT_EXPR)
56e4b17023SJohn Marino       PTRMEM_OK_P (in ADDR_EXPR, OFFSET_REF, SCOPE_REF)
57e4b17023SJohn Marino       PAREN_STRING_LITERAL (in STRING_CST)
58e4b17023SJohn Marino       DECL_PRETTY_FUNCTION_P (in VAR_DECL)
59e4b17023SJohn Marino       KOENIG_LOOKUP_P (in CALL_EXPR)
60e4b17023SJohn Marino       STATEMENT_LIST_NO_SCOPE (in STATEMENT_LIST).
61e4b17023SJohn Marino       EXPR_STMT_STMT_EXPR_RESULT (in EXPR_STMT)
62e4b17023SJohn Marino       STMT_EXPR_NO_SCOPE (in STMT_EXPR)
63e4b17023SJohn Marino       BIND_EXPR_TRY_BLOCK (in BIND_EXPR)
64e4b17023SJohn Marino       TYPENAME_IS_ENUM_P (in TYPENAME_TYPE)
65e4b17023SJohn Marino       OMP_FOR_GIMPLIFYING_P (in OMP_FOR)
66e4b17023SJohn Marino       BASELINK_QUALIFIED_P (in BASELINK)
67e4b17023SJohn Marino       TARGET_EXPR_IMPLICIT_P (in TARGET_EXPR)
68e4b17023SJohn Marino       TEMPLATE_PARM_PARAMETER_PACK (in TEMPLATE_PARM_INDEX)
69e4b17023SJohn Marino       ATTR_IS_DEPENDENT (in the TREE_LIST for an attribute)
70e4b17023SJohn Marino       CONSTRUCTOR_IS_DIRECT_INIT (in CONSTRUCTOR)
71e4b17023SJohn Marino       LAMBDA_EXPR_CAPTURES_THIS_P (in LAMBDA_EXPR)
72e4b17023SJohn Marino       DECLTYPE_FOR_LAMBDA_CAPTURE (in DECLTYPE_TYPE)
73e4b17023SJohn Marino       VEC_INIT_EXPR_IS_CONSTEXPR (in VEC_INIT_EXPR)
74e4b17023SJohn Marino       DECL_OVERRIDE_P (in FUNCTION_DECL)
75e4b17023SJohn Marino       IMPLICIT_CONV_EXPR_DIRECT_INIT (in IMPLICIT_CONV_EXPR)
76e4b17023SJohn Marino       TRANSACTION_EXPR_IS_STMT (in TRANSACTION_EXPR)
77e4b17023SJohn Marino       CONVERT_EXPR_VBASE_PATH (in CONVERT_EXPR)
78e4b17023SJohn Marino       OVL_ARG_DEPENDENT (in OVERLOAD)
79e4b17023SJohn Marino       PACK_EXPANSION_LOCAL_P (in *_PACK_EXPANSION)
80e4b17023SJohn Marino    1: IDENTIFIER_VIRTUAL_P (in IDENTIFIER_NODE)
81e4b17023SJohn Marino       TI_PENDING_TEMPLATE_FLAG.
82e4b17023SJohn Marino       TEMPLATE_PARMS_FOR_INLINE.
83e4b17023SJohn Marino       DELETE_EXPR_USE_VEC (in DELETE_EXPR).
84e4b17023SJohn Marino       (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
85e4b17023SJohn Marino       ICS_ELLIPSIS_FLAG (in _CONV)
86e4b17023SJohn Marino       DECL_INITIALIZED_P (in VAR_DECL)
87e4b17023SJohn Marino       TYPENAME_IS_CLASS_P (in TYPENAME_TYPE)
88e4b17023SJohn Marino       STMT_IS_FULL_EXPR_P (in _STMT)
89e4b17023SJohn Marino       TARGET_EXPR_LIST_INIT_P (in TARGET_EXPR)
90e4b17023SJohn Marino       LAMBDA_EXPR_MUTABLE_P (in LAMBDA_EXPR)
91e4b17023SJohn Marino       DECL_FINAL_P (in FUNCTION_DECL)
92e4b17023SJohn Marino       QUALIFIED_NAME_IS_TEMPLATE (in SCOPE_REF)
93e4b17023SJohn Marino    2: IDENTIFIER_OPNAME_P (in IDENTIFIER_NODE)
94e4b17023SJohn Marino       ICS_THIS_FLAG (in _CONV)
95e4b17023SJohn Marino       DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (in VAR_DECL)
96e4b17023SJohn Marino       STATEMENT_LIST_TRY_BLOCK (in STATEMENT_LIST)
97e4b17023SJohn Marino       TYPENAME_IS_RESOLVING_P (in TYPE_NAME_TYPE)
98e4b17023SJohn Marino       LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P (in LAMBDA_EXPR)
99e4b17023SJohn Marino       TARGET_EXPR_DIRECT_INIT_P (in TARGET_EXPR)
100e4b17023SJohn Marino    3: (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
101e4b17023SJohn Marino       ICS_BAD_FLAG (in _CONV)
102e4b17023SJohn Marino       FN_TRY_BLOCK_P (in TRY_BLOCK)
103e4b17023SJohn Marino       IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE)
104e4b17023SJohn Marino       BIND_EXPR_BODY_BLOCK (in BIND_EXPR)
105e4b17023SJohn Marino       DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL)
106e4b17023SJohn Marino    4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
107e4b17023SJohn Marino 	  or FIELD_DECL).
108e4b17023SJohn Marino       IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE)
109e4b17023SJohn Marino       DECL_TINFO_P (in VAR_DECL)
110e4b17023SJohn Marino    5: C_IS_RESERVED_WORD (in IDENTIFIER_NODE)
111e4b17023SJohn Marino       DECL_VTABLE_OR_VTT_P (in VAR_DECL)
112e4b17023SJohn Marino    6: IDENTIFIER_REPO_CHOSEN (in IDENTIFIER_NODE)
113e4b17023SJohn Marino       DECL_CONSTRUCTION_VTABLE_P (in VAR_DECL)
114e4b17023SJohn Marino       TYPE_MARKED_P (in _TYPE)
115e4b17023SJohn Marino 
116e4b17023SJohn Marino    Usage of TYPE_LANG_FLAG_?:
117e4b17023SJohn Marino    0: TYPE_DEPENDENT_P
118e4b17023SJohn Marino    1: TYPE_HAS_USER_CONSTRUCTOR.
119e4b17023SJohn Marino    2: unused
120e4b17023SJohn Marino    3: TYPE_FOR_JAVA.
121e4b17023SJohn Marino    4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
122e4b17023SJohn Marino    5: CLASS_TYPE_P (in RECORD_TYPE and UNION_TYPE)
123e4b17023SJohn Marino       ENUM_FIXED_UNDERLYING_TYPE_P (in ENUMERAL_TYPE)
124e4b17023SJohn Marino    6: TYPE_DEPENDENT_P_VALID
125e4b17023SJohn Marino 
126e4b17023SJohn Marino    Usage of DECL_LANG_FLAG_?:
127e4b17023SJohn Marino    0: DECL_ERROR_REPORTED (in VAR_DECL).
128e4b17023SJohn Marino       DECL_TEMPLATE_PARM_P (in PARM_DECL, CONST_DECL, TYPE_DECL, or TEMPLATE_DECL)
129e4b17023SJohn Marino       DECL_LOCAL_FUNCTION_P (in FUNCTION_DECL)
130e4b17023SJohn Marino       DECL_MUTABLE_P (in FIELD_DECL)
131e4b17023SJohn Marino       DECL_DEPENDENT_P (in USING_DECL)
132e4b17023SJohn Marino    1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
133e4b17023SJohn Marino       DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
134e4b17023SJohn Marino       DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
135e4b17023SJohn Marino       FUNCTION_PARAMETER_PACK_P (in PARM_DECL)
136e4b17023SJohn Marino       USING_DECL_TYPENAME_P (in USING_DECL)
137e4b17023SJohn Marino    2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
138e4b17023SJohn Marino       DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
139e4b17023SJohn Marino    3: DECL_IN_AGGR_P.
140e4b17023SJohn Marino    4: DECL_C_BIT_FIELD (in a FIELD_DECL)
141e4b17023SJohn Marino       DECL_ANON_UNION_VAR_P (in a VAR_DECL)
142e4b17023SJohn Marino       DECL_SELF_REFERENCE_P (in a TYPE_DECL)
143e4b17023SJohn Marino       DECL_INVALID_OVERRIDER_P (in a FUNCTION_DECL)
144e4b17023SJohn Marino    5: DECL_INTERFACE_KNOWN.
145e4b17023SJohn Marino    6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
146e4b17023SJohn Marino       DECL_FIELD_IS_BASE (in FIELD_DECL)
147e4b17023SJohn Marino       TYPE_DECL_ALIAS_P (in TYPE_DECL)
148e4b17023SJohn Marino    7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
149e4b17023SJohn Marino       DECL_THUNK_P (in a member FUNCTION_DECL)
150e4b17023SJohn Marino       DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
151e4b17023SJohn Marino    8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL)
152e4b17023SJohn Marino 
153e4b17023SJohn Marino    Usage of language-independent fields in a language-dependent manner:
154e4b17023SJohn Marino 
155e4b17023SJohn Marino    TYPE_ALIAS_SET
156e4b17023SJohn Marino      This field is used by TYPENAME_TYPEs, TEMPLATE_TYPE_PARMs, and so
157e4b17023SJohn Marino      forth as a substitute for the mark bits provided in `lang_type'.
158e4b17023SJohn Marino      At present, only the six low-order bits are used.
159e4b17023SJohn Marino 
160e4b17023SJohn Marino    TYPE_LANG_SLOT_1
161e4b17023SJohn Marino      For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
162e4b17023SJohn Marino      For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
163e4b17023SJohn Marino 
164e4b17023SJohn Marino   BINFO_VIRTUALS
165e4b17023SJohn Marino      For a binfo, this is a TREE_LIST.  There is an entry for each
166e4b17023SJohn Marino      virtual function declared either in BINFO or its direct and
167e4b17023SJohn Marino      indirect primary bases.
168e4b17023SJohn Marino 
169e4b17023SJohn Marino      The BV_DELTA of each node gives the amount by which to adjust the
170e4b17023SJohn Marino      `this' pointer when calling the function.  If the method is an
171e4b17023SJohn Marino      overridden version of a base class method, then it is assumed
172e4b17023SJohn Marino      that, prior to adjustment, the this pointer points to an object
173e4b17023SJohn Marino      of the base class.
174e4b17023SJohn Marino 
175e4b17023SJohn Marino      The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
176e4b17023SJohn Marino      index of the vcall offset for this entry.
177e4b17023SJohn Marino 
178e4b17023SJohn Marino      The BV_FN is the declaration for the virtual function itself.
179e4b17023SJohn Marino 
180e4b17023SJohn Marino      If BV_LOST_PRIMARY is set, it means that this entry is for a lost
181e4b17023SJohn Marino      primary virtual base and can be left null in the vtable.
182e4b17023SJohn Marino 
183e4b17023SJohn Marino    BINFO_VTABLE
184e4b17023SJohn Marino      This is an expression with POINTER_TYPE that gives the value
185e4b17023SJohn Marino      to which the vptr should be initialized.  Use get_vtbl_decl_for_binfo
186e4b17023SJohn Marino      to extract the VAR_DECL for the complete vtable.
187e4b17023SJohn Marino 
188e4b17023SJohn Marino    DECL_VINDEX
189e4b17023SJohn Marino      This field is NULL for a non-virtual function.  For a virtual
190e4b17023SJohn Marino      function, it is eventually set to an INTEGER_CST indicating the
191e4b17023SJohn Marino      index in the vtable at which this function can be found.  When
192e4b17023SJohn Marino      a virtual function is declared, but before it is known what
193e4b17023SJohn Marino      function is overridden, this field is the error_mark_node.
194e4b17023SJohn Marino 
195e4b17023SJohn Marino      Temporarily, it may be set to a TREE_LIST whose TREE_VALUE is
196e4b17023SJohn Marino      the virtual function this one overrides, and whose TREE_CHAIN is
197e4b17023SJohn Marino      the old DECL_VINDEX.  */
198e4b17023SJohn Marino 
199e4b17023SJohn Marino /* Language-specific tree checkers.  */
200e4b17023SJohn Marino 
201e4b17023SJohn Marino #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
202e4b17023SJohn Marino   TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL)
203e4b17023SJohn Marino 
204e4b17023SJohn Marino #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
205e4b17023SJohn Marino   TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL)
206e4b17023SJohn Marino 
207e4b17023SJohn Marino #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
208e4b17023SJohn Marino   TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
209e4b17023SJohn Marino 
210e4b17023SJohn Marino #define VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK(NODE) \
211e4b17023SJohn Marino   TREE_CHECK5(NODE,VAR_DECL,FIELD_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
212e4b17023SJohn Marino 
213e4b17023SJohn Marino #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
214e4b17023SJohn Marino   TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
215e4b17023SJohn Marino 
216e4b17023SJohn Marino #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
217e4b17023SJohn Marino #define THUNK_FUNCTION_CHECK(NODE) __extension__			\
218e4b17023SJohn Marino ({  __typeof (NODE) const __t = (NODE);					\
219e4b17023SJohn Marino     if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
220e4b17023SJohn Marino 	|| !__t->decl_common.lang_specific->u.fn.thunk_p)		\
221e4b17023SJohn Marino       tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0);	\
222e4b17023SJohn Marino      __t; })
223e4b17023SJohn Marino #else
224e4b17023SJohn Marino #define THUNK_FUNCTION_CHECK(NODE) (NODE)
225e4b17023SJohn Marino #endif
226e4b17023SJohn Marino 
227e4b17023SJohn Marino /* Language-dependent contents of an identifier.  */
228e4b17023SJohn Marino 
229e4b17023SJohn Marino struct GTY(()) lang_identifier {
230e4b17023SJohn Marino   struct c_common_identifier c_common;
231e4b17023SJohn Marino   cxx_binding *namespace_bindings;
232e4b17023SJohn Marino   cxx_binding *bindings;
233e4b17023SJohn Marino   tree class_template_info;
234e4b17023SJohn Marino   tree label_value;
235e4b17023SJohn Marino };
236e4b17023SJohn Marino 
237e4b17023SJohn Marino /* In an IDENTIFIER_NODE, nonzero if this identifier is actually a
238e4b17023SJohn Marino    keyword.  C_RID_CODE (node) is then the RID_* value of the keyword,
239e4b17023SJohn Marino    and C_RID_YYCODE is the token number wanted by Yacc.  */
240e4b17023SJohn Marino 
241e4b17023SJohn Marino #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
242e4b17023SJohn Marino 
243e4b17023SJohn Marino #define LANG_IDENTIFIER_CAST(NODE) \
244e4b17023SJohn Marino 	((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
245e4b17023SJohn Marino 
246e4b17023SJohn Marino struct GTY(()) template_parm_index_s {
247e4b17023SJohn Marino   struct tree_common common;
248e4b17023SJohn Marino   int index;
249e4b17023SJohn Marino   int level;
250e4b17023SJohn Marino   int orig_level;
251e4b17023SJohn Marino   tree decl;
252e4b17023SJohn Marino };
253e4b17023SJohn Marino typedef struct template_parm_index_s template_parm_index;
254e4b17023SJohn Marino 
255e4b17023SJohn Marino struct GTY(()) ptrmem_cst {
256e4b17023SJohn Marino   struct tree_common common;
257e4b17023SJohn Marino   tree member;
258e4b17023SJohn Marino };
259e4b17023SJohn Marino typedef struct ptrmem_cst * ptrmem_cst_t;
260e4b17023SJohn Marino 
261e4b17023SJohn Marino #define IDENTIFIER_GLOBAL_VALUE(NODE) \
262e4b17023SJohn Marino   namespace_binding ((NODE), global_namespace)
263e4b17023SJohn Marino #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
264e4b17023SJohn Marino   set_namespace_binding ((NODE), global_namespace, (VAL))
265e4b17023SJohn Marino #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
266e4b17023SJohn Marino   namespace_binding ((NODE), current_namespace)
267e4b17023SJohn Marino #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
268e4b17023SJohn Marino   set_namespace_binding ((NODE), current_namespace, (VAL))
269e4b17023SJohn Marino 
270e4b17023SJohn Marino #define CLEANUP_P(NODE)		TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
271e4b17023SJohn Marino 
272e4b17023SJohn Marino #define BIND_EXPR_TRY_BLOCK(NODE) \
273e4b17023SJohn Marino   TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE))
274e4b17023SJohn Marino 
275e4b17023SJohn Marino /* Used to mark the block around the member initializers and cleanups.  */
276e4b17023SJohn Marino #define BIND_EXPR_BODY_BLOCK(NODE) \
277e4b17023SJohn Marino   TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
278e4b17023SJohn Marino #define FUNCTION_NEEDS_BODY_BLOCK(NODE) \
279e4b17023SJohn Marino   (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE) \
280e4b17023SJohn Marino    || LAMBDA_FUNCTION_P (NODE))
281e4b17023SJohn Marino 
282e4b17023SJohn Marino #define STATEMENT_LIST_NO_SCOPE(NODE) \
283e4b17023SJohn Marino   TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
284e4b17023SJohn Marino #define STATEMENT_LIST_TRY_BLOCK(NODE) \
285e4b17023SJohn Marino   TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
286e4b17023SJohn Marino 
287e4b17023SJohn Marino /* Nonzero if this statement should be considered a full-expression,
288e4b17023SJohn Marino    i.e., if temporaries created during this statement should have
289e4b17023SJohn Marino    their destructors run at the end of this statement.  */
290e4b17023SJohn Marino #define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
291e4b17023SJohn Marino 
292e4b17023SJohn Marino /* Marks the result of a statement expression.  */
293e4b17023SJohn Marino #define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
294e4b17023SJohn Marino   TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
295e4b17023SJohn Marino 
296e4b17023SJohn Marino /* Nonzero if this statement-expression does not have an associated scope.  */
297e4b17023SJohn Marino #define STMT_EXPR_NO_SCOPE(NODE) \
298e4b17023SJohn Marino    TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
299e4b17023SJohn Marino 
300e4b17023SJohn Marino /* Returns nonzero iff TYPE1 and TYPE2 are the same type, in the usual
301e4b17023SJohn Marino    sense of `same'.  */
302e4b17023SJohn Marino #define same_type_p(TYPE1, TYPE2) \
303e4b17023SJohn Marino   comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
304e4b17023SJohn Marino 
305e4b17023SJohn Marino /* Returns nonzero iff NODE is a declaration for the global function
306e4b17023SJohn Marino    `main'.  */
307e4b17023SJohn Marino #define DECL_MAIN_P(NODE)				\
308e4b17023SJohn Marino    (DECL_EXTERN_C_FUNCTION_P (NODE)			\
309e4b17023SJohn Marino     && DECL_NAME (NODE) != NULL_TREE			\
310e4b17023SJohn Marino     && MAIN_NAME_P (DECL_NAME (NODE))			\
311e4b17023SJohn Marino     && flag_hosted)
312e4b17023SJohn Marino 
313e4b17023SJohn Marino /* The overloaded FUNCTION_DECL.  */
314e4b17023SJohn Marino #define OVL_FUNCTION(NODE) \
315e4b17023SJohn Marino   (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
316e4b17023SJohn Marino #define OVL_CHAIN(NODE)      TREE_CHAIN (NODE)
317e4b17023SJohn Marino /* Polymorphic access to FUNCTION and CHAIN.  */
318e4b17023SJohn Marino #define OVL_CURRENT(NODE)	\
319e4b17023SJohn Marino   ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
320e4b17023SJohn Marino #define OVL_NEXT(NODE)		\
321e4b17023SJohn Marino   ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
322e4b17023SJohn Marino /* If set, this was imported in a using declaration.
323e4b17023SJohn Marino    This is not to confuse with being used somewhere, which
324e4b17023SJohn Marino    is not important for this node.  */
325e4b17023SJohn Marino #define OVL_USED(NODE)		TREE_USED (NODE)
326e4b17023SJohn Marino /* If set, this OVERLOAD was created for argument-dependent lookup
327e4b17023SJohn Marino    and can be freed afterward.  */
328e4b17023SJohn Marino #define OVL_ARG_DEPENDENT(NODE) TREE_LANG_FLAG_0 (OVERLOAD_CHECK (NODE))
329e4b17023SJohn Marino 
330e4b17023SJohn Marino struct GTY(()) tree_overload {
331e4b17023SJohn Marino   struct tree_common common;
332e4b17023SJohn Marino   tree function;
333e4b17023SJohn Marino };
334e4b17023SJohn Marino 
335e4b17023SJohn Marino /* Returns true iff NODE is a BASELINK.  */
336e4b17023SJohn Marino #define BASELINK_P(NODE) \
337e4b17023SJohn Marino   (TREE_CODE (NODE) == BASELINK)
338e4b17023SJohn Marino /* The BINFO indicating the base from which the BASELINK_FUNCTIONS came.  */
339e4b17023SJohn Marino #define BASELINK_BINFO(NODE) \
340e4b17023SJohn Marino   (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
341e4b17023SJohn Marino /* The functions referred to by the BASELINK; either a FUNCTION_DECL,
342e4b17023SJohn Marino    a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR.  */
343e4b17023SJohn Marino #define BASELINK_FUNCTIONS(NODE) \
344e4b17023SJohn Marino   (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
345e4b17023SJohn Marino /* The BINFO in which the search for the functions indicated by this baselink
346e4b17023SJohn Marino    began.  This base is used to determine the accessibility of functions
347e4b17023SJohn Marino    selected by overload resolution.  */
348e4b17023SJohn Marino #define BASELINK_ACCESS_BINFO(NODE) \
349e4b17023SJohn Marino   (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
350e4b17023SJohn Marino /* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
351e4b17023SJohn Marino    to which the conversion should occur.  This value is important if
352e4b17023SJohn Marino    the BASELINK_FUNCTIONS include a template conversion operator --
353e4b17023SJohn Marino    the BASELINK_OPTYPE can be used to determine what type the user
354e4b17023SJohn Marino    requested.  */
355e4b17023SJohn Marino #define BASELINK_OPTYPE(NODE) \
356e4b17023SJohn Marino   (TREE_CHAIN (BASELINK_CHECK (NODE)))
357e4b17023SJohn Marino /* Nonzero if this baselink was from a qualified lookup.  */
358e4b17023SJohn Marino #define BASELINK_QUALIFIED_P(NODE) \
359e4b17023SJohn Marino   TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE))
360e4b17023SJohn Marino 
361e4b17023SJohn Marino struct GTY(()) tree_baselink {
362e4b17023SJohn Marino   struct tree_common common;
363e4b17023SJohn Marino   tree binfo;
364e4b17023SJohn Marino   tree functions;
365e4b17023SJohn Marino   tree access_binfo;
366e4b17023SJohn Marino };
367e4b17023SJohn Marino 
368e4b17023SJohn Marino /* The different kinds of ids that we encounter.  */
369e4b17023SJohn Marino 
370e4b17023SJohn Marino typedef enum cp_id_kind
371e4b17023SJohn Marino {
372e4b17023SJohn Marino   /* Not an id at all.  */
373e4b17023SJohn Marino   CP_ID_KIND_NONE,
374e4b17023SJohn Marino   /* An unqualified-id that is not a template-id.  */
375e4b17023SJohn Marino   CP_ID_KIND_UNQUALIFIED,
376e4b17023SJohn Marino   /* An unqualified-id that is a dependent name.  */
377e4b17023SJohn Marino   CP_ID_KIND_UNQUALIFIED_DEPENDENT,
378e4b17023SJohn Marino   /* An unqualified template-id.  */
379e4b17023SJohn Marino   CP_ID_KIND_TEMPLATE_ID,
380e4b17023SJohn Marino   /* A qualified-id.  */
381e4b17023SJohn Marino   CP_ID_KIND_QUALIFIED
382e4b17023SJohn Marino } cp_id_kind;
383e4b17023SJohn Marino 
384e4b17023SJohn Marino 
385e4b17023SJohn Marino /* The various kinds of C++0x warnings we encounter. */
386e4b17023SJohn Marino 
387e4b17023SJohn Marino typedef enum cpp0x_warn_str
388e4b17023SJohn Marino {
389e4b17023SJohn Marino   /* extended initializer lists */
390e4b17023SJohn Marino   CPP0X_INITIALIZER_LISTS,
391e4b17023SJohn Marino   /* explicit conversion operators */
392e4b17023SJohn Marino   CPP0X_EXPLICIT_CONVERSION,
393e4b17023SJohn Marino   /* variadic templates */
394e4b17023SJohn Marino   CPP0X_VARIADIC_TEMPLATES,
395e4b17023SJohn Marino   /* lambda expressions */
396e4b17023SJohn Marino   CPP0X_LAMBDA_EXPR,
397e4b17023SJohn Marino   /* C++0x auto */
398e4b17023SJohn Marino   CPP0X_AUTO,
399e4b17023SJohn Marino   /* scoped enums */
400e4b17023SJohn Marino   CPP0X_SCOPED_ENUMS,
401e4b17023SJohn Marino   /* defaulted and deleted functions */
402e4b17023SJohn Marino   CPP0X_DEFAULTED_DELETED,
403e4b17023SJohn Marino   /* inline namespaces */
404e4b17023SJohn Marino   CPP0X_INLINE_NAMESPACES,
405e4b17023SJohn Marino   /* override controls, override/final */
406e4b17023SJohn Marino   CPP0X_OVERRIDE_CONTROLS,
407e4b17023SJohn Marino   /* non-static data member initializers */
408e4b17023SJohn Marino   CPP0X_NSDMI,
409e4b17023SJohn Marino   /* user defined literals */
410e4b17023SJohn Marino   CPP0X_USER_DEFINED_LITERALS,
411e4b17023SJohn Marino   /* delegating constructors */
412e4b17023SJohn Marino   CPP0X_DELEGATING_CTORS
413e4b17023SJohn Marino } cpp0x_warn_str;
414e4b17023SJohn Marino 
415e4b17023SJohn Marino /* The various kinds of operation used by composite_pointer_type. */
416e4b17023SJohn Marino 
417e4b17023SJohn Marino typedef enum composite_pointer_operation
418e4b17023SJohn Marino {
419e4b17023SJohn Marino   /* comparison */
420e4b17023SJohn Marino   CPO_COMPARISON,
421e4b17023SJohn Marino   /* conversion */
422e4b17023SJohn Marino   CPO_CONVERSION,
423e4b17023SJohn Marino   /* conditional expression */
424e4b17023SJohn Marino   CPO_CONDITIONAL_EXPR
425e4b17023SJohn Marino } composite_pointer_operation;
426e4b17023SJohn Marino 
427e4b17023SJohn Marino /* Possible cases of expression list used by build_x_compound_expr_from_list. */
428e4b17023SJohn Marino typedef enum expr_list_kind {
429e4b17023SJohn Marino   ELK_INIT,		/* initializer */
430e4b17023SJohn Marino   ELK_MEM_INIT,		/* member initializer */
431e4b17023SJohn Marino   ELK_FUNC_CAST		/* functional cast */
432e4b17023SJohn Marino } expr_list_kind;
433e4b17023SJohn Marino 
434e4b17023SJohn Marino /* Possible cases of implicit bad rhs conversions. */
435e4b17023SJohn Marino typedef enum impl_conv_rhs {
436e4b17023SJohn Marino   ICR_DEFAULT_ARGUMENT, /* default argument */
437e4b17023SJohn Marino   ICR_CONVERTING,       /* converting */
438e4b17023SJohn Marino   ICR_INIT,             /* initialization */
439e4b17023SJohn Marino   ICR_ARGPASS,          /* argument passing */
440e4b17023SJohn Marino   ICR_RETURN,           /* return */
441e4b17023SJohn Marino   ICR_ASSIGN            /* assignment */
442e4b17023SJohn Marino } impl_conv_rhs;
443e4b17023SJohn Marino 
444e4b17023SJohn Marino /* Possible cases of implicit or explicit bad conversions to void. */
445e4b17023SJohn Marino typedef enum impl_conv_void {
446e4b17023SJohn Marino   ICV_CAST,            /* (explicit) conversion to void */
447e4b17023SJohn Marino   ICV_SECOND_OF_COND,  /* second operand of conditional expression */
448e4b17023SJohn Marino   ICV_THIRD_OF_COND,   /* third operand of conditional expression */
449e4b17023SJohn Marino   ICV_RIGHT_OF_COMMA,  /* right operand of comma operator */
450e4b17023SJohn Marino   ICV_LEFT_OF_COMMA,   /* left operand of comma operator */
451e4b17023SJohn Marino   ICV_STATEMENT,       /* statement */
452e4b17023SJohn Marino   ICV_THIRD_IN_FOR     /* for increment expression */
453e4b17023SJohn Marino } impl_conv_void;
454e4b17023SJohn Marino 
455e4b17023SJohn Marino /* Macros for access to language-specific slots in an identifier.  */
456e4b17023SJohn Marino 
457e4b17023SJohn Marino #define IDENTIFIER_NAMESPACE_BINDINGS(NODE)	\
458e4b17023SJohn Marino   (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
459e4b17023SJohn Marino #define IDENTIFIER_TEMPLATE(NODE)	\
460e4b17023SJohn Marino   (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
461e4b17023SJohn Marino 
462e4b17023SJohn Marino /* The IDENTIFIER_BINDING is the innermost cxx_binding for the
463e4b17023SJohn Marino     identifier.  It's PREVIOUS is the next outermost binding.  Each
464e4b17023SJohn Marino     VALUE field is a DECL for the associated declaration.  Thus,
465e4b17023SJohn Marino     name lookup consists simply of pulling off the node at the front
466e4b17023SJohn Marino     of the list (modulo oddities for looking up the names of types,
467e4b17023SJohn Marino     and such.)  You can use SCOPE field to determine the scope
468e4b17023SJohn Marino     that bound the name.  */
469e4b17023SJohn Marino #define IDENTIFIER_BINDING(NODE) \
470e4b17023SJohn Marino   (LANG_IDENTIFIER_CAST (NODE)->bindings)
471e4b17023SJohn Marino 
472e4b17023SJohn Marino /* TREE_TYPE only indicates on local and class scope the current
473e4b17023SJohn Marino    type. For namespace scope, the presence of a type in any namespace
474e4b17023SJohn Marino    is indicated with global_type_node, and the real type behind must
475e4b17023SJohn Marino    be found through lookup.  */
476e4b17023SJohn Marino #define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
477e4b17023SJohn Marino #define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
478e4b17023SJohn Marino #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
479e4b17023SJohn Marino #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
480e4b17023SJohn Marino 
481e4b17023SJohn Marino #define IDENTIFIER_LABEL_VALUE(NODE) \
482e4b17023SJohn Marino   (LANG_IDENTIFIER_CAST (NODE)->label_value)
483e4b17023SJohn Marino #define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE)   \
484e4b17023SJohn Marino   IDENTIFIER_LABEL_VALUE (NODE) = (VALUE)
485e4b17023SJohn Marino 
486e4b17023SJohn Marino /* Nonzero if this identifier is used as a virtual function name somewhere
487e4b17023SJohn Marino    (optimizes searches).  */
488e4b17023SJohn Marino #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
489e4b17023SJohn Marino 
490e4b17023SJohn Marino /* Nonzero if this identifier is the prefix for a mangled C++ operator
491e4b17023SJohn Marino    name.  */
492e4b17023SJohn Marino #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
493e4b17023SJohn Marino 
494e4b17023SJohn Marino /* Nonzero if this identifier is the name of a type-conversion
495e4b17023SJohn Marino    operator.  */
496e4b17023SJohn Marino #define IDENTIFIER_TYPENAME_P(NODE) \
497e4b17023SJohn Marino   TREE_LANG_FLAG_4 (NODE)
498e4b17023SJohn Marino 
499e4b17023SJohn Marino /* Nonzero if this identifier is the name of a constructor or
500e4b17023SJohn Marino    destructor.  */
501e4b17023SJohn Marino #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
502e4b17023SJohn Marino   TREE_LANG_FLAG_3 (NODE)
503e4b17023SJohn Marino 
504e4b17023SJohn Marino /* True iff NAME is the DECL_ASSEMBLER_NAME for an entity with vague
505e4b17023SJohn Marino    linkage which the prelinker has assigned to this translation
506e4b17023SJohn Marino    unit.  */
507e4b17023SJohn Marino #define IDENTIFIER_REPO_CHOSEN(NAME) \
508e4b17023SJohn Marino   (TREE_LANG_FLAG_6 (NAME))
509e4b17023SJohn Marino 
510e4b17023SJohn Marino /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only.  */
511e4b17023SJohn Marino #define C_TYPE_FIELDS_READONLY(TYPE) \
512e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
513e4b17023SJohn Marino 
514e4b17023SJohn Marino /* The tokens stored in the default argument.  */
515e4b17023SJohn Marino 
516e4b17023SJohn Marino #define DEFARG_TOKENS(NODE) \
517e4b17023SJohn Marino   (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
518e4b17023SJohn Marino #define DEFARG_INSTANTIATIONS(NODE) \
519e4b17023SJohn Marino   (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations)
520e4b17023SJohn Marino 
521e4b17023SJohn Marino struct GTY (()) tree_default_arg {
522e4b17023SJohn Marino   struct tree_common common;
523e4b17023SJohn Marino   struct cp_token_cache *tokens;
524e4b17023SJohn Marino   VEC(tree,gc) *instantiations;
525e4b17023SJohn Marino };
526e4b17023SJohn Marino 
527e4b17023SJohn Marino 
528e4b17023SJohn Marino #define DEFERRED_NOEXCEPT_PATTERN(NODE) \
529e4b17023SJohn Marino   (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->pattern)
530e4b17023SJohn Marino #define DEFERRED_NOEXCEPT_ARGS(NODE) \
531e4b17023SJohn Marino   (((struct tree_deferred_noexcept *)DEFERRED_NOEXCEPT_CHECK (NODE))->args)
532e4b17023SJohn Marino #define DEFERRED_NOEXCEPT_SPEC_P(NODE)				\
533e4b17023SJohn Marino   ((NODE) && (TREE_PURPOSE (NODE))				\
534e4b17023SJohn Marino   && (TREE_CODE (TREE_PURPOSE (NODE)) == DEFERRED_NOEXCEPT	\
535e4b17023SJohn Marino       || is_overloaded_fn (TREE_PURPOSE (NODE))))
536e4b17023SJohn Marino 
537e4b17023SJohn Marino struct GTY (()) tree_deferred_noexcept {
538e4b17023SJohn Marino   struct tree_base base;
539e4b17023SJohn Marino   tree pattern;
540e4b17023SJohn Marino   tree args;
541e4b17023SJohn Marino };
542e4b17023SJohn Marino 
543e4b17023SJohn Marino 
544e4b17023SJohn Marino /* The condition associated with the static assertion.  This must be
545e4b17023SJohn Marino    an integral constant expression.  */
546e4b17023SJohn Marino #define STATIC_ASSERT_CONDITION(NODE) \
547e4b17023SJohn Marino   (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->condition)
548e4b17023SJohn Marino 
549e4b17023SJohn Marino /* The message associated with the static assertion.  This must be a
550e4b17023SJohn Marino    string constant, which will be emitted as an error message when the
551e4b17023SJohn Marino    static assert condition is false.  */
552e4b17023SJohn Marino #define STATIC_ASSERT_MESSAGE(NODE) \
553e4b17023SJohn Marino   (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->message)
554e4b17023SJohn Marino 
555e4b17023SJohn Marino /* Source location information for a static assertion.  */
556e4b17023SJohn Marino #define STATIC_ASSERT_SOURCE_LOCATION(NODE) \
557e4b17023SJohn Marino   (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location)
558e4b17023SJohn Marino 
559e4b17023SJohn Marino struct GTY (()) tree_static_assert {
560e4b17023SJohn Marino   struct tree_common common;
561e4b17023SJohn Marino   tree condition;
562e4b17023SJohn Marino   tree message;
563e4b17023SJohn Marino   location_t location;
564e4b17023SJohn Marino };
565e4b17023SJohn Marino 
566e4b17023SJohn Marino struct GTY (()) tree_argument_pack_select {
567e4b17023SJohn Marino   struct tree_common common;
568e4b17023SJohn Marino   tree argument_pack;
569e4b17023SJohn Marino   int index;
570e4b17023SJohn Marino };
571e4b17023SJohn Marino 
572e4b17023SJohn Marino /* The different kinds of traits that we encounter.  */
573e4b17023SJohn Marino 
574e4b17023SJohn Marino typedef enum cp_trait_kind
575e4b17023SJohn Marino {
576e4b17023SJohn Marino   CPTK_BASES,
577e4b17023SJohn Marino   CPTK_DIRECT_BASES,
578e4b17023SJohn Marino   CPTK_HAS_NOTHROW_ASSIGN,
579e4b17023SJohn Marino   CPTK_HAS_NOTHROW_CONSTRUCTOR,
580e4b17023SJohn Marino   CPTK_HAS_NOTHROW_COPY,
581e4b17023SJohn Marino   CPTK_HAS_TRIVIAL_ASSIGN,
582e4b17023SJohn Marino   CPTK_HAS_TRIVIAL_CONSTRUCTOR,
583e4b17023SJohn Marino   CPTK_HAS_TRIVIAL_COPY,
584e4b17023SJohn Marino   CPTK_HAS_TRIVIAL_DESTRUCTOR,
585e4b17023SJohn Marino   CPTK_HAS_VIRTUAL_DESTRUCTOR,
586e4b17023SJohn Marino   CPTK_IS_ABSTRACT,
587e4b17023SJohn Marino   CPTK_IS_BASE_OF,
588e4b17023SJohn Marino   CPTK_IS_CLASS,
589e4b17023SJohn Marino   CPTK_IS_CONVERTIBLE_TO,
590e4b17023SJohn Marino   CPTK_IS_EMPTY,
591e4b17023SJohn Marino   CPTK_IS_ENUM,
592e4b17023SJohn Marino   CPTK_IS_FINAL,
593e4b17023SJohn Marino   CPTK_IS_LITERAL_TYPE,
594e4b17023SJohn Marino   CPTK_IS_POD,
595e4b17023SJohn Marino   CPTK_IS_POLYMORPHIC,
596e4b17023SJohn Marino   CPTK_IS_STD_LAYOUT,
597e4b17023SJohn Marino   CPTK_IS_TRIVIAL,
598e4b17023SJohn Marino   CPTK_IS_UNION,
599e4b17023SJohn Marino   CPTK_UNDERLYING_TYPE
600e4b17023SJohn Marino } cp_trait_kind;
601e4b17023SJohn Marino 
602e4b17023SJohn Marino /* The types that we are processing.  */
603e4b17023SJohn Marino #define TRAIT_EXPR_TYPE1(NODE) \
604e4b17023SJohn Marino   (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type1)
605e4b17023SJohn Marino 
606e4b17023SJohn Marino #define TRAIT_EXPR_TYPE2(NODE) \
607e4b17023SJohn Marino   (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->type2)
608e4b17023SJohn Marino 
609e4b17023SJohn Marino /* The specific trait that we are processing.  */
610e4b17023SJohn Marino #define TRAIT_EXPR_KIND(NODE) \
611e4b17023SJohn Marino   (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->kind)
612e4b17023SJohn Marino 
613e4b17023SJohn Marino struct GTY (()) tree_trait_expr {
614e4b17023SJohn Marino   struct tree_common common;
615e4b17023SJohn Marino   tree type1;
616e4b17023SJohn Marino   tree type2;
617e4b17023SJohn Marino   enum cp_trait_kind kind;
618e4b17023SJohn Marino };
619e4b17023SJohn Marino 
620e4b17023SJohn Marino /* Based off of TYPE_ANONYMOUS_P.  */
621e4b17023SJohn Marino #define LAMBDA_TYPE_P(NODE) \
622e4b17023SJohn Marino   (CLASS_TYPE_P (NODE) && LAMBDANAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
623e4b17023SJohn Marino 
624e4b17023SJohn Marino /* Test if FUNCTION_DECL is a lambda function.  */
625e4b17023SJohn Marino #define LAMBDA_FUNCTION_P(FNDECL) \
626e4b17023SJohn Marino   (DECL_OVERLOADED_OPERATOR_P (FNDECL) == CALL_EXPR \
627e4b17023SJohn Marino    && LAMBDA_TYPE_P (CP_DECL_CONTEXT (FNDECL)))
628e4b17023SJohn Marino 
629e4b17023SJohn Marino enum cp_lambda_default_capture_mode_type {
630e4b17023SJohn Marino   CPLD_NONE,
631e4b17023SJohn Marino   CPLD_COPY,
632e4b17023SJohn Marino   CPLD_REFERENCE
633e4b17023SJohn Marino };
634e4b17023SJohn Marino 
635e4b17023SJohn Marino /* The method of default capture, if any.  */
636e4b17023SJohn Marino #define LAMBDA_EXPR_DEFAULT_CAPTURE_MODE(NODE) \
637e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->default_capture_mode)
638e4b17023SJohn Marino 
639e4b17023SJohn Marino /* The capture-list, including `this'.  Each capture is stored as a FIELD_DECL
640e4b17023SJohn Marino  * so that the name, type, and field are all together, whether or not it has
641e4b17023SJohn Marino  * been added to the lambda's class type.
642e4b17023SJohn Marino    TREE_LIST:
643e4b17023SJohn Marino      TREE_PURPOSE: The FIELD_DECL for this capture.
644e4b17023SJohn Marino      TREE_VALUE: The initializer. This is part of a GNU extension.  */
645e4b17023SJohn Marino #define LAMBDA_EXPR_CAPTURE_LIST(NODE) \
646e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list)
647e4b17023SJohn Marino 
6485ce9237cSJohn Marino /* During parsing of the lambda-introducer, the node in the capture-list
6495ce9237cSJohn Marino    that holds the 'this' capture.  During parsing of the body, the
6505ce9237cSJohn Marino    capture proxy for that node.  */
651e4b17023SJohn Marino #define LAMBDA_EXPR_THIS_CAPTURE(NODE) \
652e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture)
653e4b17023SJohn Marino 
654e4b17023SJohn Marino /* Predicate tracking whether `this' is in the effective capture set.  */
655e4b17023SJohn Marino #define LAMBDA_EXPR_CAPTURES_THIS_P(NODE) \
656e4b17023SJohn Marino   LAMBDA_EXPR_THIS_CAPTURE(NODE)
657e4b17023SJohn Marino 
658e4b17023SJohn Marino /* Predicate tracking whether the lambda was declared 'mutable'.  */
659e4b17023SJohn Marino #define LAMBDA_EXPR_MUTABLE_P(NODE) \
660e4b17023SJohn Marino   TREE_LANG_FLAG_1 (LAMBDA_EXPR_CHECK (NODE))
661e4b17023SJohn Marino 
662e4b17023SJohn Marino /* True iff we should try to deduce the lambda return type from any return
663e4b17023SJohn Marino    statement.  */
664e4b17023SJohn Marino #define LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P(NODE) \
665e4b17023SJohn Marino   TREE_LANG_FLAG_2 (LAMBDA_EXPR_CHECK (NODE))
666e4b17023SJohn Marino 
667e4b17023SJohn Marino /* The return type in the expression.
668e4b17023SJohn Marino  * NULL_TREE indicates that none was specified.  */
669e4b17023SJohn Marino #define LAMBDA_EXPR_RETURN_TYPE(NODE) \
670e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->return_type)
671e4b17023SJohn Marino 
672e4b17023SJohn Marino /* The source location of the lambda.  */
673e4b17023SJohn Marino #define LAMBDA_EXPR_LOCATION(NODE) \
674e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->locus)
675e4b17023SJohn Marino 
676e4b17023SJohn Marino /* The mangling scope for the lambda: FUNCTION_DECL, PARM_DECL, VAR_DECL,
677e4b17023SJohn Marino    FIELD_DECL or NULL_TREE.  If this is NULL_TREE, we have no linkage.  */
678e4b17023SJohn Marino #define LAMBDA_EXPR_EXTRA_SCOPE(NODE) \
679e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->extra_scope)
680e4b17023SJohn Marino 
681e4b17023SJohn Marino /* If EXTRA_SCOPE, this is the number of the lambda within that scope.  */
682e4b17023SJohn Marino #define LAMBDA_EXPR_DISCRIMINATOR(NODE) \
683e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->discriminator)
684e4b17023SJohn Marino 
685e4b17023SJohn Marino /* During parsing of the lambda, a vector of capture proxies which need
686e4b17023SJohn Marino    to be pushed once we're done processing a nested lambda.  */
687e4b17023SJohn Marino #define LAMBDA_EXPR_PENDING_PROXIES(NODE) \
688e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->pending_proxies)
689e4b17023SJohn Marino 
690e4b17023SJohn Marino /* The closure type of the lambda.  Note that the TREE_TYPE of a
691e4b17023SJohn Marino    LAMBDA_EXPR is always NULL_TREE, because we need to instantiate the
692e4b17023SJohn Marino    LAMBDA_EXPR in order to instantiate the type.  */
693e4b17023SJohn Marino #define LAMBDA_EXPR_CLOSURE(NODE) \
694e4b17023SJohn Marino   (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->closure)
695e4b17023SJohn Marino 
696e4b17023SJohn Marino struct GTY (()) tree_lambda_expr
697e4b17023SJohn Marino {
698e4b17023SJohn Marino   struct tree_typed typed;
699e4b17023SJohn Marino   tree capture_list;
700e4b17023SJohn Marino   tree this_capture;
701e4b17023SJohn Marino   tree return_type;
702e4b17023SJohn Marino   tree extra_scope;
703e4b17023SJohn Marino   tree closure;
704e4b17023SJohn Marino   VEC(tree,gc)* pending_proxies;
705e4b17023SJohn Marino   location_t locus;
706e4b17023SJohn Marino   enum cp_lambda_default_capture_mode_type default_capture_mode;
707e4b17023SJohn Marino   int discriminator;
708e4b17023SJohn Marino };
709e4b17023SJohn Marino 
710e4b17023SJohn Marino /* A (typedef,context,usage location) triplet.
711e4b17023SJohn Marino    It represents a typedef used through a
712e4b17023SJohn Marino    context at a given source location.
713e4b17023SJohn Marino    e.g.
714e4b17023SJohn Marino    struct foo {
715e4b17023SJohn Marino      typedef int myint;
716e4b17023SJohn Marino    };
717e4b17023SJohn Marino 
718e4b17023SJohn Marino    struct bar {
719e4b17023SJohn Marino     foo::myint v; // #1<-- this location.
720e4b17023SJohn Marino    };
721e4b17023SJohn Marino 
722e4b17023SJohn Marino    In bar, the triplet will be (myint, foo, #1).
723e4b17023SJohn Marino    */
724e4b17023SJohn Marino struct GTY(()) qualified_typedef_usage_s {
725e4b17023SJohn Marino   tree typedef_decl;
726e4b17023SJohn Marino   tree context;
727e4b17023SJohn Marino   location_t locus;
728e4b17023SJohn Marino };
729e4b17023SJohn Marino typedef struct qualified_typedef_usage_s qualified_typedef_usage_t;
730e4b17023SJohn Marino DEF_VEC_O (qualified_typedef_usage_t);
731e4b17023SJohn Marino DEF_VEC_ALLOC_O (qualified_typedef_usage_t,gc);
732e4b17023SJohn Marino 
733e4b17023SJohn Marino struct GTY(()) tree_template_info {
734e4b17023SJohn Marino   struct tree_common common;
735e4b17023SJohn Marino   VEC(qualified_typedef_usage_t,gc) *typedefs_needing_access_checking;
736e4b17023SJohn Marino };
737e4b17023SJohn Marino 
738e4b17023SJohn Marino enum cp_tree_node_structure_enum {
739e4b17023SJohn Marino   TS_CP_GENERIC,
740e4b17023SJohn Marino   TS_CP_IDENTIFIER,
741e4b17023SJohn Marino   TS_CP_TPI,
742e4b17023SJohn Marino   TS_CP_PTRMEM,
743e4b17023SJohn Marino   TS_CP_BINDING,
744e4b17023SJohn Marino   TS_CP_OVERLOAD,
745e4b17023SJohn Marino   TS_CP_BASELINK,
746e4b17023SJohn Marino   TS_CP_WRAPPER,
747e4b17023SJohn Marino   TS_CP_DEFAULT_ARG,
748e4b17023SJohn Marino   TS_CP_DEFERRED_NOEXCEPT,
749e4b17023SJohn Marino   TS_CP_STATIC_ASSERT,
750e4b17023SJohn Marino   TS_CP_ARGUMENT_PACK_SELECT,
751e4b17023SJohn Marino   TS_CP_TRAIT_EXPR,
752e4b17023SJohn Marino   TS_CP_LAMBDA_EXPR,
753e4b17023SJohn Marino   TS_CP_TEMPLATE_INFO,
754e4b17023SJohn Marino   TS_CP_USERDEF_LITERAL,
755e4b17023SJohn Marino   LAST_TS_CP_ENUM
756e4b17023SJohn Marino };
757e4b17023SJohn Marino 
758e4b17023SJohn Marino /* The resulting tree type.  */
759e4b17023SJohn Marino union GTY((desc ("cp_tree_node_structure (&%h)"),
760e4b17023SJohn Marino        chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) lang_tree_node {
761e4b17023SJohn Marino   union tree_node GTY ((tag ("TS_CP_GENERIC"),
762e4b17023SJohn Marino 			desc ("tree_node_structure (&%h)"))) generic;
763e4b17023SJohn Marino   struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
764e4b17023SJohn Marino   struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
765e4b17023SJohn Marino   struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
766e4b17023SJohn Marino   struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
767e4b17023SJohn Marino   struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
768e4b17023SJohn Marino   struct tree_deferred_noexcept GTY ((tag ("TS_CP_DEFERRED_NOEXCEPT"))) deferred_noexcept;
769e4b17023SJohn Marino   struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
770e4b17023SJohn Marino   struct tree_static_assert GTY ((tag ("TS_CP_STATIC_ASSERT")))
771e4b17023SJohn Marino     static_assertion;
772e4b17023SJohn Marino   struct tree_argument_pack_select GTY ((tag ("TS_CP_ARGUMENT_PACK_SELECT")))
773e4b17023SJohn Marino     argument_pack_select;
774e4b17023SJohn Marino   struct tree_trait_expr GTY ((tag ("TS_CP_TRAIT_EXPR")))
775e4b17023SJohn Marino     trait_expression;
776e4b17023SJohn Marino   struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR")))
777e4b17023SJohn Marino     lambda_expression;
778e4b17023SJohn Marino   struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO")))
779e4b17023SJohn Marino     template_info;
780e4b17023SJohn Marino   struct tree_userdef_literal GTY ((tag ("TS_CP_USERDEF_LITERAL")))
781e4b17023SJohn Marino     userdef_literal;
782e4b17023SJohn Marino };
783e4b17023SJohn Marino 
784e4b17023SJohn Marino 
785e4b17023SJohn Marino enum cp_tree_index
786e4b17023SJohn Marino {
787e4b17023SJohn Marino     CPTI_JAVA_BYTE_TYPE,
788e4b17023SJohn Marino     CPTI_JAVA_SHORT_TYPE,
789e4b17023SJohn Marino     CPTI_JAVA_INT_TYPE,
790e4b17023SJohn Marino     CPTI_JAVA_LONG_TYPE,
791e4b17023SJohn Marino     CPTI_JAVA_FLOAT_TYPE,
792e4b17023SJohn Marino     CPTI_JAVA_DOUBLE_TYPE,
793e4b17023SJohn Marino     CPTI_JAVA_CHAR_TYPE,
794e4b17023SJohn Marino     CPTI_JAVA_BOOLEAN_TYPE,
795e4b17023SJohn Marino 
796e4b17023SJohn Marino     CPTI_WCHAR_DECL,
797e4b17023SJohn Marino     CPTI_VTABLE_ENTRY_TYPE,
798e4b17023SJohn Marino     CPTI_DELTA_TYPE,
799e4b17023SJohn Marino     CPTI_VTABLE_INDEX_TYPE,
800e4b17023SJohn Marino     CPTI_CLEANUP_TYPE,
801e4b17023SJohn Marino     CPTI_VTT_PARM_TYPE,
802e4b17023SJohn Marino 
803e4b17023SJohn Marino     CPTI_CLASS_TYPE,
804e4b17023SJohn Marino     CPTI_UNKNOWN_TYPE,
805e4b17023SJohn Marino     CPTI_INIT_LIST_TYPE,
806e4b17023SJohn Marino     CPTI_DEPENDENT_LAMBDA_RETURN_TYPE,
807e4b17023SJohn Marino     CPTI_VTBL_TYPE,
808e4b17023SJohn Marino     CPTI_VTBL_PTR_TYPE,
809e4b17023SJohn Marino     CPTI_STD,
810e4b17023SJohn Marino     CPTI_ABI,
811e4b17023SJohn Marino     CPTI_CONST_TYPE_INFO_TYPE,
812e4b17023SJohn Marino     CPTI_TYPE_INFO_PTR_TYPE,
813e4b17023SJohn Marino     CPTI_ABORT_FNDECL,
814e4b17023SJohn Marino     CPTI_GLOBAL_DELETE_FNDECL,
815e4b17023SJohn Marino     CPTI_AGGR_TAG,
816e4b17023SJohn Marino 
817e4b17023SJohn Marino     CPTI_CTOR_IDENTIFIER,
818e4b17023SJohn Marino     CPTI_COMPLETE_CTOR_IDENTIFIER,
819e4b17023SJohn Marino     CPTI_BASE_CTOR_IDENTIFIER,
820e4b17023SJohn Marino     CPTI_DTOR_IDENTIFIER,
821e4b17023SJohn Marino     CPTI_COMPLETE_DTOR_IDENTIFIER,
822e4b17023SJohn Marino     CPTI_BASE_DTOR_IDENTIFIER,
823e4b17023SJohn Marino     CPTI_DELETING_DTOR_IDENTIFIER,
824e4b17023SJohn Marino     CPTI_DELTA_IDENTIFIER,
825e4b17023SJohn Marino     CPTI_IN_CHARGE_IDENTIFIER,
826e4b17023SJohn Marino     CPTI_VTT_PARM_IDENTIFIER,
827e4b17023SJohn Marino     CPTI_NELTS_IDENTIFIER,
828e4b17023SJohn Marino     CPTI_THIS_IDENTIFIER,
829e4b17023SJohn Marino     CPTI_PFN_IDENTIFIER,
830e4b17023SJohn Marino     CPTI_VPTR_IDENTIFIER,
831e4b17023SJohn Marino     CPTI_STD_IDENTIFIER,
832e4b17023SJohn Marino 
833e4b17023SJohn Marino     CPTI_LANG_NAME_C,
834e4b17023SJohn Marino     CPTI_LANG_NAME_CPLUSPLUS,
835e4b17023SJohn Marino     CPTI_LANG_NAME_JAVA,
836e4b17023SJohn Marino 
837e4b17023SJohn Marino     CPTI_EMPTY_EXCEPT_SPEC,
838e4b17023SJohn Marino     CPTI_NOEXCEPT_TRUE_SPEC,
839e4b17023SJohn Marino     CPTI_NOEXCEPT_FALSE_SPEC,
840e4b17023SJohn Marino     CPTI_JCLASS,
841e4b17023SJohn Marino     CPTI_TERMINATE,
842e4b17023SJohn Marino     CPTI_CALL_UNEXPECTED,
843e4b17023SJohn Marino     CPTI_ATEXIT_FN_PTR_TYPE,
844e4b17023SJohn Marino     CPTI_ATEXIT,
845e4b17023SJohn Marino     CPTI_DSO_HANDLE,
846e4b17023SJohn Marino     CPTI_DCAST,
847e4b17023SJohn Marino 
848e4b17023SJohn Marino     CPTI_KEYED_CLASSES,
849e4b17023SJohn Marino 
850e4b17023SJohn Marino     CPTI_NULLPTR,
851e4b17023SJohn Marino     CPTI_NULLPTR_TYPE,
852e4b17023SJohn Marino 
853e4b17023SJohn Marino     CPTI_MAX
854e4b17023SJohn Marino };
855e4b17023SJohn Marino 
856e4b17023SJohn Marino extern GTY(()) tree cp_global_trees[CPTI_MAX];
857e4b17023SJohn Marino 
858e4b17023SJohn Marino #define java_byte_type_node		cp_global_trees[CPTI_JAVA_BYTE_TYPE]
859e4b17023SJohn Marino #define java_short_type_node		cp_global_trees[CPTI_JAVA_SHORT_TYPE]
860e4b17023SJohn Marino #define java_int_type_node		cp_global_trees[CPTI_JAVA_INT_TYPE]
861e4b17023SJohn Marino #define java_long_type_node		cp_global_trees[CPTI_JAVA_LONG_TYPE]
862e4b17023SJohn Marino #define java_float_type_node		cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
863e4b17023SJohn Marino #define java_double_type_node		cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
864e4b17023SJohn Marino #define java_char_type_node		cp_global_trees[CPTI_JAVA_CHAR_TYPE]
865e4b17023SJohn Marino #define java_boolean_type_node		cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
866e4b17023SJohn Marino 
867e4b17023SJohn Marino #define wchar_decl_node			cp_global_trees[CPTI_WCHAR_DECL]
868e4b17023SJohn Marino #define vtable_entry_type		cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
869e4b17023SJohn Marino /* The type used to represent an offset by which to adjust the `this'
870e4b17023SJohn Marino    pointer in pointer-to-member types.  */
871e4b17023SJohn Marino #define delta_type_node			cp_global_trees[CPTI_DELTA_TYPE]
872e4b17023SJohn Marino /* The type used to represent an index into the vtable.  */
873e4b17023SJohn Marino #define vtable_index_type		cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
874e4b17023SJohn Marino 
875e4b17023SJohn Marino #define class_type_node			cp_global_trees[CPTI_CLASS_TYPE]
876e4b17023SJohn Marino #define unknown_type_node		cp_global_trees[CPTI_UNKNOWN_TYPE]
877e4b17023SJohn Marino #define init_list_type_node		cp_global_trees[CPTI_INIT_LIST_TYPE]
878e4b17023SJohn Marino #define dependent_lambda_return_type_node cp_global_trees[CPTI_DEPENDENT_LAMBDA_RETURN_TYPE]
879e4b17023SJohn Marino #define vtbl_type_node			cp_global_trees[CPTI_VTBL_TYPE]
880e4b17023SJohn Marino #define vtbl_ptr_type_node		cp_global_trees[CPTI_VTBL_PTR_TYPE]
881e4b17023SJohn Marino #define std_node			cp_global_trees[CPTI_STD]
882e4b17023SJohn Marino #define abi_node			cp_global_trees[CPTI_ABI]
883e4b17023SJohn Marino #define const_type_info_type_node	cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
884e4b17023SJohn Marino #define type_info_ptr_type		cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
885e4b17023SJohn Marino #define abort_fndecl			cp_global_trees[CPTI_ABORT_FNDECL]
886e4b17023SJohn Marino #define global_delete_fndecl		cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
887e4b17023SJohn Marino #define current_aggr			cp_global_trees[CPTI_AGGR_TAG]
888e4b17023SJohn Marino #define nullptr_node			cp_global_trees[CPTI_NULLPTR]
889e4b17023SJohn Marino #define nullptr_type_node		cp_global_trees[CPTI_NULLPTR_TYPE]
890e4b17023SJohn Marino 
891e4b17023SJohn Marino /* We cache these tree nodes so as to call get_identifier less
892e4b17023SJohn Marino    frequently.  */
893e4b17023SJohn Marino 
894e4b17023SJohn Marino /* The name of a constructor that takes an in-charge parameter to
895e4b17023SJohn Marino    decide whether or not to construct virtual base classes.  */
896e4b17023SJohn Marino #define ctor_identifier			cp_global_trees[CPTI_CTOR_IDENTIFIER]
897e4b17023SJohn Marino /* The name of a constructor that constructs virtual base classes.  */
898e4b17023SJohn Marino #define complete_ctor_identifier	cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
899e4b17023SJohn Marino /* The name of a constructor that does not construct virtual base classes.  */
900e4b17023SJohn Marino #define base_ctor_identifier		cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
901e4b17023SJohn Marino /* The name of a destructor that takes an in-charge parameter to
902e4b17023SJohn Marino    decide whether or not to destroy virtual base classes and whether
903e4b17023SJohn Marino    or not to delete the object.  */
904e4b17023SJohn Marino #define dtor_identifier			cp_global_trees[CPTI_DTOR_IDENTIFIER]
905e4b17023SJohn Marino /* The name of a destructor that destroys virtual base classes.  */
906e4b17023SJohn Marino #define complete_dtor_identifier	cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
907e4b17023SJohn Marino /* The name of a destructor that does not destroy virtual base
908e4b17023SJohn Marino    classes.  */
909e4b17023SJohn Marino #define base_dtor_identifier		cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
910e4b17023SJohn Marino /* The name of a destructor that destroys virtual base classes, and
911e4b17023SJohn Marino    then deletes the entire object.  */
912e4b17023SJohn Marino #define deleting_dtor_identifier	cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
913e4b17023SJohn Marino #define delta_identifier		cp_global_trees[CPTI_DELTA_IDENTIFIER]
914e4b17023SJohn Marino #define in_charge_identifier		cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
915e4b17023SJohn Marino /* The name of the parameter that contains a pointer to the VTT to use
916e4b17023SJohn Marino    for this subobject constructor or destructor.  */
917e4b17023SJohn Marino #define vtt_parm_identifier		cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
918e4b17023SJohn Marino #define nelts_identifier		cp_global_trees[CPTI_NELTS_IDENTIFIER]
919e4b17023SJohn Marino #define this_identifier			cp_global_trees[CPTI_THIS_IDENTIFIER]
920e4b17023SJohn Marino #define pfn_identifier			cp_global_trees[CPTI_PFN_IDENTIFIER]
921e4b17023SJohn Marino #define vptr_identifier			cp_global_trees[CPTI_VPTR_IDENTIFIER]
922e4b17023SJohn Marino /* The name of the std namespace.  */
923e4b17023SJohn Marino #define std_identifier			cp_global_trees[CPTI_STD_IDENTIFIER]
924e4b17023SJohn Marino #define lang_name_c			cp_global_trees[CPTI_LANG_NAME_C]
925e4b17023SJohn Marino #define lang_name_cplusplus		cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
926e4b17023SJohn Marino #define lang_name_java			cp_global_trees[CPTI_LANG_NAME_JAVA]
927e4b17023SJohn Marino 
928e4b17023SJohn Marino /* Exception specifier used for throw().  */
929e4b17023SJohn Marino #define empty_except_spec		cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
930e4b17023SJohn Marino #define noexcept_true_spec		cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC]
931e4b17023SJohn Marino #define noexcept_false_spec		cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC]
932e4b17023SJohn Marino 
933e4b17023SJohn Marino /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*).  */
934e4b17023SJohn Marino #define jclass_node			cp_global_trees[CPTI_JCLASS]
935e4b17023SJohn Marino 
936e4b17023SJohn Marino /* The declaration for `std::terminate'.  */
937e4b17023SJohn Marino #define terminate_node			cp_global_trees[CPTI_TERMINATE]
938e4b17023SJohn Marino 
939e4b17023SJohn Marino /* The declaration for "__cxa_call_unexpected".  */
940e4b17023SJohn Marino #define call_unexpected_node		cp_global_trees[CPTI_CALL_UNEXPECTED]
941e4b17023SJohn Marino 
942e4b17023SJohn Marino /* The type of the function-pointer argument to "__cxa_atexit" (or
943e4b17023SJohn Marino    "std::atexit", if "__cxa_atexit" is not being used).  */
944e4b17023SJohn Marino #define atexit_fn_ptr_type_node         cp_global_trees[CPTI_ATEXIT_FN_PTR_TYPE]
945e4b17023SJohn Marino 
946e4b17023SJohn Marino /* A pointer to `std::atexit'.  */
947e4b17023SJohn Marino #define atexit_node			cp_global_trees[CPTI_ATEXIT]
948e4b17023SJohn Marino 
949e4b17023SJohn Marino /* A pointer to `__dso_handle'.  */
950e4b17023SJohn Marino #define dso_handle_node			cp_global_trees[CPTI_DSO_HANDLE]
951e4b17023SJohn Marino 
952e4b17023SJohn Marino /* The declaration of the dynamic_cast runtime.  */
953e4b17023SJohn Marino #define dynamic_cast_node		cp_global_trees[CPTI_DCAST]
954e4b17023SJohn Marino 
955e4b17023SJohn Marino /* The type of a destructor.  */
956e4b17023SJohn Marino #define cleanup_type			cp_global_trees[CPTI_CLEANUP_TYPE]
957e4b17023SJohn Marino 
958e4b17023SJohn Marino /* The type of the vtt parameter passed to subobject constructors and
959e4b17023SJohn Marino    destructors.  */
960e4b17023SJohn Marino #define vtt_parm_type			cp_global_trees[CPTI_VTT_PARM_TYPE]
961e4b17023SJohn Marino 
962e4b17023SJohn Marino /* A TREE_LIST of the dynamic classes whose vtables may have to be
963e4b17023SJohn Marino    emitted in this translation unit.  */
964e4b17023SJohn Marino 
965e4b17023SJohn Marino #define keyed_classes			cp_global_trees[CPTI_KEYED_CLASSES]
966e4b17023SJohn Marino 
967e4b17023SJohn Marino /* Node to indicate default access. This must be distinct from the
968e4b17023SJohn Marino    access nodes in tree.h.  */
969e4b17023SJohn Marino 
970e4b17023SJohn Marino #define access_default_node		null_node
971e4b17023SJohn Marino 
972e4b17023SJohn Marino /* Global state.  */
973e4b17023SJohn Marino 
974e4b17023SJohn Marino struct GTY(()) saved_scope {
975e4b17023SJohn Marino   VEC(cxx_saved_binding,gc) *old_bindings;
976e4b17023SJohn Marino   tree old_namespace;
977e4b17023SJohn Marino   VEC(tree,gc) *decl_ns_list;
978e4b17023SJohn Marino   tree class_name;
979e4b17023SJohn Marino   tree class_type;
980e4b17023SJohn Marino   tree access_specifier;
981e4b17023SJohn Marino   tree function_decl;
982e4b17023SJohn Marino   VEC(tree,gc) *lang_base;
983e4b17023SJohn Marino   tree lang_name;
984e4b17023SJohn Marino   tree template_parms;
985e4b17023SJohn Marino   cp_binding_level *x_previous_class_level;
986e4b17023SJohn Marino   tree x_saved_tree;
987e4b17023SJohn Marino 
988e4b17023SJohn Marino   /* Only used for uses of this in trailing return type.  */
989e4b17023SJohn Marino   tree x_current_class_ptr;
990e4b17023SJohn Marino   tree x_current_class_ref;
991e4b17023SJohn Marino 
992e4b17023SJohn Marino   int x_processing_template_decl;
993e4b17023SJohn Marino   int x_processing_specialization;
994e4b17023SJohn Marino   BOOL_BITFIELD x_processing_explicit_instantiation : 1;
995e4b17023SJohn Marino   BOOL_BITFIELD need_pop_function_context : 1;
996e4b17023SJohn Marino 
997e4b17023SJohn Marino   int unevaluated_operand;
998e4b17023SJohn Marino   int inhibit_evaluation_warnings;
999e4b17023SJohn Marino 
1000e4b17023SJohn Marino   struct stmt_tree_s x_stmt_tree;
1001e4b17023SJohn Marino 
1002e4b17023SJohn Marino   cp_binding_level *class_bindings;
1003e4b17023SJohn Marino   cp_binding_level *bindings;
1004e4b17023SJohn Marino 
1005e4b17023SJohn Marino   struct saved_scope *prev;
1006e4b17023SJohn Marino };
1007e4b17023SJohn Marino 
1008e4b17023SJohn Marino /* The current open namespace.  */
1009e4b17023SJohn Marino 
1010e4b17023SJohn Marino #define current_namespace scope_chain->old_namespace
1011e4b17023SJohn Marino 
1012e4b17023SJohn Marino /* The stack for namespaces of current declarations.  */
1013e4b17023SJohn Marino 
1014e4b17023SJohn Marino #define decl_namespace_list scope_chain->decl_ns_list
1015e4b17023SJohn Marino 
1016e4b17023SJohn Marino /* IDENTIFIER_NODE: name of current class */
1017e4b17023SJohn Marino 
1018e4b17023SJohn Marino #define current_class_name scope_chain->class_name
1019e4b17023SJohn Marino 
1020e4b17023SJohn Marino /* _TYPE: the type of the current class */
1021e4b17023SJohn Marino 
1022e4b17023SJohn Marino #define current_class_type scope_chain->class_type
1023e4b17023SJohn Marino 
1024e4b17023SJohn Marino /* When parsing a class definition, the access specifier most recently
1025e4b17023SJohn Marino    given by the user, or, if no access specifier was given, the
1026e4b17023SJohn Marino    default value appropriate for the kind of class (i.e., struct,
1027e4b17023SJohn Marino    class, or union).  */
1028e4b17023SJohn Marino 
1029e4b17023SJohn Marino #define current_access_specifier scope_chain->access_specifier
1030e4b17023SJohn Marino 
1031e4b17023SJohn Marino /* Pointer to the top of the language name stack.  */
1032e4b17023SJohn Marino 
1033e4b17023SJohn Marino #define current_lang_base scope_chain->lang_base
1034e4b17023SJohn Marino #define current_lang_name scope_chain->lang_name
1035e4b17023SJohn Marino 
1036e4b17023SJohn Marino /* When parsing a template declaration, a TREE_LIST represents the
1037e4b17023SJohn Marino    active template parameters.  Each node in the list represents one
1038e4b17023SJohn Marino    level of template parameters.  The innermost level is first in the
1039e4b17023SJohn Marino    list.  The depth of each level is stored as an INTEGER_CST in the
1040e4b17023SJohn Marino    TREE_PURPOSE of each node.  The parameters for that level are
1041e4b17023SJohn Marino    stored in the TREE_VALUE.  */
1042e4b17023SJohn Marino 
1043e4b17023SJohn Marino #define current_template_parms scope_chain->template_parms
1044e4b17023SJohn Marino 
1045e4b17023SJohn Marino #define processing_template_decl scope_chain->x_processing_template_decl
1046e4b17023SJohn Marino #define processing_specialization scope_chain->x_processing_specialization
1047e4b17023SJohn Marino #define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
1048e4b17023SJohn Marino 
1049e4b17023SJohn Marino /* The cached class binding level, from the most recently exited
1050e4b17023SJohn Marino    class, or NULL if none.  */
1051e4b17023SJohn Marino 
1052e4b17023SJohn Marino #define previous_class_level scope_chain->x_previous_class_level
1053e4b17023SJohn Marino 
1054e4b17023SJohn Marino /* A list of private types mentioned, for deferred access checking.  */
1055e4b17023SJohn Marino 
1056e4b17023SJohn Marino extern GTY(()) struct saved_scope *scope_chain;
1057e4b17023SJohn Marino 
1058e4b17023SJohn Marino struct GTY(()) cxx_int_tree_map {
1059e4b17023SJohn Marino   unsigned int uid;
1060e4b17023SJohn Marino   tree to;
1061e4b17023SJohn Marino };
1062e4b17023SJohn Marino 
1063e4b17023SJohn Marino extern unsigned int cxx_int_tree_map_hash (const void *);
1064e4b17023SJohn Marino extern int cxx_int_tree_map_eq (const void *, const void *);
1065e4b17023SJohn Marino 
1066e4b17023SJohn Marino /* Global state pertinent to the current function.  */
1067e4b17023SJohn Marino 
1068e4b17023SJohn Marino struct GTY(()) language_function {
1069e4b17023SJohn Marino   struct c_language_function base;
1070e4b17023SJohn Marino 
1071e4b17023SJohn Marino   tree x_cdtor_label;
1072e4b17023SJohn Marino   tree x_current_class_ptr;
1073e4b17023SJohn Marino   tree x_current_class_ref;
1074e4b17023SJohn Marino   tree x_eh_spec_block;
1075e4b17023SJohn Marino   tree x_in_charge_parm;
1076e4b17023SJohn Marino   tree x_vtt_parm;
1077e4b17023SJohn Marino   tree x_return_value;
1078e4b17023SJohn Marino 
1079e4b17023SJohn Marino   BOOL_BITFIELD returns_value : 1;
1080e4b17023SJohn Marino   BOOL_BITFIELD returns_null : 1;
1081e4b17023SJohn Marino   BOOL_BITFIELD returns_abnormally : 1;
1082e4b17023SJohn Marino   BOOL_BITFIELD x_in_function_try_handler : 1;
1083e4b17023SJohn Marino   BOOL_BITFIELD x_in_base_initializer : 1;
1084e4b17023SJohn Marino 
1085e4b17023SJohn Marino   /* True if this function can throw an exception.  */
1086e4b17023SJohn Marino   BOOL_BITFIELD can_throw : 1;
1087e4b17023SJohn Marino 
1088e4b17023SJohn Marino   htab_t GTY((param_is(struct named_label_entry))) x_named_labels;
1089e4b17023SJohn Marino   cp_binding_level *bindings;
1090e4b17023SJohn Marino   VEC(tree,gc) *x_local_names;
1091e4b17023SJohn Marino   htab_t GTY((param_is (struct cxx_int_tree_map))) extern_decl_map;
1092e4b17023SJohn Marino };
1093e4b17023SJohn Marino 
1094e4b17023SJohn Marino /* The current C++-specific per-function global variables.  */
1095e4b17023SJohn Marino 
1096e4b17023SJohn Marino #define cp_function_chain (cfun->language)
1097e4b17023SJohn Marino 
1098e4b17023SJohn Marino /* In a constructor destructor, the point at which all derived class
1099e4b17023SJohn Marino    destroying/construction has been done.  I.e., just before a
1100e4b17023SJohn Marino    constructor returns, or before any base class destroying will be done
1101e4b17023SJohn Marino    in a destructor.  */
1102e4b17023SJohn Marino 
1103e4b17023SJohn Marino #define cdtor_label cp_function_chain->x_cdtor_label
1104e4b17023SJohn Marino 
1105e4b17023SJohn Marino /* When we're processing a member function, current_class_ptr is the
1106e4b17023SJohn Marino    PARM_DECL for the `this' pointer.  The current_class_ref is an
1107e4b17023SJohn Marino    expression for `*this'.  */
1108e4b17023SJohn Marino 
1109e4b17023SJohn Marino #define current_class_ptr			\
1110e4b17023SJohn Marino   (*(cfun && cp_function_chain			\
1111e4b17023SJohn Marino      ? &cp_function_chain->x_current_class_ptr	\
1112e4b17023SJohn Marino      : &scope_chain->x_current_class_ptr))
1113e4b17023SJohn Marino #define current_class_ref			\
1114e4b17023SJohn Marino   (*(cfun && cp_function_chain			\
1115e4b17023SJohn Marino      ? &cp_function_chain->x_current_class_ref	\
1116e4b17023SJohn Marino      : &scope_chain->x_current_class_ref))
1117e4b17023SJohn Marino 
1118e4b17023SJohn Marino /* The EH_SPEC_BLOCK for the exception-specifiers for the current
1119e4b17023SJohn Marino    function, if any.  */
1120e4b17023SJohn Marino 
1121e4b17023SJohn Marino #define current_eh_spec_block cp_function_chain->x_eh_spec_block
1122e4b17023SJohn Marino 
1123e4b17023SJohn Marino /* The `__in_chrg' parameter for the current function.  Only used for
1124e4b17023SJohn Marino    constructors and destructors.  */
1125e4b17023SJohn Marino 
1126e4b17023SJohn Marino #define current_in_charge_parm cp_function_chain->x_in_charge_parm
1127e4b17023SJohn Marino 
1128e4b17023SJohn Marino /* The `__vtt_parm' parameter for the current function.  Only used for
1129e4b17023SJohn Marino    constructors and destructors.  */
1130e4b17023SJohn Marino 
1131e4b17023SJohn Marino #define current_vtt_parm cp_function_chain->x_vtt_parm
1132e4b17023SJohn Marino 
1133e4b17023SJohn Marino /* Set to 0 at beginning of a function definition, set to 1 if
1134e4b17023SJohn Marino    a return statement that specifies a return value is seen.  */
1135e4b17023SJohn Marino 
1136e4b17023SJohn Marino #define current_function_returns_value cp_function_chain->returns_value
1137e4b17023SJohn Marino 
1138e4b17023SJohn Marino /* Set to 0 at beginning of a function definition, set to 1 if
1139e4b17023SJohn Marino    a return statement with no argument is seen.  */
1140e4b17023SJohn Marino 
1141e4b17023SJohn Marino #define current_function_returns_null cp_function_chain->returns_null
1142e4b17023SJohn Marino 
1143e4b17023SJohn Marino /* Set to 0 at beginning of a function definition, set to 1 if
1144e4b17023SJohn Marino    a call to a noreturn function is seen.  */
1145e4b17023SJohn Marino 
1146e4b17023SJohn Marino #define current_function_returns_abnormally \
1147e4b17023SJohn Marino   cp_function_chain->returns_abnormally
1148e4b17023SJohn Marino 
1149e4b17023SJohn Marino /* Nonzero if we are processing a base initializer.  Zero elsewhere.  */
1150e4b17023SJohn Marino #define in_base_initializer cp_function_chain->x_in_base_initializer
1151e4b17023SJohn Marino 
1152e4b17023SJohn Marino #define in_function_try_handler cp_function_chain->x_in_function_try_handler
1153e4b17023SJohn Marino 
1154e4b17023SJohn Marino /* Expression always returned from function, or error_mark_node
1155e4b17023SJohn Marino    otherwise, for use by the automatic named return value optimization.  */
1156e4b17023SJohn Marino 
1157e4b17023SJohn Marino #define current_function_return_value \
1158e4b17023SJohn Marino   (cp_function_chain->x_return_value)
1159e4b17023SJohn Marino 
1160e4b17023SJohn Marino /* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
1161e4b17023SJohn Marino    new" or "operator delete".  */
1162e4b17023SJohn Marino #define NEW_DELETE_OPNAME_P(NAME)		\
1163e4b17023SJohn Marino   ((NAME) == ansi_opname (NEW_EXPR)		\
1164e4b17023SJohn Marino    || (NAME) == ansi_opname (VEC_NEW_EXPR)	\
1165e4b17023SJohn Marino    || (NAME) == ansi_opname (DELETE_EXPR)	\
1166e4b17023SJohn Marino    || (NAME) == ansi_opname (VEC_DELETE_EXPR))
1167e4b17023SJohn Marino 
1168e4b17023SJohn Marino #define ansi_opname(CODE) \
1169e4b17023SJohn Marino   (operator_name_info[(int) (CODE)].identifier)
1170e4b17023SJohn Marino #define ansi_assopname(CODE) \
1171e4b17023SJohn Marino   (assignment_operator_name_info[(int) (CODE)].identifier)
1172e4b17023SJohn Marino 
1173e4b17023SJohn Marino /* TRUE if a tree code represents a statement.  */
1174e4b17023SJohn Marino extern bool statement_code_p[MAX_TREE_CODES];
1175e4b17023SJohn Marino 
1176e4b17023SJohn Marino #define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
1177e4b17023SJohn Marino 
1178e4b17023SJohn Marino enum languages { lang_c, lang_cplusplus, lang_java };
1179e4b17023SJohn Marino 
1180e4b17023SJohn Marino /* Macros to make error reporting functions' lives easier.  */
1181e4b17023SJohn Marino #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
1182e4b17023SJohn Marino #define TYPE_LINKAGE_IDENTIFIER(NODE) \
1183e4b17023SJohn Marino   (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
1184e4b17023SJohn Marino #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
1185e4b17023SJohn Marino #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
1186e4b17023SJohn Marino 
1187e4b17023SJohn Marino /* Nonzero if NODE has no name for linkage purposes.  */
1188e4b17023SJohn Marino #define TYPE_ANONYMOUS_P(NODE) \
1189e4b17023SJohn Marino   (TAGGED_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
1190e4b17023SJohn Marino 
1191e4b17023SJohn Marino /* The _DECL for this _TYPE.  */
1192e4b17023SJohn Marino #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
1193e4b17023SJohn Marino 
1194*95d28233SJohn Marino /* Nonzero if T is a type that could resolve to any kind of concrete type
1195*95d28233SJohn Marino    at instantiation time.  */
1196*95d28233SJohn Marino #define WILDCARD_TYPE_P(T)				\
1197e4b17023SJohn Marino   (TREE_CODE (T) == TEMPLATE_TYPE_PARM			\
1198e4b17023SJohn Marino    || TREE_CODE (T) == TYPENAME_TYPE			\
1199e4b17023SJohn Marino    || TREE_CODE (T) == TYPEOF_TYPE			\
1200e4b17023SJohn Marino    || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM	\
1201*95d28233SJohn Marino    || TREE_CODE (T) == DECLTYPE_TYPE)
1202*95d28233SJohn Marino 
1203*95d28233SJohn Marino /* Nonzero if T is a class (or struct or union) type.  Also nonzero
1204*95d28233SJohn Marino    for template type parameters, typename types, and instantiated
1205*95d28233SJohn Marino    template template parameters.  Keep these checks in ascending code
1206*95d28233SJohn Marino    order.  */
1207*95d28233SJohn Marino #define MAYBE_CLASS_TYPE_P(T) (WILDCARD_TYPE_P (T) || CLASS_TYPE_P (T))
1208e4b17023SJohn Marino 
1209e4b17023SJohn Marino /* Set CLASS_TYPE_P for T to VAL.  T must be a class, struct, or
1210e4b17023SJohn Marino    union type.  */
1211e4b17023SJohn Marino #define SET_CLASS_TYPE_P(T, VAL) \
1212e4b17023SJohn Marino   (TYPE_LANG_FLAG_5 (T) = (VAL))
1213e4b17023SJohn Marino 
1214e4b17023SJohn Marino /* Nonzero if T is a class type.  Zero for template type parameters,
1215e4b17023SJohn Marino    typename types, and so forth.  */
1216e4b17023SJohn Marino #define CLASS_TYPE_P(T) \
1217e4b17023SJohn Marino   (RECORD_OR_UNION_CODE_P (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
1218e4b17023SJohn Marino 
1219e4b17023SJohn Marino /* Nonzero if T is a class type but not an union.  */
1220e4b17023SJohn Marino #define NON_UNION_CLASS_TYPE_P(T) \
1221e4b17023SJohn Marino   (CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE)
1222e4b17023SJohn Marino 
1223e4b17023SJohn Marino /* Keep these checks in ascending code order.  */
1224e4b17023SJohn Marino #define RECORD_OR_UNION_CODE_P(T)	\
1225e4b17023SJohn Marino   ((T) == RECORD_TYPE || (T) == UNION_TYPE)
1226e4b17023SJohn Marino #define TAGGED_TYPE_P(T) \
1227e4b17023SJohn Marino   (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
1228e4b17023SJohn Marino #define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
1229e4b17023SJohn Marino 
1230e4b17023SJohn Marino /* True if this a "Java" type, defined in 'extern "Java"'.  */
1231e4b17023SJohn Marino #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
1232e4b17023SJohn Marino 
1233e4b17023SJohn Marino /* True if this type is dependent.  This predicate is only valid if
1234e4b17023SJohn Marino    TYPE_DEPENDENT_P_VALID is true.  */
1235e4b17023SJohn Marino #define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
1236e4b17023SJohn Marino 
1237e4b17023SJohn Marino /* True if dependent_type_p has been called for this type, with the
1238e4b17023SJohn Marino    result that TYPE_DEPENDENT_P is valid.  */
1239e4b17023SJohn Marino #define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
1240e4b17023SJohn Marino 
1241e4b17023SJohn Marino /* Nonzero if this type is const-qualified.  */
1242e4b17023SJohn Marino #define CP_TYPE_CONST_P(NODE)				\
1243e4b17023SJohn Marino   ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
1244e4b17023SJohn Marino 
1245e4b17023SJohn Marino /* Nonzero if this type is volatile-qualified.  */
1246e4b17023SJohn Marino #define CP_TYPE_VOLATILE_P(NODE)			\
1247e4b17023SJohn Marino   ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
1248e4b17023SJohn Marino 
1249e4b17023SJohn Marino /* Nonzero if this type is restrict-qualified.  */
1250e4b17023SJohn Marino #define CP_TYPE_RESTRICT_P(NODE)			\
1251e4b17023SJohn Marino   ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
1252e4b17023SJohn Marino 
1253e4b17023SJohn Marino /* Nonzero if this type is const-qualified, but not
1254e4b17023SJohn Marino    volatile-qualified.  Other qualifiers are ignored.  This macro is
1255e4b17023SJohn Marino    used to test whether or not it is OK to bind an rvalue to a
1256e4b17023SJohn Marino    reference.  */
1257e4b17023SJohn Marino #define CP_TYPE_CONST_NON_VOLATILE_P(NODE)				\
1258e4b17023SJohn Marino   ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE))	\
1259e4b17023SJohn Marino    == TYPE_QUAL_CONST)
1260e4b17023SJohn Marino 
1261e4b17023SJohn Marino #define FUNCTION_ARG_CHAIN(NODE) \
1262e4b17023SJohn Marino   TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
1263e4b17023SJohn Marino 
1264e4b17023SJohn Marino /* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
1265e4b17023SJohn Marino    which refers to a user-written parameter.  */
1266e4b17023SJohn Marino #define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
1267e4b17023SJohn Marino   skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
1268e4b17023SJohn Marino 
1269e4b17023SJohn Marino /* Similarly, but for DECL_ARGUMENTS.  */
1270e4b17023SJohn Marino #define FUNCTION_FIRST_USER_PARM(NODE) \
1271e4b17023SJohn Marino   skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
1272e4b17023SJohn Marino 
1273e4b17023SJohn Marino /* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
1274e4b17023SJohn Marino    ambiguity issues.  */
1275e4b17023SJohn Marino #define DERIVED_FROM_P(PARENT, TYPE) \
1276e4b17023SJohn Marino   (lookup_base ((TYPE), (PARENT), ba_any, NULL) != NULL_TREE)
1277e4b17023SJohn Marino /* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
1278e4b17023SJohn Marino    accessibility.  */
1279e4b17023SJohn Marino #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
1280e4b17023SJohn Marino   (lookup_base ((TYPE), (PARENT), ba_unique | ba_quiet, NULL) != NULL_TREE)
1281e4b17023SJohn Marino /* Nonzero iff TYPE is publicly & uniquely derived from PARENT.  */
1282e4b17023SJohn Marino #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
1283e4b17023SJohn Marino   (lookup_base ((TYPE), (PARENT), ba_ignore_scope | ba_check | ba_quiet, \
1284e4b17023SJohn Marino 		NULL) != NULL_TREE)
1285e4b17023SJohn Marino 
1286e4b17023SJohn Marino /* Gives the visibility specification for a class type.  */
1287e4b17023SJohn Marino #define CLASSTYPE_VISIBILITY(TYPE)		\
1288e4b17023SJohn Marino 	DECL_VISIBILITY (TYPE_MAIN_DECL (TYPE))
1289e4b17023SJohn Marino #define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE)	\
1290e4b17023SJohn Marino 	DECL_VISIBILITY_SPECIFIED (TYPE_MAIN_DECL (TYPE))
1291e4b17023SJohn Marino 
1292e4b17023SJohn Marino typedef struct GTY (()) tree_pair_s {
1293e4b17023SJohn Marino   tree purpose;
1294e4b17023SJohn Marino   tree value;
1295e4b17023SJohn Marino } tree_pair_s;
1296e4b17023SJohn Marino typedef tree_pair_s *tree_pair_p;
1297e4b17023SJohn Marino DEF_VEC_O (tree_pair_s);
1298e4b17023SJohn Marino DEF_VEC_ALLOC_O (tree_pair_s,gc);
1299e4b17023SJohn Marino 
1300e4b17023SJohn Marino /* This is a few header flags for 'struct lang_type'.  Actually,
1301e4b17023SJohn Marino    all but the first are used only for lang_type_class; they
1302e4b17023SJohn Marino    are put in this structure to save space.  */
1303e4b17023SJohn Marino struct GTY(()) lang_type_header {
1304e4b17023SJohn Marino   BOOL_BITFIELD is_lang_type_class : 1;
1305e4b17023SJohn Marino 
1306e4b17023SJohn Marino   BOOL_BITFIELD has_type_conversion : 1;
1307e4b17023SJohn Marino   BOOL_BITFIELD has_copy_ctor : 1;
1308e4b17023SJohn Marino   BOOL_BITFIELD has_default_ctor : 1;
1309e4b17023SJohn Marino   BOOL_BITFIELD const_needs_init : 1;
1310e4b17023SJohn Marino   BOOL_BITFIELD ref_needs_init : 1;
1311e4b17023SJohn Marino   BOOL_BITFIELD has_const_copy_assign : 1;
1312e4b17023SJohn Marino 
1313e4b17023SJohn Marino   BOOL_BITFIELD spare : 1;
1314e4b17023SJohn Marino };
1315e4b17023SJohn Marino 
1316e4b17023SJohn Marino /* This structure provides additional information above and beyond
1317e4b17023SJohn Marino    what is provide in the ordinary tree_type.  In the past, we used it
1318e4b17023SJohn Marino    for the types of class types, template parameters types, typename
1319e4b17023SJohn Marino    types, and so forth.  However, there can be many (tens to hundreds
1320e4b17023SJohn Marino    of thousands) of template parameter types in a compilation, and
1321e4b17023SJohn Marino    there's no need for this additional information in that case.
1322e4b17023SJohn Marino    Therefore, we now use this data structure only for class types.
1323e4b17023SJohn Marino 
1324e4b17023SJohn Marino    In the past, it was thought that there would be relatively few
1325e4b17023SJohn Marino    class types.  However, in the presence of heavy use of templates,
1326e4b17023SJohn Marino    many (i.e., thousands) of classes can easily be generated.
1327e4b17023SJohn Marino    Therefore, we should endeavor to keep the size of this structure to
1328e4b17023SJohn Marino    a minimum.  */
1329e4b17023SJohn Marino struct GTY(()) lang_type_class {
1330e4b17023SJohn Marino   struct lang_type_header h;
1331e4b17023SJohn Marino 
1332e4b17023SJohn Marino   unsigned char align;
1333e4b17023SJohn Marino 
1334e4b17023SJohn Marino   unsigned has_mutable : 1;
1335e4b17023SJohn Marino   unsigned com_interface : 1;
1336e4b17023SJohn Marino   unsigned non_pod_class : 1;
1337e4b17023SJohn Marino   unsigned nearly_empty_p : 1;
1338e4b17023SJohn Marino   unsigned user_align : 1;
1339e4b17023SJohn Marino   unsigned has_copy_assign : 1;
1340e4b17023SJohn Marino   unsigned has_new : 1;
1341e4b17023SJohn Marino   unsigned has_array_new : 1;
1342e4b17023SJohn Marino 
1343e4b17023SJohn Marino   unsigned gets_delete : 2;
1344e4b17023SJohn Marino   unsigned interface_only : 1;
1345e4b17023SJohn Marino   unsigned interface_unknown : 1;
1346e4b17023SJohn Marino   unsigned contains_empty_class_p : 1;
1347e4b17023SJohn Marino   unsigned anon_aggr : 1;
1348e4b17023SJohn Marino   unsigned non_zero_init : 1;
1349e4b17023SJohn Marino   unsigned empty_p : 1;
1350e4b17023SJohn Marino 
1351e4b17023SJohn Marino   unsigned vec_new_uses_cookie : 1;
1352e4b17023SJohn Marino   unsigned declared_class : 1;
1353e4b17023SJohn Marino   unsigned diamond_shaped : 1;
1354e4b17023SJohn Marino   unsigned repeated_base : 1;
1355e4b17023SJohn Marino   unsigned being_defined : 1;
1356e4b17023SJohn Marino   unsigned java_interface : 1;
1357e4b17023SJohn Marino   unsigned debug_requested : 1;
1358e4b17023SJohn Marino   unsigned fields_readonly : 1;
1359e4b17023SJohn Marino 
1360e4b17023SJohn Marino   unsigned use_template : 2;
1361e4b17023SJohn Marino   unsigned ptrmemfunc_flag : 1;
1362e4b17023SJohn Marino   unsigned was_anonymous : 1;
1363e4b17023SJohn Marino   unsigned lazy_default_ctor : 1;
1364e4b17023SJohn Marino   unsigned lazy_copy_ctor : 1;
1365e4b17023SJohn Marino   unsigned lazy_copy_assign : 1;
1366e4b17023SJohn Marino   unsigned lazy_destructor : 1;
1367e4b17023SJohn Marino 
1368e4b17023SJohn Marino   unsigned has_const_copy_ctor : 1;
1369e4b17023SJohn Marino   unsigned has_complex_copy_ctor : 1;
1370e4b17023SJohn Marino   unsigned has_complex_copy_assign : 1;
1371e4b17023SJohn Marino   unsigned non_aggregate : 1;
1372e4b17023SJohn Marino   unsigned has_complex_dflt : 1;
1373e4b17023SJohn Marino   unsigned has_list_ctor : 1;
1374e4b17023SJohn Marino   unsigned non_std_layout : 1;
1375e4b17023SJohn Marino   unsigned is_literal : 1;
1376e4b17023SJohn Marino 
1377e4b17023SJohn Marino   unsigned lazy_move_ctor : 1;
1378e4b17023SJohn Marino   unsigned lazy_move_assign : 1;
1379e4b17023SJohn Marino   unsigned has_complex_move_ctor : 1;
1380e4b17023SJohn Marino   unsigned has_complex_move_assign : 1;
1381e4b17023SJohn Marino   unsigned has_constexpr_ctor : 1;
1382e4b17023SJohn Marino   unsigned is_final : 1;
1383e4b17023SJohn Marino 
1384e4b17023SJohn Marino   /* When adding a flag here, consider whether or not it ought to
1385e4b17023SJohn Marino      apply to a template instance if it applies to the template.  If
1386e4b17023SJohn Marino      so, make sure to copy it in instantiate_class_template!  */
1387e4b17023SJohn Marino 
1388e4b17023SJohn Marino   /* There are some bits left to fill out a 32-bit word.  Keep track
1389e4b17023SJohn Marino      of this by updating the size of this bitfield whenever you add or
1390e4b17023SJohn Marino      remove a flag.  */
1391e4b17023SJohn Marino   unsigned dummy : 2;
1392e4b17023SJohn Marino 
1393e4b17023SJohn Marino   tree primary_base;
1394e4b17023SJohn Marino   VEC(tree_pair_s,gc) *vcall_indices;
1395e4b17023SJohn Marino   tree vtables;
1396e4b17023SJohn Marino   tree typeinfo_var;
1397e4b17023SJohn Marino   VEC(tree,gc) *vbases;
1398e4b17023SJohn Marino   binding_table nested_udts;
1399e4b17023SJohn Marino   tree as_base;
1400e4b17023SJohn Marino   VEC(tree,gc) *pure_virtuals;
1401e4b17023SJohn Marino   tree friend_classes;
1402e4b17023SJohn Marino   VEC(tree,gc) * GTY((reorder ("resort_type_method_vec"))) methods;
1403e4b17023SJohn Marino   tree key_method;
1404e4b17023SJohn Marino   tree decl_list;
1405e4b17023SJohn Marino   tree template_info;
1406e4b17023SJohn Marino   tree befriending_classes;
1407e4b17023SJohn Marino   /* In a RECORD_TYPE, information specific to Objective-C++, such
1408e4b17023SJohn Marino      as a list of adopted protocols or a pointer to a corresponding
1409e4b17023SJohn Marino      @interface.  See objc/objc-act.h for details.  */
1410e4b17023SJohn Marino   tree objc_info;
1411e4b17023SJohn Marino   /* sorted_fields is sorted based on a pointer, so we need to be able
1412e4b17023SJohn Marino      to resort it if pointers get rearranged.  */
1413e4b17023SJohn Marino   struct sorted_fields_type * GTY ((reorder ("resort_sorted_fields")))
1414e4b17023SJohn Marino     sorted_fields;
1415e4b17023SJohn Marino   /* FIXME reuse another field?  */
1416e4b17023SJohn Marino   tree lambda_expr;
1417e4b17023SJohn Marino };
1418e4b17023SJohn Marino 
1419e4b17023SJohn Marino struct GTY(()) lang_type_ptrmem {
1420e4b17023SJohn Marino   struct lang_type_header h;
1421e4b17023SJohn Marino   tree record;
1422e4b17023SJohn Marino };
1423e4b17023SJohn Marino 
1424e4b17023SJohn Marino struct GTY((variable_size)) lang_type {
1425e4b17023SJohn Marino   union lang_type_u
1426e4b17023SJohn Marino   {
1427e4b17023SJohn Marino     struct lang_type_header GTY((skip (""))) h;
1428e4b17023SJohn Marino     struct lang_type_class  GTY((tag ("1"))) c;
1429e4b17023SJohn Marino     struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
1430e4b17023SJohn Marino   } GTY((desc ("%h.h.is_lang_type_class"))) u;
1431e4b17023SJohn Marino };
1432e4b17023SJohn Marino 
1433e4b17023SJohn Marino #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
1434e4b17023SJohn Marino 
1435e4b17023SJohn Marino #define LANG_TYPE_CLASS_CHECK(NODE) __extension__		\
1436e4b17023SJohn Marino ({  struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE);		\
1437e4b17023SJohn Marino     if (! lt->u.h.is_lang_type_class)				\
1438e4b17023SJohn Marino       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);	\
1439e4b17023SJohn Marino     &lt->u.c; })
1440e4b17023SJohn Marino 
1441e4b17023SJohn Marino #define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__		\
1442e4b17023SJohn Marino ({  struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE);		\
1443e4b17023SJohn Marino     if (lt->u.h.is_lang_type_class)				\
1444e4b17023SJohn Marino       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);	\
1445e4b17023SJohn Marino     &lt->u.ptrmem; })
1446e4b17023SJohn Marino 
1447e4b17023SJohn Marino #else
1448e4b17023SJohn Marino 
1449e4b17023SJohn Marino #define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
1450e4b17023SJohn Marino #define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
1451e4b17023SJohn Marino 
1452e4b17023SJohn Marino #endif /* ENABLE_TREE_CHECKING */
1453e4b17023SJohn Marino 
1454e4b17023SJohn Marino /* Nonzero for _CLASSTYPE means that operator delete is defined.  */
1455e4b17023SJohn Marino #define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
1456e4b17023SJohn Marino #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
1457e4b17023SJohn Marino 
1458e4b17023SJohn Marino /* Nonzero if `new NODE[x]' should cause the allocation of extra
1459e4b17023SJohn Marino    storage to indicate how many array elements are in use.  */
1460e4b17023SJohn Marino #define TYPE_VEC_NEW_USES_COOKIE(NODE)			\
1461e4b17023SJohn Marino   (CLASS_TYPE_P (NODE)					\
1462e4b17023SJohn Marino    && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
1463e4b17023SJohn Marino 
1464e4b17023SJohn Marino /* Nonzero means that this _CLASSTYPE node defines ways of converting
1465e4b17023SJohn Marino    itself to other types.  */
1466e4b17023SJohn Marino #define TYPE_HAS_CONVERSION(NODE) \
1467e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
1468e4b17023SJohn Marino 
1469e4b17023SJohn Marino /* Nonzero means that NODE (a class type) has a default constructor --
1470e4b17023SJohn Marino    but that it has not yet been declared.  */
1471e4b17023SJohn Marino #define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \
1472e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor)
1473e4b17023SJohn Marino 
1474e4b17023SJohn Marino /* Nonzero means that NODE (a class type) has a copy constructor --
1475e4b17023SJohn Marino    but that it has not yet been declared.  */
1476e4b17023SJohn Marino #define CLASSTYPE_LAZY_COPY_CTOR(NODE) \
1477e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor)
1478e4b17023SJohn Marino 
1479e4b17023SJohn Marino /* Nonzero means that NODE (a class type) has a move constructor --
1480e4b17023SJohn Marino    but that it has not yet been declared.  */
1481e4b17023SJohn Marino #define CLASSTYPE_LAZY_MOVE_CTOR(NODE) \
1482e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_ctor)
1483e4b17023SJohn Marino 
1484e4b17023SJohn Marino /* Nonzero means that NODE (a class type) has an assignment operator
1485e4b17023SJohn Marino    -- but that it has not yet been declared.  */
1486e4b17023SJohn Marino #define CLASSTYPE_LAZY_COPY_ASSIGN(NODE) \
1487e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_assign)
1488e4b17023SJohn Marino 
1489e4b17023SJohn Marino /* Nonzero means that NODE (a class type) has an assignment operator
1490e4b17023SJohn Marino    -- but that it has not yet been declared.  */
1491e4b17023SJohn Marino #define CLASSTYPE_LAZY_MOVE_ASSIGN(NODE) \
1492e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_move_assign)
1493e4b17023SJohn Marino 
1494e4b17023SJohn Marino /* Nonzero means that NODE (a class type) has a destructor -- but that
1495e4b17023SJohn Marino    it has not yet been declared.  */
1496e4b17023SJohn Marino #define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
1497e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
1498e4b17023SJohn Marino 
1499e4b17023SJohn Marino /* Nonzero means that NODE (a class type) is final */
1500e4b17023SJohn Marino #define CLASSTYPE_FINAL(NODE) \
1501e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->is_final)
1502e4b17023SJohn Marino 
1503e4b17023SJohn Marino 
1504e4b17023SJohn Marino /* Nonzero means that this _CLASSTYPE node overloads operator=(X&).  */
1505e4b17023SJohn Marino #define TYPE_HAS_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_copy_assign)
1506e4b17023SJohn Marino 
1507e4b17023SJohn Marino /* True iff the class type NODE has an "operator =" whose parameter
1508e4b17023SJohn Marino    has a parameter of type "const X&".  */
1509e4b17023SJohn Marino #define TYPE_HAS_CONST_COPY_ASSIGN(NODE) \
1510e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_copy_assign)
1511e4b17023SJohn Marino 
1512e4b17023SJohn Marino /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor.  */
1513e4b17023SJohn Marino #define TYPE_HAS_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_copy_ctor)
1514e4b17023SJohn Marino #define TYPE_HAS_CONST_COPY_CTOR(NODE) \
1515e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->has_const_copy_ctor)
1516e4b17023SJohn Marino 
1517e4b17023SJohn Marino /* Nonzero if this class has an X(initializer_list<T>) constructor.  */
1518e4b17023SJohn Marino #define TYPE_HAS_LIST_CTOR(NODE) \
1519e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->has_list_ctor)
1520e4b17023SJohn Marino 
1521e4b17023SJohn Marino /* Nonzero if this class has a constexpr constructor other than a copy/move
1522e4b17023SJohn Marino    constructor.  Note that a class can have constexpr constructors for
1523e4b17023SJohn Marino    static initialization even if it isn't a literal class.  */
1524e4b17023SJohn Marino #define TYPE_HAS_CONSTEXPR_CTOR(NODE) \
1525e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->has_constexpr_ctor)
1526e4b17023SJohn Marino 
1527e4b17023SJohn Marino /* Nonzero if this class defines an overloaded operator new.  (An
1528e4b17023SJohn Marino    operator new [] doesn't count.)  */
1529e4b17023SJohn Marino #define TYPE_HAS_NEW_OPERATOR(NODE) \
1530e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->has_new)
1531e4b17023SJohn Marino 
1532e4b17023SJohn Marino /* Nonzero if this class defines an overloaded operator new[].  */
1533e4b17023SJohn Marino #define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
1534e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
1535e4b17023SJohn Marino 
1536e4b17023SJohn Marino /* Nonzero means that this type is being defined.  I.e., the left brace
1537e4b17023SJohn Marino    starting the definition of this type has been seen.  */
1538e4b17023SJohn Marino #define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
1539e4b17023SJohn Marino 
1540e4b17023SJohn Marino /* Nonzero means that this type is either complete or being defined, so we
1541e4b17023SJohn Marino    can do lookup in it.  */
1542e4b17023SJohn Marino #define COMPLETE_OR_OPEN_TYPE_P(NODE) \
1543e4b17023SJohn Marino   (COMPLETE_TYPE_P (NODE) || (CLASS_TYPE_P (NODE) && TYPE_BEING_DEFINED (NODE)))
1544e4b17023SJohn Marino 
1545e4b17023SJohn Marino /* Mark bits for repeated base checks.  */
1546e4b17023SJohn Marino #define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
1547e4b17023SJohn Marino 
1548e4b17023SJohn Marino /* Nonzero if the class NODE has multiple paths to the same (virtual)
1549e4b17023SJohn Marino    base object.  */
1550e4b17023SJohn Marino #define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \
1551e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped)
1552e4b17023SJohn Marino 
1553e4b17023SJohn Marino /* Nonzero if the class NODE has multiple instances of the same base
1554e4b17023SJohn Marino    type.  */
1555e4b17023SJohn Marino #define CLASSTYPE_REPEATED_BASE_P(NODE) \
1556e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK(NODE)->repeated_base)
1557e4b17023SJohn Marino 
1558e4b17023SJohn Marino /* The member function with which the vtable will be emitted:
1559e4b17023SJohn Marino    the first noninline non-pure-virtual member function.  NULL_TREE
1560e4b17023SJohn Marino    if there is no key function or if this is a class template */
1561e4b17023SJohn Marino #define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method)
1562e4b17023SJohn Marino 
1563e4b17023SJohn Marino /* Vector member functions defined in this class.  Each element is
1564e4b17023SJohn Marino    either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD.  All
1565e4b17023SJohn Marino    functions with the same name end up in the same slot.  The first
1566e4b17023SJohn Marino    two elements are for constructors, and destructors, respectively.
1567e4b17023SJohn Marino    All template conversion operators to innermost template dependent
1568e4b17023SJohn Marino    types are overloaded on the next slot, if they exist.  Note, the
1569e4b17023SJohn Marino    names for these functions will not all be the same.  The
1570e4b17023SJohn Marino    non-template conversion operators & templated conversions to
1571e4b17023SJohn Marino    non-innermost template types are next, followed by ordinary member
1572e4b17023SJohn Marino    functions.  There may be empty entries at the end of the vector.
1573e4b17023SJohn Marino    The conversion operators are unsorted. The ordinary member
1574e4b17023SJohn Marino    functions are sorted, once the class is complete.  */
1575e4b17023SJohn Marino #define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
1576e4b17023SJohn Marino 
1577e4b17023SJohn Marino /* For class templates, this is a TREE_LIST of all member data,
1578e4b17023SJohn Marino    functions, types, and friends in the order of declaration.
1579e4b17023SJohn Marino    The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
1580e4b17023SJohn Marino    and the RECORD_TYPE for the class template otherwise.  */
1581e4b17023SJohn Marino #define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
1582e4b17023SJohn Marino 
1583e4b17023SJohn Marino /* The slot in the CLASSTYPE_METHOD_VEC where constructors go.  */
1584e4b17023SJohn Marino #define CLASSTYPE_CONSTRUCTOR_SLOT 0
1585e4b17023SJohn Marino 
1586e4b17023SJohn Marino /* The slot in the CLASSTYPE_METHOD_VEC where destructors go.  */
1587e4b17023SJohn Marino #define CLASSTYPE_DESTRUCTOR_SLOT 1
1588e4b17023SJohn Marino 
1589e4b17023SJohn Marino /* The first slot in the CLASSTYPE_METHOD_VEC where conversion
1590e4b17023SJohn Marino    operators can appear.  */
1591e4b17023SJohn Marino #define CLASSTYPE_FIRST_CONVERSION_SLOT 2
1592e4b17023SJohn Marino 
1593e4b17023SJohn Marino /* A FUNCTION_DECL or OVERLOAD for the constructors for NODE.  These
1594e4b17023SJohn Marino    are the constructors that take an in-charge parameter.  */
1595e4b17023SJohn Marino #define CLASSTYPE_CONSTRUCTORS(NODE) \
1596e4b17023SJohn Marino   (VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT))
1597e4b17023SJohn Marino 
1598e4b17023SJohn Marino /* A FUNCTION_DECL for the destructor for NODE.  These are the
1599e4b17023SJohn Marino    destructors that take an in-charge parameter.  If
1600e4b17023SJohn Marino    CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL
1601e4b17023SJohn Marino    until the destructor is created with lazily_declare_fn.  */
1602e4b17023SJohn Marino #define CLASSTYPE_DESTRUCTORS(NODE) \
1603e4b17023SJohn Marino   (CLASSTYPE_METHOD_VEC (NODE)						      \
1604e4b17023SJohn Marino    ? VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT) \
1605e4b17023SJohn Marino    : NULL_TREE)
1606e4b17023SJohn Marino 
1607e4b17023SJohn Marino /* A dictionary of the nested user-defined-types (class-types, or enums)
1608e4b17023SJohn Marino    found within this class.  This table includes nested member class
1609e4b17023SJohn Marino    templates.  */
1610e4b17023SJohn Marino #define CLASSTYPE_NESTED_UTDS(NODE) \
1611e4b17023SJohn Marino    (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
1612e4b17023SJohn Marino 
1613e4b17023SJohn Marino /* Nonzero if NODE has a primary base class, i.e., a base class with
1614e4b17023SJohn Marino    which it shares the virtual function table pointer.  */
1615e4b17023SJohn Marino #define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
1616e4b17023SJohn Marino   (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
1617e4b17023SJohn Marino 
1618e4b17023SJohn Marino /* If non-NULL, this is the binfo for the primary base class, i.e.,
1619e4b17023SJohn Marino    the base class which contains the virtual function table pointer
1620e4b17023SJohn Marino    for this class.  */
1621e4b17023SJohn Marino #define CLASSTYPE_PRIMARY_BINFO(NODE) \
1622e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
1623e4b17023SJohn Marino 
1624e4b17023SJohn Marino /* A vector of BINFOs for the direct and indirect virtual base classes
1625e4b17023SJohn Marino    that this type uses in a post-order depth-first left-to-right
1626e4b17023SJohn Marino    order.  (In other words, these bases appear in the order that they
1627e4b17023SJohn Marino    should be initialized.)  */
1628e4b17023SJohn Marino #define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
1629e4b17023SJohn Marino 
1630e4b17023SJohn Marino /* The type corresponding to NODE when NODE is used as a base class,
1631e4b17023SJohn Marino    i.e., NODE without virtual base classes.  */
1632e4b17023SJohn Marino 
1633e4b17023SJohn Marino #define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
1634e4b17023SJohn Marino 
1635e4b17023SJohn Marino /* True iff NODE is the CLASSTYPE_AS_BASE version of some type.  */
1636e4b17023SJohn Marino 
1637e4b17023SJohn Marino #define IS_FAKE_BASE_TYPE(NODE)					\
1638e4b17023SJohn Marino   (TREE_CODE (NODE) == RECORD_TYPE				\
1639e4b17023SJohn Marino    && TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE))	\
1640e4b17023SJohn Marino    && CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE))
1641e4b17023SJohn Marino 
1642e4b17023SJohn Marino /* These are the size and alignment of the type without its virtual
1643e4b17023SJohn Marino    base classes, for when we use this type as a base itself.  */
1644e4b17023SJohn Marino #define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE))
1645e4b17023SJohn Marino #define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE))
1646e4b17023SJohn Marino #define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE))
1647e4b17023SJohn Marino #define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE))
1648e4b17023SJohn Marino 
1649e4b17023SJohn Marino /* The alignment of NODE, without its virtual bases, in bytes.  */
1650e4b17023SJohn Marino #define CLASSTYPE_ALIGN_UNIT(NODE) \
1651e4b17023SJohn Marino   (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
1652e4b17023SJohn Marino 
1653e4b17023SJohn Marino /* True if this a Java interface type, declared with
1654e4b17023SJohn Marino    '__attribute__ ((java_interface))'.  */
1655e4b17023SJohn Marino #define TYPE_JAVA_INTERFACE(NODE) \
1656e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->java_interface)
1657e4b17023SJohn Marino 
1658e4b17023SJohn Marino /* A VEC(tree) of virtual functions which cannot be inherited by
1659e4b17023SJohn Marino    derived classes.  When deriving from this type, the derived
1660e4b17023SJohn Marino    class must provide its own definition for each of these functions.  */
1661e4b17023SJohn Marino #define CLASSTYPE_PURE_VIRTUALS(NODE) \
1662e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
1663e4b17023SJohn Marino 
1664e4b17023SJohn Marino /* Nonzero means that this type has an X() constructor.  */
1665e4b17023SJohn Marino #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
1666e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
1667e4b17023SJohn Marino 
1668e4b17023SJohn Marino /* Nonzero means that this type contains a mutable member.  */
1669e4b17023SJohn Marino #define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
1670e4b17023SJohn Marino #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
1671e4b17023SJohn Marino 
1672e4b17023SJohn Marino /* Nonzero means that this class type is not POD for the purpose of layout
1673e4b17023SJohn Marino    (as defined in the ABI).  This is different from the language's POD.  */
1674e4b17023SJohn Marino #define CLASSTYPE_NON_LAYOUT_POD_P(NODE) \
1675e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
1676e4b17023SJohn Marino 
1677e4b17023SJohn Marino /* Nonzero means that this class type is a non-standard-layout class.  */
1678e4b17023SJohn Marino #define CLASSTYPE_NON_STD_LAYOUT(NODE) \
1679e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->non_std_layout)
1680e4b17023SJohn Marino 
1681e4b17023SJohn Marino /* Nonzero means that this class contains pod types whose default
1682e4b17023SJohn Marino    initialization is not a zero initialization (namely, pointers to
1683e4b17023SJohn Marino    data members).  */
1684e4b17023SJohn Marino #define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
1685e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
1686e4b17023SJohn Marino 
1687e4b17023SJohn Marino /* Nonzero if this class is "empty" in the sense of the C++ ABI.  */
1688e4b17023SJohn Marino #define CLASSTYPE_EMPTY_P(NODE) \
1689e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
1690e4b17023SJohn Marino 
1691e4b17023SJohn Marino /* Nonzero if this class is "nearly empty", i.e., contains only a
1692e4b17023SJohn Marino    virtual function table pointer.  */
1693e4b17023SJohn Marino #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
1694e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
1695e4b17023SJohn Marino 
1696e4b17023SJohn Marino /* Nonzero if this class contains an empty subobject.  */
1697e4b17023SJohn Marino #define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
1698e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
1699e4b17023SJohn Marino 
1700e4b17023SJohn Marino /* A list of class types of which this type is a friend.  The
1701e4b17023SJohn Marino    TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
1702e4b17023SJohn Marino    case of a template friend.  */
1703e4b17023SJohn Marino #define CLASSTYPE_FRIEND_CLASSES(NODE) \
1704e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
1705e4b17023SJohn Marino 
1706e4b17023SJohn Marino /* A list of the classes which grant friendship to this class.  */
1707e4b17023SJohn Marino #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
1708e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
1709e4b17023SJohn Marino 
1710e4b17023SJohn Marino /* The associated LAMBDA_EXPR that made this class.  */
1711e4b17023SJohn Marino #define CLASSTYPE_LAMBDA_EXPR(NODE) \
1712e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->lambda_expr)
1713e4b17023SJohn Marino /* The extra mangling scope for this closure type.  */
1714e4b17023SJohn Marino #define LAMBDA_TYPE_EXTRA_SCOPE(NODE) \
1715e4b17023SJohn Marino   (LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (NODE)))
1716e4b17023SJohn Marino 
1717e4b17023SJohn Marino /* Say whether this node was declared as a "class" or a "struct".  */
1718e4b17023SJohn Marino #define CLASSTYPE_DECLARED_CLASS(NODE) \
1719e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
1720e4b17023SJohn Marino 
1721e4b17023SJohn Marino /* Nonzero if this class has const members
1722e4b17023SJohn Marino    which have no specified initialization.  */
1723e4b17023SJohn Marino #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE)	\
1724e4b17023SJohn Marino   (TYPE_LANG_SPECIFIC (NODE)				\
1725e4b17023SJohn Marino    ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
1726e4b17023SJohn Marino #define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
1727e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
1728e4b17023SJohn Marino 
1729e4b17023SJohn Marino /* Nonzero if this class has ref members
1730e4b17023SJohn Marino    which have no specified initialization.  */
1731e4b17023SJohn Marino #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE)		\
1732e4b17023SJohn Marino   (TYPE_LANG_SPECIFIC (NODE)				\
1733e4b17023SJohn Marino    ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
1734e4b17023SJohn Marino #define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
1735e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
1736e4b17023SJohn Marino 
1737e4b17023SJohn Marino /* Nonzero if this class is included from a header file which employs
1738e4b17023SJohn Marino    `#pragma interface', and it is not included in its implementation file.  */
1739e4b17023SJohn Marino #define CLASSTYPE_INTERFACE_ONLY(NODE) \
1740e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
1741e4b17023SJohn Marino 
1742e4b17023SJohn Marino /* True if we have already determined whether or not vtables, VTTs,
1743e4b17023SJohn Marino    typeinfo, and other similar per-class data should be emitted in
1744e4b17023SJohn Marino    this translation unit.  This flag does not indicate whether or not
1745e4b17023SJohn Marino    these items should be emitted; it only indicates that we know one
1746e4b17023SJohn Marino    way or the other.  */
1747e4b17023SJohn Marino #define CLASSTYPE_INTERFACE_KNOWN(NODE) \
1748e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
1749e4b17023SJohn Marino /* The opposite of CLASSTYPE_INTERFACE_KNOWN.  */
1750e4b17023SJohn Marino #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
1751e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
1752e4b17023SJohn Marino 
1753e4b17023SJohn Marino #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
1754e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
1755e4b17023SJohn Marino #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
1756e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
1757e4b17023SJohn Marino #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
1758e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
1759e4b17023SJohn Marino 
1760e4b17023SJohn Marino /* Nonzero if a _DECL node requires us to output debug info for this class.  */
1761e4b17023SJohn Marino #define CLASSTYPE_DEBUG_REQUESTED(NODE) \
1762e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
1763e4b17023SJohn Marino 
1764e4b17023SJohn Marino /* Additional macros for inheritance information.  */
1765e4b17023SJohn Marino 
1766e4b17023SJohn Marino /* Nonzero means that this class is on a path leading to a new vtable.  */
1767e4b17023SJohn Marino #define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE)
1768e4b17023SJohn Marino 
1769e4b17023SJohn Marino /* Nonzero means B (a BINFO) has its own vtable.  Any copies will not
1770e4b17023SJohn Marino    have this flag set.  */
1771e4b17023SJohn Marino #define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B))
1772e4b17023SJohn Marino 
1773e4b17023SJohn Marino /* Compare a BINFO_TYPE with another type for equality.  For a binfo,
1774e4b17023SJohn Marino    this is functionally equivalent to using same_type_p, but
1775e4b17023SJohn Marino    measurably faster.  At least one of the arguments must be a
1776e4b17023SJohn Marino    BINFO_TYPE.  The other can be a BINFO_TYPE or a regular type.  If
1777e4b17023SJohn Marino    BINFO_TYPE(T) ever stops being the main variant of the class the
1778e4b17023SJohn Marino    binfo is for, this macro must change.  */
1779e4b17023SJohn Marino #define SAME_BINFO_TYPE_P(A, B) ((A) == (B))
1780e4b17023SJohn Marino 
1781e4b17023SJohn Marino /* Any subobject that needs a new vtable must have a vptr and must not
1782e4b17023SJohn Marino    be a non-virtual primary base (since it would then use the vtable from a
1783e4b17023SJohn Marino    derived class and never become non-primary.)  */
1784e4b17023SJohn Marino #define SET_BINFO_NEW_VTABLE_MARKED(B)					 \
1785e4b17023SJohn Marino   (BINFO_NEW_VTABLE_MARKED (B) = 1,					 \
1786e4b17023SJohn Marino    gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)),		 \
1787e4b17023SJohn Marino    gcc_assert (TYPE_VFIELD (BINFO_TYPE (B))))
1788e4b17023SJohn Marino 
1789e4b17023SJohn Marino /* Nonzero if this binfo is for a dependent base - one that should not
1790e4b17023SJohn Marino    be searched.  */
1791e4b17023SJohn Marino #define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE)
1792e4b17023SJohn Marino 
1793e4b17023SJohn Marino /* Nonzero if this binfo has lost its primary base binfo (because that
1794e4b17023SJohn Marino    is a nearly-empty virtual base that has been taken by some other
1795e4b17023SJohn Marino    base in the complete hierarchy.  */
1796e4b17023SJohn Marino #define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE)
1797e4b17023SJohn Marino 
1798e4b17023SJohn Marino /* Nonzero if this BINFO is a primary base class.  */
1799e4b17023SJohn Marino #define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE)
1800e4b17023SJohn Marino 
1801e4b17023SJohn Marino /* Used by various search routines.  */
1802e4b17023SJohn Marino #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
1803e4b17023SJohn Marino 
1804e4b17023SJohn Marino /* A VEC(tree_pair_s) of the vcall indices associated with the class
1805e4b17023SJohn Marino    NODE.  The PURPOSE of each element is a FUNCTION_DECL for a virtual
1806e4b17023SJohn Marino    function.  The VALUE is the index into the virtual table where the
1807e4b17023SJohn Marino    vcall offset for that function is stored, when NODE is a virtual
1808e4b17023SJohn Marino    base.  */
1809e4b17023SJohn Marino #define CLASSTYPE_VCALL_INDICES(NODE) \
1810e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
1811e4b17023SJohn Marino 
1812e4b17023SJohn Marino /* The various vtables for the class NODE.  The primary vtable will be
1813e4b17023SJohn Marino    first, followed by the construction vtables and VTT, if any.  */
1814e4b17023SJohn Marino #define CLASSTYPE_VTABLES(NODE) \
1815e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
1816e4b17023SJohn Marino 
1817e4b17023SJohn Marino /* The std::type_info variable representing this class, or NULL if no
1818e4b17023SJohn Marino    such variable has been created.  This field is only set for the
1819e4b17023SJohn Marino    TYPE_MAIN_VARIANT of the class.  */
1820e4b17023SJohn Marino #define CLASSTYPE_TYPEINFO_VAR(NODE) \
1821e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
1822e4b17023SJohn Marino 
1823e4b17023SJohn Marino /* Accessor macros for the BINFO_VIRTUALS list.  */
1824e4b17023SJohn Marino 
1825e4b17023SJohn Marino /* The number of bytes by which to adjust the `this' pointer when
1826e4b17023SJohn Marino    calling this virtual function.  Subtract this value from the this
1827e4b17023SJohn Marino    pointer. Always non-NULL, might be constant zero though.  */
1828e4b17023SJohn Marino #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
1829e4b17023SJohn Marino 
1830e4b17023SJohn Marino /* If non-NULL, the vtable index at which to find the vcall offset
1831e4b17023SJohn Marino    when calling this virtual function.  Add the value at that vtable
1832e4b17023SJohn Marino    index to the this pointer.  */
1833e4b17023SJohn Marino #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
1834e4b17023SJohn Marino 
1835e4b17023SJohn Marino /* The function to call.  */
1836e4b17023SJohn Marino #define BV_FN(NODE) (TREE_VALUE (NODE))
1837e4b17023SJohn Marino 
1838e4b17023SJohn Marino /* Whether or not this entry is for a lost primary virtual base.  */
1839e4b17023SJohn Marino #define BV_LOST_PRIMARY(NODE) (TREE_LANG_FLAG_0 (NODE))
1840e4b17023SJohn Marino 
1841e4b17023SJohn Marino /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1842e4b17023SJohn Marino    this type can raise.  Each TREE_VALUE is a _TYPE.  The TREE_VALUE
1843e4b17023SJohn Marino    will be NULL_TREE to indicate a throw specification of `()', or
1844e4b17023SJohn Marino    no exceptions allowed.  For a noexcept specification, TREE_VALUE
1845e4b17023SJohn Marino    is NULL_TREE and TREE_PURPOSE is the constant-expression.  For
1846e4b17023SJohn Marino    a deferred noexcept-specification, TREE_PURPOSE is a DEFERRED_NOEXCEPT
1847e4b17023SJohn Marino    (for templates) or an OVERLOAD list of functions (for implicitly
1848e4b17023SJohn Marino    declared functions).  */
1849e4b17023SJohn Marino #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
1850e4b17023SJohn Marino 
1851e4b17023SJohn Marino /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'
1852e4b17023SJohn Marino    or noexcept(true).  */
1853e4b17023SJohn Marino #define TYPE_NOTHROW_P(NODE) nothrow_spec_p (TYPE_RAISES_EXCEPTIONS (NODE))
1854e4b17023SJohn Marino 
1855e4b17023SJohn Marino /* For FUNCTION_TYPE or METHOD_TYPE, true if NODE is noexcept.  This is the
1856e4b17023SJohn Marino    case for things declared noexcept(true) and, with -fnothrow-opt, for
1857e4b17023SJohn Marino    throw() functions.  */
1858e4b17023SJohn Marino #define TYPE_NOEXCEPT_P(NODE) type_noexcept_p (NODE)
1859e4b17023SJohn Marino 
1860e4b17023SJohn Marino /* The binding level associated with the namespace.  */
1861e4b17023SJohn Marino #define NAMESPACE_LEVEL(NODE) \
1862e4b17023SJohn Marino   (LANG_DECL_NS_CHECK (NODE)->level)
1863e4b17023SJohn Marino 
1864e4b17023SJohn Marino /* Flags shared by all forms of DECL_LANG_SPECIFIC.
1865e4b17023SJohn Marino 
1866e4b17023SJohn Marino    Some of the flags live here only to make lang_decl_min/fn smaller.  Do
1867e4b17023SJohn Marino    not make this struct larger than 32 bits; instead, make sel smaller.  */
1868e4b17023SJohn Marino 
1869e4b17023SJohn Marino struct GTY(()) lang_decl_base {
1870e4b17023SJohn Marino   unsigned selector : 16;   /* Larger than necessary for faster access.  */
1871e4b17023SJohn Marino   ENUM_BITFIELD(languages) language : 4;
1872e4b17023SJohn Marino   unsigned use_template : 2;
1873e4b17023SJohn Marino   unsigned not_really_extern : 1;	   /* var or fn */
1874e4b17023SJohn Marino   unsigned initialized_in_class : 1;	   /* var or fn */
1875e4b17023SJohn Marino   unsigned repo_available_p : 1;	   /* var or fn */
1876e4b17023SJohn Marino   unsigned threadprivate_or_deleted_p : 1; /* var or fn */
1877e4b17023SJohn Marino   unsigned anticipated_p : 1;		   /* fn or type */
1878e4b17023SJohn Marino   unsigned friend_attr : 1;		   /* fn or type */
1879e4b17023SJohn Marino   unsigned template_conv_p : 1;		   /* var or template */
1880e4b17023SJohn Marino   unsigned odr_used : 1;		   /* var or fn */
1881e4b17023SJohn Marino   unsigned u2sel : 1;
1882e4b17023SJohn Marino   /* 1 spare bit */
1883e4b17023SJohn Marino };
1884e4b17023SJohn Marino 
1885e4b17023SJohn Marino /* True for DECL codes which have template info and access.  */
1886e4b17023SJohn Marino #define LANG_DECL_HAS_MIN(NODE)			\
1887e4b17023SJohn Marino   (TREE_CODE (NODE) == FUNCTION_DECL		\
1888e4b17023SJohn Marino    || TREE_CODE (NODE) == FIELD_DECL		\
1889e4b17023SJohn Marino    || TREE_CODE (NODE) == VAR_DECL		\
1890e4b17023SJohn Marino    || TREE_CODE (NODE) == CONST_DECL		\
1891e4b17023SJohn Marino    || TREE_CODE (NODE) == TYPE_DECL		\
1892e4b17023SJohn Marino    || TREE_CODE (NODE) == TEMPLATE_DECL		\
1893e4b17023SJohn Marino    || TREE_CODE (NODE) == USING_DECL)
1894e4b17023SJohn Marino 
1895e4b17023SJohn Marino /* DECL_LANG_SPECIFIC for the above codes.  */
1896e4b17023SJohn Marino 
1897e4b17023SJohn Marino struct GTY(()) lang_decl_min {
1898e4b17023SJohn Marino   struct lang_decl_base base;
1899e4b17023SJohn Marino 
1900e4b17023SJohn Marino   /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
1901e4b17023SJohn Marino      THUNK_ALIAS.
1902e4b17023SJohn Marino      In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
1903e4b17023SJohn Marino      VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
1904e4b17023SJohn Marino      DECL_TEMPLATE_INFO.  */
1905e4b17023SJohn Marino   tree template_info;
1906e4b17023SJohn Marino 
1907e4b17023SJohn Marino   union lang_decl_u2 {
1908e4b17023SJohn Marino     /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
1909e4b17023SJohn Marino        THUNK_VIRTUAL_OFFSET.
1910e4b17023SJohn Marino        Otherwise this is DECL_ACCESS.  */
1911e4b17023SJohn Marino     tree GTY ((tag ("0"))) access;
1912e4b17023SJohn Marino 
1913e4b17023SJohn Marino     /* For VAR_DECL in function, this is DECL_DISCRIMINATOR.  */
1914e4b17023SJohn Marino     int GTY ((tag ("1"))) discriminator;
1915e4b17023SJohn Marino   } GTY ((desc ("%0.u.base.u2sel"))) u2;
1916e4b17023SJohn Marino };
1917e4b17023SJohn Marino 
1918e4b17023SJohn Marino /* Additional DECL_LANG_SPECIFIC information for functions.  */
1919e4b17023SJohn Marino 
1920e4b17023SJohn Marino struct GTY(()) lang_decl_fn {
1921e4b17023SJohn Marino   struct lang_decl_min min;
1922e4b17023SJohn Marino 
1923e4b17023SJohn Marino   /* In an overloaded operator, this is the value of
1924e4b17023SJohn Marino      DECL_OVERLOADED_OPERATOR_P.  */
1925e4b17023SJohn Marino   ENUM_BITFIELD (tree_code) operator_code : 16;
1926e4b17023SJohn Marino 
1927e4b17023SJohn Marino   unsigned global_ctor_p : 1;
1928e4b17023SJohn Marino   unsigned global_dtor_p : 1;
1929e4b17023SJohn Marino   unsigned constructor_attr : 1;
1930e4b17023SJohn Marino   unsigned destructor_attr : 1;
1931e4b17023SJohn Marino   unsigned assignment_operator_p : 1;
1932e4b17023SJohn Marino   unsigned static_function : 1;
1933e4b17023SJohn Marino   unsigned pure_virtual : 1;
1934e4b17023SJohn Marino   unsigned defaulted_p : 1;
1935e4b17023SJohn Marino 
1936e4b17023SJohn Marino   unsigned has_in_charge_parm_p : 1;
1937e4b17023SJohn Marino   unsigned has_vtt_parm_p : 1;
1938e4b17023SJohn Marino   unsigned pending_inline_p : 1;
1939e4b17023SJohn Marino   unsigned nonconverting : 1;
1940e4b17023SJohn Marino   unsigned thunk_p : 1;
1941e4b17023SJohn Marino   unsigned this_thunk_p : 1;
1942e4b17023SJohn Marino   unsigned hidden_friend_p : 1;
1943e4b17023SJohn Marino   unsigned suppress_implicit_decl : 1;
1944e4b17023SJohn Marino 
1945e4b17023SJohn Marino   /* For a non-thunk function decl, this is a tree list of
1946e4b17023SJohn Marino      friendly classes. For a thunk function decl, it is the
1947e4b17023SJohn Marino      thunked to function decl.  */
1948e4b17023SJohn Marino   tree befriending_classes;
1949e4b17023SJohn Marino 
1950e4b17023SJohn Marino   /* For a non-virtual FUNCTION_DECL, this is
1951e4b17023SJohn Marino      DECL_FRIEND_CONTEXT.  For a virtual FUNCTION_DECL for which
1952e4b17023SJohn Marino      DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
1953e4b17023SJohn Marino      this pointer and result pointer adjusting thunks are
1954e4b17023SJohn Marino      chained here.  This pointer thunks to return pointer thunks
1955e4b17023SJohn Marino      will be chained on the return pointer thunk.  */
1956e4b17023SJohn Marino   tree context;
1957e4b17023SJohn Marino 
1958e4b17023SJohn Marino   union lang_decl_u5
1959e4b17023SJohn Marino   {
1960e4b17023SJohn Marino     /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is
1961e4b17023SJohn Marino        DECL_CLONED_FUNCTION.  */
1962e4b17023SJohn Marino     tree GTY ((tag ("0"))) cloned_function;
1963e4b17023SJohn Marino 
1964e4b17023SJohn Marino     /* In a FUNCTION_DECL for which THUNK_P holds this is the
1965e4b17023SJohn Marino        THUNK_FIXED_OFFSET.  */
1966e4b17023SJohn Marino     HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset;
1967e4b17023SJohn Marino   } GTY ((desc ("%1.thunk_p"))) u5;
1968e4b17023SJohn Marino 
1969e4b17023SJohn Marino   union lang_decl_u3
1970e4b17023SJohn Marino   {
1971e4b17023SJohn Marino     struct cp_token_cache * GTY ((tag ("1"))) pending_inline_info;
1972e4b17023SJohn Marino     struct language_function * GTY ((tag ("0")))
1973e4b17023SJohn Marino       saved_language_function;
1974e4b17023SJohn Marino   } GTY ((desc ("%1.pending_inline_p"))) u;
1975e4b17023SJohn Marino 
1976e4b17023SJohn Marino };
1977e4b17023SJohn Marino 
1978e4b17023SJohn Marino /* DECL_LANG_SPECIFIC for namespaces.  */
1979e4b17023SJohn Marino 
1980e4b17023SJohn Marino struct GTY(()) lang_decl_ns {
1981e4b17023SJohn Marino   struct lang_decl_base base;
1982e4b17023SJohn Marino   cp_binding_level *level;
1983e4b17023SJohn Marino };
1984e4b17023SJohn Marino 
1985e4b17023SJohn Marino /* DECL_LANG_SPECIFIC for parameters.  */
1986e4b17023SJohn Marino 
1987e4b17023SJohn Marino struct GTY(()) lang_decl_parm {
1988e4b17023SJohn Marino   struct lang_decl_base base;
1989e4b17023SJohn Marino   int level;
1990e4b17023SJohn Marino   int index;
1991e4b17023SJohn Marino };
1992e4b17023SJohn Marino 
1993e4b17023SJohn Marino /* DECL_LANG_SPECIFIC for all types.  It would be nice to just make this a
1994e4b17023SJohn Marino    union rather than a struct containing a union as its only field, but
1995e4b17023SJohn Marino    tree.h declares it as a struct.  */
1996e4b17023SJohn Marino 
1997e4b17023SJohn Marino struct GTY((variable_size)) lang_decl {
1998e4b17023SJohn Marino   union GTY((desc ("%h.base.selector"))) lang_decl_u {
1999e4b17023SJohn Marino     struct lang_decl_base GTY ((default)) base;
2000e4b17023SJohn Marino     struct lang_decl_min GTY((tag ("0"))) min;
2001e4b17023SJohn Marino     struct lang_decl_fn GTY ((tag ("1"))) fn;
2002e4b17023SJohn Marino     struct lang_decl_ns GTY((tag ("2"))) ns;
2003e4b17023SJohn Marino     struct lang_decl_parm GTY((tag ("3"))) parm;
2004e4b17023SJohn Marino   } u;
2005e4b17023SJohn Marino };
2006e4b17023SJohn Marino 
2007e4b17023SJohn Marino /* Looks through a template (if present) to find what it declares.  */
2008e4b17023SJohn Marino #define STRIP_TEMPLATE(NODE) \
2009e4b17023SJohn Marino   (TREE_CODE (NODE) == TEMPLATE_DECL ? DECL_TEMPLATE_RESULT (NODE) : NODE)
2010e4b17023SJohn Marino 
2011e4b17023SJohn Marino #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
2012e4b17023SJohn Marino 
2013e4b17023SJohn Marino #define LANG_DECL_MIN_CHECK(NODE) __extension__			\
2014e4b17023SJohn Marino ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);		\
2015e4b17023SJohn Marino    if (!LANG_DECL_HAS_MIN (NODE))				\
2016e4b17023SJohn Marino      lang_check_failed (__FILE__, __LINE__, __FUNCTION__);	\
2017e4b17023SJohn Marino    &lt->u.min; })
2018e4b17023SJohn Marino 
2019e4b17023SJohn Marino /* We want to be able to check DECL_CONSTRUCTOR_P and such on a function
2020e4b17023SJohn Marino    template, not just on a FUNCTION_DECL.  So when looking for things in
2021e4b17023SJohn Marino    lang_decl_fn, look down through a TEMPLATE_DECL into its result.  */
2022e4b17023SJohn Marino #define LANG_DECL_FN_CHECK(NODE) __extension__				\
2023e4b17023SJohn Marino ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE));	\
2024e4b17023SJohn Marino    if (!DECL_DECLARES_FUNCTION_P (NODE) || lt->u.base.selector != 1)	\
2025e4b17023SJohn Marino      lang_check_failed (__FILE__, __LINE__, __FUNCTION__);		\
2026e4b17023SJohn Marino    &lt->u.fn; })
2027e4b17023SJohn Marino 
2028e4b17023SJohn Marino #define LANG_DECL_NS_CHECK(NODE) __extension__				\
2029e4b17023SJohn Marino ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);			\
2030e4b17023SJohn Marino    if (TREE_CODE (NODE) != NAMESPACE_DECL || lt->u.base.selector != 2)	\
2031e4b17023SJohn Marino      lang_check_failed (__FILE__, __LINE__, __FUNCTION__);		\
2032e4b17023SJohn Marino    &lt->u.ns; })
2033e4b17023SJohn Marino 
2034e4b17023SJohn Marino #define LANG_DECL_PARM_CHECK(NODE) __extension__		\
2035e4b17023SJohn Marino ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);		\
2036e4b17023SJohn Marino   if (TREE_CODE (NODE) != PARM_DECL)				\
2037e4b17023SJohn Marino     lang_check_failed (__FILE__, __LINE__, __FUNCTION__);	\
2038e4b17023SJohn Marino   &lt->u.parm; })
2039e4b17023SJohn Marino 
2040e4b17023SJohn Marino #define LANG_DECL_U2_CHECK(NODE, TF) __extension__		\
2041e4b17023SJohn Marino ({  struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE);		\
2042e4b17023SJohn Marino     if (!LANG_DECL_HAS_MIN (NODE) || lt->u.base.u2sel != TF)	\
2043e4b17023SJohn Marino       lang_check_failed (__FILE__, __LINE__, __FUNCTION__);	\
2044e4b17023SJohn Marino     &lt->u.min.u2; })
2045e4b17023SJohn Marino 
2046e4b17023SJohn Marino #else
2047e4b17023SJohn Marino 
2048e4b17023SJohn Marino #define LANG_DECL_MIN_CHECK(NODE) \
2049e4b17023SJohn Marino   (&DECL_LANG_SPECIFIC (NODE)->u.min)
2050e4b17023SJohn Marino 
2051e4b17023SJohn Marino #define LANG_DECL_FN_CHECK(NODE) \
2052e4b17023SJohn Marino   (&DECL_LANG_SPECIFIC (STRIP_TEMPLATE (NODE))->u.fn)
2053e4b17023SJohn Marino 
2054e4b17023SJohn Marino #define LANG_DECL_NS_CHECK(NODE) \
2055e4b17023SJohn Marino   (&DECL_LANG_SPECIFIC (NODE)->u.ns)
2056e4b17023SJohn Marino 
2057e4b17023SJohn Marino #define LANG_DECL_PARM_CHECK(NODE) \
2058e4b17023SJohn Marino   (&DECL_LANG_SPECIFIC (NODE)->u.parm)
2059e4b17023SJohn Marino 
2060e4b17023SJohn Marino #define LANG_DECL_U2_CHECK(NODE, TF) \
2061e4b17023SJohn Marino   (&DECL_LANG_SPECIFIC (NODE)->u.min.u2)
2062e4b17023SJohn Marino 
2063e4b17023SJohn Marino #endif /* ENABLE_TREE_CHECKING */
2064e4b17023SJohn Marino 
2065e4b17023SJohn Marino /* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
2066e4b17023SJohn Marino    declaration.  Some entities (like a member function in a local
2067e4b17023SJohn Marino    class, or a local variable) do not have linkage at all, and this
2068e4b17023SJohn Marino    macro should not be used in those cases.
2069e4b17023SJohn Marino 
2070e4b17023SJohn Marino    Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
2071e4b17023SJohn Marino    created by language-independent code, and has C linkage.  Most
2072e4b17023SJohn Marino    VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
2073e4b17023SJohn Marino    we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage.  */
2074e4b17023SJohn Marino #define DECL_LANGUAGE(NODE)				\
2075e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (NODE)				\
2076e4b17023SJohn Marino    ? DECL_LANG_SPECIFIC (NODE)->u.base.language		\
2077e4b17023SJohn Marino    : (TREE_CODE (NODE) == FUNCTION_DECL			\
2078e4b17023SJohn Marino       ? lang_c : lang_cplusplus))
2079e4b17023SJohn Marino 
2080e4b17023SJohn Marino /* Set the language linkage for NODE to LANGUAGE.  */
2081e4b17023SJohn Marino #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
2082e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (NODE)->u.base.language = (LANGUAGE))
2083e4b17023SJohn Marino 
2084e4b17023SJohn Marino /* For FUNCTION_DECLs: nonzero means that this function is a constructor.  */
2085e4b17023SJohn Marino #define DECL_CONSTRUCTOR_P(NODE) \
2086e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->constructor_attr)
2087e4b17023SJohn Marino 
2088e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
2089e4b17023SJohn Marino    object.  */
2090e4b17023SJohn Marino #define DECL_COMPLETE_CONSTRUCTOR_P(NODE)		\
2091e4b17023SJohn Marino   (DECL_CONSTRUCTOR_P (NODE)				\
2092e4b17023SJohn Marino    && DECL_NAME (NODE) == complete_ctor_identifier)
2093e4b17023SJohn Marino 
2094e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
2095e4b17023SJohn Marino    object.  */
2096e4b17023SJohn Marino #define DECL_BASE_CONSTRUCTOR_P(NODE)		\
2097e4b17023SJohn Marino   (DECL_CONSTRUCTOR_P (NODE)			\
2098e4b17023SJohn Marino    && DECL_NAME (NODE) == base_ctor_identifier)
2099e4b17023SJohn Marino 
2100e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
2101e4b17023SJohn Marino    specialized in-charge constructor or the specialized not-in-charge
2102e4b17023SJohn Marino    constructor.  */
2103e4b17023SJohn Marino #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE)		\
2104e4b17023SJohn Marino   (DECL_DECLARES_FUNCTION_P (NODE) && DECL_CONSTRUCTOR_P (NODE) \
2105e4b17023SJohn Marino    && !DECL_CLONED_FUNCTION_P (NODE))
2106e4b17023SJohn Marino 
2107e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor.  */
2108e4b17023SJohn Marino #define DECL_COPY_CONSTRUCTOR_P(NODE) \
2109e4b17023SJohn Marino   (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
2110e4b17023SJohn Marino 
2111e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a move constructor.  */
2112e4b17023SJohn Marino #define DECL_MOVE_CONSTRUCTOR_P(NODE) \
2113e4b17023SJohn Marino   (DECL_CONSTRUCTOR_P (NODE) && move_fn_p (NODE))
2114e4b17023SJohn Marino 
2115e4b17023SJohn Marino /* Nonzero if NODE is a destructor.  */
2116e4b17023SJohn Marino #define DECL_DESTRUCTOR_P(NODE)				\
2117e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->destructor_attr)
2118e4b17023SJohn Marino 
2119e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
2120e4b17023SJohn Marino    specialized in-charge constructor, in-charge deleting constructor,
2121e4b17023SJohn Marino    or the base destructor.  */
2122e4b17023SJohn Marino #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE)			\
2123e4b17023SJohn Marino   (DECL_DECLARES_FUNCTION_P (NODE) && DECL_DESTRUCTOR_P (NODE)	\
2124e4b17023SJohn Marino    && !DECL_CLONED_FUNCTION_P (NODE))
2125e4b17023SJohn Marino 
2126e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
2127e4b17023SJohn Marino    object.  */
2128e4b17023SJohn Marino #define DECL_COMPLETE_DESTRUCTOR_P(NODE)		\
2129e4b17023SJohn Marino   (DECL_DESTRUCTOR_P (NODE)				\
2130e4b17023SJohn Marino    && DECL_NAME (NODE) == complete_dtor_identifier)
2131e4b17023SJohn Marino 
2132e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
2133e4b17023SJohn Marino    object.  */
2134e4b17023SJohn Marino #define DECL_BASE_DESTRUCTOR_P(NODE)		\
2135e4b17023SJohn Marino   (DECL_DESTRUCTOR_P (NODE)			\
2136e4b17023SJohn Marino    && DECL_NAME (NODE) == base_dtor_identifier)
2137e4b17023SJohn Marino 
2138e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
2139e4b17023SJohn Marino    object that deletes the object after it has been destroyed.  */
2140e4b17023SJohn Marino #define DECL_DELETING_DESTRUCTOR_P(NODE)		\
2141e4b17023SJohn Marino   (DECL_DESTRUCTOR_P (NODE)				\
2142e4b17023SJohn Marino    && DECL_NAME (NODE) == deleting_dtor_identifier)
2143e4b17023SJohn Marino 
2144e4b17023SJohn Marino /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
2145e4b17023SJohn Marino    destructor.  */
2146e4b17023SJohn Marino #define DECL_CLONED_FUNCTION_P(NODE) (!!decl_cloned_function_p (NODE, true))
2147e4b17023SJohn Marino 
2148e4b17023SJohn Marino /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
2149e4b17023SJohn Marino    cloned.  */
2150e4b17023SJohn Marino #define DECL_CLONED_FUNCTION(NODE) (*decl_cloned_function_p (NODE, false))
2151e4b17023SJohn Marino 
2152e4b17023SJohn Marino /* Perform an action for each clone of FN, if FN is a function with
2153e4b17023SJohn Marino    clones.  This macro should be used like:
2154e4b17023SJohn Marino 
2155e4b17023SJohn Marino       FOR_EACH_CLONE (clone, fn)
2156e4b17023SJohn Marino 	{ ... }
2157e4b17023SJohn Marino 
2158e4b17023SJohn Marino   */
2159e4b17023SJohn Marino #define FOR_EACH_CLONE(CLONE, FN)			\
2160e4b17023SJohn Marino   if (TREE_CODE (FN) == FUNCTION_DECL			\
2161e4b17023SJohn Marino       && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN)	\
2162e4b17023SJohn Marino 	  || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN)))	\
2163e4b17023SJohn Marino      for (CLONE = DECL_CHAIN (FN);			\
2164e4b17023SJohn Marino 	  CLONE && DECL_CLONED_FUNCTION_P (CLONE);	\
2165e4b17023SJohn Marino 	  CLONE = DECL_CHAIN (CLONE))
2166e4b17023SJohn Marino 
2167e4b17023SJohn Marino /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS.  */
2168e4b17023SJohn Marino #define DECL_DISCRIMINATOR_P(NODE)	\
2169e4b17023SJohn Marino   (TREE_CODE (NODE) == VAR_DECL		\
2170e4b17023SJohn Marino    && DECL_FUNCTION_SCOPE_P (NODE))
2171e4b17023SJohn Marino 
2172e4b17023SJohn Marino /* Discriminator for name mangling.  */
2173e4b17023SJohn Marino #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
2174e4b17023SJohn Marino 
2175e4b17023SJohn Marino /* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl.  */
2176e4b17023SJohn Marino #define DECL_DISCRIMINATOR_SET_P(NODE) \
2177e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1)
2178e4b17023SJohn Marino 
2179e4b17023SJohn Marino /* The index of a user-declared parameter in its function, starting at 1.
2180e4b17023SJohn Marino    All artificial parameters will have index 0.  */
2181e4b17023SJohn Marino #define DECL_PARM_INDEX(NODE) \
2182e4b17023SJohn Marino   (LANG_DECL_PARM_CHECK (NODE)->index)
2183e4b17023SJohn Marino 
2184e4b17023SJohn Marino /* The level of a user-declared parameter in its function, starting at 1.
2185e4b17023SJohn Marino    A parameter of the function will have level 1; a parameter of the first
2186e4b17023SJohn Marino    nested function declarator (i.e. t in void f (void (*p)(T t))) will have
2187e4b17023SJohn Marino    level 2.  */
2188e4b17023SJohn Marino #define DECL_PARM_LEVEL(NODE) \
2189e4b17023SJohn Marino   (LANG_DECL_PARM_CHECK (NODE)->level)
2190e4b17023SJohn Marino 
2191e4b17023SJohn Marino /* Nonzero if the VTT parm has been added to NODE.  */
2192e4b17023SJohn Marino #define DECL_HAS_VTT_PARM_P(NODE) \
2193e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->has_vtt_parm_p)
2194e4b17023SJohn Marino 
2195e4b17023SJohn Marino /* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is
2196e4b17023SJohn Marino    required.  */
2197e4b17023SJohn Marino #define DECL_NEEDS_VTT_PARM_P(NODE)			\
2198e4b17023SJohn Marino   (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE))		\
2199e4b17023SJohn Marino    && (DECL_BASE_CONSTRUCTOR_P (NODE)			\
2200e4b17023SJohn Marino        || DECL_BASE_DESTRUCTOR_P (NODE)))
2201e4b17023SJohn Marino 
2202e4b17023SJohn Marino /* Nonzero if NODE is a user-defined conversion operator.  */
2203e4b17023SJohn Marino #define DECL_CONV_FN_P(NODE) \
2204e4b17023SJohn Marino   (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
2205e4b17023SJohn Marino 
2206e4b17023SJohn Marino /* If FN is a conversion operator, the type to which it converts.
2207e4b17023SJohn Marino    Otherwise, NULL_TREE.  */
2208e4b17023SJohn Marino #define DECL_CONV_FN_TYPE(FN) \
2209e4b17023SJohn Marino   (DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE)
2210e4b17023SJohn Marino 
2211e4b17023SJohn Marino /* Nonzero if NODE, which is a TEMPLATE_DECL, is a template
2212e4b17023SJohn Marino    conversion operator to a type dependent on the innermost template
2213e4b17023SJohn Marino    args.  */
2214e4b17023SJohn Marino #define DECL_TEMPLATE_CONV_FN_P(NODE) \
2215e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (TEMPLATE_DECL_CHECK (NODE))->u.base.template_conv_p)
2216e4b17023SJohn Marino 
2217e4b17023SJohn Marino /* Nonzero if NODE, a static data member, was declared in its class as an
2218e4b17023SJohn Marino    array of unknown bound.  */
2219e4b17023SJohn Marino #define VAR_HAD_UNKNOWN_BOUND(NODE)			\
2220e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))		\
2221e4b17023SJohn Marino    ? DECL_LANG_SPECIFIC (NODE)->u.base.template_conv_p	\
2222e4b17023SJohn Marino    : false)
2223e4b17023SJohn Marino #define SET_VAR_HAD_UNKNOWN_BOUND(NODE) \
2224e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))->u.base.template_conv_p = true)
2225e4b17023SJohn Marino 
2226e4b17023SJohn Marino /* Set the overloaded operator code for NODE to CODE.  */
2227e4b17023SJohn Marino #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
2228e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->operator_code = (CODE))
2229e4b17023SJohn Marino 
2230e4b17023SJohn Marino /* If NODE is an overloaded operator, then this returns the TREE_CODE
2231e4b17023SJohn Marino    associated with the overloaded operator.
2232e4b17023SJohn Marino    DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
2233e4b17023SJohn Marino    whether or not NODE is an assignment operator.  If NODE is not an
2234e4b17023SJohn Marino    overloaded operator, ERROR_MARK is returned.  Since the numerical
2235e4b17023SJohn Marino    value of ERROR_MARK is zero, this macro can be used as a predicate
2236e4b17023SJohn Marino    to test whether or not NODE is an overloaded operator.  */
2237e4b17023SJohn Marino #define DECL_OVERLOADED_OPERATOR_P(NODE)		\
2238e4b17023SJohn Marino   (IDENTIFIER_OPNAME_P (DECL_NAME (NODE))		\
2239e4b17023SJohn Marino    ? LANG_DECL_FN_CHECK (NODE)->operator_code : ERROR_MARK)
2240e4b17023SJohn Marino 
2241e4b17023SJohn Marino /* Nonzero if NODE is an assignment operator (including += and such).  */
2242e4b17023SJohn Marino #define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
2243e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->assignment_operator_p)
2244e4b17023SJohn Marino 
2245e4b17023SJohn Marino /* For FUNCTION_DECLs: nonzero means that this function is a
2246e4b17023SJohn Marino    constructor or a destructor with an extra in-charge parameter to
2247e4b17023SJohn Marino    control whether or not virtual bases are constructed.  */
2248e4b17023SJohn Marino #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
2249e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->has_in_charge_parm_p)
2250e4b17023SJohn Marino 
2251e4b17023SJohn Marino /* Nonzero if DECL is a declaration of __builtin_constant_p.  */
2252e4b17023SJohn Marino #define DECL_IS_BUILTIN_CONSTANT_P(NODE)		\
2253e4b17023SJohn Marino  (TREE_CODE (NODE) == FUNCTION_DECL			\
2254e4b17023SJohn Marino   && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL	\
2255e4b17023SJohn Marino   && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P)
2256e4b17023SJohn Marino 
2257e4b17023SJohn Marino /* Nonzero for _DECL means that this decl appears in (or will appear
2258e4b17023SJohn Marino    in) as a member in a RECORD_TYPE or UNION_TYPE node.  It is also for
2259e4b17023SJohn Marino    detecting circularity in case members are multiply defined.  In the
2260e4b17023SJohn Marino    case of a VAR_DECL, it is also used to determine how program storage
2261e4b17023SJohn Marino    should be allocated.  */
2262e4b17023SJohn Marino #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
2263e4b17023SJohn Marino 
2264e4b17023SJohn Marino /* Nonzero for a VAR_DECL means that the variable's initialization (if
2265e4b17023SJohn Marino    any) has been processed.  (In general, DECL_INITIALIZED_P is
2266e4b17023SJohn Marino    !DECL_EXTERN, but static data members may be initialized even if
2267e4b17023SJohn Marino    not defined.)  */
2268e4b17023SJohn Marino #define DECL_INITIALIZED_P(NODE) \
2269e4b17023SJohn Marino    (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
2270e4b17023SJohn Marino 
2271e4b17023SJohn Marino /* Nonzero for a VAR_DECL iff an explicit initializer was provided.  */
2272e4b17023SJohn Marino #define DECL_NONTRIVIALLY_INITIALIZED_P(NODE)	\
2273e4b17023SJohn Marino    (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
2274e4b17023SJohn Marino 
2275e4b17023SJohn Marino /* Nonzero for a VAR_DECL that was initialized with a
2276e4b17023SJohn Marino    constant-expression.  */
2277e4b17023SJohn Marino #define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
2278e4b17023SJohn Marino   (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
2279e4b17023SJohn Marino 
2280e4b17023SJohn Marino /* Nonzero if the DECL was initialized in the class definition itself,
2281e4b17023SJohn Marino    rather than outside the class.  This is used for both static member
2282e4b17023SJohn Marino    VAR_DECLS, and FUNCTION_DECLS that are defined in the class.  */
2283e4b17023SJohn Marino #define DECL_INITIALIZED_IN_CLASS_P(DECL) \
2284e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
2285e4b17023SJohn Marino    ->u.base.initialized_in_class)
2286e4b17023SJohn Marino 
2287e4b17023SJohn Marino /* Nonzero if the DECL is used in the sense of 3.2 [basic.def.odr].
2288e4b17023SJohn Marino    Only available for decls with DECL_LANG_SPECIFIC.  */
2289e4b17023SJohn Marino #define DECL_ODR_USED(DECL) \
2290e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (VAR_OR_FUNCTION_DECL_CHECK (DECL)) \
2291e4b17023SJohn Marino    ->u.base.odr_used)
2292e4b17023SJohn Marino 
2293e4b17023SJohn Marino /* Nonzero for DECL means that this decl is just a friend declaration,
2294e4b17023SJohn Marino    and should not be added to the list of members for this class.  */
2295e4b17023SJohn Marino #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.friend_attr)
2296e4b17023SJohn Marino 
2297e4b17023SJohn Marino /* A TREE_LIST of the types which have befriended this FUNCTION_DECL.  */
2298e4b17023SJohn Marino #define DECL_BEFRIENDING_CLASSES(NODE) \
2299e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->befriending_classes)
2300e4b17023SJohn Marino 
2301e4b17023SJohn Marino /* Nonzero for FUNCTION_DECL means that this decl is a static
2302e4b17023SJohn Marino    member function.  */
2303e4b17023SJohn Marino #define DECL_STATIC_FUNCTION_P(NODE) \
2304e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->static_function)
2305e4b17023SJohn Marino 
2306e4b17023SJohn Marino /* Nonzero for FUNCTION_DECL means that this decl is a non-static
2307e4b17023SJohn Marino    member function.  */
2308e4b17023SJohn Marino #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
2309e4b17023SJohn Marino   (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
2310e4b17023SJohn Marino 
2311e4b17023SJohn Marino /* Nonzero for FUNCTION_DECL means that this decl is a member function
2312e4b17023SJohn Marino    (static or non-static).  */
2313e4b17023SJohn Marino #define DECL_FUNCTION_MEMBER_P(NODE) \
2314e4b17023SJohn Marino   (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
2315e4b17023SJohn Marino 
2316e4b17023SJohn Marino /* Nonzero for FUNCTION_DECL means that this member function
2317e4b17023SJohn Marino    has `this' as const X *const.  */
2318e4b17023SJohn Marino #define DECL_CONST_MEMFUNC_P(NODE)					 \
2319e4b17023SJohn Marino   (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)				 \
2320e4b17023SJohn Marino    && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE				 \
2321e4b17023SJohn Marino 				  (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2322e4b17023SJohn Marino 
2323e4b17023SJohn Marino /* Nonzero for FUNCTION_DECL means that this member function
2324e4b17023SJohn Marino    has `this' as volatile X *const.  */
2325e4b17023SJohn Marino #define DECL_VOLATILE_MEMFUNC_P(NODE)					 \
2326e4b17023SJohn Marino   (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)				 \
2327e4b17023SJohn Marino    && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE				 \
2328e4b17023SJohn Marino 				  (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
2329e4b17023SJohn Marino 
2330e4b17023SJohn Marino /* Nonzero for a DECL means that this member is a non-static member.  */
2331e4b17023SJohn Marino #define DECL_NONSTATIC_MEMBER_P(NODE)		\
2332e4b17023SJohn Marino   (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)	\
2333e4b17023SJohn Marino    || TREE_CODE (NODE) == FIELD_DECL)
2334e4b17023SJohn Marino 
2335e4b17023SJohn Marino /* Nonzero for _DECL means that this member object type
2336e4b17023SJohn Marino    is mutable.  */
2337e4b17023SJohn Marino #define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
2338e4b17023SJohn Marino 
2339e4b17023SJohn Marino /* Nonzero for _DECL means that this constructor or conversion function is
2340e4b17023SJohn Marino    non-converting.  */
2341e4b17023SJohn Marino #define DECL_NONCONVERTING_P(NODE) \
2342e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->nonconverting)
2343e4b17023SJohn Marino 
2344e4b17023SJohn Marino /* Nonzero for FUNCTION_DECL means that this member function is a pure
2345e4b17023SJohn Marino    virtual function.  */
2346e4b17023SJohn Marino #define DECL_PURE_VIRTUAL_P(NODE) \
2347e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->pure_virtual)
2348e4b17023SJohn Marino 
2349e4b17023SJohn Marino /* True (in a FUNCTION_DECL) if NODE is a virtual function that is an
2350e4b17023SJohn Marino    invalid overrider for a function from a base class.  Once we have
2351e4b17023SJohn Marino    complained about an invalid overrider we avoid complaining about it
2352e4b17023SJohn Marino    again.  */
2353e4b17023SJohn Marino #define DECL_INVALID_OVERRIDER_P(NODE) \
2354e4b17023SJohn Marino   (DECL_LANG_FLAG_4 (NODE))
2355e4b17023SJohn Marino 
2356e4b17023SJohn Marino /* True (in a FUNCTION_DECL) if NODE is a function declared with
2357e4b17023SJohn Marino    an override virt-specifier */
2358e4b17023SJohn Marino #define DECL_OVERRIDE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
2359e4b17023SJohn Marino 
2360e4b17023SJohn Marino /* True (in a FUNCTION_DECL) if NODE is a function declared with
2361e4b17023SJohn Marino    a final virt-specifier */
2362e4b17023SJohn Marino #define DECL_FINAL_P(NODE) (TREE_LANG_FLAG_1 (NODE))
2363e4b17023SJohn Marino 
2364e4b17023SJohn Marino /* The thunks associated with NODE, a FUNCTION_DECL.  */
2365e4b17023SJohn Marino #define DECL_THUNKS(NODE) \
2366e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->context)
2367e4b17023SJohn Marino 
2368e4b17023SJohn Marino /* Nonzero if NODE is a thunk, rather than an ordinary function.  */
2369e4b17023SJohn Marino #define DECL_THUNK_P(NODE)			\
2370e4b17023SJohn Marino   (TREE_CODE (NODE) == FUNCTION_DECL		\
2371e4b17023SJohn Marino    && DECL_LANG_SPECIFIC (NODE)			\
2372e4b17023SJohn Marino    && LANG_DECL_FN_CHECK (NODE)->thunk_p)
2373e4b17023SJohn Marino 
2374e4b17023SJohn Marino /* Set DECL_THUNK_P for node.  */
2375e4b17023SJohn Marino #define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING)			\
2376e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->thunk_p = 1,			\
2377e4b17023SJohn Marino    LANG_DECL_FN_CHECK (NODE)->this_thunk_p = (THIS_ADJUSTING))
2378e4b17023SJohn Marino 
2379e4b17023SJohn Marino /* Nonzero if NODE is a this pointer adjusting thunk.  */
2380e4b17023SJohn Marino #define DECL_THIS_THUNK_P(NODE)			\
2381e4b17023SJohn Marino   (DECL_THUNK_P (NODE) && LANG_DECL_FN_CHECK (NODE)->this_thunk_p)
2382e4b17023SJohn Marino 
2383e4b17023SJohn Marino /* Nonzero if NODE is a result pointer adjusting thunk.  */
2384e4b17023SJohn Marino #define DECL_RESULT_THUNK_P(NODE)			\
2385e4b17023SJohn Marino   (DECL_THUNK_P (NODE) && !LANG_DECL_FN_CHECK (NODE)->this_thunk_p)
2386e4b17023SJohn Marino 
2387e4b17023SJohn Marino /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk.  */
2388e4b17023SJohn Marino #define DECL_NON_THUNK_FUNCTION_P(NODE)				\
2389e4b17023SJohn Marino   (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
2390e4b17023SJohn Marino 
2391e4b17023SJohn Marino /* Nonzero if NODE is `extern "C"'.  */
2392e4b17023SJohn Marino #define DECL_EXTERN_C_P(NODE) \
2393e4b17023SJohn Marino   (DECL_LANGUAGE (NODE) == lang_c)
2394e4b17023SJohn Marino 
2395e4b17023SJohn Marino /* Nonzero if NODE is an `extern "C"' function.  */
2396e4b17023SJohn Marino #define DECL_EXTERN_C_FUNCTION_P(NODE) \
2397e4b17023SJohn Marino   (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
2398e4b17023SJohn Marino 
2399e4b17023SJohn Marino /* True iff DECL is an entity with vague linkage whose definition is
2400e4b17023SJohn Marino    available in this translation unit.  */
2401e4b17023SJohn Marino #define DECL_REPO_AVAILABLE_P(NODE) \
2402e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (NODE)->u.base.repo_available_p)
2403e4b17023SJohn Marino 
2404e4b17023SJohn Marino /* True if DECL is declared 'constexpr'.  */
2405e4b17023SJohn Marino #define DECL_DECLARED_CONSTEXPR_P(DECL) \
2406e4b17023SJohn Marino   DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL)))
2407e4b17023SJohn Marino 
2408e4b17023SJohn Marino /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
2409e4b17023SJohn Marino    template function.  */
2410e4b17023SJohn Marino #define DECL_PRETTY_FUNCTION_P(NODE) \
2411e4b17023SJohn Marino   (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)))
2412e4b17023SJohn Marino 
2413e4b17023SJohn Marino /* The _TYPE context in which this _DECL appears.  This field holds the
2414e4b17023SJohn Marino    class where a virtual function instance is actually defined.  */
2415e4b17023SJohn Marino #define DECL_CLASS_CONTEXT(NODE) \
2416e4b17023SJohn Marino   (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
2417e4b17023SJohn Marino 
2418e4b17023SJohn Marino /* For a non-member friend function, the class (if any) in which this
2419e4b17023SJohn Marino    friend was defined.  For example, given:
2420e4b17023SJohn Marino 
2421e4b17023SJohn Marino      struct S { friend void f (); };
2422e4b17023SJohn Marino 
2423e4b17023SJohn Marino    the DECL_FRIEND_CONTEXT for `f' will be `S'.  */
2424e4b17023SJohn Marino #define DECL_FRIEND_CONTEXT(NODE)				\
2425e4b17023SJohn Marino   ((DECL_DECLARES_FUNCTION_P (NODE)				\
2426e4b17023SJohn Marino     && DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE))	\
2427e4b17023SJohn Marino    ? LANG_DECL_FN_CHECK (NODE)->context				\
2428e4b17023SJohn Marino    : NULL_TREE)
2429e4b17023SJohn Marino 
2430e4b17023SJohn Marino /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT.  */
2431e4b17023SJohn Marino #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
2432e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->context = (CONTEXT))
2433e4b17023SJohn Marino 
2434e4b17023SJohn Marino #define CP_DECL_CONTEXT(NODE) \
2435e4b17023SJohn Marino   (!DECL_FILE_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
2436e4b17023SJohn Marino #define CP_TYPE_CONTEXT(NODE) \
2437e4b17023SJohn Marino   (!TYPE_FILE_SCOPE_P (NODE) ? TYPE_CONTEXT (NODE) : global_namespace)
2438e4b17023SJohn Marino #define FROB_CONTEXT(NODE) \
2439e4b17023SJohn Marino   ((NODE) == global_namespace ? DECL_CONTEXT (NODE) : (NODE))
2440e4b17023SJohn Marino 
2441e4b17023SJohn Marino /* 1 iff NODE has namespace scope, including the global namespace.  */
2442e4b17023SJohn Marino #define DECL_NAMESPACE_SCOPE_P(NODE)				\
2443e4b17023SJohn Marino   (!DECL_TEMPLATE_PARM_P (NODE)					\
2444e4b17023SJohn Marino    && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
2445e4b17023SJohn Marino 
2446e4b17023SJohn Marino #define TYPE_NAMESPACE_SCOPE_P(NODE) \
2447e4b17023SJohn Marino   (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL)
2448e4b17023SJohn Marino 
2449e4b17023SJohn Marino #define NAMESPACE_SCOPE_P(NODE) \
2450e4b17023SJohn Marino   ((DECL_P (NODE) && DECL_NAMESPACE_SCOPE_P (NODE)) \
2451e4b17023SJohn Marino    || (TYPE_P (NODE) && TYPE_NAMESPACE_SCOPE_P (NODE)))
2452e4b17023SJohn Marino 
2453e4b17023SJohn Marino /* 1 iff NODE is a class member.  */
2454e4b17023SJohn Marino #define DECL_CLASS_SCOPE_P(NODE) \
2455e4b17023SJohn Marino   (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
2456e4b17023SJohn Marino 
2457e4b17023SJohn Marino #define TYPE_CLASS_SCOPE_P(NODE) \
2458e4b17023SJohn Marino   (TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE)))
2459e4b17023SJohn Marino 
2460e4b17023SJohn Marino /* 1 iff NODE is function-local.  */
2461e4b17023SJohn Marino #define DECL_FUNCTION_SCOPE_P(NODE) \
2462e4b17023SJohn Marino   (DECL_CONTEXT (NODE) \
2463e4b17023SJohn Marino    && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
2464e4b17023SJohn Marino 
2465e4b17023SJohn Marino #define TYPE_FUNCTION_SCOPE_P(NODE) \
2466e4b17023SJohn Marino   (TYPE_CONTEXT (NODE) && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL)
2467e4b17023SJohn Marino 
2468e4b17023SJohn Marino /* 1 iff VAR_DECL node NODE is a type-info decl.  This flag is set for
2469e4b17023SJohn Marino    both the primary typeinfo object and the associated NTBS name.  */
2470e4b17023SJohn Marino #define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
2471e4b17023SJohn Marino 
2472e4b17023SJohn Marino /* 1 iff VAR_DECL node NODE is virtual table or VTT.  */
2473e4b17023SJohn Marino #define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
2474e4b17023SJohn Marino 
2475e4b17023SJohn Marino /* Returns 1 iff VAR_DECL is a construction virtual table.
2476e4b17023SJohn Marino    DECL_VTABLE_OR_VTT_P will be true in this case and must be checked
2477e4b17023SJohn Marino    before using this macro.  */
2478e4b17023SJohn Marino #define DECL_CONSTRUCTION_VTABLE_P(NODE) \
2479e4b17023SJohn Marino   TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))
2480e4b17023SJohn Marino 
2481e4b17023SJohn Marino /* 1 iff NODE is function-local, but for types.  */
2482e4b17023SJohn Marino #define LOCAL_CLASS_P(NODE)				\
2483e4b17023SJohn Marino   (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
2484e4b17023SJohn Marino 
2485e4b17023SJohn Marino /* For a NAMESPACE_DECL: the list of using namespace directives
2486e4b17023SJohn Marino    The PURPOSE is the used namespace, the value is the namespace
2487e4b17023SJohn Marino    that is the common ancestor.  */
2488e4b17023SJohn Marino #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
2489e4b17023SJohn Marino 
2490e4b17023SJohn Marino /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
2491e4b17023SJohn Marino    of a namespace, to record the transitive closure of using namespace.  */
2492e4b17023SJohn Marino #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
2493e4b17023SJohn Marino 
2494e4b17023SJohn Marino /* In a NAMESPACE_DECL, the list of namespaces which have associated
2495e4b17023SJohn Marino    themselves with this one.  */
2496e4b17023SJohn Marino #define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
2497e4b17023SJohn Marino   (NAMESPACE_DECL_CHECK (NODE)->decl_non_common.saved_tree)
2498e4b17023SJohn Marino 
2499e4b17023SJohn Marino /* In a NAMESPACE_DECL, points to the original namespace if this is
2500e4b17023SJohn Marino    a namespace alias.  */
2501e4b17023SJohn Marino #define DECL_NAMESPACE_ALIAS(NODE) \
2502e4b17023SJohn Marino 	DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
2503e4b17023SJohn Marino #define ORIGINAL_NAMESPACE(NODE)  \
2504e4b17023SJohn Marino   (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
2505e4b17023SJohn Marino 
2506e4b17023SJohn Marino /* Nonzero if NODE is the std namespace.  */
2507e4b17023SJohn Marino #define DECL_NAMESPACE_STD_P(NODE)			\
2508e4b17023SJohn Marino   (TREE_CODE (NODE) == NAMESPACE_DECL			\
2509e4b17023SJohn Marino    && CP_DECL_CONTEXT (NODE) == global_namespace	\
2510e4b17023SJohn Marino    && DECL_NAME (NODE) == std_identifier)
2511e4b17023SJohn Marino 
2512e4b17023SJohn Marino /* In a TREE_LIST concatenating using directives, indicate indirect
2513e4b17023SJohn Marino    directives  */
2514e4b17023SJohn Marino #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
2515e4b17023SJohn Marino 
2516e4b17023SJohn Marino /* In a TREE_LIST in an attribute list, indicates that the attribute
2517e4b17023SJohn Marino    must be applied at instantiation time.  */
2518e4b17023SJohn Marino #define ATTR_IS_DEPENDENT(NODE) (TREE_LIST_CHECK (NODE)->base.lang_flag_0)
2519e4b17023SJohn Marino 
2520e4b17023SJohn Marino extern tree decl_shadowed_for_var_lookup (tree);
2521e4b17023SJohn Marino extern void decl_shadowed_for_var_insert (tree, tree);
2522e4b17023SJohn Marino 
2523e4b17023SJohn Marino /* Non zero if this is a using decl for a dependent scope. */
2524e4b17023SJohn Marino #define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
2525e4b17023SJohn Marino 
2526e4b17023SJohn Marino /* The scope named in a using decl.  */
2527e4b17023SJohn Marino #define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE))
2528e4b17023SJohn Marino 
2529e4b17023SJohn Marino /* The decls named by a using decl.  */
2530e4b17023SJohn Marino #define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
2531e4b17023SJohn Marino 
2532e4b17023SJohn Marino /* Non zero if the using decl refers to a dependent type.  */
2533e4b17023SJohn Marino #define USING_DECL_TYPENAME_P(NODE) DECL_LANG_FLAG_1 (USING_DECL_CHECK (NODE))
2534e4b17023SJohn Marino 
2535e4b17023SJohn Marino /* In a VAR_DECL, true if we have a shadowed local variable
2536e4b17023SJohn Marino    in the shadowed var table for this VAR_DECL.  */
2537e4b17023SJohn Marino #define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \
2538e4b17023SJohn Marino   (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p)
2539e4b17023SJohn Marino 
2540e4b17023SJohn Marino /* In a VAR_DECL for a variable declared in a for statement,
2541e4b17023SJohn Marino    this is the shadowed (local) variable.  */
2542e4b17023SJohn Marino #define DECL_SHADOWED_FOR_VAR(NODE) \
2543e4b17023SJohn Marino   (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL)
2544e4b17023SJohn Marino 
2545e4b17023SJohn Marino #define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \
2546e4b17023SJohn Marino   (decl_shadowed_for_var_insert (NODE, VAL))
2547e4b17023SJohn Marino 
2548e4b17023SJohn Marino /* In a FUNCTION_DECL, this is nonzero if this function was defined in
2549e4b17023SJohn Marino    the class definition.  We have saved away the text of the function,
2550e4b17023SJohn Marino    but have not yet processed it.  */
2551e4b17023SJohn Marino #define DECL_PENDING_INLINE_P(NODE) \
2552e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->pending_inline_p)
2553e4b17023SJohn Marino 
2554e4b17023SJohn Marino /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
2555e4b17023SJohn Marino    function.  */
2556e4b17023SJohn Marino #define DECL_PENDING_INLINE_INFO(NODE) \
2557e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info)
2558e4b17023SJohn Marino 
2559e4b17023SJohn Marino /* Nonzero for TYPE_DECL means that it was written 'using name = type'.  */
2560e4b17023SJohn Marino #define TYPE_DECL_ALIAS_P(NODE) \
2561e4b17023SJohn Marino   DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE))
2562e4b17023SJohn Marino 
2563e4b17023SJohn Marino /* Nonzero for a type which is an alias for another type; i.e, a type
2564e4b17023SJohn Marino    which declaration was written 'using name-of-type =
2565e4b17023SJohn Marino    another-type'.  */
2566e4b17023SJohn Marino #define TYPE_ALIAS_P(NODE)			\
2567e4b17023SJohn Marino   (TYPE_P (NODE)				\
2568e4b17023SJohn Marino    && TYPE_NAME (NODE)				\
2569e4b17023SJohn Marino    && TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL	\
2570e4b17023SJohn Marino    && TYPE_DECL_ALIAS_P (TYPE_NAME (NODE)))
2571e4b17023SJohn Marino 
2572e4b17023SJohn Marino /* For a class type: if this structure has many fields, we'll sort them
2573e4b17023SJohn Marino    and put them into a TREE_VEC.  */
2574e4b17023SJohn Marino #define CLASSTYPE_SORTED_FIELDS(NODE) \
2575e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->sorted_fields)
2576e4b17023SJohn Marino 
2577e4b17023SJohn Marino /* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
2578e4b17023SJohn Marino    TEMPLATE_DECL, the entity is either a template specialization (if
2579e4b17023SJohn Marino    DECL_USE_TEMPLATE is nonzero) or the abstract instance of the
2580e4b17023SJohn Marino    template itself.
2581e4b17023SJohn Marino 
2582e4b17023SJohn Marino    In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose
2583e4b17023SJohn Marino    TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a
2584e4b17023SJohn Marino    specialization or abstract instance.  The TREE_VALUE is the
2585e4b17023SJohn Marino    template arguments used to specialize the template.
2586e4b17023SJohn Marino 
2587e4b17023SJohn Marino    Consider:
2588e4b17023SJohn Marino 
2589e4b17023SJohn Marino       template <typename T> struct S { friend void f(T) {} };
2590e4b17023SJohn Marino 
2591e4b17023SJohn Marino    In this case, S<int>::f is, from the point of view of the compiler,
2592e4b17023SJohn Marino    an instantiation of a template -- but, from the point of view of
2593e4b17023SJohn Marino    the language, each instantiation of S results in a wholly unrelated
2594e4b17023SJohn Marino    global function f.  In this case, DECL_TEMPLATE_INFO for S<int>::f
2595e4b17023SJohn Marino    will be non-NULL, but DECL_USE_TEMPLATE will be zero.  */
2596e4b17023SJohn Marino #define DECL_TEMPLATE_INFO(NODE) \
2597e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_FIELD_OR_FUNCTION_DECL_CHECK (NODE)) \
2598e4b17023SJohn Marino    ->u.min.template_info)
2599e4b17023SJohn Marino 
2600e4b17023SJohn Marino /* For a VAR_DECL, indicates that the variable is actually a
2601e4b17023SJohn Marino    non-static data member of anonymous union that has been promoted to
2602e4b17023SJohn Marino    variable status.  */
2603e4b17023SJohn Marino #define DECL_ANON_UNION_VAR_P(NODE) \
2604e4b17023SJohn Marino   (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)))
2605e4b17023SJohn Marino 
2606e4b17023SJohn Marino /* Template information for a RECORD_TYPE or UNION_TYPE.  */
2607e4b17023SJohn Marino #define CLASSTYPE_TEMPLATE_INFO(NODE) \
2608e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
2609e4b17023SJohn Marino 
2610e4b17023SJohn Marino /* Template information for an ENUMERAL_TYPE.  Although an enumeration may
2611e4b17023SJohn Marino    not be a primary template, it may be declared within the scope of a
2612e4b17023SJohn Marino    primary template and the enumeration constants may depend on
2613e4b17023SJohn Marino    non-type template parameters.  */
2614e4b17023SJohn Marino #define ENUM_TEMPLATE_INFO(NODE) \
2615e4b17023SJohn Marino   (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
2616e4b17023SJohn Marino 
2617e4b17023SJohn Marino /* Template information for a template template parameter.  */
2618e4b17023SJohn Marino #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
2619e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
2620e4b17023SJohn Marino    ->template_info)
2621e4b17023SJohn Marino 
2622e4b17023SJohn Marino /* Template information for an ENUMERAL_, RECORD_, UNION_TYPE, or
2623e4b17023SJohn Marino    BOUND_TEMPLATE_TEMPLATE_PARM type.  Note that if NODE is a
2624e4b17023SJohn Marino    specialization of an alias template, this accessor returns the
2625e4b17023SJohn Marino    template info for the alias template, not the one (if any) for the
2626e4b17023SJohn Marino    template of the underlying type.  */
2627e4b17023SJohn Marino #define TYPE_TEMPLATE_INFO(NODE)					\
2628e4b17023SJohn Marino   (TYPE_ALIAS_P (NODE)							\
2629e4b17023SJohn Marino    ? ((TYPE_NAME (NODE) && DECL_LANG_SPECIFIC (TYPE_NAME (NODE)))	\
2630e4b17023SJohn Marino       ? DECL_TEMPLATE_INFO (TYPE_NAME (NODE))				\
2631e4b17023SJohn Marino       : NULL_TREE)							\
2632e4b17023SJohn Marino    : ((TREE_CODE (NODE) == ENUMERAL_TYPE)				\
2633e4b17023SJohn Marino       ? ENUM_TEMPLATE_INFO (NODE)					\
2634e4b17023SJohn Marino       : ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM)		\
2635e4b17023SJohn Marino 	 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE)			\
2636e4b17023SJohn Marino 	 : (CLASS_TYPE_P (NODE)						\
2637e4b17023SJohn Marino 	    ? CLASSTYPE_TEMPLATE_INFO (NODE)				\
2638e4b17023SJohn Marino 	    : NULL_TREE))))
2639e4b17023SJohn Marino 
2640e4b17023SJohn Marino 
2641e4b17023SJohn Marino /* Set the template information for an ENUMERAL_, RECORD_, or
2642e4b17023SJohn Marino    UNION_TYPE to VAL.  */
2643e4b17023SJohn Marino #define SET_TYPE_TEMPLATE_INFO(NODE, VAL)				\
2644e4b17023SJohn Marino   (TREE_CODE (NODE) == ENUMERAL_TYPE					\
2645e4b17023SJohn Marino    ? (ENUM_TEMPLATE_INFO (NODE) = (VAL))				\
2646e4b17023SJohn Marino    : ((CLASS_TYPE_P (NODE) && !TYPE_ALIAS_P (NODE))			\
2647e4b17023SJohn Marino       ? (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL))			\
2648e4b17023SJohn Marino       : (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL))))
2649e4b17023SJohn Marino 
2650e4b17023SJohn Marino #define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
2651e4b17023SJohn Marino #define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
2652e4b17023SJohn Marino #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
2653e4b17023SJohn Marino /* For a given TREE_VEC containing a template argument list,
2654e4b17023SJohn Marino    this property contains the number of arguments that are not
2655e4b17023SJohn Marino    defaulted.  */
2656e4b17023SJohn Marino #define NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) TREE_CHAIN (TREE_VEC_CHECK (NODE))
2657e4b17023SJohn Marino /* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT
2658e4b17023SJohn Marino    property.  */
2659e4b17023SJohn Marino #define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \
2660e4b17023SJohn Marino   NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (NULL_TREE, INT_VALUE)
2661e4b17023SJohn Marino #ifdef ENABLE_CHECKING
2662e4b17023SJohn Marino #define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
2663e4b17023SJohn Marino     int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE))
2664e4b17023SJohn Marino #else
2665e4b17023SJohn Marino #define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
2666e4b17023SJohn Marino   NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE) \
2667e4b17023SJohn Marino   ? int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE)) \
2668e4b17023SJohn Marino   : TREE_VEC_LENGTH (INNERMOST_TEMPLATE_ARGS (NODE))
2669e4b17023SJohn Marino #endif
2670e4b17023SJohn Marino /* The list of typedefs - used in the template - that need
2671e4b17023SJohn Marino    access checking at template instantiation time.  */
2672e4b17023SJohn Marino #define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) \
2673e4b17023SJohn Marino   ((struct tree_template_info*)TEMPLATE_INFO_CHECK \
2674e4b17023SJohn Marino      (NODE))->typedefs_needing_access_checking
2675e4b17023SJohn Marino 
2676e4b17023SJohn Marino /* We use TREE_VECs to hold template arguments.  If there is only one
2677e4b17023SJohn Marino    level of template arguments, then the TREE_VEC contains the
2678e4b17023SJohn Marino    arguments directly.  If there is more than one level of template
2679e4b17023SJohn Marino    arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
2680e4b17023SJohn Marino    containing the template arguments for a single level.  The first
2681e4b17023SJohn Marino    entry in the outer TREE_VEC is the outermost level of template
2682e4b17023SJohn Marino    parameters; the last is the innermost.
2683e4b17023SJohn Marino 
2684e4b17023SJohn Marino    It is incorrect to ever form a template argument vector containing
2685e4b17023SJohn Marino    only one level of arguments, but which is a TREE_VEC containing as
2686e4b17023SJohn Marino    its only entry the TREE_VEC for that level.
2687e4b17023SJohn Marino 
2688e4b17023SJohn Marino    For each TREE_VEC containing the template arguments for a single
2689e4b17023SJohn Marino    level, it's possible to get or set the number of non defaulted
2690e4b17023SJohn Marino    template arguments by using the accessor macros
2691e4b17023SJohn Marino    GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT or
2692e4b17023SJohn Marino    SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.  */
2693e4b17023SJohn Marino 
2694e4b17023SJohn Marino /* Nonzero if the template arguments is actually a vector of vectors,
2695e4b17023SJohn Marino    rather than just a vector.  */
2696e4b17023SJohn Marino #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE)		     \
2697e4b17023SJohn Marino   (NODE && TREE_VEC_LENGTH (NODE) && TREE_VEC_ELT (NODE, 0)  \
2698e4b17023SJohn Marino    && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
2699e4b17023SJohn Marino 
2700e4b17023SJohn Marino /* The depth of a template argument vector.  When called directly by
2701e4b17023SJohn Marino    the parser, we use a TREE_LIST rather than a TREE_VEC to represent
2702e4b17023SJohn Marino    template arguments.  In fact, we may even see NULL_TREE if there
2703e4b17023SJohn Marino    are no template arguments.  In both of those cases, there is only
2704e4b17023SJohn Marino    one level of template arguments.  */
2705e4b17023SJohn Marino #define TMPL_ARGS_DEPTH(NODE)					\
2706e4b17023SJohn Marino   (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
2707e4b17023SJohn Marino 
2708e4b17023SJohn Marino /* The LEVELth level of the template ARGS.  The outermost level of
2709e4b17023SJohn Marino    args is level 1, not level 0.  */
2710e4b17023SJohn Marino #define TMPL_ARGS_LEVEL(ARGS, LEVEL)		\
2711e4b17023SJohn Marino   (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS)	\
2712e4b17023SJohn Marino    ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
2713e4b17023SJohn Marino 
2714e4b17023SJohn Marino /* Set the LEVELth level of the template ARGS to VAL.  This macro does
2715e4b17023SJohn Marino    not work with single-level argument vectors.  */
2716e4b17023SJohn Marino #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL)	\
2717e4b17023SJohn Marino   (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
2718e4b17023SJohn Marino 
2719e4b17023SJohn Marino /* Accesses the IDXth parameter in the LEVELth level of the ARGS.  */
2720e4b17023SJohn Marino #define TMPL_ARG(ARGS, LEVEL, IDX)				\
2721e4b17023SJohn Marino   (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
2722e4b17023SJohn Marino 
2723e4b17023SJohn Marino /* Given a single level of template arguments in NODE, return the
2724e4b17023SJohn Marino    number of arguments.  */
2725e4b17023SJohn Marino #define NUM_TMPL_ARGS(NODE)				\
2726e4b17023SJohn Marino   (TREE_VEC_LENGTH (NODE))
2727e4b17023SJohn Marino 
2728e4b17023SJohn Marino /* Returns the innermost level of template arguments in ARGS.  */
2729e4b17023SJohn Marino #define INNERMOST_TEMPLATE_ARGS(NODE) \
2730e4b17023SJohn Marino   (get_innermost_template_args ((NODE), 1))
2731e4b17023SJohn Marino 
2732e4b17023SJohn Marino /* The number of levels of template parameters given by NODE.  */
2733e4b17023SJohn Marino #define TMPL_PARMS_DEPTH(NODE) \
2734e4b17023SJohn Marino   ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
2735e4b17023SJohn Marino 
2736e4b17023SJohn Marino /* The TEMPLATE_DECL instantiated or specialized by NODE.  This
2737e4b17023SJohn Marino    TEMPLATE_DECL will be the immediate parent, not the most general
2738e4b17023SJohn Marino    template.  For example, in:
2739e4b17023SJohn Marino 
2740e4b17023SJohn Marino       template <class T> struct S { template <class U> void f(U); }
2741e4b17023SJohn Marino 
2742e4b17023SJohn Marino    the FUNCTION_DECL for S<int>::f<double> will have, as its
2743e4b17023SJohn Marino    DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
2744e4b17023SJohn Marino 
2745e4b17023SJohn Marino    As a special case, for a member friend template of a template
2746e4b17023SJohn Marino    class, this value will not be a TEMPLATE_DECL, but rather an
2747e4b17023SJohn Marino    IDENTIFIER_NODE or OVERLOAD indicating the name of the template and
2748e4b17023SJohn Marino    any explicit template arguments provided.  For example, in:
2749e4b17023SJohn Marino 
2750e4b17023SJohn Marino      template <class T> struct S { friend void f<int>(int, double); }
2751e4b17023SJohn Marino 
2752e4b17023SJohn Marino    the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
2753e4b17023SJohn Marino    DECL_TI_ARGS will be {int}.
2754e4b17023SJohn Marino 
2755e4b17023SJohn Marino    For a FIELD_DECL with a non-static data member initializer, this value
2756e4b17023SJohn Marino    is the FIELD_DECL it was instantiated from.  */
2757e4b17023SJohn Marino #define DECL_TI_TEMPLATE(NODE)      TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
2758e4b17023SJohn Marino 
2759e4b17023SJohn Marino /* The template arguments used to obtain this decl from the most
2760e4b17023SJohn Marino    general form of DECL_TI_TEMPLATE.  For the example given for
2761e4b17023SJohn Marino    DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}.  These
2762e4b17023SJohn Marino    are always the full set of arguments required to instantiate this
2763e4b17023SJohn Marino    declaration from the most general template specialized here.  */
2764e4b17023SJohn Marino #define DECL_TI_ARGS(NODE)	    TI_ARGS (DECL_TEMPLATE_INFO (NODE))
2765e4b17023SJohn Marino 
2766e4b17023SJohn Marino /* The TEMPLATE_DECL associated with NODE, a class type.  Even if NODE
2767e4b17023SJohn Marino    will be generated from a partial specialization, the TEMPLATE_DECL
2768e4b17023SJohn Marino    referred to here will be the original template.  For example,
2769e4b17023SJohn Marino    given:
2770e4b17023SJohn Marino 
2771e4b17023SJohn Marino       template <typename T> struct S {};
2772e4b17023SJohn Marino       template <typename T> struct S<T*> {};
2773e4b17023SJohn Marino 
2774e4b17023SJohn Marino    the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>.  */
2775e4b17023SJohn Marino #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
2776e4b17023SJohn Marino #define CLASSTYPE_TI_ARGS(NODE)     TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
2777e4b17023SJohn Marino 
2778e4b17023SJohn Marino /* For a template instantiation TYPE, returns the TYPE corresponding
2779e4b17023SJohn Marino    to the primary template.  Otherwise returns TYPE itself.  */
2780e4b17023SJohn Marino #define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE)				\
2781e4b17023SJohn Marino   ((CLASSTYPE_USE_TEMPLATE ((TYPE))					\
2782e4b17023SJohn Marino     && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE)))			\
2783e4b17023SJohn Marino    ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE		\
2784e4b17023SJohn Marino 				      (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
2785e4b17023SJohn Marino    : (TYPE))
2786e4b17023SJohn Marino 
2787e4b17023SJohn Marino /* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs.  */
2788e4b17023SJohn Marino #define TYPE_TI_TEMPLATE(NODE)			\
2789e4b17023SJohn Marino   (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
2790e4b17023SJohn Marino 
2791e4b17023SJohn Marino /* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE.  */
2792e4b17023SJohn Marino #define TYPE_TI_ARGS(NODE)			\
2793e4b17023SJohn Marino   (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
2794e4b17023SJohn Marino 
2795e4b17023SJohn Marino #define INNERMOST_TEMPLATE_PARMS(NODE)  TREE_VALUE (NODE)
2796e4b17023SJohn Marino 
2797e4b17023SJohn Marino /* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the
2798e4b17023SJohn Marino    sense of [temp.mem].  */
2799e4b17023SJohn Marino #define DECL_MEMBER_TEMPLATE_P(NODE) \
2800e4b17023SJohn Marino   (DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE)))
2801e4b17023SJohn Marino 
2802e4b17023SJohn Marino /* Nonzero if the NODE corresponds to the template parameters for a
2803e4b17023SJohn Marino    member template, whose inline definition is being processed after
2804e4b17023SJohn Marino    the class definition is complete.  */
2805e4b17023SJohn Marino #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
2806e4b17023SJohn Marino 
2807e4b17023SJohn Marino /* Determine if a parameter (i.e., a PARM_DECL) is a function
2808e4b17023SJohn Marino    parameter pack.  */
2809e4b17023SJohn Marino #define FUNCTION_PARAMETER_PACK_P(NODE) \
2810e4b17023SJohn Marino   (DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE)))
2811e4b17023SJohn Marino 
2812e4b17023SJohn Marino /* Determines if NODE is an expansion of one or more parameter packs,
2813e4b17023SJohn Marino    e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION.  */
2814e4b17023SJohn Marino #define PACK_EXPANSION_P(NODE)                 \
2815e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_PACK_EXPANSION     \
2816e4b17023SJohn Marino    || TREE_CODE (NODE) == EXPR_PACK_EXPANSION)
2817e4b17023SJohn Marino 
2818e4b17023SJohn Marino /* Extracts the type or expression pattern from a TYPE_PACK_EXPANSION or
2819e4b17023SJohn Marino    EXPR_PACK_EXPANSION.  */
2820e4b17023SJohn Marino #define PACK_EXPANSION_PATTERN(NODE)                            \
2821e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_PACK_EXPANSION? TREE_TYPE (NODE)    \
2822e4b17023SJohn Marino    : TREE_OPERAND (NODE, 0))
2823e4b17023SJohn Marino 
2824e4b17023SJohn Marino /* Sets the type or expression pattern for a TYPE_PACK_EXPANSION or
2825e4b17023SJohn Marino    EXPR_PACK_EXPANSION.  */
2826e4b17023SJohn Marino #define SET_PACK_EXPANSION_PATTERN(NODE,VALUE)  \
2827e4b17023SJohn Marino   if (TREE_CODE (NODE) == TYPE_PACK_EXPANSION)  \
2828e4b17023SJohn Marino     TREE_TYPE (NODE) = VALUE;                   \
2829e4b17023SJohn Marino   else                                          \
2830e4b17023SJohn Marino     TREE_OPERAND (NODE, 0) = VALUE
2831e4b17023SJohn Marino 
2832e4b17023SJohn Marino /* The list of parameter packs used in the PACK_EXPANSION_* node. The
2833e4b17023SJohn Marino    TREE_VALUE of each TREE_LIST contains the parameter packs.  */
2834e4b17023SJohn Marino #define PACK_EXPANSION_PARAMETER_PACKS(NODE)		\
2835e4b17023SJohn Marino   *(TREE_CODE (NODE) == EXPR_PACK_EXPANSION		\
2836e4b17023SJohn Marino     ? &TREE_OPERAND (NODE, 1)				\
2837e4b17023SJohn Marino     : &TYPE_MINVAL (TYPE_PACK_EXPANSION_CHECK (NODE)))
2838e4b17023SJohn Marino 
2839e4b17023SJohn Marino /* Any additional template args to be applied when substituting into
2840e4b17023SJohn Marino    the pattern, set by tsubst_pack_expansion for partial instantiations.  */
2841e4b17023SJohn Marino #define PACK_EXPANSION_EXTRA_ARGS(NODE)		\
2842e4b17023SJohn Marino   *(TREE_CODE (NODE) == TYPE_PACK_EXPANSION	\
2843e4b17023SJohn Marino     ? &TYPE_MAXVAL (NODE)			\
2844e4b17023SJohn Marino     : &TREE_OPERAND ((NODE), 2))
2845e4b17023SJohn Marino 
2846e4b17023SJohn Marino /* True iff this pack expansion is within a function context.  */
2847e4b17023SJohn Marino #define PACK_EXPANSION_LOCAL_P(NODE) TREE_LANG_FLAG_0 (NODE)
2848e4b17023SJohn Marino 
2849e4b17023SJohn Marino /* Determine if this is an argument pack.  */
2850e4b17023SJohn Marino #define ARGUMENT_PACK_P(NODE)                          \
2851e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK              \
2852e4b17023SJohn Marino    || TREE_CODE (NODE) == NONTYPE_ARGUMENT_PACK)
2853e4b17023SJohn Marino 
2854e4b17023SJohn Marino /* The arguments stored in an argument pack. Arguments are stored in a
2855e4b17023SJohn Marino    TREE_VEC, which may have length zero.  */
2856e4b17023SJohn Marino #define ARGUMENT_PACK_ARGS(NODE)                               \
2857e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK? TREE_TYPE (NODE)    \
2858e4b17023SJohn Marino    : TREE_OPERAND (NODE, 0))
2859e4b17023SJohn Marino 
2860e4b17023SJohn Marino /* Set the arguments stored in an argument pack. VALUE must be a
2861e4b17023SJohn Marino    TREE_VEC.  */
2862e4b17023SJohn Marino #define SET_ARGUMENT_PACK_ARGS(NODE,VALUE)     \
2863e4b17023SJohn Marino   if (TREE_CODE (NODE) == TYPE_ARGUMENT_PACK)  \
2864e4b17023SJohn Marino     TREE_TYPE (NODE) = VALUE;                           \
2865e4b17023SJohn Marino   else                                                  \
2866e4b17023SJohn Marino     TREE_OPERAND (NODE, 0) = VALUE
2867e4b17023SJohn Marino 
2868e4b17023SJohn Marino /* Whether the argument pack is "incomplete", meaning that more
2869e4b17023SJohn Marino    arguments can still be deduced. Incomplete argument packs are only
2870e4b17023SJohn Marino    used when the user has provided an explicit template argument list
2871e4b17023SJohn Marino    for a variadic function template. Some of the explicit template
2872e4b17023SJohn Marino    arguments will be placed into the beginning of the argument pack,
2873e4b17023SJohn Marino    but additional arguments might still be deduced.  */
2874e4b17023SJohn Marino #define ARGUMENT_PACK_INCOMPLETE_P(NODE)        \
2875e4b17023SJohn Marino   TREE_LANG_FLAG_0 (ARGUMENT_PACK_ARGS (NODE))
2876e4b17023SJohn Marino 
2877e4b17023SJohn Marino /* When ARGUMENT_PACK_INCOMPLETE_P, stores the explicit template
2878e4b17023SJohn Marino    arguments used to fill this pack.  */
2879e4b17023SJohn Marino #define ARGUMENT_PACK_EXPLICIT_ARGS(NODE)       \
2880e4b17023SJohn Marino   TREE_TYPE (ARGUMENT_PACK_ARGS (NODE))
2881e4b17023SJohn Marino 
2882e4b17023SJohn Marino /* In an ARGUMENT_PACK_SELECT, the argument pack from which an
2883e4b17023SJohn Marino    argument will be selected.  */
2884e4b17023SJohn Marino #define ARGUMENT_PACK_SELECT_FROM_PACK(NODE)				\
2885e4b17023SJohn Marino   (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->argument_pack)
2886e4b17023SJohn Marino 
2887e4b17023SJohn Marino /* In an ARGUMENT_PACK_SELECT, the index of the argument we want to
2888e4b17023SJohn Marino    select.  */
2889e4b17023SJohn Marino #define ARGUMENT_PACK_SELECT_INDEX(NODE)				\
2890e4b17023SJohn Marino   (((struct tree_argument_pack_select *)ARGUMENT_PACK_SELECT_CHECK (NODE))->index)
2891e4b17023SJohn Marino 
2892e4b17023SJohn Marino /* In an ARGUMENT_PACK_SELECT, the actual underlying argument that the
2893e4b17023SJohn Marino    ARGUMENT_PACK_SELECT represents. */
2894e4b17023SJohn Marino #define ARGUMENT_PACK_SELECT_ARG(NODE)					\
2895e4b17023SJohn Marino   TREE_VEC_ELT (ARGUMENT_PACK_ARGS (ARGUMENT_PACK_SELECT_FROM_PACK (NODE)), \
2896e4b17023SJohn Marino 	        ARGUMENT_PACK_SELECT_INDEX (NODE));
2897e4b17023SJohn Marino 
2898e4b17023SJohn Marino /* In a FUNCTION_DECL, the saved language-specific per-function data.  */
2899e4b17023SJohn Marino #define DECL_SAVED_FUNCTION_DATA(NODE)			\
2900e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (FUNCTION_DECL_CHECK (NODE))	\
2901e4b17023SJohn Marino    ->u.saved_language_function)
2902e4b17023SJohn Marino 
2903e4b17023SJohn Marino /* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference.  */
2904e4b17023SJohn Marino #define REFERENCE_REF_P(NODE)				\
2905e4b17023SJohn Marino   (TREE_CODE (NODE) == INDIRECT_REF			\
2906e4b17023SJohn Marino    && TREE_TYPE (TREE_OPERAND (NODE, 0))		\
2907e4b17023SJohn Marino    && (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0)))	\
2908e4b17023SJohn Marino        == REFERENCE_TYPE))
2909e4b17023SJohn Marino 
2910e4b17023SJohn Marino #define NEW_EXPR_USE_GLOBAL(NODE) \
2911e4b17023SJohn Marino   TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
2912e4b17023SJohn Marino #define DELETE_EXPR_USE_GLOBAL(NODE) \
2913e4b17023SJohn Marino   TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE))
2914e4b17023SJohn Marino #define DELETE_EXPR_USE_VEC(NODE) \
2915e4b17023SJohn Marino   TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE))
2916e4b17023SJohn Marino 
2917e4b17023SJohn Marino /* Indicates that this is a non-dependent COMPOUND_EXPR which will
2918e4b17023SJohn Marino    resolve to a function call.  */
2919e4b17023SJohn Marino #define COMPOUND_EXPR_OVERLOADED(NODE) \
2920e4b17023SJohn Marino   TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE))
2921e4b17023SJohn Marino 
2922e4b17023SJohn Marino /* In a CALL_EXPR appearing in a template, true if Koenig lookup
2923e4b17023SJohn Marino    should be performed at instantiation time.  */
2924e4b17023SJohn Marino #define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
2925e4b17023SJohn Marino 
2926e4b17023SJohn Marino /* Indicates whether a string literal has been parenthesized. Such
2927e4b17023SJohn Marino    usages are disallowed in certain circumstances.  */
2928e4b17023SJohn Marino 
2929e4b17023SJohn Marino #define PAREN_STRING_LITERAL_P(NODE) \
2930e4b17023SJohn Marino   TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE))
2931e4b17023SJohn Marino 
2932e4b17023SJohn Marino /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
2933e4b17023SJohn Marino    constructor call, rather than an ordinary function call.  */
2934e4b17023SJohn Marino #define AGGR_INIT_VIA_CTOR_P(NODE) \
2935e4b17023SJohn Marino   TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
2936e4b17023SJohn Marino 
2937e4b17023SJohn Marino /* Nonzero if expanding this AGGR_INIT_EXPR should first zero-initialize
2938e4b17023SJohn Marino    the object.  */
2939e4b17023SJohn Marino #define AGGR_INIT_ZERO_FIRST(NODE) \
2940e4b17023SJohn Marino   TREE_LANG_FLAG_2 (AGGR_INIT_EXPR_CHECK (NODE))
2941e4b17023SJohn Marino 
2942e4b17023SJohn Marino /* AGGR_INIT_EXPR accessors.  These are equivalent to the CALL_EXPR
2943e4b17023SJohn Marino    accessors, except for AGGR_INIT_EXPR_SLOT (which takes the place of
2944e4b17023SJohn Marino    CALL_EXPR_STATIC_CHAIN).  */
2945e4b17023SJohn Marino 
2946e4b17023SJohn Marino #define AGGR_INIT_EXPR_FN(NODE) TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 1)
2947e4b17023SJohn Marino #define AGGR_INIT_EXPR_SLOT(NODE) \
2948e4b17023SJohn Marino   TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 2)
2949e4b17023SJohn Marino #define AGGR_INIT_EXPR_ARG(NODE, I) \
2950e4b17023SJohn Marino   TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), (I) + 3)
2951e4b17023SJohn Marino #define aggr_init_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3)
2952e4b17023SJohn Marino 
2953e4b17023SJohn Marino /* AGGR_INIT_EXPR_ARGP returns a pointer to the argument vector for NODE.
2954e4b17023SJohn Marino    We can't use &AGGR_INIT_EXPR_ARG (NODE, 0) because that will complain if
2955e4b17023SJohn Marino    the argument count is zero when checking is enabled.  Instead, do
2956e4b17023SJohn Marino    the pointer arithmetic to advance past the 3 fixed operands in a
2957e4b17023SJohn Marino    AGGR_INIT_EXPR.  That produces a valid pointer to just past the end of
2958e4b17023SJohn Marino    the operand array, even if it's not valid to dereference it.  */
2959e4b17023SJohn Marino #define AGGR_INIT_EXPR_ARGP(NODE) \
2960e4b17023SJohn Marino   (&(TREE_OPERAND (AGGR_INIT_EXPR_CHECK (NODE), 0)) + 3)
2961e4b17023SJohn Marino 
2962e4b17023SJohn Marino /* Abstract iterators for AGGR_INIT_EXPRs.  */
2963e4b17023SJohn Marino 
2964e4b17023SJohn Marino /* Structure containing iterator state.  */
2965e4b17023SJohn Marino typedef struct aggr_init_expr_arg_iterator_d {
2966e4b17023SJohn Marino   tree t;	/* the aggr_init_expr */
2967e4b17023SJohn Marino   int n;	/* argument count */
2968e4b17023SJohn Marino   int i;	/* next argument index */
2969e4b17023SJohn Marino } aggr_init_expr_arg_iterator;
2970e4b17023SJohn Marino 
2971e4b17023SJohn Marino /* Initialize the abstract argument list iterator object ITER with the
2972e4b17023SJohn Marino    arguments from AGGR_INIT_EXPR node EXP.  */
2973e4b17023SJohn Marino static inline void
init_aggr_init_expr_arg_iterator(tree exp,aggr_init_expr_arg_iterator * iter)2974e4b17023SJohn Marino init_aggr_init_expr_arg_iterator (tree exp,
2975e4b17023SJohn Marino 				       aggr_init_expr_arg_iterator *iter)
2976e4b17023SJohn Marino {
2977e4b17023SJohn Marino   iter->t = exp;
2978e4b17023SJohn Marino   iter->n = aggr_init_expr_nargs (exp);
2979e4b17023SJohn Marino   iter->i = 0;
2980e4b17023SJohn Marino }
2981e4b17023SJohn Marino 
2982e4b17023SJohn Marino /* Return the next argument from abstract argument list iterator object ITER,
2983e4b17023SJohn Marino    and advance its state.  Return NULL_TREE if there are no more arguments.  */
2984e4b17023SJohn Marino static inline tree
next_aggr_init_expr_arg(aggr_init_expr_arg_iterator * iter)2985e4b17023SJohn Marino next_aggr_init_expr_arg (aggr_init_expr_arg_iterator *iter)
2986e4b17023SJohn Marino {
2987e4b17023SJohn Marino   tree result;
2988e4b17023SJohn Marino   if (iter->i >= iter->n)
2989e4b17023SJohn Marino     return NULL_TREE;
2990e4b17023SJohn Marino   result = AGGR_INIT_EXPR_ARG (iter->t, iter->i);
2991e4b17023SJohn Marino   iter->i++;
2992e4b17023SJohn Marino   return result;
2993e4b17023SJohn Marino }
2994e4b17023SJohn Marino 
2995e4b17023SJohn Marino /* Initialize the abstract argument list iterator object ITER, then advance
2996e4b17023SJohn Marino    past and return the first argument.  Useful in for expressions, e.g.
2997e4b17023SJohn Marino      for (arg = first_aggr_init_expr_arg (exp, &iter); arg;
2998e4b17023SJohn Marino           arg = next_aggr_init_expr_arg (&iter))   */
2999e4b17023SJohn Marino static inline tree
first_aggr_init_expr_arg(tree exp,aggr_init_expr_arg_iterator * iter)3000e4b17023SJohn Marino first_aggr_init_expr_arg (tree exp, aggr_init_expr_arg_iterator *iter)
3001e4b17023SJohn Marino {
3002e4b17023SJohn Marino   init_aggr_init_expr_arg_iterator (exp, iter);
3003e4b17023SJohn Marino   return next_aggr_init_expr_arg (iter);
3004e4b17023SJohn Marino }
3005e4b17023SJohn Marino 
3006e4b17023SJohn Marino /* Test whether there are more arguments in abstract argument list iterator
3007e4b17023SJohn Marino    ITER, without changing its state.  */
3008e4b17023SJohn Marino static inline bool
more_aggr_init_expr_args_p(const aggr_init_expr_arg_iterator * iter)3009e4b17023SJohn Marino more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
3010e4b17023SJohn Marino {
3011e4b17023SJohn Marino   return (iter->i < iter->n);
3012e4b17023SJohn Marino }
3013e4b17023SJohn Marino 
3014e4b17023SJohn Marino /* Iterate through each argument ARG of AGGR_INIT_EXPR CALL, using variable
3015e4b17023SJohn Marino    ITER (of type aggr_init_expr_arg_iterator) to hold the iteration state.  */
3016e4b17023SJohn Marino #define FOR_EACH_AGGR_INIT_EXPR_ARG(arg, iter, call)			\
3017e4b17023SJohn Marino   for ((arg) = first_aggr_init_expr_arg ((call), &(iter)); (arg);	\
3018e4b17023SJohn Marino        (arg) = next_aggr_init_expr_arg (&(iter)))
3019e4b17023SJohn Marino 
3020e4b17023SJohn Marino /* VEC_INIT_EXPR accessors.  */
3021e4b17023SJohn Marino #define VEC_INIT_EXPR_SLOT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 0)
3022e4b17023SJohn Marino #define VEC_INIT_EXPR_INIT(NODE) TREE_OPERAND (VEC_INIT_EXPR_CHECK (NODE), 1)
3023e4b17023SJohn Marino 
3024e4b17023SJohn Marino /* Indicates that a VEC_INIT_EXPR is a potential constant expression.
3025e4b17023SJohn Marino    Only set when the current function is constexpr.  */
3026e4b17023SJohn Marino #define VEC_INIT_EXPR_IS_CONSTEXPR(NODE) \
3027e4b17023SJohn Marino   TREE_LANG_FLAG_0 (VEC_INIT_EXPR_CHECK (NODE))
3028e4b17023SJohn Marino 
3029e4b17023SJohn Marino /* Indicates that a VEC_INIT_EXPR is expressing value-initialization.  */
3030e4b17023SJohn Marino #define VEC_INIT_EXPR_VALUE_INIT(NODE) \
3031e4b17023SJohn Marino   TREE_LANG_FLAG_1 (VEC_INIT_EXPR_CHECK (NODE))
3032e4b17023SJohn Marino 
3033e4b17023SJohn Marino /* The condition under which this MUST_NOT_THROW_EXPR actually blocks
3034e4b17023SJohn Marino    exceptions.  NULL_TREE means 'true'.  */
3035e4b17023SJohn Marino #define MUST_NOT_THROW_COND(NODE) \
3036e4b17023SJohn Marino   TREE_OPERAND (MUST_NOT_THROW_EXPR_CHECK (NODE), 1)
3037e4b17023SJohn Marino 
3038e4b17023SJohn Marino /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
3039e4b17023SJohn Marino    TEMPLATE_DECL.  This macro determines whether or not a given class
3040e4b17023SJohn Marino    type is really a template type, as opposed to an instantiation or
3041e4b17023SJohn Marino    specialization of one.  */
3042e4b17023SJohn Marino #define CLASSTYPE_IS_TEMPLATE(NODE)  \
3043e4b17023SJohn Marino   (CLASSTYPE_TEMPLATE_INFO (NODE)    \
3044e4b17023SJohn Marino    && !CLASSTYPE_USE_TEMPLATE (NODE) \
3045e4b17023SJohn Marino    && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
3046e4b17023SJohn Marino 
3047e4b17023SJohn Marino /* The name used by the user to name the typename type.  Typically,
3048e4b17023SJohn Marino    this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
3049e4b17023SJohn Marino    corresponding TYPE_DECL.  However, this may also be a
3050e4b17023SJohn Marino    TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'.  */
3051e4b17023SJohn Marino #define TYPENAME_TYPE_FULLNAME(NODE) \
3052e4b17023SJohn Marino   (TYPE_VALUES_RAW (TYPENAME_TYPE_CHECK (NODE)))
3053e4b17023SJohn Marino 
3054e4b17023SJohn Marino /* True if a TYPENAME_TYPE was declared as an "enum".  */
3055e4b17023SJohn Marino #define TYPENAME_IS_ENUM_P(NODE) \
3056e4b17023SJohn Marino   (TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE)))
3057e4b17023SJohn Marino 
3058e4b17023SJohn Marino /* True if a TYPENAME_TYPE was declared as a "class", "struct", or
3059e4b17023SJohn Marino    "union".  */
3060e4b17023SJohn Marino #define TYPENAME_IS_CLASS_P(NODE) \
3061e4b17023SJohn Marino   (TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE)))
3062e4b17023SJohn Marino 
3063e4b17023SJohn Marino /* True if a TYPENAME_TYPE is in the process of being resolved.  */
3064e4b17023SJohn Marino #define TYPENAME_IS_RESOLVING_P(NODE) \
3065e4b17023SJohn Marino   (TREE_LANG_FLAG_2 (TYPENAME_TYPE_CHECK (NODE)))
3066e4b17023SJohn Marino 
3067e4b17023SJohn Marino /* [class.virtual]
3068e4b17023SJohn Marino 
3069e4b17023SJohn Marino    A class that declares or inherits a virtual function is called a
3070e4b17023SJohn Marino    polymorphic class.  */
3071e4b17023SJohn Marino #define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
3072e4b17023SJohn Marino 
3073e4b17023SJohn Marino /* Nonzero if this class has a virtual function table pointer.  */
3074e4b17023SJohn Marino #define TYPE_CONTAINS_VPTR_P(NODE)		\
3075e4b17023SJohn Marino   (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE))
3076e4b17023SJohn Marino 
3077e4b17023SJohn Marino /* This flag is true of a local VAR_DECL if it was declared in a for
3078e4b17023SJohn Marino    statement, but we are no longer in the scope of the for.  */
3079e4b17023SJohn Marino #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
3080e4b17023SJohn Marino 
3081e4b17023SJohn Marino /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
3082e4b17023SJohn Marino    if we already emitted a warning about using it.  */
3083e4b17023SJohn Marino #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
3084e4b17023SJohn Marino 
3085e4b17023SJohn Marino /* Nonzero if NODE is a FUNCTION_DECL (for a function with global
3086e4b17023SJohn Marino    scope) declared in a local scope.  */
3087e4b17023SJohn Marino #define DECL_LOCAL_FUNCTION_P(NODE) \
3088e4b17023SJohn Marino   DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
3089e4b17023SJohn Marino 
3090e4b17023SJohn Marino /* Nonzero if NODE is a DECL which we know about but which has not
3091e4b17023SJohn Marino    been explicitly declared, such as a built-in function or a friend
3092e4b17023SJohn Marino    declared inside a class.  In the latter case DECL_HIDDEN_FRIEND_P
3093e4b17023SJohn Marino    will be set.  */
3094e4b17023SJohn Marino #define DECL_ANTICIPATED(NODE) \
3095e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->u.base.anticipated_p)
3096e4b17023SJohn Marino 
3097e4b17023SJohn Marino /* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
3098e4b17023SJohn Marino    within a class but has not been declared in the surrounding scope.
3099e4b17023SJohn Marino    The function is invisible except via argument dependent lookup.  */
3100e4b17023SJohn Marino #define DECL_HIDDEN_FRIEND_P(NODE) \
3101e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->hidden_friend_p)
3102e4b17023SJohn Marino 
3103e4b17023SJohn Marino /* Nonzero if NODE is a FUNCTION_DECL generated by implicitly_declare_fn
3104e4b17023SJohn Marino    that we shouldn't actually declare implicitly; it is only used for
3105e4b17023SJohn Marino    comparing to an =default declaration.  */
3106e4b17023SJohn Marino #define FNDECL_SUPPRESS_IMPLICIT_DECL(NODE) \
3107e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (DECL_COMMON_CHECK (NODE))->suppress_implicit_decl)
3108e4b17023SJohn Marino 
3109e4b17023SJohn Marino /* Nonzero if DECL has been declared threadprivate by
3110e4b17023SJohn Marino    #pragma omp threadprivate.  */
3111e4b17023SJohn Marino #define CP_DECL_THREADPRIVATE_P(DECL) \
3112e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p)
3113e4b17023SJohn Marino 
3114e4b17023SJohn Marino /* Nonzero if DECL was declared with '= delete'.  */
3115e4b17023SJohn Marino #define DECL_DELETED_FN(DECL) \
3116e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.base.threadprivate_or_deleted_p)
3117e4b17023SJohn Marino 
3118e4b17023SJohn Marino /* Nonzero if DECL was declared with '= default' (maybe implicitly).  */
3119e4b17023SJohn Marino #define DECL_DEFAULTED_FN(DECL) \
3120e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (DECL)->defaulted_p)
3121e4b17023SJohn Marino 
3122e4b17023SJohn Marino /* Nonzero if DECL is explicitly defaulted in the class body.  */
3123e4b17023SJohn Marino #define DECL_DEFAULTED_IN_CLASS_P(DECL)					\
3124e4b17023SJohn Marino   (DECL_DEFAULTED_FN (DECL) && DECL_INITIALIZED_IN_CLASS_P (DECL))
3125e4b17023SJohn Marino /* Nonzero if DECL was defaulted outside the class body.  */
3126e4b17023SJohn Marino #define DECL_DEFAULTED_OUTSIDE_CLASS_P(DECL)				\
3127e4b17023SJohn Marino   (DECL_DEFAULTED_FN (DECL)						\
3128e4b17023SJohn Marino    && !(DECL_ARTIFICIAL (DECL) || DECL_INITIALIZED_IN_CLASS_P (DECL)))
3129e4b17023SJohn Marino 
3130e4b17023SJohn Marino /* Record whether a typedef for type `int' was actually `signed int'.  */
3131e4b17023SJohn Marino #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
3132e4b17023SJohn Marino 
3133e4b17023SJohn Marino /* Returns nonzero if DECL has external linkage, as specified by the
3134e4b17023SJohn Marino    language standard.  (This predicate may hold even when the
3135e4b17023SJohn Marino    corresponding entity is not actually given external linkage in the
3136e4b17023SJohn Marino    object file; see decl_linkage for details.)  */
3137e4b17023SJohn Marino #define DECL_EXTERNAL_LINKAGE_P(DECL) \
3138e4b17023SJohn Marino   (decl_linkage (DECL) == lk_external)
3139e4b17023SJohn Marino 
3140e4b17023SJohn Marino /* Keep these codes in ascending code order.  */
3141e4b17023SJohn Marino 
3142e4b17023SJohn Marino #define INTEGRAL_CODE_P(CODE)	\
3143e4b17023SJohn Marino   ((CODE) == ENUMERAL_TYPE	\
3144e4b17023SJohn Marino    || (CODE) == BOOLEAN_TYPE	\
3145e4b17023SJohn Marino    || (CODE) == INTEGER_TYPE)
3146e4b17023SJohn Marino 
3147e4b17023SJohn Marino /* [basic.fundamental]
3148e4b17023SJohn Marino 
3149e4b17023SJohn Marino    Types  bool, char, wchar_t, and the signed and unsigned integer types
3150e4b17023SJohn Marino    are collectively called integral types.
3151e4b17023SJohn Marino 
3152e4b17023SJohn Marino    Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
3153e4b17023SJohn Marino    types as well, which is incorrect in C++.  Keep these checks in
3154e4b17023SJohn Marino    ascending code order.  */
3155e4b17023SJohn Marino #define CP_INTEGRAL_TYPE_P(TYPE)		\
3156e4b17023SJohn Marino   (TREE_CODE (TYPE) == BOOLEAN_TYPE		\
3157e4b17023SJohn Marino    || TREE_CODE (TYPE) == INTEGER_TYPE)
3158e4b17023SJohn Marino 
3159e4b17023SJohn Marino /* Returns true if TYPE is an integral or enumeration name.  Keep
3160e4b17023SJohn Marino    these checks in ascending code order.  */
3161e4b17023SJohn Marino #define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
3162e4b17023SJohn Marino    (TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE))
3163e4b17023SJohn Marino 
3164e4b17023SJohn Marino /* Returns true if TYPE is an integral or unscoped enumeration type.  */
3165e4b17023SJohn Marino #define INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P(TYPE) \
3166e4b17023SJohn Marino    (UNSCOPED_ENUM_P (TYPE) || CP_INTEGRAL_TYPE_P (TYPE))
3167e4b17023SJohn Marino 
3168e4b17023SJohn Marino /* True if the class type TYPE is a literal type.  */
3169e4b17023SJohn Marino #define CLASSTYPE_LITERAL_P(TYPE)              \
3170e4b17023SJohn Marino    (LANG_TYPE_CLASS_CHECK (TYPE)->is_literal)
3171e4b17023SJohn Marino 
3172e4b17023SJohn Marino /* [basic.fundamental]
3173e4b17023SJohn Marino 
3174e4b17023SJohn Marino    Integral and floating types are collectively called arithmetic
3175e4b17023SJohn Marino    types.
3176e4b17023SJohn Marino 
3177e4b17023SJohn Marino    As a GNU extension, we also accept complex types.
3178e4b17023SJohn Marino 
3179e4b17023SJohn Marino    Keep these checks in ascending code order.  */
3180e4b17023SJohn Marino #define ARITHMETIC_TYPE_P(TYPE) \
3181e4b17023SJohn Marino   (CP_INTEGRAL_TYPE_P (TYPE) \
3182e4b17023SJohn Marino    || TREE_CODE (TYPE) == REAL_TYPE \
3183e4b17023SJohn Marino    || TREE_CODE (TYPE) == COMPLEX_TYPE)
3184e4b17023SJohn Marino 
3185e4b17023SJohn Marino /* True iff TYPE is cv decltype(nullptr).  */
3186e4b17023SJohn Marino #define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE)
3187e4b17023SJohn Marino 
3188e4b17023SJohn Marino /* [basic.types]
3189e4b17023SJohn Marino 
3190e4b17023SJohn Marino    Arithmetic types, enumeration types, pointer types,
3191e4b17023SJohn Marino    pointer-to-member types, and std::nullptr_t are collectively called
3192e4b17023SJohn Marino    scalar types.
3193e4b17023SJohn Marino 
3194e4b17023SJohn Marino    Keep these checks in ascending code order.  */
3195e4b17023SJohn Marino #define SCALAR_TYPE_P(TYPE)			\
3196e4b17023SJohn Marino   (TYPE_PTRMEM_P (TYPE)				\
3197e4b17023SJohn Marino    || TREE_CODE (TYPE) == ENUMERAL_TYPE		\
3198e4b17023SJohn Marino    || ARITHMETIC_TYPE_P (TYPE)			\
3199e4b17023SJohn Marino    || TYPE_PTR_P (TYPE)				\
3200e4b17023SJohn Marino    || TYPE_PTRMEMFUNC_P (TYPE)                  \
3201e4b17023SJohn Marino    || NULLPTR_TYPE_P (TYPE))
3202e4b17023SJohn Marino 
3203e4b17023SJohn Marino /* Determines whether this type is a C++0x scoped enumeration
3204e4b17023SJohn Marino    type. Scoped enumerations types are introduced via "enum class" or
3205e4b17023SJohn Marino    "enum struct", e.g.,
3206e4b17023SJohn Marino 
3207e4b17023SJohn Marino      enum class Color {
3208e4b17023SJohn Marino        Red, Green, Blue
3209e4b17023SJohn Marino      };
3210e4b17023SJohn Marino 
3211e4b17023SJohn Marino    Scoped enumeration types are different from normal (unscoped)
3212e4b17023SJohn Marino    enumeration types in several ways:
3213e4b17023SJohn Marino 
3214e4b17023SJohn Marino      - The enumerators of a scoped enumeration type are only available
3215e4b17023SJohn Marino        within the scope of the enumeration type and not in the
3216e4b17023SJohn Marino        enclosing scope. For example, the Red color can be referred to
3217e4b17023SJohn Marino        with "Color::Red" but not "Red".
3218e4b17023SJohn Marino 
3219e4b17023SJohn Marino      - Scoped enumerators and enumerations do not implicitly convert
3220e4b17023SJohn Marino        to integers or 'bool'.
3221e4b17023SJohn Marino 
3222e4b17023SJohn Marino      - The underlying type of the enum is well-defined.  */
3223e4b17023SJohn Marino #define SCOPED_ENUM_P(TYPE)                                             \
3224e4b17023SJohn Marino   (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_SCOPED (TYPE))
3225e4b17023SJohn Marino 
3226e4b17023SJohn Marino /* Determine whether this is an unscoped enumeration type.  */
3227e4b17023SJohn Marino #define UNSCOPED_ENUM_P(TYPE)                                           \
3228e4b17023SJohn Marino   (TREE_CODE (TYPE) == ENUMERAL_TYPE && !ENUM_IS_SCOPED (TYPE))
3229e4b17023SJohn Marino 
3230e4b17023SJohn Marino /* Set the flag indicating whether an ENUMERAL_TYPE is a C++0x scoped
3231e4b17023SJohn Marino    enumeration type (1) or a normal (unscoped) enumeration type
3232e4b17023SJohn Marino    (0).  */
3233e4b17023SJohn Marino #define SET_SCOPED_ENUM_P(TYPE, VAL)                    \
3234e4b17023SJohn Marino   (ENUM_IS_SCOPED (TYPE) = (VAL))
3235e4b17023SJohn Marino 
3236e4b17023SJohn Marino #define SET_OPAQUE_ENUM_P(TYPE, VAL)                    \
3237e4b17023SJohn Marino   (ENUM_IS_OPAQUE (TYPE) = (VAL))
3238e4b17023SJohn Marino 
3239e4b17023SJohn Marino #define OPAQUE_ENUM_P(TYPE)				\
3240e4b17023SJohn Marino   (TREE_CODE (TYPE) == ENUMERAL_TYPE && ENUM_IS_OPAQUE (TYPE))
3241e4b17023SJohn Marino 
3242e4b17023SJohn Marino /* Determines whether an ENUMERAL_TYPE has an explicit
3243e4b17023SJohn Marino    underlying type.  */
3244e4b17023SJohn Marino #define ENUM_FIXED_UNDERLYING_TYPE_P(NODE) (TYPE_LANG_FLAG_5 (NODE))
3245e4b17023SJohn Marino 
3246e4b17023SJohn Marino /* Returns the underlying type of the given enumeration type. The
3247e4b17023SJohn Marino    underlying type is determined in different ways, depending on the
3248e4b17023SJohn Marino    properties of the enum:
3249e4b17023SJohn Marino 
3250e4b17023SJohn Marino      - In C++0x, the underlying type can be explicitly specified, e.g.,
3251e4b17023SJohn Marino 
3252e4b17023SJohn Marino          enum E1 : char { ... } // underlying type is char
3253e4b17023SJohn Marino 
3254e4b17023SJohn Marino      - In a C++0x scoped enumeration, the underlying type is int
3255e4b17023SJohn Marino        unless otherwises specified:
3256e4b17023SJohn Marino 
3257e4b17023SJohn Marino          enum class E2 { ... } // underlying type is int
3258e4b17023SJohn Marino 
3259e4b17023SJohn Marino      - Otherwise, the underlying type is determined based on the
3260e4b17023SJohn Marino        values of the enumerators. In this case, the
3261e4b17023SJohn Marino        ENUM_UNDERLYING_TYPE will not be set until after the definition
3262e4b17023SJohn Marino        of the enumeration is completed by finish_enum.  */
3263e4b17023SJohn Marino #define ENUM_UNDERLYING_TYPE(TYPE) \
3264e4b17023SJohn Marino   TREE_TYPE (ENUMERAL_TYPE_CHECK (TYPE))
3265e4b17023SJohn Marino 
3266e4b17023SJohn Marino /* [dcl.init.aggr]
3267e4b17023SJohn Marino 
3268e4b17023SJohn Marino    An aggregate is an array or a class with no user-provided
3269e4b17023SJohn Marino    constructors, no brace-or-equal-initializers for non-static data
3270e4b17023SJohn Marino    members, no private or protected non-static data members, no
3271e4b17023SJohn Marino    base classes, and no virtual functions.
3272e4b17023SJohn Marino 
3273e4b17023SJohn Marino    As an extension, we also treat vectors as aggregates.  Keep these
3274e4b17023SJohn Marino    checks in ascending code order.  */
3275e4b17023SJohn Marino #define CP_AGGREGATE_TYPE_P(TYPE)				\
3276e4b17023SJohn Marino   (TREE_CODE (TYPE) == VECTOR_TYPE				\
3277e4b17023SJohn Marino    ||TREE_CODE (TYPE) == ARRAY_TYPE				\
3278e4b17023SJohn Marino    || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
3279e4b17023SJohn Marino 
3280e4b17023SJohn Marino /* Nonzero for a class type means that the class type has a
3281e4b17023SJohn Marino    user-declared constructor.  */
3282e4b17023SJohn Marino #define TYPE_HAS_USER_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
3283e4b17023SJohn Marino 
3284e4b17023SJohn Marino /* When appearing in an INDIRECT_REF, it means that the tree structure
3285e4b17023SJohn Marino    underneath is actually a call to a constructor.  This is needed
3286e4b17023SJohn Marino    when the constructor must initialize local storage (which can
3287e4b17023SJohn Marino    be automatically destroyed), rather than allowing it to allocate
3288e4b17023SJohn Marino    space from the heap.
3289e4b17023SJohn Marino 
3290e4b17023SJohn Marino    When appearing in a SAVE_EXPR, it means that underneath
3291e4b17023SJohn Marino    is a call to a constructor.
3292e4b17023SJohn Marino 
3293e4b17023SJohn Marino    When appearing in a CONSTRUCTOR, the expression is a
3294e4b17023SJohn Marino    compound literal.
3295e4b17023SJohn Marino 
3296e4b17023SJohn Marino    When appearing in a FIELD_DECL, it means that this field
3297e4b17023SJohn Marino    has been duly initialized in its constructor.  */
3298e4b17023SJohn Marino #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
3299e4b17023SJohn Marino 
3300e4b17023SJohn Marino /* True if NODE is a brace-enclosed initializer.  */
3301e4b17023SJohn Marino #define BRACE_ENCLOSED_INITIALIZER_P(NODE) \
3302e4b17023SJohn Marino   (TREE_CODE (NODE) == CONSTRUCTOR && TREE_TYPE (NODE) == init_list_type_node)
3303e4b17023SJohn Marino 
3304e4b17023SJohn Marino /* True if NODE is a compound-literal, i.e., a brace-enclosed
3305e4b17023SJohn Marino    initializer cast to a particular type.  */
3306e4b17023SJohn Marino #define COMPOUND_LITERAL_P(NODE) \
3307e4b17023SJohn Marino   (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE))
3308e4b17023SJohn Marino 
3309e4b17023SJohn Marino #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
3310e4b17023SJohn Marino 				   && VEC_empty (constructor_elt, \
3311e4b17023SJohn Marino 						 CONSTRUCTOR_ELTS (NODE)) \
3312e4b17023SJohn Marino 				   && !TREE_HAS_CONSTRUCTOR (NODE))
3313e4b17023SJohn Marino 
3314e4b17023SJohn Marino /* True if NODE is a init-list used as a direct-initializer, i.e.
3315e4b17023SJohn Marino    B b{1,2}, not B b({1,2}) or B b = {1,2}.  */
3316e4b17023SJohn Marino #define CONSTRUCTOR_IS_DIRECT_INIT(NODE) (TREE_LANG_FLAG_0 (CONSTRUCTOR_CHECK (NODE)))
3317e4b17023SJohn Marino 
3318e4b17023SJohn Marino /* True if NODE represents a conversion for direct-initialization in a
3319e4b17023SJohn Marino    template.  Set by perform_implicit_conversion_flags.  */
3320e4b17023SJohn Marino #define IMPLICIT_CONV_EXPR_DIRECT_INIT(NODE) \
3321e4b17023SJohn Marino   (TREE_LANG_FLAG_0 (IMPLICIT_CONV_EXPR_CHECK (NODE)))
3322e4b17023SJohn Marino 
3323e4b17023SJohn Marino /* Nonzero means that an object of this type can not be initialized using
3324e4b17023SJohn Marino    an initializer list.  */
3325e4b17023SJohn Marino #define CLASSTYPE_NON_AGGREGATE(NODE) \
3326e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
3327e4b17023SJohn Marino #define TYPE_NON_AGGREGATE_CLASS(NODE) \
3328e4b17023SJohn Marino   (CLASS_TYPE_P (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
3329e4b17023SJohn Marino 
3330e4b17023SJohn Marino /* Nonzero if there is a non-trivial X::op=(cv X&) for this class.  */
3331e4b17023SJohn Marino #define TYPE_HAS_COMPLEX_COPY_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_assign)
3332e4b17023SJohn Marino 
3333e4b17023SJohn Marino /* Nonzero if there is a non-trivial X::X(cv X&) for this class.  */
3334e4b17023SJohn Marino #define TYPE_HAS_COMPLEX_COPY_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_copy_ctor)
3335e4b17023SJohn Marino 
3336e4b17023SJohn Marino /* Nonzero if there is a non-trivial X::op=(X&&) for this class.  */
3337e4b17023SJohn Marino #define TYPE_HAS_COMPLEX_MOVE_ASSIGN(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_assign)
3338e4b17023SJohn Marino 
3339e4b17023SJohn Marino /* Nonzero if there is a non-trivial X::X(X&&) for this class.  */
3340e4b17023SJohn Marino #define TYPE_HAS_COMPLEX_MOVE_CTOR(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_move_ctor)
3341e4b17023SJohn Marino 
3342e4b17023SJohn Marino /* Nonzero if there is a non-trivial default constructor for this class.  */
3343e4b17023SJohn Marino #define TYPE_HAS_COMPLEX_DFLT(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_dflt)
3344e4b17023SJohn Marino 
3345e4b17023SJohn Marino /* Nonzero if TYPE has a trivial destructor.  From [class.dtor]:
3346e4b17023SJohn Marino 
3347e4b17023SJohn Marino      A destructor is trivial if it is an implicitly declared
3348e4b17023SJohn Marino      destructor and if:
3349e4b17023SJohn Marino 
3350e4b17023SJohn Marino        - all of the direct base classes of its class have trivial
3351e4b17023SJohn Marino 	 destructors,
3352e4b17023SJohn Marino 
3353e4b17023SJohn Marino        - for all of the non-static data members of its class that are
3354e4b17023SJohn Marino 	 of class type (or array thereof), each such class has a
3355e4b17023SJohn Marino 	 trivial destructor.  */
3356e4b17023SJohn Marino #define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
3357e4b17023SJohn Marino   (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
3358e4b17023SJohn Marino 
3359e4b17023SJohn Marino /* Nonzero for _TYPE node means that this type does not have a trivial
3360e4b17023SJohn Marino    destructor.  Therefore, destroying an object of this type will
3361e4b17023SJohn Marino    involve a call to a destructor.  This can apply to objects of
3362e4b17023SJohn Marino    ARRAY_TYPE is the type of the elements needs a destructor.  */
3363e4b17023SJohn Marino #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
3364e4b17023SJohn Marino   (TYPE_LANG_FLAG_4 (NODE))
3365e4b17023SJohn Marino 
3366e4b17023SJohn Marino /* Nonzero for class type means that the default constructor is trivial.  */
3367e4b17023SJohn Marino #define TYPE_HAS_TRIVIAL_DFLT(NODE) \
3368e4b17023SJohn Marino   (TYPE_HAS_DEFAULT_CONSTRUCTOR (NODE) && ! TYPE_HAS_COMPLEX_DFLT (NODE))
3369e4b17023SJohn Marino 
3370e4b17023SJohn Marino /* Nonzero for class type means that copy initialization of this type can use
3371e4b17023SJohn Marino    a bitwise copy.  */
3372e4b17023SJohn Marino #define TYPE_HAS_TRIVIAL_COPY_CTOR(NODE) \
3373e4b17023SJohn Marino   (TYPE_HAS_COPY_CTOR (NODE) && ! TYPE_HAS_COMPLEX_COPY_CTOR (NODE))
3374e4b17023SJohn Marino 
3375e4b17023SJohn Marino /* Nonzero for class type means that assignment of this type can use
3376e4b17023SJohn Marino    a bitwise copy.  */
3377e4b17023SJohn Marino #define TYPE_HAS_TRIVIAL_COPY_ASSIGN(NODE) \
3378e4b17023SJohn Marino   (TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE))
3379e4b17023SJohn Marino 
3380e4b17023SJohn Marino /* Returns true if NODE is a pointer-to-data-member.  */
3381e4b17023SJohn Marino #define TYPE_PTRMEM_P(NODE)			\
3382e4b17023SJohn Marino   (TREE_CODE (NODE) == OFFSET_TYPE)
3383e4b17023SJohn Marino /* Returns true if NODE is a pointer.  */
3384e4b17023SJohn Marino #define TYPE_PTR_P(NODE)			\
3385e4b17023SJohn Marino   (TREE_CODE (NODE) == POINTER_TYPE)
3386e4b17023SJohn Marino 
3387e4b17023SJohn Marino /* Returns true if NODE is an object type:
3388e4b17023SJohn Marino 
3389e4b17023SJohn Marino      [basic.types]
3390e4b17023SJohn Marino 
3391e4b17023SJohn Marino      An object type is a (possibly cv-qualified) type that is not a
3392e4b17023SJohn Marino      function type, not a reference type, and not a void type.
3393e4b17023SJohn Marino 
3394e4b17023SJohn Marino    Keep these checks in ascending order, for speed.  */
3395e4b17023SJohn Marino #define TYPE_OBJ_P(NODE)			\
3396e4b17023SJohn Marino   (TREE_CODE (NODE) != REFERENCE_TYPE		\
3397e4b17023SJohn Marino    && TREE_CODE (NODE) != VOID_TYPE		\
3398e4b17023SJohn Marino    && TREE_CODE (NODE) != FUNCTION_TYPE		\
3399e4b17023SJohn Marino    && TREE_CODE (NODE) != METHOD_TYPE)
3400e4b17023SJohn Marino 
3401e4b17023SJohn Marino /* Returns true if NODE is a pointer to an object.  Keep these checks
3402e4b17023SJohn Marino    in ascending tree code order.  */
3403e4b17023SJohn Marino #define TYPE_PTROB_P(NODE)					\
3404e4b17023SJohn Marino   (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))
3405e4b17023SJohn Marino 
3406e4b17023SJohn Marino /* Returns true if NODE is a reference to an object.  Keep these checks
3407e4b17023SJohn Marino    in ascending tree code order.  */
3408e4b17023SJohn Marino #define TYPE_REF_OBJ_P(NODE)					\
3409e4b17023SJohn Marino   (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE)))
3410e4b17023SJohn Marino 
3411e4b17023SJohn Marino /* Returns true if NODE is a pointer to an object, or a pointer to
3412e4b17023SJohn Marino    void.  Keep these checks in ascending tree code order.  */
3413e4b17023SJohn Marino #define TYPE_PTROBV_P(NODE)					\
3414e4b17023SJohn Marino   (TYPE_PTR_P (NODE)						\
3415e4b17023SJohn Marino    && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE		\
3416e4b17023SJohn Marino 	|| TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
3417e4b17023SJohn Marino 
3418e4b17023SJohn Marino /* Returns true if NODE is a pointer to function.  */
3419e4b17023SJohn Marino #define TYPE_PTRFN_P(NODE)				\
3420e4b17023SJohn Marino   (TREE_CODE (NODE) == POINTER_TYPE			\
3421e4b17023SJohn Marino    && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
3422e4b17023SJohn Marino 
3423e4b17023SJohn Marino /* Returns true if NODE is a reference to function.  */
3424e4b17023SJohn Marino #define TYPE_REFFN_P(NODE)				\
3425e4b17023SJohn Marino   (TREE_CODE (NODE) == REFERENCE_TYPE			\
3426e4b17023SJohn Marino    && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
3427e4b17023SJohn Marino 
3428e4b17023SJohn Marino /* Nonzero for _TYPE node means that this type is a pointer to member
3429e4b17023SJohn Marino    function type.  */
3430e4b17023SJohn Marino #define TYPE_PTRMEMFUNC_P(NODE)		\
3431e4b17023SJohn Marino   (TREE_CODE (NODE) == RECORD_TYPE	\
3432e4b17023SJohn Marino    && TYPE_LANG_SPECIFIC (NODE)		\
3433e4b17023SJohn Marino    && TYPE_PTRMEMFUNC_FLAG (NODE))
3434e4b17023SJohn Marino 
3435e4b17023SJohn Marino #define TYPE_PTRMEMFUNC_FLAG(NODE) \
3436e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
3437e4b17023SJohn Marino 
3438e4b17023SJohn Marino /* Returns true if NODE is a pointer-to-member.  */
3439e4b17023SJohn Marino #define TYPE_PTR_TO_MEMBER_P(NODE) \
3440e4b17023SJohn Marino   (TYPE_PTRMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
3441e4b17023SJohn Marino 
3442e4b17023SJohn Marino /* Indicates when overload resolution may resolve to a pointer to
3443e4b17023SJohn Marino    member function. [expr.unary.op]/3 */
3444e4b17023SJohn Marino #define PTRMEM_OK_P(NODE) \
3445e4b17023SJohn Marino   TREE_LANG_FLAG_0 (TREE_CHECK3 ((NODE), ADDR_EXPR, OFFSET_REF, SCOPE_REF))
3446e4b17023SJohn Marino 
3447e4b17023SJohn Marino /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
3448e4b17023SJohn Marino    pointer to member function.  TYPE_PTRMEMFUNC_P _must_ be true,
3449e4b17023SJohn Marino    before using this macro.  */
3450e4b17023SJohn Marino #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
3451e4b17023SJohn Marino   (TREE_TYPE (TYPE_FIELDS (NODE)))
3452e4b17023SJohn Marino 
3453e4b17023SJohn Marino /* Returns `A' for a type like `int (A::*)(double)' */
3454e4b17023SJohn Marino #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
3455e4b17023SJohn Marino   TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
3456e4b17023SJohn Marino 
3457e4b17023SJohn Marino /* These are use to manipulate the canonical RECORD_TYPE from the
3458e4b17023SJohn Marino    hashed POINTER_TYPE, and can only be used on the POINTER_TYPE.  */
3459e4b17023SJohn Marino #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
3460e4b17023SJohn Marino   (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
3461e4b17023SJohn Marino #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE)				\
3462e4b17023SJohn Marino   do {									\
3463e4b17023SJohn Marino     if (TYPE_LANG_SPECIFIC (NODE) == NULL)				\
3464e4b17023SJohn Marino       {									\
3465e4b17023SJohn Marino 	TYPE_LANG_SPECIFIC (NODE) = ggc_alloc_cleared_lang_type		\
3466e4b17023SJohn Marino 	 (sizeof (struct lang_type_ptrmem));				\
3467e4b17023SJohn Marino 	TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0;	\
3468e4b17023SJohn Marino       }									\
3469e4b17023SJohn Marino     TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE);		\
3470e4b17023SJohn Marino   } while (0)
3471e4b17023SJohn Marino 
3472e4b17023SJohn Marino /* For a pointer-to-member type of the form `T X::*', this is `X'.
3473e4b17023SJohn Marino    For a type like `void (X::*)() const', this type is `X', not `const
3474e4b17023SJohn Marino    X'.  To get at the `const X' you have to look at the
3475e4b17023SJohn Marino    TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
3476e4b17023SJohn Marino    type `const X*'.  */
3477e4b17023SJohn Marino #define TYPE_PTRMEM_CLASS_TYPE(NODE)			\
3478e4b17023SJohn Marino   (TYPE_PTRMEM_P (NODE)					\
3479e4b17023SJohn Marino    ? TYPE_OFFSET_BASETYPE (NODE)		\
3480e4b17023SJohn Marino    : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
3481e4b17023SJohn Marino 
3482e4b17023SJohn Marino /* For a pointer-to-member type of the form `T X::*', this is `T'.  */
3483e4b17023SJohn Marino #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE)		\
3484e4b17023SJohn Marino    (TYPE_PTRMEM_P (NODE)				\
3485e4b17023SJohn Marino     ? TREE_TYPE (NODE)					\
3486e4b17023SJohn Marino     : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
3487e4b17023SJohn Marino 
3488e4b17023SJohn Marino /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
3489e4b17023SJohn Marino    `X'.  */
3490e4b17023SJohn Marino #define PTRMEM_CST_CLASS(NODE) \
3491e4b17023SJohn Marino   TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
3492e4b17023SJohn Marino 
3493e4b17023SJohn Marino /* For a pointer-to-member constant `X::Y' this is the _DECL for
3494e4b17023SJohn Marino    `Y'.  */
3495e4b17023SJohn Marino #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
3496e4b17023SJohn Marino 
3497e4b17023SJohn Marino /* The expression in question for a TYPEOF_TYPE.  */
3498e4b17023SJohn Marino #define TYPEOF_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (TYPEOF_TYPE_CHECK (NODE)))
3499e4b17023SJohn Marino 
3500e4b17023SJohn Marino /* The type in question for an UNDERLYING_TYPE.  */
3501e4b17023SJohn Marino #define UNDERLYING_TYPE_TYPE(NODE) \
3502e4b17023SJohn Marino   (TYPE_VALUES_RAW (UNDERLYING_TYPE_CHECK (NODE)))
3503e4b17023SJohn Marino 
3504e4b17023SJohn Marino /* The type in question for BASES.  */
3505e4b17023SJohn Marino #define BASES_TYPE(NODE) \
3506e4b17023SJohn Marino   (TYPE_VALUES_RAW (BASES_CHECK (NODE)))
3507e4b17023SJohn Marino 
3508e4b17023SJohn Marino #define BASES_DIRECT(NODE) \
3509e4b17023SJohn Marino   TREE_LANG_FLAG_0 (BASES_CHECK (NODE))
3510e4b17023SJohn Marino 
3511e4b17023SJohn Marino /* The expression in question for a DECLTYPE_TYPE.  */
3512e4b17023SJohn Marino #define DECLTYPE_TYPE_EXPR(NODE) (TYPE_VALUES_RAW (DECLTYPE_TYPE_CHECK (NODE)))
3513e4b17023SJohn Marino 
3514e4b17023SJohn Marino /* Whether the DECLTYPE_TYPE_EXPR of NODE was originally parsed as an
3515e4b17023SJohn Marino    id-expression or a member-access expression. When false, it was
3516e4b17023SJohn Marino    parsed as a full expression.  */
3517e4b17023SJohn Marino #define DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P(NODE) \
3518e4b17023SJohn Marino   (DECLTYPE_TYPE_CHECK (NODE))->type_common.string_flag
3519e4b17023SJohn Marino 
3520e4b17023SJohn Marino /* These flags indicate that we want different semantics from normal
3521e4b17023SJohn Marino    decltype: lambda capture just drops references, lambda proxies look
3522e4b17023SJohn Marino    through implicit dereference.  */
3523e4b17023SJohn Marino #define DECLTYPE_FOR_LAMBDA_CAPTURE(NODE) \
3524e4b17023SJohn Marino   TREE_LANG_FLAG_0 (DECLTYPE_TYPE_CHECK (NODE))
3525e4b17023SJohn Marino #define DECLTYPE_FOR_LAMBDA_PROXY(NODE) \
3526e4b17023SJohn Marino   TREE_LANG_FLAG_2 (DECLTYPE_TYPE_CHECK (NODE))
3527e4b17023SJohn Marino 
3528e4b17023SJohn Marino /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
3529e4b17023SJohn Marino    specified in its declaration.  This can also be set for an
3530e4b17023SJohn Marino    erroneously declared PARM_DECL.  */
3531e4b17023SJohn Marino #define DECL_THIS_EXTERN(NODE) \
3532e4b17023SJohn Marino   DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
3533e4b17023SJohn Marino 
3534e4b17023SJohn Marino /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
3535e4b17023SJohn Marino    specified in its declaration.  This can also be set for an
3536e4b17023SJohn Marino    erroneously declared PARM_DECL.  */
3537e4b17023SJohn Marino #define DECL_THIS_STATIC(NODE) \
3538e4b17023SJohn Marino   DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
3539e4b17023SJohn Marino 
3540e4b17023SJohn Marino /* Nonzero for FIELD_DECL node means that this field is a base class
3541e4b17023SJohn Marino    of the parent object, as opposed to a member field.  */
3542e4b17023SJohn Marino #define DECL_FIELD_IS_BASE(NODE) \
3543e4b17023SJohn Marino   DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
3544e4b17023SJohn Marino 
3545e4b17023SJohn Marino /* Nonzero for FIELD_DECL node means that this field is a simple (no
3546e4b17023SJohn Marino    explicit initializer) lambda capture field, making it invisible to
3547e4b17023SJohn Marino    name lookup in unevaluated contexts.  */
3548e4b17023SJohn Marino #define DECL_NORMAL_CAPTURE_P(NODE) \
3549e4b17023SJohn Marino   DECL_LANG_FLAG_7 (FIELD_DECL_CHECK (NODE))
3550e4b17023SJohn Marino 
3551e4b17023SJohn Marino /* Nonzero if TYPE is an anonymous union or struct type.  We have to use a
3552e4b17023SJohn Marino    flag for this because "A union for which objects or pointers are
3553e4b17023SJohn Marino    declared is not an anonymous union" [class.union].  */
3554e4b17023SJohn Marino #define ANON_AGGR_TYPE_P(NODE)				\
3555e4b17023SJohn Marino   (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
3556e4b17023SJohn Marino #define SET_ANON_AGGR_TYPE_P(NODE)			\
3557e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
3558e4b17023SJohn Marino 
3559e4b17023SJohn Marino /* Nonzero if TYPE is an anonymous union type.  */
3560e4b17023SJohn Marino #define ANON_UNION_TYPE_P(NODE) \
3561e4b17023SJohn Marino   (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
3562e4b17023SJohn Marino 
3563e4b17023SJohn Marino /* Define fields and accessors for nodes representing declared names.  */
3564e4b17023SJohn Marino 
3565e4b17023SJohn Marino #define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
3566e4b17023SJohn Marino 
3567e4b17023SJohn Marino /* C++: all of these are overloaded!  These apply only to TYPE_DECLs.  */
3568e4b17023SJohn Marino 
3569e4b17023SJohn Marino /* The format of each node in the DECL_FRIENDLIST is as follows:
3570e4b17023SJohn Marino 
3571e4b17023SJohn Marino    The TREE_PURPOSE will be the name of a function, i.e., an
3572e4b17023SJohn Marino    IDENTIFIER_NODE.  The TREE_VALUE will be itself a TREE_LIST, whose
3573e4b17023SJohn Marino    TREE_VALUEs are friends with the given name.  */
3574e4b17023SJohn Marino #define DECL_FRIENDLIST(NODE)		(DECL_INITIAL (NODE))
3575e4b17023SJohn Marino #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
3576e4b17023SJohn Marino #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
3577e4b17023SJohn Marino 
3578e4b17023SJohn Marino /* The DECL_ACCESS, if non-NULL, is a TREE_LIST.  The TREE_PURPOSE of
3579e4b17023SJohn Marino    each node is a type; the TREE_VALUE is the access granted for this
3580e4b17023SJohn Marino    DECL in that type.  The DECL_ACCESS is set by access declarations.
3581e4b17023SJohn Marino    For example, if a member that would normally be public in a
3582e4b17023SJohn Marino    derived class is made protected, then the derived class and the
3583e4b17023SJohn Marino    protected_access_node will appear in the DECL_ACCESS for the node.  */
3584e4b17023SJohn Marino #define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
3585e4b17023SJohn Marino 
3586e4b17023SJohn Marino /* Nonzero if the FUNCTION_DECL is a global constructor.  */
3587e4b17023SJohn Marino #define DECL_GLOBAL_CTOR_P(NODE) \
3588e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->global_ctor_p)
3589e4b17023SJohn Marino 
3590e4b17023SJohn Marino /* Nonzero if the FUNCTION_DECL is a global destructor.  */
3591e4b17023SJohn Marino #define DECL_GLOBAL_DTOR_P(NODE) \
3592e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->global_dtor_p)
3593e4b17023SJohn Marino 
3594e4b17023SJohn Marino /* Accessor macros for C++ template decl nodes.  */
3595e4b17023SJohn Marino 
3596e4b17023SJohn Marino /* The DECL_TEMPLATE_PARMS are a list.  The TREE_PURPOSE of each node
3597e4b17023SJohn Marino    is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
3598e4b17023SJohn Marino    template parameters, with 1 being the outermost set of template
3599e4b17023SJohn Marino    parameters.  The TREE_VALUE is a vector, whose elements are the
3600e4b17023SJohn Marino    template parameters at each level.  Each element in the vector is a
3601e4b17023SJohn Marino    TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
3602e4b17023SJohn Marino    non-type parameter), or a TYPE_DECL (if the parameter is a type
3603e4b17023SJohn Marino    parameter).  The TREE_PURPOSE is the default value, if any.  The
3604e4b17023SJohn Marino    TEMPLATE_PARM_INDEX for the parameter is available as the
3605e4b17023SJohn Marino    DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
3606e4b17023SJohn Marino    TYPE_DECL).  */
3607e4b17023SJohn Marino #define DECL_TEMPLATE_PARMS(NODE)       DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments
3608e4b17023SJohn Marino #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
3609e4b17023SJohn Marino    INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
3610e4b17023SJohn Marino #define DECL_NTPARMS(NODE) \
3611e4b17023SJohn Marino    TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
3612e4b17023SJohn Marino /* For function, method, class-data templates.  */
3613e4b17023SJohn Marino #define DECL_TEMPLATE_RESULT(NODE)      DECL_RESULT_FLD (NODE)
3614e4b17023SJohn Marino /* For a function template at namespace scope, DECL_TEMPLATE_INSTANTIATIONS
3615e4b17023SJohn Marino    lists all instantiations and specializations of the function so that
3616e4b17023SJohn Marino    tsubst_friend_function can reassign them to another template if we find
3617e4b17023SJohn Marino    that the namespace-scope template is really a partial instantiation of a
3618e4b17023SJohn Marino    friend template.
3619e4b17023SJohn Marino 
3620e4b17023SJohn Marino    For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
3621e4b17023SJohn Marino    all instantiations and specializations of the class type, including
3622e4b17023SJohn Marino    partial instantiations and partial specializations, so that if we
3623e4b17023SJohn Marino    explicitly specialize a partial instantiation we can walk the list
3624e4b17023SJohn Marino    in maybe_process_partial_specialization and reassign them or complain
3625e4b17023SJohn Marino    as appropriate.
3626e4b17023SJohn Marino 
3627e4b17023SJohn Marino    In both cases, the TREE_PURPOSE of each node contains the arguments
3628e4b17023SJohn Marino    used; the TREE_VALUE contains the generated variable.  The template
3629e4b17023SJohn Marino    arguments are always complete.  For example, given:
3630e4b17023SJohn Marino 
3631e4b17023SJohn Marino       template <class T> struct S1 {
3632e4b17023SJohn Marino 	template <class U> struct S2 {};
3633e4b17023SJohn Marino 	template <class U> struct S2<U*> {};
3634e4b17023SJohn Marino       };
3635e4b17023SJohn Marino 
3636e4b17023SJohn Marino    the record for the partial specialization will contain, as its
3637e4b17023SJohn Marino    argument list, { {T}, {U*} }, and will be on the
3638e4b17023SJohn Marino    DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
3639e4b17023SJohn Marino    <class U> struct S1<T>::S2'.
3640e4b17023SJohn Marino 
3641e4b17023SJohn Marino    This list is not used for other templates.  */
3642e4b17023SJohn Marino #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE)
3643e4b17023SJohn Marino /* For a class template, this list contains the partial
3644e4b17023SJohn Marino    specializations of this template.  (Full specializations are not
3645e4b17023SJohn Marino    recorded on this list.)  The TREE_PURPOSE holds the arguments used
3646e4b17023SJohn Marino    in the partial specialization (e.g., for `template <class T> struct
3647e4b17023SJohn Marino    S<T*, int>' this will be `T*'.)  The arguments will also include
3648e4b17023SJohn Marino    any outer template arguments.  The TREE_VALUE holds the innermost
3649e4b17023SJohn Marino    template parameters for the specialization (e.g., `T' in the
3650e4b17023SJohn Marino    example above.)  The TREE_TYPE is the _TYPE node for the partial
3651e4b17023SJohn Marino    specialization.
3652e4b17023SJohn Marino 
3653e4b17023SJohn Marino    This list is not used for other templates.  */
3654e4b17023SJohn Marino #define DECL_TEMPLATE_SPECIALIZATIONS(NODE)     DECL_SIZE (NODE)
3655e4b17023SJohn Marino 
3656e4b17023SJohn Marino /* Nonzero for a DECL which is actually a template parameter.  Keep
3657e4b17023SJohn Marino    these checks in ascending tree code order.   */
3658e4b17023SJohn Marino #define DECL_TEMPLATE_PARM_P(NODE)		\
3659e4b17023SJohn Marino   (DECL_LANG_FLAG_0 (NODE)			\
3660e4b17023SJohn Marino    && (TREE_CODE (NODE) == CONST_DECL		\
3661e4b17023SJohn Marino        || TREE_CODE (NODE) == PARM_DECL		\
3662e4b17023SJohn Marino        || TREE_CODE (NODE) == TYPE_DECL		\
3663e4b17023SJohn Marino        || TREE_CODE (NODE) == TEMPLATE_DECL))
3664e4b17023SJohn Marino 
3665e4b17023SJohn Marino /* Mark NODE as a template parameter.  */
3666e4b17023SJohn Marino #define SET_DECL_TEMPLATE_PARM_P(NODE) \
3667e4b17023SJohn Marino   (DECL_LANG_FLAG_0 (NODE) = 1)
3668e4b17023SJohn Marino 
3669e4b17023SJohn Marino /* Nonzero if NODE is a template template parameter.  */
3670e4b17023SJohn Marino #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
3671e4b17023SJohn Marino   (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
3672e4b17023SJohn Marino 
3673e4b17023SJohn Marino /* Nonzero if NODE is a TEMPLATE_DECL representing an
3674e4b17023SJohn Marino    UNBOUND_CLASS_TEMPLATE tree node.  */
3675e4b17023SJohn Marino #define DECL_UNBOUND_CLASS_TEMPLATE_P(NODE) \
3676e4b17023SJohn Marino   (TREE_CODE (NODE) == TEMPLATE_DECL && !DECL_TEMPLATE_RESULT (NODE))
3677e4b17023SJohn Marino 
3678e4b17023SJohn Marino #define DECL_FUNCTION_TEMPLATE_P(NODE)  \
3679e4b17023SJohn Marino   (TREE_CODE (NODE) == TEMPLATE_DECL \
3680e4b17023SJohn Marino    && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
3681e4b17023SJohn Marino    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
3682e4b17023SJohn Marino 
3683e4b17023SJohn Marino /* Nonzero for a DECL that represents a class template or alias
3684e4b17023SJohn Marino    template.  */
3685e4b17023SJohn Marino #define DECL_TYPE_TEMPLATE_P(NODE)				\
3686e4b17023SJohn Marino   (TREE_CODE (NODE) == TEMPLATE_DECL				\
3687e4b17023SJohn Marino    && DECL_TEMPLATE_RESULT (NODE) != NULL_TREE			\
3688e4b17023SJohn Marino    && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL)
3689e4b17023SJohn Marino 
3690e4b17023SJohn Marino /* Nonzero for a DECL that represents a class template.  */
3691e4b17023SJohn Marino #define DECL_CLASS_TEMPLATE_P(NODE)				\
3692e4b17023SJohn Marino   (DECL_TYPE_TEMPLATE_P (NODE)					\
3693e4b17023SJohn Marino    && DECL_IMPLICIT_TYPEDEF_P (DECL_TEMPLATE_RESULT (NODE)))
3694e4b17023SJohn Marino 
3695e4b17023SJohn Marino /* Nonzero for a TEMPLATE_DECL that represents an alias template.  */
3696e4b17023SJohn Marino #define DECL_ALIAS_TEMPLATE_P(NODE)			\
3697e4b17023SJohn Marino   (DECL_TYPE_TEMPLATE_P (NODE)				\
3698e4b17023SJohn Marino    && !DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (NODE)))
3699e4b17023SJohn Marino 
3700e4b17023SJohn Marino /* Nonzero for a NODE which declares a type.  */
3701e4b17023SJohn Marino #define DECL_DECLARES_TYPE_P(NODE) \
3702e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
3703e4b17023SJohn Marino 
3704e4b17023SJohn Marino /* Nonzero if NODE declares a function.  */
3705e4b17023SJohn Marino #define DECL_DECLARES_FUNCTION_P(NODE) \
3706e4b17023SJohn Marino   (TREE_CODE (NODE) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (NODE))
3707e4b17023SJohn Marino 
3708e4b17023SJohn Marino /* Nonzero if NODE is the typedef implicitly generated for a type when
3709e4b17023SJohn Marino    the type is declared.  In C++, `struct S {};' is roughly
3710e4b17023SJohn Marino    equivalent to `struct S {}; typedef struct S S;' in C.
3711e4b17023SJohn Marino    DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this
3712e4b17023SJohn Marino    example.  In C++, there is a second implicit typedef for each
3713e4b17023SJohn Marino    class, in the scope of `S' itself, so that you can say `S::S'.
3714e4b17023SJohn Marino    DECL_SELF_REFERENCE_P will hold for that second typedef.  */
3715e4b17023SJohn Marino #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
3716e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
3717e4b17023SJohn Marino #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
3718e4b17023SJohn Marino   (DECL_LANG_FLAG_2 (NODE) = 1)
3719e4b17023SJohn Marino #define DECL_SELF_REFERENCE_P(NODE) \
3720e4b17023SJohn Marino   (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE))
3721e4b17023SJohn Marino #define SET_DECL_SELF_REFERENCE_P(NODE) \
3722e4b17023SJohn Marino   (DECL_LANG_FLAG_4 (NODE) = 1)
3723e4b17023SJohn Marino 
3724e4b17023SJohn Marino /* A `primary' template is one that has its own template header.  A
3725e4b17023SJohn Marino    member function of a class template is a template, but not primary.
3726e4b17023SJohn Marino    A member template is primary.  Friend templates are primary, too.  */
3727e4b17023SJohn Marino 
3728e4b17023SJohn Marino /* Returns the primary template corresponding to these parameters.  */
3729e4b17023SJohn Marino #define DECL_PRIMARY_TEMPLATE(NODE) \
3730e4b17023SJohn Marino   (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
3731e4b17023SJohn Marino 
3732e4b17023SJohn Marino /* Returns nonzero if NODE is a primary template.  */
3733e4b17023SJohn Marino #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
3734e4b17023SJohn Marino 
3735e4b17023SJohn Marino /* Nonzero iff NODE is a specialization of a template.  The value
3736e4b17023SJohn Marino    indicates the type of specializations:
3737e4b17023SJohn Marino 
3738e4b17023SJohn Marino      1=implicit instantiation
3739e4b17023SJohn Marino 
3740e4b17023SJohn Marino      2=partial or explicit specialization, e.g.:
3741e4b17023SJohn Marino 
3742e4b17023SJohn Marino         template <> int min<int> (int, int),
3743e4b17023SJohn Marino 
3744e4b17023SJohn Marino      3=explicit instantiation, e.g.:
3745e4b17023SJohn Marino 
3746e4b17023SJohn Marino         template int min<int> (int, int);
3747e4b17023SJohn Marino 
3748e4b17023SJohn Marino    Note that NODE will be marked as a specialization even if the
3749e4b17023SJohn Marino    template it is instantiating is not a primary template.  For
3750e4b17023SJohn Marino    example, given:
3751e4b17023SJohn Marino 
3752e4b17023SJohn Marino      template <typename T> struct O {
3753e4b17023SJohn Marino        void f();
3754e4b17023SJohn Marino        struct I {};
3755e4b17023SJohn Marino      };
3756e4b17023SJohn Marino 
3757e4b17023SJohn Marino    both O<int>::f and O<int>::I will be marked as instantiations.
3758e4b17023SJohn Marino 
3759e4b17023SJohn Marino    If DECL_USE_TEMPLATE is nonzero, then DECL_TEMPLATE_INFO will also
3760e4b17023SJohn Marino    be non-NULL.  */
3761e4b17023SJohn Marino #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.use_template)
3762e4b17023SJohn Marino 
3763e4b17023SJohn Marino /* Like DECL_USE_TEMPLATE, but for class types.  */
3764e4b17023SJohn Marino #define CLASSTYPE_USE_TEMPLATE(NODE) \
3765e4b17023SJohn Marino   (LANG_TYPE_CLASS_CHECK (NODE)->use_template)
3766e4b17023SJohn Marino 
3767e4b17023SJohn Marino /* True if NODE is a specialization of a primary template.  */
3768e4b17023SJohn Marino #define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE)	\
3769e4b17023SJohn Marino   (CLASS_TYPE_P (NODE)						\
3770e4b17023SJohn Marino    && CLASSTYPE_USE_TEMPLATE (NODE)				\
3771e4b17023SJohn Marino    && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
3772e4b17023SJohn Marino 
3773e4b17023SJohn Marino #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
3774e4b17023SJohn Marino #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
3775e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
3776e4b17023SJohn Marino 
3777e4b17023SJohn Marino #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
3778e4b17023SJohn Marino #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
3779e4b17023SJohn Marino 
3780e4b17023SJohn Marino /* Returns true for an explicit or partial specialization of a class
3781e4b17023SJohn Marino    template.  */
3782e4b17023SJohn Marino #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
3783e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
3784e4b17023SJohn Marino #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
3785e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
3786e4b17023SJohn Marino 
3787e4b17023SJohn Marino #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
3788e4b17023SJohn Marino #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
3789e4b17023SJohn Marino #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
3790e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) == 1)
3791e4b17023SJohn Marino #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
3792e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) = 1)
3793e4b17023SJohn Marino 
3794e4b17023SJohn Marino #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
3795e4b17023SJohn Marino #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
3796e4b17023SJohn Marino #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
3797e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) == 3)
3798e4b17023SJohn Marino #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
3799e4b17023SJohn Marino   (CLASSTYPE_USE_TEMPLATE (NODE) = 3)
3800e4b17023SJohn Marino 
3801e4b17023SJohn Marino /* Nonzero if DECL is a friend function which is an instantiation
3802e4b17023SJohn Marino    from the point of view of the compiler, but not from the point of
3803e4b17023SJohn Marino    view of the language.  For example given:
3804e4b17023SJohn Marino       template <class T> struct S { friend void f(T) {}; };
3805e4b17023SJohn Marino    the declaration of `void f(int)' generated when S<int> is
3806e4b17023SJohn Marino    instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
3807e4b17023SJohn Marino    a DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION.  */
3808e4b17023SJohn Marino #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
3809e4b17023SJohn Marino   (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
3810e4b17023SJohn Marino 
3811e4b17023SJohn Marino /* Nonzero if DECL is a function generated from a function 'temploid',
3812e4b17023SJohn Marino    i.e. template, member of class template, or dependent friend.  */
3813e4b17023SJohn Marino #define DECL_TEMPLOID_INSTANTIATION(DECL)		\
3814e4b17023SJohn Marino   (DECL_TEMPLATE_INSTANTIATION (DECL)			\
3815e4b17023SJohn Marino    || DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (DECL))
3816e4b17023SJohn Marino 
3817e4b17023SJohn Marino /* Nonzero if DECL is either defined implicitly by the compiler or
3818e4b17023SJohn Marino    generated from a temploid.  */
3819e4b17023SJohn Marino #define DECL_GENERATED_P(DECL) \
3820e4b17023SJohn Marino   (DECL_TEMPLOID_INSTANTIATION (DECL) || DECL_DEFAULTED_FN (DECL))
3821e4b17023SJohn Marino 
3822e4b17023SJohn Marino /* Nonzero iff we are currently processing a declaration for an
3823e4b17023SJohn Marino    entity with its own template parameter list, and which is not a
3824e4b17023SJohn Marino    full specialization.  */
3825e4b17023SJohn Marino #define PROCESSING_REAL_TEMPLATE_DECL_P() \
3826e4b17023SJohn Marino   (processing_template_decl > template_class_depth (current_scope ()))
3827e4b17023SJohn Marino 
3828e4b17023SJohn Marino /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
3829e4b17023SJohn Marino    instantiated, i.e. its definition has been generated from the
3830e4b17023SJohn Marino    pattern given in the template.  */
3831e4b17023SJohn Marino #define DECL_TEMPLATE_INSTANTIATED(NODE) \
3832e4b17023SJohn Marino   DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
3833e4b17023SJohn Marino 
3834e4b17023SJohn Marino /* We know what we're doing with this decl now.  */
3835e4b17023SJohn Marino #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
3836e4b17023SJohn Marino 
3837e4b17023SJohn Marino /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
3838e4b17023SJohn Marino    so that assemble_external will work properly.  So we have this flag to
3839e4b17023SJohn Marino    tell us whether the decl is really not external.
3840e4b17023SJohn Marino 
3841e4b17023SJohn Marino    This flag does not indicate whether or not the decl is defined in the
3842e4b17023SJohn Marino    current translation unit; it indicates whether or not we should emit the
3843e4b17023SJohn Marino    decl at the end of compilation if it is defined and needed.  */
3844e4b17023SJohn Marino #define DECL_NOT_REALLY_EXTERN(NODE) \
3845e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (NODE)->u.base.not_really_extern)
3846e4b17023SJohn Marino 
3847e4b17023SJohn Marino #define DECL_REALLY_EXTERN(NODE) \
3848e4b17023SJohn Marino   (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
3849e4b17023SJohn Marino 
3850e4b17023SJohn Marino /* A thunk is a stub function.
3851e4b17023SJohn Marino 
3852e4b17023SJohn Marino    A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
3853e4b17023SJohn Marino    The address of the ordinary FUNCTION_DECL is given by the
3854e4b17023SJohn Marino    DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
3855e4b17023SJohn Marino    FUNCTION_DECL.  The job of the thunk is to either adjust the this
3856e4b17023SJohn Marino    pointer before transferring control to the FUNCTION_DECL, or call
3857e4b17023SJohn Marino    FUNCTION_DECL and then adjust the result value. Note, the result
3858e4b17023SJohn Marino    pointer adjusting thunk must perform a call to the thunked
3859e4b17023SJohn Marino    function, (or be implemented via passing some invisible parameter
3860e4b17023SJohn Marino    to the thunked function, which is modified to perform the
3861e4b17023SJohn Marino    adjustment just before returning).
3862e4b17023SJohn Marino 
3863e4b17023SJohn Marino    A thunk may perform either, or both, of the following operations:
3864e4b17023SJohn Marino 
3865e4b17023SJohn Marino    o Adjust the this or result pointer by a constant offset.
3866e4b17023SJohn Marino    o Adjust the this or result pointer by looking up a vcall or vbase offset
3867e4b17023SJohn Marino      in the vtable.
3868e4b17023SJohn Marino 
3869e4b17023SJohn Marino    A this pointer adjusting thunk converts from a base to a derived
3870e4b17023SJohn Marino    class, and hence adds the offsets. A result pointer adjusting thunk
3871e4b17023SJohn Marino    converts from a derived class to a base, and hence subtracts the
3872e4b17023SJohn Marino    offsets.  If both operations are performed, then the constant
3873e4b17023SJohn Marino    adjustment is performed first for this pointer adjustment and last
3874e4b17023SJohn Marino    for the result pointer adjustment.
3875e4b17023SJohn Marino 
3876e4b17023SJohn Marino    The constant adjustment is given by THUNK_FIXED_OFFSET.  If the
3877e4b17023SJohn Marino    vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is
3878e4b17023SJohn Marino    used. For this pointer adjusting thunks, it is the vcall offset
3879e4b17023SJohn Marino    into the vtable.  For result pointer adjusting thunks it is the
3880e4b17023SJohn Marino    binfo of the virtual base to convert to.  Use that binfo's vbase
3881e4b17023SJohn Marino    offset.
3882e4b17023SJohn Marino 
3883e4b17023SJohn Marino    It is possible to have equivalent covariant thunks.  These are
3884e4b17023SJohn Marino    distinct virtual covariant thunks whose vbase offsets happen to
3885e4b17023SJohn Marino    have the same value.  THUNK_ALIAS is used to pick one as the
3886e4b17023SJohn Marino    canonical thunk, which will get all the this pointer adjusting
3887e4b17023SJohn Marino    thunks attached to it.  */
3888e4b17023SJohn Marino 
3889e4b17023SJohn Marino /* An integer indicating how many bytes should be subtracted from the
3890e4b17023SJohn Marino    this or result pointer when this function is called.  */
3891e4b17023SJohn Marino #define THUNK_FIXED_OFFSET(DECL) \
3892e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.fn.u5.fixed_offset)
3893e4b17023SJohn Marino 
3894e4b17023SJohn Marino /* A tree indicating how to perform the virtual adjustment. For a this
3895e4b17023SJohn Marino    adjusting thunk it is the number of bytes to be added to the vtable
3896e4b17023SJohn Marino    to find the vcall offset. For a result adjusting thunk, it is the
3897e4b17023SJohn Marino    binfo of the relevant virtual base.  If NULL, then there is no
3898e4b17023SJohn Marino    virtual adjust.  (The vptr is always located at offset zero from
3899e4b17023SJohn Marino    the this or result pointer.)  (If the covariant type is within the
3900e4b17023SJohn Marino    class hierarchy being laid out, the vbase index is not yet known
3901e4b17023SJohn Marino    at the point we need to create the thunks, hence the need to use
3902e4b17023SJohn Marino    binfos.)  */
3903e4b17023SJohn Marino 
3904e4b17023SJohn Marino #define THUNK_VIRTUAL_OFFSET(DECL) \
3905e4b17023SJohn Marino   (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access)
3906e4b17023SJohn Marino 
3907e4b17023SJohn Marino /* A thunk which is equivalent to another thunk.  */
3908e4b17023SJohn Marino #define THUNK_ALIAS(DECL) \
3909e4b17023SJohn Marino   (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->u.min.template_info)
3910e4b17023SJohn Marino 
3911e4b17023SJohn Marino /* For thunk NODE, this is the FUNCTION_DECL thunked to.  It is
3912e4b17023SJohn Marino    possible for the target to be a thunk too.  */
3913e4b17023SJohn Marino #define THUNK_TARGET(NODE)				\
3914e4b17023SJohn Marino   (LANG_DECL_FN_CHECK (NODE)->befriending_classes)
3915e4b17023SJohn Marino 
3916e4b17023SJohn Marino /* True for a SCOPE_REF iff the "template" keyword was used to
3917e4b17023SJohn Marino    indicate that the qualified name denotes a template.  */
3918e4b17023SJohn Marino #define QUALIFIED_NAME_IS_TEMPLATE(NODE) \
3919e4b17023SJohn Marino   (TREE_LANG_FLAG_1 (SCOPE_REF_CHECK (NODE)))
3920e4b17023SJohn Marino 
3921e4b17023SJohn Marino /* True for an OMP_ATOMIC that has dependent parameters.  These are stored
3922e4b17023SJohn Marino    as an expr in operand 1, and integer_zero_node in operand 0.  */
3923e4b17023SJohn Marino #define OMP_ATOMIC_DEPENDENT_P(NODE) \
3924e4b17023SJohn Marino   (TREE_CODE (TREE_OPERAND (OMP_ATOMIC_CHECK (NODE), 0)) == INTEGER_CST)
3925e4b17023SJohn Marino 
3926e4b17023SJohn Marino /* Used while gimplifying continue statements bound to OMP_FOR nodes.  */
3927e4b17023SJohn Marino #define OMP_FOR_GIMPLIFYING_P(NODE) \
3928e4b17023SJohn Marino   (TREE_LANG_FLAG_0 (OMP_FOR_CHECK (NODE)))
3929e4b17023SJohn Marino 
3930e4b17023SJohn Marino /* A language-specific token attached to the OpenMP data clauses to
3931e4b17023SJohn Marino    hold code (or code fragments) related to ctors, dtors, and op=.
3932e4b17023SJohn Marino    See semantics.c for details.  */
3933e4b17023SJohn Marino #define CP_OMP_CLAUSE_INFO(NODE) \
3934e4b17023SJohn Marino   TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
3935e4b17023SJohn Marino 				     OMP_CLAUSE_COPYPRIVATE))
3936e4b17023SJohn Marino 
3937e4b17023SJohn Marino /* Nonzero if this transaction expression's body contains statements.  */
3938e4b17023SJohn Marino #define TRANSACTION_EXPR_IS_STMT(NODE) \
3939e4b17023SJohn Marino    TREE_LANG_FLAG_0 (TRANSACTION_EXPR_CHECK (NODE))
3940e4b17023SJohn Marino 
3941e4b17023SJohn Marino /* These macros provide convenient access to the various _STMT nodes
3942e4b17023SJohn Marino    created when parsing template declarations.  */
3943e4b17023SJohn Marino #define TRY_STMTS(NODE)		TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
3944e4b17023SJohn Marino #define TRY_HANDLERS(NODE)	TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
3945e4b17023SJohn Marino 
3946e4b17023SJohn Marino #define EH_SPEC_STMTS(NODE)	TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
3947e4b17023SJohn Marino #define EH_SPEC_RAISES(NODE)	TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
3948e4b17023SJohn Marino 
3949e4b17023SJohn Marino #define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
3950e4b17023SJohn Marino 
3951e4b17023SJohn Marino /* Nonzero if this try block is a function try block.  */
3952e4b17023SJohn Marino #define FN_TRY_BLOCK_P(NODE)	TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
3953e4b17023SJohn Marino #define HANDLER_PARMS(NODE)	TREE_OPERAND (HANDLER_CHECK (NODE), 0)
3954e4b17023SJohn Marino #define HANDLER_BODY(NODE)	TREE_OPERAND (HANDLER_CHECK (NODE), 1)
3955e4b17023SJohn Marino #define HANDLER_TYPE(NODE)	TREE_TYPE (HANDLER_CHECK (NODE))
3956e4b17023SJohn Marino 
3957e4b17023SJohn Marino /* CLEANUP_STMT accessors.  The statement(s) covered, the cleanup to run
3958e4b17023SJohn Marino    and the VAR_DECL for which this cleanup exists.  */
3959e4b17023SJohn Marino #define CLEANUP_BODY(NODE)	TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
3960e4b17023SJohn Marino #define CLEANUP_EXPR(NODE)	TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
3961e4b17023SJohn Marino #define CLEANUP_DECL(NODE)	TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2)
3962e4b17023SJohn Marino 
3963e4b17023SJohn Marino /* IF_STMT accessors. These give access to the condition of the if
3964e4b17023SJohn Marino    statement, the then block of the if statement, and the else block
3965e4b17023SJohn Marino    of the if statement if it exists.  */
3966e4b17023SJohn Marino #define IF_COND(NODE)		TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
3967e4b17023SJohn Marino #define THEN_CLAUSE(NODE)	TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
3968e4b17023SJohn Marino #define ELSE_CLAUSE(NODE)	TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
3969e4b17023SJohn Marino #define IF_SCOPE(NODE)		TREE_OPERAND (IF_STMT_CHECK (NODE), 3)
3970e4b17023SJohn Marino 
3971e4b17023SJohn Marino /* WHILE_STMT accessors. These give access to the condition of the
3972e4b17023SJohn Marino    while statement and the body of the while statement, respectively.  */
3973e4b17023SJohn Marino #define WHILE_COND(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
3974e4b17023SJohn Marino #define WHILE_BODY(NODE)	TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
3975e4b17023SJohn Marino 
3976e4b17023SJohn Marino /* DO_STMT accessors. These give access to the condition of the do
3977e4b17023SJohn Marino    statement and the body of the do statement, respectively.  */
3978e4b17023SJohn Marino #define DO_COND(NODE)		TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
3979e4b17023SJohn Marino #define DO_BODY(NODE)		TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
3980e4b17023SJohn Marino 
3981e4b17023SJohn Marino /* FOR_STMT accessors. These give access to the init statement,
3982e4b17023SJohn Marino    condition, update expression, and body of the for statement,
3983e4b17023SJohn Marino    respectively.  */
3984e4b17023SJohn Marino #define FOR_INIT_STMT(NODE)	TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
3985e4b17023SJohn Marino #define FOR_COND(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
3986e4b17023SJohn Marino #define FOR_EXPR(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
3987e4b17023SJohn Marino #define FOR_BODY(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
3988e4b17023SJohn Marino #define FOR_SCOPE(NODE)		TREE_OPERAND (FOR_STMT_CHECK (NODE), 4)
3989e4b17023SJohn Marino 
3990e4b17023SJohn Marino /* RANGE_FOR_STMT accessors. These give access to the declarator,
3991e4b17023SJohn Marino    expression, body, and scope of the statement, respectively.  */
3992e4b17023SJohn Marino #define RANGE_FOR_DECL(NODE)	TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 0)
3993e4b17023SJohn Marino #define RANGE_FOR_EXPR(NODE)	TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 1)
3994e4b17023SJohn Marino #define RANGE_FOR_BODY(NODE)	TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 2)
3995e4b17023SJohn Marino #define RANGE_FOR_SCOPE(NODE)	TREE_OPERAND (RANGE_FOR_STMT_CHECK (NODE), 3)
3996e4b17023SJohn Marino 
3997e4b17023SJohn Marino #define SWITCH_STMT_COND(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
3998e4b17023SJohn Marino #define SWITCH_STMT_BODY(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
3999e4b17023SJohn Marino #define SWITCH_STMT_TYPE(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
4000e4b17023SJohn Marino #define SWITCH_STMT_SCOPE(NODE)	TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 3)
4001e4b17023SJohn Marino 
4002e4b17023SJohn Marino /* STMT_EXPR accessor.  */
4003e4b17023SJohn Marino #define STMT_EXPR_STMT(NODE)	TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
4004e4b17023SJohn Marino 
4005e4b17023SJohn Marino /* EXPR_STMT accessor. This gives the expression associated with an
4006e4b17023SJohn Marino    expression statement.  */
4007e4b17023SJohn Marino #define EXPR_STMT_EXPR(NODE)	TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
4008e4b17023SJohn Marino 
4009e4b17023SJohn Marino /* True if this TARGET_EXPR was created by build_cplus_new, and so we can
4010e4b17023SJohn Marino    discard it if it isn't useful.  */
4011e4b17023SJohn Marino #define TARGET_EXPR_IMPLICIT_P(NODE) \
4012e4b17023SJohn Marino   TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE))
4013e4b17023SJohn Marino 
4014e4b17023SJohn Marino /* True if this TARGET_EXPR is the result of list-initialization of a
4015e4b17023SJohn Marino    temporary.  */
4016e4b17023SJohn Marino #define TARGET_EXPR_LIST_INIT_P(NODE) \
4017e4b17023SJohn Marino   TREE_LANG_FLAG_1 (TARGET_EXPR_CHECK (NODE))
4018e4b17023SJohn Marino 
4019e4b17023SJohn Marino /* True if this TARGET_EXPR expresses direct-initialization of an object
4020e4b17023SJohn Marino    to be named later.  */
4021e4b17023SJohn Marino #define TARGET_EXPR_DIRECT_INIT_P(NODE) \
4022e4b17023SJohn Marino   TREE_LANG_FLAG_2 (TARGET_EXPR_CHECK (NODE))
4023e4b17023SJohn Marino 
4024e4b17023SJohn Marino /* True if EXPR expresses direct-initialization of a TYPE.  */
4025e4b17023SJohn Marino #define DIRECT_INIT_EXPR_P(TYPE,EXPR)					\
4026e4b17023SJohn Marino   (TREE_CODE (EXPR) == TARGET_EXPR && TREE_LANG_FLAG_2 (EXPR)		\
4027e4b17023SJohn Marino    && same_type_ignoring_top_level_qualifiers_p (TYPE, TREE_TYPE (EXPR)))
4028e4b17023SJohn Marino 
4029e4b17023SJohn Marino /* True if this CONVERT_EXPR is for a conversion to virtual base in
4030e4b17023SJohn Marino    an NSDMI, and should be re-evaluated when used in a constructor.  */
4031e4b17023SJohn Marino #define CONVERT_EXPR_VBASE_PATH(NODE) \
4032e4b17023SJohn Marino   TREE_LANG_FLAG_0 (CONVERT_EXPR_CHECK (NODE))
4033e4b17023SJohn Marino 
4034e4b17023SJohn Marino /* An enumeration of the kind of tags that C++ accepts.  */
4035e4b17023SJohn Marino enum tag_types {
4036e4b17023SJohn Marino   none_type = 0, /* Not a tag type.  */
4037e4b17023SJohn Marino   record_type,   /* "struct" types.  */
4038e4b17023SJohn Marino   class_type,    /* "class" types.  */
4039e4b17023SJohn Marino   union_type,    /* "union" types.  */
4040e4b17023SJohn Marino   enum_type,     /* "enum" types.  */
4041e4b17023SJohn Marino   typename_type  /* "typename" types.  */
4042e4b17023SJohn Marino };
4043e4b17023SJohn Marino 
4044e4b17023SJohn Marino /* The various kinds of lvalues we distinguish.  */
4045e4b17023SJohn Marino enum cp_lvalue_kind_flags {
4046e4b17023SJohn Marino   clk_none = 0,     /* Things that are not an lvalue.  */
4047e4b17023SJohn Marino   clk_ordinary = 1, /* An ordinary lvalue.  */
4048e4b17023SJohn Marino   clk_rvalueref = 2,/* An rvalue formed using an rvalue reference */
4049e4b17023SJohn Marino   clk_class = 4,    /* An rvalue of class-type.  */
4050e4b17023SJohn Marino   clk_bitfield = 8, /* An lvalue for a bit-field.  */
4051e4b17023SJohn Marino   clk_packed = 16   /* An lvalue for a packed field.  */
4052e4b17023SJohn Marino };
4053e4b17023SJohn Marino 
4054e4b17023SJohn Marino /* This type is used for parameters and variables which hold
4055e4b17023SJohn Marino    combinations of the flags in enum cp_lvalue_kind_flags.  */
4056e4b17023SJohn Marino typedef int cp_lvalue_kind;
4057e4b17023SJohn Marino 
4058e4b17023SJohn Marino /* Various kinds of template specialization, instantiation, etc.  */
4059e4b17023SJohn Marino typedef enum tmpl_spec_kind {
4060e4b17023SJohn Marino   tsk_none,		   /* Not a template at all.  */
4061e4b17023SJohn Marino   tsk_invalid_member_spec, /* An explicit member template
4062e4b17023SJohn Marino 			      specialization, but the enclosing
4063e4b17023SJohn Marino 			      classes have not all been explicitly
4064e4b17023SJohn Marino 			      specialized.  */
4065e4b17023SJohn Marino   tsk_invalid_expl_inst,   /* An explicit instantiation containing
4066e4b17023SJohn Marino 			      template parameter lists.  */
4067e4b17023SJohn Marino   tsk_excessive_parms,	   /* A template declaration with too many
4068e4b17023SJohn Marino 			      template parameter lists.  */
4069e4b17023SJohn Marino   tsk_insufficient_parms,  /* A template declaration with too few
4070e4b17023SJohn Marino 			      parameter lists.  */
4071e4b17023SJohn Marino   tsk_template,		   /* A template declaration.  */
4072e4b17023SJohn Marino   tsk_expl_spec,	   /* An explicit specialization.  */
4073e4b17023SJohn Marino   tsk_expl_inst		   /* An explicit instantiation.  */
4074e4b17023SJohn Marino } tmpl_spec_kind;
4075e4b17023SJohn Marino 
4076e4b17023SJohn Marino /* The various kinds of access.  BINFO_ACCESS depends on these being
4077e4b17023SJohn Marino    two bit quantities.  The numerical values are important; they are
4078e4b17023SJohn Marino    used to initialize RTTI data structures, so changing them changes
4079e4b17023SJohn Marino    the ABI.  */
4080e4b17023SJohn Marino typedef enum access_kind {
4081e4b17023SJohn Marino   ak_none = 0,		   /* Inaccessible.  */
4082e4b17023SJohn Marino   ak_public = 1,	   /* Accessible, as a `public' thing.  */
4083e4b17023SJohn Marino   ak_protected = 2,	   /* Accessible, as a `protected' thing.  */
4084e4b17023SJohn Marino   ak_private = 3	   /* Accessible, as a `private' thing.  */
4085e4b17023SJohn Marino } access_kind;
4086e4b17023SJohn Marino 
4087e4b17023SJohn Marino /* The various kinds of special functions.  If you add to this list,
4088e4b17023SJohn Marino    you should update special_function_p as well.  */
4089e4b17023SJohn Marino typedef enum special_function_kind {
4090e4b17023SJohn Marino   sfk_none = 0,		   /* Not a special function.  This enumeral
4091e4b17023SJohn Marino 			      must have value zero; see
4092e4b17023SJohn Marino 			      special_function_p.  */
4093e4b17023SJohn Marino   sfk_constructor,	   /* A constructor.  */
4094e4b17023SJohn Marino   sfk_copy_constructor,    /* A copy constructor.  */
4095e4b17023SJohn Marino   sfk_move_constructor,    /* A move constructor.  */
4096e4b17023SJohn Marino   sfk_copy_assignment,     /* A copy assignment operator.  */
4097e4b17023SJohn Marino   sfk_move_assignment,     /* A move assignment operator.  */
4098e4b17023SJohn Marino   sfk_destructor,	   /* A destructor.  */
4099e4b17023SJohn Marino   sfk_complete_destructor, /* A destructor for complete objects.  */
4100e4b17023SJohn Marino   sfk_base_destructor,     /* A destructor for base subobjects.  */
4101e4b17023SJohn Marino   sfk_deleting_destructor, /* A destructor for complete objects that
4102e4b17023SJohn Marino 			      deletes the object after it has been
4103e4b17023SJohn Marino 			      destroyed.  */
4104e4b17023SJohn Marino   sfk_conversion	   /* A conversion operator.  */
4105e4b17023SJohn Marino } special_function_kind;
4106e4b17023SJohn Marino 
4107e4b17023SJohn Marino /* The various kinds of linkage.  From [basic.link],
4108e4b17023SJohn Marino 
4109e4b17023SJohn Marino       A name is said to have linkage when it might denote the same
4110e4b17023SJohn Marino       object, reference, function, type, template, namespace or value
4111e4b17023SJohn Marino       as a name introduced in another scope:
4112e4b17023SJohn Marino 
4113e4b17023SJohn Marino       -- When a name has external linkage, the entity it denotes can
4114e4b17023SJohn Marino 	 be referred to from scopes of other translation units or from
4115e4b17023SJohn Marino 	 other scopes of the same translation unit.
4116e4b17023SJohn Marino 
4117e4b17023SJohn Marino       -- When a name has internal linkage, the entity it denotes can
4118e4b17023SJohn Marino 	 be referred to by names from other scopes in the same
4119e4b17023SJohn Marino 	 translation unit.
4120e4b17023SJohn Marino 
4121e4b17023SJohn Marino       -- When a name has no linkage, the entity it denotes cannot be
4122e4b17023SJohn Marino 	 referred to by names from other scopes.  */
4123e4b17023SJohn Marino 
4124e4b17023SJohn Marino typedef enum linkage_kind {
4125e4b17023SJohn Marino   lk_none,			/* No linkage.  */
4126e4b17023SJohn Marino   lk_internal,			/* Internal linkage.  */
4127e4b17023SJohn Marino   lk_external			/* External linkage.  */
4128e4b17023SJohn Marino } linkage_kind;
4129e4b17023SJohn Marino 
4130e4b17023SJohn Marino typedef enum duration_kind {
4131e4b17023SJohn Marino   dk_static,
4132e4b17023SJohn Marino   dk_thread,
4133e4b17023SJohn Marino   dk_auto,
4134e4b17023SJohn Marino   dk_dynamic
4135e4b17023SJohn Marino } duration_kind;
4136e4b17023SJohn Marino 
4137e4b17023SJohn Marino /* Bitmask flags to control type substitution.  */
4138e4b17023SJohn Marino enum tsubst_flags {
4139e4b17023SJohn Marino   tf_none = 0,			 /* nothing special */
4140e4b17023SJohn Marino   tf_error = 1 << 0,		 /* give error messages  */
4141e4b17023SJohn Marino   tf_warning = 1 << 1,	 	 /* give warnings too  */
4142e4b17023SJohn Marino   tf_ignore_bad_quals = 1 << 2,	 /* ignore bad cvr qualifiers */
4143e4b17023SJohn Marino   tf_keep_type_decl = 1 << 3,	 /* retain typedef type decls
4144e4b17023SJohn Marino 				    (make_typename_type use) */
4145e4b17023SJohn Marino   tf_ptrmem_ok = 1 << 4,	 /* pointers to member ok (internal
4146e4b17023SJohn Marino 				    instantiate_type use) */
4147e4b17023SJohn Marino   tf_user = 1 << 5,		 /* found template must be a user template
4148e4b17023SJohn Marino 				    (lookup_template_class use) */
4149e4b17023SJohn Marino   tf_conv = 1 << 6,		 /* We are determining what kind of
4150e4b17023SJohn Marino 				    conversion might be permissible,
4151e4b17023SJohn Marino 				    not actually performing the
4152e4b17023SJohn Marino 				    conversion.  */
4153e4b17023SJohn Marino   tf_no_access_control = 1 << 7, /* Do not perform access checks, even
4154e4b17023SJohn Marino 				    when issuing other errors.   */
4155e4b17023SJohn Marino   /* Convenient substitution flags combinations.  */
4156e4b17023SJohn Marino   tf_warning_or_error = tf_warning | tf_error
4157e4b17023SJohn Marino };
4158e4b17023SJohn Marino 
4159e4b17023SJohn Marino /* This type is used for parameters and variables which hold
4160e4b17023SJohn Marino    combinations of the flags in enum tsubst_flags.  */
4161e4b17023SJohn Marino typedef int tsubst_flags_t;
4162e4b17023SJohn Marino 
4163e4b17023SJohn Marino /* The kind of checking we can do looking in a class hierarchy.  */
4164e4b17023SJohn Marino enum base_access_flags {
4165e4b17023SJohn Marino   ba_any = 0,  /* Do not check access, allow an ambiguous base,
4166e4b17023SJohn Marino 		      prefer a non-virtual base */
4167e4b17023SJohn Marino   ba_unique = 1 << 0,  /* Must be a unique base.  */
4168e4b17023SJohn Marino   ba_check_bit = 1 << 1,   /* Check access.  */
4169e4b17023SJohn Marino   ba_check = ba_unique | ba_check_bit,
4170e4b17023SJohn Marino   ba_ignore_scope = 1 << 2, /* Ignore access allowed by local scope.  */
4171e4b17023SJohn Marino   ba_quiet = 1 << 3     /* Do not issue error messages.  */
4172e4b17023SJohn Marino };
4173e4b17023SJohn Marino 
4174e4b17023SJohn Marino /* This type is used for parameters and variables which hold
4175e4b17023SJohn Marino    combinations of the flags in enum base_access_flags.  */
4176e4b17023SJohn Marino typedef int base_access;
4177e4b17023SJohn Marino 
4178e4b17023SJohn Marino /* The various kinds of access check during parsing.  */
4179e4b17023SJohn Marino typedef enum deferring_kind {
4180e4b17023SJohn Marino   dk_no_deferred = 0, /* Check access immediately */
4181e4b17023SJohn Marino   dk_deferred = 1,    /* Deferred check */
4182e4b17023SJohn Marino   dk_no_check = 2     /* No access check */
4183e4b17023SJohn Marino } deferring_kind;
4184e4b17023SJohn Marino 
4185e4b17023SJohn Marino /* The kind of base we can find, looking in a class hierarchy.
4186e4b17023SJohn Marino    Values <0 indicate we failed.  */
4187e4b17023SJohn Marino typedef enum base_kind {
4188e4b17023SJohn Marino   bk_inaccessible = -3,   /* The base is inaccessible */
4189e4b17023SJohn Marino   bk_ambig = -2,	  /* The base is ambiguous */
4190e4b17023SJohn Marino   bk_not_base = -1,	  /* It is not a base */
4191e4b17023SJohn Marino   bk_same_type = 0,	  /* It is the same type */
4192e4b17023SJohn Marino   bk_proper_base = 1,	  /* It is a proper base */
4193e4b17023SJohn Marino   bk_via_virtual = 2	  /* It is a proper base, but via a virtual
4194e4b17023SJohn Marino 			     path. This might not be the canonical
4195e4b17023SJohn Marino 			     binfo.  */
4196e4b17023SJohn Marino } base_kind;
4197e4b17023SJohn Marino 
4198e4b17023SJohn Marino /* Node for "pointer to (virtual) function".
4199e4b17023SJohn Marino    This may be distinct from ptr_type_node so gdb can distinguish them.  */
4200e4b17023SJohn Marino #define vfunc_ptr_type_node  vtable_entry_type
4201e4b17023SJohn Marino 
4202e4b17023SJohn Marino 
4203e4b17023SJohn Marino /* For building calls to `delete'.  */
4204e4b17023SJohn Marino extern GTY(()) tree integer_two_node;
4205e4b17023SJohn Marino 
4206e4b17023SJohn Marino /* The number of function bodies which we are currently processing.
4207e4b17023SJohn Marino    (Zero if we are at namespace scope, one inside the body of a
4208e4b17023SJohn Marino    function, two inside the body of a function in a local class, etc.)  */
4209e4b17023SJohn Marino extern int function_depth;
4210e4b17023SJohn Marino 
42115ce9237cSJohn Marino /* Nonzero if we are inside eq_specializations, which affects comparison of
42125ce9237cSJohn Marino    PARM_DECLs in cp_tree_equal.  */
42135ce9237cSJohn Marino extern int comparing_specializations;
42145ce9237cSJohn Marino 
4215e4b17023SJohn Marino /* In parser.c.  */
4216e4b17023SJohn Marino 
4217e4b17023SJohn Marino /* Nonzero if we are parsing an unevaluated operand: an operand to
4218e4b17023SJohn Marino    sizeof, typeof, or alignof.  This is a count since operands to
4219e4b17023SJohn Marino    sizeof can be nested.  */
4220e4b17023SJohn Marino 
4221e4b17023SJohn Marino extern int cp_unevaluated_operand;
4222e4b17023SJohn Marino extern tree cp_convert_range_for (tree, tree, tree);
4223e4b17023SJohn Marino 
4224e4b17023SJohn Marino /* in pt.c  */
4225e4b17023SJohn Marino 
4226e4b17023SJohn Marino /* These values are used for the `STRICT' parameter to type_unification and
4227e4b17023SJohn Marino    fn_type_unification.  Their meanings are described with the
4228e4b17023SJohn Marino    documentation for fn_type_unification.  */
4229e4b17023SJohn Marino 
4230e4b17023SJohn Marino typedef enum unification_kind_t {
4231e4b17023SJohn Marino   DEDUCE_CALL,
4232e4b17023SJohn Marino   DEDUCE_CONV,
4233e4b17023SJohn Marino   DEDUCE_EXACT
4234e4b17023SJohn Marino } unification_kind_t;
4235e4b17023SJohn Marino 
4236e4b17023SJohn Marino /* in class.c */
4237e4b17023SJohn Marino 
4238e4b17023SJohn Marino extern int current_class_depth;
4239e4b17023SJohn Marino 
4240e4b17023SJohn Marino /* An array of all local classes present in this translation unit, in
4241e4b17023SJohn Marino    declaration order.  */
4242e4b17023SJohn Marino extern GTY(()) VEC(tree,gc) *local_classes;
4243e4b17023SJohn Marino 
4244e4b17023SJohn Marino /* Here's where we control how name mangling takes place.  */
4245e4b17023SJohn Marino 
4246e4b17023SJohn Marino /* Cannot use '$' up front, because this confuses gdb
4247e4b17023SJohn Marino    (names beginning with '$' are gdb-local identifiers).
4248e4b17023SJohn Marino 
4249e4b17023SJohn Marino    Note that all forms in which the '$' is significant are long enough
4250e4b17023SJohn Marino    for direct indexing (meaning that if we know there is a '$'
4251e4b17023SJohn Marino    at a particular location, we can index into the string at
4252e4b17023SJohn Marino    any other location that provides distinguishing characters).  */
4253e4b17023SJohn Marino 
4254e4b17023SJohn Marino /* Define NO_DOT_IN_LABEL in your favorite tm file if your assembler
4255e4b17023SJohn Marino    doesn't allow '.' in symbol names.  */
4256e4b17023SJohn Marino #ifndef NO_DOT_IN_LABEL
4257e4b17023SJohn Marino 
4258e4b17023SJohn Marino #define JOINER '.'
4259e4b17023SJohn Marino 
4260e4b17023SJohn Marino #define AUTO_TEMP_NAME "_.tmp_"
4261e4b17023SJohn Marino #define VFIELD_BASE ".vf"
4262e4b17023SJohn Marino #define VFIELD_NAME "_vptr."
4263e4b17023SJohn Marino #define VFIELD_NAME_FORMAT "_vptr.%s"
4264e4b17023SJohn Marino 
4265e4b17023SJohn Marino #define ANON_AGGRNAME_FORMAT "._%d"
4266e4b17023SJohn Marino 
4267e4b17023SJohn Marino #else /* NO_DOT_IN_LABEL */
4268e4b17023SJohn Marino 
4269e4b17023SJohn Marino #ifndef NO_DOLLAR_IN_LABEL
4270e4b17023SJohn Marino 
4271e4b17023SJohn Marino #define JOINER '$'
4272e4b17023SJohn Marino 
4273e4b17023SJohn Marino #define AUTO_TEMP_NAME "_$tmp_"
4274e4b17023SJohn Marino #define VFIELD_BASE "$vf"
4275e4b17023SJohn Marino #define VFIELD_NAME "_vptr$"
4276e4b17023SJohn Marino #define VFIELD_NAME_FORMAT "_vptr$%s"
4277e4b17023SJohn Marino #define ANON_AGGRNAME_FORMAT "$_%d"
4278e4b17023SJohn Marino 
4279e4b17023SJohn Marino #else /* NO_DOLLAR_IN_LABEL */
4280e4b17023SJohn Marino 
4281e4b17023SJohn Marino #define IN_CHARGE_NAME "__in_chrg"
4282e4b17023SJohn Marino #define AUTO_TEMP_NAME "__tmp_"
4283e4b17023SJohn Marino #define TEMP_NAME_P(ID_NODE) \
4284e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
4285e4b17023SJohn Marino 	     sizeof (AUTO_TEMP_NAME) - 1))
4286e4b17023SJohn Marino #define VTABLE_NAME "__vt_"
4287e4b17023SJohn Marino #define VTABLE_NAME_P(ID_NODE) \
4288e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
4289e4b17023SJohn Marino 	     sizeof (VTABLE_NAME) - 1))
4290e4b17023SJohn Marino #define VFIELD_BASE "__vfb"
4291e4b17023SJohn Marino #define VFIELD_NAME "__vptr_"
4292e4b17023SJohn Marino #define VFIELD_NAME_P(ID_NODE) \
4293e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
4294e4b17023SJohn Marino 	    sizeof (VFIELD_NAME) - 1))
4295e4b17023SJohn Marino #define VFIELD_NAME_FORMAT "__vptr_%s"
4296e4b17023SJohn Marino 
4297e4b17023SJohn Marino #define ANON_AGGRNAME_PREFIX "__anon_"
4298e4b17023SJohn Marino #define ANON_AGGRNAME_P(ID_NODE) \
4299e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
4300e4b17023SJohn Marino 	     sizeof (ANON_AGGRNAME_PREFIX) - 1))
4301e4b17023SJohn Marino #define ANON_AGGRNAME_FORMAT "__anon_%d"
4302e4b17023SJohn Marino 
4303e4b17023SJohn Marino #endif	/* NO_DOLLAR_IN_LABEL */
4304e4b17023SJohn Marino #endif	/* NO_DOT_IN_LABEL */
4305e4b17023SJohn Marino 
4306e4b17023SJohn Marino #define THIS_NAME "this"
4307e4b17023SJohn Marino 
4308e4b17023SJohn Marino #define IN_CHARGE_NAME "__in_chrg"
4309e4b17023SJohn Marino 
4310e4b17023SJohn Marino #define VTBL_PTR_TYPE		"__vtbl_ptr_type"
4311e4b17023SJohn Marino #define VTABLE_DELTA_NAME	"__delta"
4312e4b17023SJohn Marino #define VTABLE_PFN_NAME		"__pfn"
4313e4b17023SJohn Marino 
4314e4b17023SJohn Marino #define LAMBDANAME_PREFIX "__lambda"
4315e4b17023SJohn Marino #define LAMBDANAME_FORMAT LAMBDANAME_PREFIX "%d"
4316e4b17023SJohn Marino #define LAMBDANAME_P(ID_NODE) \
4317e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), \
4318e4b17023SJohn Marino              LAMBDANAME_PREFIX, \
4319e4b17023SJohn Marino 	     sizeof (LAMBDANAME_PREFIX) - 1))
4320e4b17023SJohn Marino 
4321e4b17023SJohn Marino #define UDLIT_OP_ANSI_PREFIX "operator\"\" "
4322e4b17023SJohn Marino #define UDLIT_OP_ANSI_FORMAT UDLIT_OP_ANSI_PREFIX "%s"
4323e4b17023SJohn Marino #define UDLIT_OP_MANGLED_PREFIX "li"
4324e4b17023SJohn Marino #define UDLIT_OP_MANGLED_FORMAT UDLIT_OP_MANGLED_PREFIX "%s"
4325e4b17023SJohn Marino #define UDLIT_OPER_P(ID_NODE) \
4326e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), \
4327e4b17023SJohn Marino              UDLIT_OP_ANSI_PREFIX, \
4328e4b17023SJohn Marino 	     sizeof (UDLIT_OP_ANSI_PREFIX) - 1))
4329e4b17023SJohn Marino #define UDLIT_OP_SUFFIX(ID_NODE) \
4330e4b17023SJohn Marino   (IDENTIFIER_POINTER (ID_NODE) + sizeof (UDLIT_OP_ANSI_PREFIX) - 1)
4331e4b17023SJohn Marino 
4332e4b17023SJohn Marino #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
4333e4b17023SJohn Marino 
4334e4b17023SJohn Marino #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
4335e4b17023SJohn Marino   && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
4336e4b17023SJohn Marino   && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
4337e4b17023SJohn Marino 
4338e4b17023SJohn Marino #define TEMP_NAME_P(ID_NODE) \
4339e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
4340e4b17023SJohn Marino #define VFIELD_NAME_P(ID_NODE) \
4341e4b17023SJohn Marino   (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
4342e4b17023SJohn Marino 
4343e4b17023SJohn Marino /* For anonymous aggregate types, we need some sort of name to
4344e4b17023SJohn Marino    hold on to.  In practice, this should not appear, but it should
4345e4b17023SJohn Marino    not be harmful if it does.  */
4346e4b17023SJohn Marino #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
4347e4b17023SJohn Marino 				  && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
4348e4b17023SJohn Marino #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
4349e4b17023SJohn Marino 
4350e4b17023SJohn Marino 
4351e4b17023SJohn Marino /* Nonzero if we're done parsing and into end-of-file activities.  */
4352e4b17023SJohn Marino 
4353e4b17023SJohn Marino extern int at_eof;
4354e4b17023SJohn Marino 
4355e4b17023SJohn Marino /* A list of namespace-scope objects which have constructors or
4356e4b17023SJohn Marino    destructors which reside in the global scope.  The decl is stored
4357e4b17023SJohn Marino    in the TREE_VALUE slot and the initializer is stored in the
4358e4b17023SJohn Marino    TREE_PURPOSE slot.  */
4359e4b17023SJohn Marino extern GTY(()) tree static_aggregates;
4360e4b17023SJohn Marino 
4361e4b17023SJohn Marino enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, TYPENAME_FLAG };
4362e4b17023SJohn Marino 
4363e4b17023SJohn Marino /* These are uses as bits in flags passed to various functions to
4364e4b17023SJohn Marino    control their behavior.  Despite the LOOKUP_ prefix, many of these
4365e4b17023SJohn Marino    do not control name lookup.  ??? Functions using these flags should
4366e4b17023SJohn Marino    probably be modified to accept explicit boolean flags for the
4367e4b17023SJohn Marino    behaviors relevant to them.  */
4368e4b17023SJohn Marino /* Check for access violations.  */
4369e4b17023SJohn Marino #define LOOKUP_PROTECT (1 << 0)
4370e4b17023SJohn Marino /* Complain if no suitable member function matching the arguments is
4371e4b17023SJohn Marino    found.  */
4372e4b17023SJohn Marino #define LOOKUP_COMPLAIN (1 << 1)
4373e4b17023SJohn Marino #define LOOKUP_NORMAL (LOOKUP_PROTECT | LOOKUP_COMPLAIN)
4374e4b17023SJohn Marino /* Even if the function found by lookup is a virtual function, it
4375e4b17023SJohn Marino    should be called directly.  */
4376e4b17023SJohn Marino #define LOOKUP_NONVIRTUAL (1 << 2)
4377e4b17023SJohn Marino /* Non-converting (i.e., "explicit") constructors are not tried.  This flag
4378e4b17023SJohn Marino    indicates that we are not performing direct-initialization.  */
4379e4b17023SJohn Marino #define LOOKUP_ONLYCONVERTING (1 << 3)
4380e4b17023SJohn Marino #define LOOKUP_IMPLICIT (LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING)
4381e4b17023SJohn Marino /* If a temporary is created, it should be created so that it lives
4382e4b17023SJohn Marino    as long as the current variable bindings; otherwise it only lives
4383e4b17023SJohn Marino    until the end of the complete-expression.  It also forces
4384e4b17023SJohn Marino    direct-initialization in cases where other parts of the compiler
4385e4b17023SJohn Marino    have already generated a temporary, such as reference
4386e4b17023SJohn Marino    initialization and the catch parameter.  */
4387e4b17023SJohn Marino #define DIRECT_BIND (1 << 4)
4388e4b17023SJohn Marino /* We're performing a user-defined conversion, so more user-defined
4389e4b17023SJohn Marino    conversions are not permitted (only built-in conversions).  */
4390e4b17023SJohn Marino #define LOOKUP_NO_CONVERSION (1 << 5)
4391e4b17023SJohn Marino /* The user has explicitly called a destructor.  (Therefore, we do
4392e4b17023SJohn Marino    not need to check that the object is non-NULL before calling the
4393e4b17023SJohn Marino    destructor.)  */
4394e4b17023SJohn Marino #define LOOKUP_DESTRUCTOR (1 << 6)
4395e4b17023SJohn Marino /* Do not permit references to bind to temporaries.  */
4396e4b17023SJohn Marino #define LOOKUP_NO_TEMP_BIND (1 << 7)
4397e4b17023SJohn Marino /* Do not accept objects, and possibly namespaces.  */
4398e4b17023SJohn Marino #define LOOKUP_PREFER_TYPES (1 << 8)
4399e4b17023SJohn Marino /* Do not accept objects, and possibly types.   */
4400e4b17023SJohn Marino #define LOOKUP_PREFER_NAMESPACES (1 << 9)
4401e4b17023SJohn Marino /* Accept types or namespaces.  */
4402e4b17023SJohn Marino #define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES)
4403e4b17023SJohn Marino /* Return friend declarations and un-declared builtin functions.
4404e4b17023SJohn Marino    (Normally, these entities are registered in the symbol table, but
4405e4b17023SJohn Marino    not found by lookup.)  */
4406e4b17023SJohn Marino #define LOOKUP_HIDDEN (LOOKUP_PREFER_NAMESPACES << 1)
4407e4b17023SJohn Marino /* Prefer that the lvalue be treated as an rvalue.  */
4408e4b17023SJohn Marino #define LOOKUP_PREFER_RVALUE (LOOKUP_HIDDEN << 1)
4409e4b17023SJohn Marino /* We're inside an init-list, so narrowing conversions are ill-formed.  */
4410e4b17023SJohn Marino #define LOOKUP_NO_NARROWING (LOOKUP_PREFER_RVALUE << 1)
4411e4b17023SJohn Marino /* We're looking up a constructor for list-initialization.  */
4412e4b17023SJohn Marino #define LOOKUP_LIST_INIT_CTOR (LOOKUP_NO_NARROWING << 1)
4413e4b17023SJohn Marino /* This is the first parameter of a copy constructor.  */
4414e4b17023SJohn Marino #define LOOKUP_COPY_PARM (LOOKUP_LIST_INIT_CTOR << 1)
4415e4b17023SJohn Marino /* We only want to consider list constructors.  */
4416e4b17023SJohn Marino #define LOOKUP_LIST_ONLY (LOOKUP_COPY_PARM << 1)
4417e4b17023SJohn Marino /* Return after determining which function to call and checking access.
4418e4b17023SJohn Marino    Used by sythesized_method_walk to determine which functions will
4419e4b17023SJohn Marino    be called to initialize subobjects, in order to determine exception
4420e4b17023SJohn Marino    specification and possible implicit delete.
4421e4b17023SJohn Marino    This is kind of a hack, but since access control doesn't respect SFINAE
4422e4b17023SJohn Marino    we can't just use tf_none to avoid access control errors, we need
4423e4b17023SJohn Marino    another mechanism.  Exiting early also avoids problems with trying
4424e4b17023SJohn Marino    to perform argument conversions when the class isn't complete yet.  */
4425e4b17023SJohn Marino #define LOOKUP_SPECULATIVE (LOOKUP_LIST_ONLY << 1)
4426e4b17023SJohn Marino /* Used by calls from defaulted functions to limit the overload set to avoid
4427e4b17023SJohn Marino    cycles trying to declare them (core issue 1092).  */
4428e4b17023SJohn Marino #define LOOKUP_DEFAULTED (LOOKUP_SPECULATIVE << 1)
4429e4b17023SJohn Marino /* Used in calls to store_init_value to suppress its usual call to
4430e4b17023SJohn Marino    digest_init.  */
4431e4b17023SJohn Marino #define LOOKUP_ALREADY_DIGESTED (LOOKUP_DEFAULTED << 1)
4432e4b17023SJohn Marino /* An instantiation with explicit template arguments.  */
4433e4b17023SJohn Marino #define LOOKUP_EXPLICIT_TMPL_ARGS (LOOKUP_ALREADY_DIGESTED << 1)
4434e4b17023SJohn Marino /* Like LOOKUP_NO_TEMP_BIND, but also prevent binding to xvalues.  */
4435e4b17023SJohn Marino #define LOOKUP_NO_RVAL_BIND (LOOKUP_EXPLICIT_TMPL_ARGS << 1)
4436e4b17023SJohn Marino 
4437e4b17023SJohn Marino #define LOOKUP_NAMESPACES_ONLY(F)  \
4438e4b17023SJohn Marino   (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
4439e4b17023SJohn Marino #define LOOKUP_TYPES_ONLY(F)  \
4440e4b17023SJohn Marino   (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
4441e4b17023SJohn Marino #define LOOKUP_QUALIFIERS_ONLY(F)     ((F) & LOOKUP_PREFER_BOTH)
4442e4b17023SJohn Marino 
4443e4b17023SJohn Marino 
4444e4b17023SJohn Marino /* These flags are used by the conversion code.
4445e4b17023SJohn Marino    CONV_IMPLICIT   :  Perform implicit conversions (standard and user-defined).
4446e4b17023SJohn Marino    CONV_STATIC     :  Perform the explicit conversions for static_cast.
4447e4b17023SJohn Marino    CONV_CONST      :  Perform the explicit conversions for const_cast.
4448e4b17023SJohn Marino    CONV_REINTERPRET:  Perform the explicit conversions for reinterpret_cast.
4449e4b17023SJohn Marino    CONV_PRIVATE    :  Perform upcasts to private bases.
4450e4b17023SJohn Marino    CONV_FORCE_TEMP :  Require a new temporary when converting to the same
4451e4b17023SJohn Marino 		      aggregate type.  */
4452e4b17023SJohn Marino 
4453e4b17023SJohn Marino #define CONV_IMPLICIT    1
4454e4b17023SJohn Marino #define CONV_STATIC      2
4455e4b17023SJohn Marino #define CONV_CONST       4
4456e4b17023SJohn Marino #define CONV_REINTERPRET 8
4457e4b17023SJohn Marino #define CONV_PRIVATE	 16
4458e4b17023SJohn Marino /* #define CONV_NONCONVERTING 32 */
4459e4b17023SJohn Marino #define CONV_FORCE_TEMP  64
4460e4b17023SJohn Marino #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
4461e4b17023SJohn Marino 			  | CONV_REINTERPRET)
4462e4b17023SJohn Marino #define CONV_C_CAST      (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
4463e4b17023SJohn Marino 			  | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
4464e4b17023SJohn Marino 
4465e4b17023SJohn Marino /* Used by build_expr_type_conversion to indicate which types are
4466e4b17023SJohn Marino    acceptable as arguments to the expression under consideration.  */
4467e4b17023SJohn Marino 
4468e4b17023SJohn Marino #define WANT_INT	1 /* integer types, including bool */
4469e4b17023SJohn Marino #define WANT_FLOAT	2 /* floating point types */
4470e4b17023SJohn Marino #define WANT_ENUM	4 /* enumerated types */
4471e4b17023SJohn Marino #define WANT_POINTER	8 /* pointer types */
4472e4b17023SJohn Marino #define WANT_NULL      16 /* null pointer constant */
4473e4b17023SJohn Marino #define WANT_VECTOR_OR_COMPLEX 32 /* vector or complex types */
4474e4b17023SJohn Marino #define WANT_ARITH	(WANT_INT | WANT_FLOAT | WANT_VECTOR_OR_COMPLEX)
4475e4b17023SJohn Marino 
4476e4b17023SJohn Marino /* Used with comptypes, and related functions, to guide type
4477e4b17023SJohn Marino    comparison.  */
4478e4b17023SJohn Marino 
4479e4b17023SJohn Marino #define COMPARE_STRICT	      0 /* Just check if the types are the
4480e4b17023SJohn Marino 				   same.  */
4481e4b17023SJohn Marino #define COMPARE_BASE	      1 /* Check to see if the second type is
4482e4b17023SJohn Marino 				   derived from the first.  */
4483e4b17023SJohn Marino #define COMPARE_DERIVED	      2 /* Like COMPARE_BASE, but in
4484e4b17023SJohn Marino 				   reverse.  */
4485e4b17023SJohn Marino #define COMPARE_REDECLARATION 4 /* The comparison is being done when
4486e4b17023SJohn Marino 				   another declaration of an existing
4487e4b17023SJohn Marino 				   entity is seen.  */
4488e4b17023SJohn Marino #define COMPARE_STRUCTURAL    8 /* The comparison is intended to be
4489e4b17023SJohn Marino 				   structural. The actual comparison
4490e4b17023SJohn Marino 				   will be identical to
4491e4b17023SJohn Marino 				   COMPARE_STRICT.  */
4492e4b17023SJohn Marino 
4493e4b17023SJohn Marino /* Used with push_overloaded_decl.  */
4494e4b17023SJohn Marino #define PUSH_GLOBAL	     0  /* Push the DECL into namespace scope,
4495e4b17023SJohn Marino 				   regardless of the current scope.  */
4496e4b17023SJohn Marino #define PUSH_LOCAL	     1  /* Push the DECL into the current
4497e4b17023SJohn Marino 				   scope.  */
4498e4b17023SJohn Marino #define PUSH_USING	     2  /* We are pushing this DECL as the
4499e4b17023SJohn Marino 				   result of a using declaration.  */
4500e4b17023SJohn Marino 
4501e4b17023SJohn Marino /* Used with start function.  */
4502e4b17023SJohn Marino #define SF_DEFAULT	     0  /* No flags.  */
4503e4b17023SJohn Marino #define SF_PRE_PARSED	     1  /* The function declaration has
4504e4b17023SJohn Marino 				   already been parsed.  */
4505e4b17023SJohn Marino #define SF_INCLASS_INLINE    2  /* The function is an inline, defined
4506e4b17023SJohn Marino 				   in the class body.  */
4507e4b17023SJohn Marino 
4508e4b17023SJohn Marino /* Used with start_decl's initialized parameter.  */
4509e4b17023SJohn Marino #define SD_UNINITIALIZED     0
4510e4b17023SJohn Marino #define SD_INITIALIZED       1
4511e4b17023SJohn Marino #define SD_DEFAULTED         2
4512e4b17023SJohn Marino #define SD_DELETED           3
4513e4b17023SJohn Marino 
4514e4b17023SJohn Marino /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
4515e4b17023SJohn Marino    is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
4516e4b17023SJohn Marino    class derived from the type pointed to (referred to) by TYPE1.  */
4517e4b17023SJohn Marino #define same_or_base_type_p(TYPE1, TYPE2) \
4518e4b17023SJohn Marino   comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
4519e4b17023SJohn Marino 
4520e4b17023SJohn Marino /* These macros are used to access a TEMPLATE_PARM_INDEX.  */
4521e4b17023SJohn Marino #define TEMPLATE_PARM_INDEX_CAST(NODE) \
4522e4b17023SJohn Marino 	((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
4523e4b17023SJohn Marino #define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
4524e4b17023SJohn Marino #define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
4525e4b17023SJohn Marino #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
4526e4b17023SJohn Marino #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
4527e4b17023SJohn Marino #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
4528e4b17023SJohn Marino #define TEMPLATE_PARM_PARAMETER_PACK(NODE) \
4529e4b17023SJohn Marino   (TREE_LANG_FLAG_0 (TEMPLATE_PARM_INDEX_CHECK (NODE)))
4530e4b17023SJohn Marino 
4531e4b17023SJohn Marino /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
4532e4b17023SJohn Marino    TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes.  */
4533e4b17023SJohn Marino #define TEMPLATE_TYPE_PARM_INDEX(NODE)					\
4534e4b17023SJohn Marino   (TYPE_VALUES_RAW (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM,		\
4535e4b17023SJohn Marino 				 TEMPLATE_TEMPLATE_PARM,		\
4536e4b17023SJohn Marino 				 BOUND_TEMPLATE_TEMPLATE_PARM)))
4537e4b17023SJohn Marino #define TEMPLATE_TYPE_IDX(NODE) \
4538e4b17023SJohn Marino   (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
4539e4b17023SJohn Marino #define TEMPLATE_TYPE_LEVEL(NODE) \
4540e4b17023SJohn Marino   (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
4541e4b17023SJohn Marino #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
4542e4b17023SJohn Marino   (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
4543e4b17023SJohn Marino #define TEMPLATE_TYPE_DECL(NODE) \
4544e4b17023SJohn Marino   (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
4545e4b17023SJohn Marino #define TEMPLATE_TYPE_PARAMETER_PACK(NODE) \
4546e4b17023SJohn Marino   (TEMPLATE_PARM_PARAMETER_PACK (TEMPLATE_TYPE_PARM_INDEX (NODE)))
4547e4b17023SJohn Marino 
4548e4b17023SJohn Marino /* These constants can used as bit flags in the process of tree formatting.
4549e4b17023SJohn Marino 
4550e4b17023SJohn Marino    TFF_PLAIN_IDENTIFIER: unqualified part of a name.
4551e4b17023SJohn Marino    TFF_SCOPE: include the class and namespace scope of the name.
4552e4b17023SJohn Marino    TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
4553e4b17023SJohn Marino    TFF_DECL_SPECIFIERS: print decl-specifiers.
4554e4b17023SJohn Marino    TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
4555e4b17023SJohn Marino        a class-key (resp. `enum').
4556e4b17023SJohn Marino    TFF_RETURN_TYPE: include function return type.
4557e4b17023SJohn Marino    TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
4558e4b17023SJohn Marino    TFF_EXCEPTION_SPECIFICATION: show function exception specification.
4559e4b17023SJohn Marino    TFF_TEMPLATE_HEADER: show the template<...> header in a
4560e4b17023SJohn Marino        template-declaration.
4561e4b17023SJohn Marino    TFF_TEMPLATE_NAME: show only template-name.
4562e4b17023SJohn Marino    TFF_EXPR_IN_PARENS: parenthesize expressions.
4563e4b17023SJohn Marino    TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments.
4564e4b17023SJohn Marino    TFF_UNQUALIFIED_NAME: do not print the qualifying scope of the
4565e4b17023SJohn Marino        top-level entity.
4566e4b17023SJohn Marino    TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS: do not omit template arguments
4567e4b17023SJohn Marino        identical to their defaults.  */
4568e4b17023SJohn Marino 
4569e4b17023SJohn Marino #define TFF_PLAIN_IDENTIFIER			(0)
4570e4b17023SJohn Marino #define TFF_SCOPE				(1)
4571e4b17023SJohn Marino #define TFF_CHASE_TYPEDEF			(1 << 1)
4572e4b17023SJohn Marino #define TFF_DECL_SPECIFIERS			(1 << 2)
4573e4b17023SJohn Marino #define TFF_CLASS_KEY_OR_ENUM			(1 << 3)
4574e4b17023SJohn Marino #define TFF_RETURN_TYPE				(1 << 4)
4575e4b17023SJohn Marino #define TFF_FUNCTION_DEFAULT_ARGUMENTS		(1 << 5)
4576e4b17023SJohn Marino #define TFF_EXCEPTION_SPECIFICATION		(1 << 6)
4577e4b17023SJohn Marino #define TFF_TEMPLATE_HEADER			(1 << 7)
4578e4b17023SJohn Marino #define TFF_TEMPLATE_NAME			(1 << 8)
4579e4b17023SJohn Marino #define TFF_EXPR_IN_PARENS			(1 << 9)
4580e4b17023SJohn Marino #define TFF_NO_FUNCTION_ARGUMENTS		(1 << 10)
4581e4b17023SJohn Marino #define TFF_UNQUALIFIED_NAME			(1 << 11)
4582e4b17023SJohn Marino #define TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS	(1 << 12)
4583e4b17023SJohn Marino 
4584e4b17023SJohn Marino /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
4585e4b17023SJohn Marino    node.  */
4586e4b17023SJohn Marino #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE)	\
4587e4b17023SJohn Marino   ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM)	\
4588e4b17023SJohn Marino    ? TYPE_TI_TEMPLATE (NODE)				\
4589e4b17023SJohn Marino    : TYPE_NAME (NODE))
4590e4b17023SJohn Marino 
4591e4b17023SJohn Marino /* in lex.c  */
4592e4b17023SJohn Marino 
4593e4b17023SJohn Marino extern void init_reswords (void);
4594e4b17023SJohn Marino 
4595e4b17023SJohn Marino typedef struct GTY(()) operator_name_info_t {
4596e4b17023SJohn Marino   /* The IDENTIFIER_NODE for the operator.  */
4597e4b17023SJohn Marino   tree identifier;
4598e4b17023SJohn Marino   /* The name of the operator.  */
4599e4b17023SJohn Marino   const char *name;
4600e4b17023SJohn Marino   /* The mangled name of the operator.  */
4601e4b17023SJohn Marino   const char *mangled_name;
4602e4b17023SJohn Marino   /* The arity of the operator.  */
4603e4b17023SJohn Marino   int arity;
4604e4b17023SJohn Marino } operator_name_info_t;
4605e4b17023SJohn Marino 
4606e4b17023SJohn Marino /* A mapping from tree codes to operator name information.  */
4607e4b17023SJohn Marino extern GTY(()) operator_name_info_t operator_name_info
4608e4b17023SJohn Marino   [(int) MAX_TREE_CODES];
4609e4b17023SJohn Marino /* Similar, but for assignment operators.  */
4610e4b17023SJohn Marino extern GTY(()) operator_name_info_t assignment_operator_name_info
4611e4b17023SJohn Marino   [(int) MAX_TREE_CODES];
4612e4b17023SJohn Marino 
4613e4b17023SJohn Marino /* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
4614e4b17023SJohn Marino    constants.  */
4615e4b17023SJohn Marino 
4616e4b17023SJohn Marino typedef int cp_cv_quals;
4617e4b17023SJohn Marino 
4618e4b17023SJohn Marino /* Non-static member functions have an optional virt-specifier-seq.
4619e4b17023SJohn Marino    There is a VIRT_SPEC value for each virt-specifier.
4620e4b17023SJohn Marino    They can be combined by bitwise-or to form the complete set of
4621e4b17023SJohn Marino    virt-specifiers for a member function.  */
4622e4b17023SJohn Marino enum virt_specifier
4623e4b17023SJohn Marino   {
4624e4b17023SJohn Marino     VIRT_SPEC_UNSPECIFIED = 0x0,
4625e4b17023SJohn Marino     VIRT_SPEC_FINAL       = 0x1,
4626e4b17023SJohn Marino     VIRT_SPEC_OVERRIDE    = 0x2
4627e4b17023SJohn Marino   };
4628e4b17023SJohn Marino 
4629e4b17023SJohn Marino /* A type-qualifier, or bitmask therefore, using the VIRT_SPEC
4630e4b17023SJohn Marino    constants.  */
4631e4b17023SJohn Marino 
4632e4b17023SJohn Marino typedef int cp_virt_specifiers;
4633e4b17023SJohn Marino 
4634e4b17023SJohn Marino /* A storage class.  */
4635e4b17023SJohn Marino 
4636e4b17023SJohn Marino typedef enum cp_storage_class {
4637e4b17023SJohn Marino   /* sc_none must be zero so that zeroing a cp_decl_specifier_seq
4638e4b17023SJohn Marino      sets the storage_class field to sc_none.  */
4639e4b17023SJohn Marino   sc_none = 0,
4640e4b17023SJohn Marino   sc_auto,
4641e4b17023SJohn Marino   sc_register,
4642e4b17023SJohn Marino   sc_static,
4643e4b17023SJohn Marino   sc_extern,
4644e4b17023SJohn Marino   sc_mutable
4645e4b17023SJohn Marino } cp_storage_class;
4646e4b17023SJohn Marino 
4647e4b17023SJohn Marino /* An individual decl-specifier.  */
4648e4b17023SJohn Marino 
4649e4b17023SJohn Marino typedef enum cp_decl_spec {
4650e4b17023SJohn Marino   ds_first,
4651e4b17023SJohn Marino   ds_signed = ds_first,
4652e4b17023SJohn Marino   ds_unsigned,
4653e4b17023SJohn Marino   ds_short,
4654e4b17023SJohn Marino   ds_long,
4655e4b17023SJohn Marino   ds_const,
4656e4b17023SJohn Marino   ds_volatile,
4657e4b17023SJohn Marino   ds_restrict,
4658e4b17023SJohn Marino   ds_inline,
4659e4b17023SJohn Marino   ds_virtual,
4660e4b17023SJohn Marino   ds_explicit,
4661e4b17023SJohn Marino   ds_friend,
4662e4b17023SJohn Marino   ds_typedef,
4663e4b17023SJohn Marino   ds_alias,
4664e4b17023SJohn Marino   ds_constexpr,
4665e4b17023SJohn Marino   ds_complex,
4666e4b17023SJohn Marino   ds_thread,
4667e4b17023SJohn Marino   ds_last
4668e4b17023SJohn Marino } cp_decl_spec;
4669e4b17023SJohn Marino 
4670e4b17023SJohn Marino /* A decl-specifier-seq.  */
4671e4b17023SJohn Marino 
4672e4b17023SJohn Marino typedef struct cp_decl_specifier_seq {
4673e4b17023SJohn Marino   /* The number of times each of the keywords has been seen.  */
4674e4b17023SJohn Marino   unsigned specs[(int) ds_last];
4675e4b17023SJohn Marino   /* The location of the primary type. Mainly used for error
4676e4b17023SJohn Marino      reporting.  */
4677e4b17023SJohn Marino   location_t type_location;
4678e4b17023SJohn Marino   /* The primary type, if any, given by the decl-specifier-seq.
4679e4b17023SJohn Marino      Modifiers, like "short", "const", and "unsigned" are not
4680e4b17023SJohn Marino      reflected here.  This field will be a TYPE, unless a typedef-name
4681e4b17023SJohn Marino      was used, in which case it will be a TYPE_DECL.  */
4682e4b17023SJohn Marino   tree type;
4683e4b17023SJohn Marino   /* The attributes, if any, provided with the specifier sequence.  */
4684e4b17023SJohn Marino   tree attributes;
4685e4b17023SJohn Marino   /* If non-NULL, a built-in type that the user attempted to redefine
4686e4b17023SJohn Marino      to some other type.  */
4687e4b17023SJohn Marino   tree redefined_builtin_type;
4688e4b17023SJohn Marino   /* The storage class specified -- or sc_none if no storage class was
4689e4b17023SJohn Marino      explicitly specified.  */
4690e4b17023SJohn Marino   cp_storage_class storage_class;
4691e4b17023SJohn Marino   /* True iff TYPE_SPEC defines a class or enum.  */
4692e4b17023SJohn Marino   BOOL_BITFIELD type_definition_p : 1;
4693e4b17023SJohn Marino   /* True iff multiple types were (erroneously) specified for this
4694e4b17023SJohn Marino      decl-specifier-seq.  */
4695e4b17023SJohn Marino   BOOL_BITFIELD multiple_types_p : 1;
4696e4b17023SJohn Marino   /* True iff multiple storage classes were (erroneously) specified
4697e4b17023SJohn Marino      for this decl-specifier-seq or a combination of a storage class
4698e4b17023SJohn Marino      with a typedef specifier.  */
4699e4b17023SJohn Marino   BOOL_BITFIELD conflicting_specifiers_p : 1;
4700e4b17023SJohn Marino   /* True iff at least one decl-specifier was found.  */
4701e4b17023SJohn Marino   BOOL_BITFIELD any_specifiers_p : 1;
4702e4b17023SJohn Marino   /* True iff at least one type-specifier was found.  */
4703e4b17023SJohn Marino   BOOL_BITFIELD any_type_specifiers_p : 1;
4704e4b17023SJohn Marino   /* True iff "int" was explicitly provided.  */
4705e4b17023SJohn Marino   BOOL_BITFIELD explicit_int_p : 1;
4706e4b17023SJohn Marino   /* True iff "__int128" was explicitly provided.  */
4707e4b17023SJohn Marino   BOOL_BITFIELD explicit_int128_p : 1;
4708e4b17023SJohn Marino   /* True iff "char" was explicitly provided.  */
4709e4b17023SJohn Marino   BOOL_BITFIELD explicit_char_p : 1;
4710e4b17023SJohn Marino } cp_decl_specifier_seq;
4711e4b17023SJohn Marino 
4712e4b17023SJohn Marino /* The various kinds of declarators.  */
4713e4b17023SJohn Marino 
4714e4b17023SJohn Marino typedef enum cp_declarator_kind {
4715e4b17023SJohn Marino   cdk_id,
4716e4b17023SJohn Marino   cdk_function,
4717e4b17023SJohn Marino   cdk_array,
4718e4b17023SJohn Marino   cdk_pointer,
4719e4b17023SJohn Marino   cdk_reference,
4720e4b17023SJohn Marino   cdk_ptrmem,
4721e4b17023SJohn Marino   cdk_error
4722e4b17023SJohn Marino } cp_declarator_kind;
4723e4b17023SJohn Marino 
4724e4b17023SJohn Marino /* A declarator.  */
4725e4b17023SJohn Marino 
4726e4b17023SJohn Marino typedef struct cp_declarator cp_declarator;
4727e4b17023SJohn Marino 
4728e4b17023SJohn Marino typedef struct cp_parameter_declarator cp_parameter_declarator;
4729e4b17023SJohn Marino 
4730e4b17023SJohn Marino /* A parameter, before it has been semantically analyzed.  */
4731e4b17023SJohn Marino struct cp_parameter_declarator {
4732e4b17023SJohn Marino   /* The next parameter, or NULL_TREE if none.  */
4733e4b17023SJohn Marino   cp_parameter_declarator *next;
4734e4b17023SJohn Marino   /* The decl-specifiers-seq for the parameter.  */
4735e4b17023SJohn Marino   cp_decl_specifier_seq decl_specifiers;
4736e4b17023SJohn Marino   /* The declarator for the parameter.  */
4737e4b17023SJohn Marino   cp_declarator *declarator;
4738e4b17023SJohn Marino   /* The default-argument expression, or NULL_TREE, if none.  */
4739e4b17023SJohn Marino   tree default_argument;
4740e4b17023SJohn Marino   /* True iff this is the first parameter in the list and the
4741e4b17023SJohn Marino      parameter sequence ends with an ellipsis.  */
4742e4b17023SJohn Marino   bool ellipsis_p;
4743e4b17023SJohn Marino };
4744e4b17023SJohn Marino 
4745e4b17023SJohn Marino /* A declarator.  */
4746e4b17023SJohn Marino struct cp_declarator {
4747e4b17023SJohn Marino   /* The kind of declarator.  */
4748e4b17023SJohn Marino   ENUM_BITFIELD (cp_declarator_kind) kind : 4;
4749e4b17023SJohn Marino   /* Whether we parsed an ellipsis (`...') just before the declarator,
4750e4b17023SJohn Marino      to indicate this is a parameter pack.  */
4751e4b17023SJohn Marino   BOOL_BITFIELD parameter_pack_p : 1;
4752e4b17023SJohn Marino   location_t id_loc; /* Currently only set for cdk_id and cdk_function. */
4753e4b17023SJohn Marino   /* Attributes that apply to this declarator.  */
4754e4b17023SJohn Marino   tree attributes;
4755e4b17023SJohn Marino   /* For all but cdk_id and cdk_error, the contained declarator.  For
4756e4b17023SJohn Marino      cdk_id and cdk_error, guaranteed to be NULL.  */
4757e4b17023SJohn Marino   cp_declarator *declarator;
4758e4b17023SJohn Marino   union {
4759e4b17023SJohn Marino     /* For identifiers.  */
4760e4b17023SJohn Marino     struct {
4761e4b17023SJohn Marino       /* If non-NULL, the qualifying scope (a NAMESPACE_DECL or
4762e4b17023SJohn Marino 	 *_TYPE) for this identifier.  */
4763e4b17023SJohn Marino       tree qualifying_scope;
4764e4b17023SJohn Marino       /* The unqualified name of the entity -- an IDENTIFIER_NODE,
4765e4b17023SJohn Marino 	 BIT_NOT_EXPR, or TEMPLATE_ID_EXPR.  */
4766e4b17023SJohn Marino       tree unqualified_name;
4767e4b17023SJohn Marino       /* If this is the name of a function, what kind of special
4768e4b17023SJohn Marino 	 function (if any).  */
4769e4b17023SJohn Marino       special_function_kind sfk;
4770e4b17023SJohn Marino     } id;
4771e4b17023SJohn Marino     /* For functions.  */
4772e4b17023SJohn Marino     struct {
4773e4b17023SJohn Marino       /* The parameters to the function as a TREE_LIST of decl/default.  */
4774e4b17023SJohn Marino       tree parameters;
4775e4b17023SJohn Marino       /* The cv-qualifiers for the function.  */
4776e4b17023SJohn Marino       cp_cv_quals qualifiers;
4777e4b17023SJohn Marino       /* The virt-specifiers for the function.  */
4778e4b17023SJohn Marino       cp_virt_specifiers virt_specifiers;
4779e4b17023SJohn Marino       /* The exception-specification for the function.  */
4780e4b17023SJohn Marino       tree exception_specification;
4781e4b17023SJohn Marino       /* The late-specified return type, if any.  */
4782e4b17023SJohn Marino       tree late_return_type;
4783e4b17023SJohn Marino     } function;
4784e4b17023SJohn Marino     /* For arrays.  */
4785e4b17023SJohn Marino     struct {
4786e4b17023SJohn Marino       /* The bounds to the array.  */
4787e4b17023SJohn Marino       tree bounds;
4788e4b17023SJohn Marino     } array;
4789e4b17023SJohn Marino     /* For cdk_pointer and cdk_ptrmem.  */
4790e4b17023SJohn Marino     struct {
4791e4b17023SJohn Marino       /* The cv-qualifiers for the pointer.  */
4792e4b17023SJohn Marino       cp_cv_quals qualifiers;
4793e4b17023SJohn Marino       /* For cdk_ptrmem, the class type containing the member.  */
4794e4b17023SJohn Marino       tree class_type;
4795e4b17023SJohn Marino     } pointer;
4796e4b17023SJohn Marino     /* For cdk_reference */
4797e4b17023SJohn Marino     struct {
4798e4b17023SJohn Marino       /* The cv-qualifiers for the reference.  These qualifiers are
4799e4b17023SJohn Marino          only used to diagnose ill-formed code.  */
4800e4b17023SJohn Marino       cp_cv_quals qualifiers;
4801e4b17023SJohn Marino       /* Whether this is an rvalue reference */
4802e4b17023SJohn Marino       bool rvalue_ref;
4803e4b17023SJohn Marino     } reference;
4804e4b17023SJohn Marino   } u;
4805e4b17023SJohn Marino };
4806e4b17023SJohn Marino 
4807e4b17023SJohn Marino /* A level of template instantiation.  */
4808e4b17023SJohn Marino struct GTY((chain_next ("%h.next"))) tinst_level {
4809e4b17023SJohn Marino   /* The immediately deeper level in the chain.  */
4810e4b17023SJohn Marino   struct tinst_level *next;
4811e4b17023SJohn Marino 
4812e4b17023SJohn Marino   /* The original node.  Can be either a DECL (for a function or static
4813e4b17023SJohn Marino      data member) or a TYPE (for a class), depending on what we were
4814e4b17023SJohn Marino      asked to instantiate.  */
4815e4b17023SJohn Marino   tree decl;
4816e4b17023SJohn Marino 
4817e4b17023SJohn Marino   /* The location where the template is instantiated.  */
4818e4b17023SJohn Marino   location_t locus;
4819e4b17023SJohn Marino 
4820e4b17023SJohn Marino   /* errorcount+sorrycount when we pushed this level.  */
4821e4b17023SJohn Marino   int errors;
4822e4b17023SJohn Marino 
4823e4b17023SJohn Marino   /* True if the location is in a system header.  */
4824e4b17023SJohn Marino   bool in_system_header_p;
4825e4b17023SJohn Marino };
4826e4b17023SJohn Marino 
4827e4b17023SJohn Marino /* Return the type of the `this' parameter of FNTYPE.  */
4828e4b17023SJohn Marino 
4829e4b17023SJohn Marino static inline tree
type_of_this_parm(const_tree fntype)4830e4b17023SJohn Marino type_of_this_parm (const_tree fntype)
4831e4b17023SJohn Marino {
4832e4b17023SJohn Marino   function_args_iterator iter;
4833e4b17023SJohn Marino   gcc_assert (TREE_CODE (fntype) == METHOD_TYPE);
4834e4b17023SJohn Marino   function_args_iter_init (&iter, fntype);
4835e4b17023SJohn Marino   return function_args_iter_cond (&iter);
4836e4b17023SJohn Marino }
4837e4b17023SJohn Marino 
4838e4b17023SJohn Marino /* Return the class of the `this' parameter of FNTYPE.  */
4839e4b17023SJohn Marino 
4840e4b17023SJohn Marino static inline tree
class_of_this_parm(const_tree fntype)4841e4b17023SJohn Marino class_of_this_parm (const_tree fntype)
4842e4b17023SJohn Marino {
4843e4b17023SJohn Marino   return TREE_TYPE (type_of_this_parm (fntype));
4844e4b17023SJohn Marino }
4845e4b17023SJohn Marino 
4846e4b17023SJohn Marino /* A parameter list indicating for a function with no parameters,
4847e4b17023SJohn Marino    e.g  "int f(void)".  */
4848e4b17023SJohn Marino extern cp_parameter_declarator *no_parameters;
4849e4b17023SJohn Marino 
4850e4b17023SJohn Marino /* True if we saw "#pragma GCC java_exceptions".  */
4851e4b17023SJohn Marino extern bool pragma_java_exceptions;
4852e4b17023SJohn Marino 
4853e4b17023SJohn Marino /* in call.c */
4854e4b17023SJohn Marino extern bool check_dtor_name			(tree, tree);
4855e4b17023SJohn Marino 
4856e4b17023SJohn Marino extern tree build_conditional_expr		(tree, tree, tree,
4857e4b17023SJohn Marino                                                  tsubst_flags_t);
4858e4b17023SJohn Marino extern tree build_addr_func			(tree);
4859e4b17023SJohn Marino extern void set_flags_from_callee		(tree);
4860e4b17023SJohn Marino extern tree build_call_a			(tree, int, tree*);
4861e4b17023SJohn Marino extern tree build_call_n			(tree, int, ...);
4862e4b17023SJohn Marino extern bool null_ptr_cst_p			(tree);
4863e4b17023SJohn Marino extern bool null_member_pointer_value_p		(tree);
4864e4b17023SJohn Marino extern bool sufficient_parms_p			(const_tree);
4865e4b17023SJohn Marino extern tree type_decays_to			(tree);
4866e4b17023SJohn Marino extern tree build_user_type_conversion		(tree, tree, int);
4867e4b17023SJohn Marino extern tree build_new_function_call		(tree, VEC(tree,gc) **, bool,
4868e4b17023SJohn Marino 						 tsubst_flags_t);
4869e4b17023SJohn Marino extern tree build_operator_new_call		(tree, VEC(tree,gc) **, tree *,
4870e4b17023SJohn Marino 						 tree *, tree *);
4871e4b17023SJohn Marino extern tree build_new_method_call		(tree, tree, VEC(tree,gc) **,
4872e4b17023SJohn Marino 						 tree, int, tree *,
4873e4b17023SJohn Marino 						 tsubst_flags_t);
4874e4b17023SJohn Marino extern tree build_special_member_call		(tree, tree, VEC(tree,gc) **,
4875e4b17023SJohn Marino 						 tree, int, tsubst_flags_t);
4876e4b17023SJohn Marino extern tree build_new_op			(enum tree_code, int, tree,
4877e4b17023SJohn Marino 						 tree, tree, tree *,
4878e4b17023SJohn Marino 						 tsubst_flags_t);
4879e4b17023SJohn Marino extern tree build_op_call			(tree, VEC(tree,gc) **,
4880e4b17023SJohn Marino 						 tsubst_flags_t);
4881e4b17023SJohn Marino extern tree build_op_delete_call		(enum tree_code, tree, tree, bool, tree, tree);
4882e4b17023SJohn Marino extern bool can_convert				(tree, tree);
4883e4b17023SJohn Marino extern bool can_convert_arg			(tree, tree, tree, int);
4884e4b17023SJohn Marino extern bool can_convert_arg_bad			(tree, tree, tree, int);
4885e4b17023SJohn Marino extern bool enforce_access			(tree, tree, tree);
4886e4b17023SJohn Marino extern void push_defarg_context			(tree);
4887e4b17023SJohn Marino extern void pop_defarg_context			(void);
4888e4b17023SJohn Marino extern tree convert_default_arg			(tree, tree, tree, int);
4889e4b17023SJohn Marino extern tree convert_arg_to_ellipsis		(tree);
4890e4b17023SJohn Marino extern tree build_x_va_arg			(tree, tree);
4891e4b17023SJohn Marino extern tree cxx_type_promotes_to		(tree);
4892e4b17023SJohn Marino extern tree type_passed_as			(tree);
4893e4b17023SJohn Marino extern tree convert_for_arg_passing		(tree, tree);
4894e4b17023SJohn Marino extern bool is_properly_derived_from		(tree, tree);
4895e4b17023SJohn Marino extern tree initialize_reference		(tree, tree, int,
4896e4b17023SJohn Marino 						 tsubst_flags_t);
4897e4b17023SJohn Marino extern tree extend_ref_init_temps		(tree, tree, VEC(tree,gc)**);
4898e4b17023SJohn Marino extern tree make_temporary_var_for_ref_to_temp	(tree, tree);
48995ce9237cSJohn Marino extern bool type_has_extended_temps		(tree);
4900e4b17023SJohn Marino extern tree strip_top_quals			(tree);
4901e4b17023SJohn Marino extern bool reference_related_p			(tree, tree);
4902e4b17023SJohn Marino extern tree perform_implicit_conversion		(tree, tree, tsubst_flags_t);
4903e4b17023SJohn Marino extern tree perform_implicit_conversion_flags	(tree, tree, tsubst_flags_t, int);
4904e4b17023SJohn Marino extern tree build_integral_nontype_arg_conv	(tree, tree, tsubst_flags_t);
4905e4b17023SJohn Marino extern tree perform_direct_initialization_if_possible (tree, tree, bool,
4906e4b17023SJohn Marino                                                        tsubst_flags_t);
4907e4b17023SJohn Marino extern tree in_charge_arg_for_name		(tree);
4908e4b17023SJohn Marino extern tree build_cxx_call			(tree, int, tree *);
4909e4b17023SJohn Marino extern bool is_std_init_list			(tree);
4910e4b17023SJohn Marino extern bool is_list_ctor			(tree);
4911e4b17023SJohn Marino #ifdef ENABLE_CHECKING
4912e4b17023SJohn Marino extern void validate_conversion_obstack		(void);
4913e4b17023SJohn Marino #endif /* ENABLE_CHECKING */
4914e4b17023SJohn Marino 
4915e4b17023SJohn Marino /* in class.c */
4916e4b17023SJohn Marino extern tree build_vfield_ref			(tree, tree);
4917e4b17023SJohn Marino extern tree build_base_path			(enum tree_code, tree,
4918e4b17023SJohn Marino 						 tree, int, tsubst_flags_t);
4919e4b17023SJohn Marino extern tree convert_to_base			(tree, tree, bool, bool,
4920e4b17023SJohn Marino 						 tsubst_flags_t);
4921e4b17023SJohn Marino extern tree convert_to_base_statically		(tree, tree);
4922e4b17023SJohn Marino extern tree build_vtbl_ref			(tree, tree);
4923e4b17023SJohn Marino extern tree build_vfn_ref			(tree, tree);
4924e4b17023SJohn Marino extern tree get_vtable_decl			(tree, int);
4925e4b17023SJohn Marino extern void resort_type_method_vec		(void *, void *,
4926e4b17023SJohn Marino 						 gt_pointer_operator, void *);
4927e4b17023SJohn Marino extern bool add_method				(tree, tree, tree);
4928e4b17023SJohn Marino extern bool currently_open_class		(tree);
4929e4b17023SJohn Marino extern tree currently_open_derived_class	(tree);
4930e4b17023SJohn Marino extern tree current_nonlambda_class_type	(void);
4931e4b17023SJohn Marino extern tree finish_struct			(tree, tree);
4932e4b17023SJohn Marino extern void finish_struct_1			(tree);
4933e4b17023SJohn Marino extern int resolves_to_fixed_type_p		(tree, int *);
4934e4b17023SJohn Marino extern void init_class_processing		(void);
4935e4b17023SJohn Marino extern int is_empty_class			(tree);
4936e4b17023SJohn Marino extern bool is_really_empty_class		(tree);
4937e4b17023SJohn Marino extern void pushclass				(tree);
4938e4b17023SJohn Marino extern void popclass				(void);
4939e4b17023SJohn Marino extern void push_nested_class			(tree);
4940e4b17023SJohn Marino extern void pop_nested_class			(void);
4941e4b17023SJohn Marino extern int current_lang_depth			(void);
4942e4b17023SJohn Marino extern void push_lang_context			(tree);
4943e4b17023SJohn Marino extern void pop_lang_context			(void);
4944e4b17023SJohn Marino extern tree instantiate_type			(tree, tree, tsubst_flags_t);
4945e4b17023SJohn Marino extern void print_class_statistics		(void);
4946e4b17023SJohn Marino extern void build_self_reference		(void);
4947e4b17023SJohn Marino extern int same_signature_p			(const_tree, const_tree);
4948e4b17023SJohn Marino extern void maybe_add_class_template_decl_list	(tree, tree, int);
4949e4b17023SJohn Marino extern void unreverse_member_declarations	(tree);
4950e4b17023SJohn Marino extern void invalidate_class_lookup_cache	(void);
4951e4b17023SJohn Marino extern void maybe_note_name_used_in_class	(tree, tree);
4952e4b17023SJohn Marino extern void note_name_declared_in_class		(tree, tree);
4953e4b17023SJohn Marino extern tree get_vtbl_decl_for_binfo		(tree);
4954e4b17023SJohn Marino extern void debug_class				(tree);
4955e4b17023SJohn Marino extern void debug_thunks			(tree);
4956e4b17023SJohn Marino extern void set_linkage_according_to_type	(tree, tree);
4957e4b17023SJohn Marino extern void determine_key_method		(tree);
4958e4b17023SJohn Marino extern void check_for_override			(tree, tree);
4959e4b17023SJohn Marino extern void push_class_stack			(void);
4960e4b17023SJohn Marino extern void pop_class_stack			(void);
4961e4b17023SJohn Marino extern bool type_has_user_nondefault_constructor (tree);
4962e4b17023SJohn Marino extern tree in_class_defaulted_default_constructor (tree);
4963e4b17023SJohn Marino extern bool user_provided_p			(tree);
4964e4b17023SJohn Marino extern bool type_has_user_provided_constructor  (tree);
4965e4b17023SJohn Marino extern bool type_has_user_provided_default_constructor (tree);
4966e4b17023SJohn Marino extern tree default_init_uninitialized_part (tree);
4967e4b17023SJohn Marino extern bool trivial_default_constructor_is_constexpr (tree);
4968e4b17023SJohn Marino extern bool type_has_constexpr_default_constructor (tree);
4969e4b17023SJohn Marino extern bool type_has_virtual_destructor		(tree);
4970e4b17023SJohn Marino extern bool type_has_move_constructor		(tree);
4971e4b17023SJohn Marino extern bool type_has_move_assign		(tree);
4972e4b17023SJohn Marino extern bool type_has_user_declared_move_constructor (tree);
4973e4b17023SJohn Marino extern bool type_has_user_declared_move_assign(tree);
4974e4b17023SJohn Marino extern bool type_build_ctor_call		(tree);
4975e4b17023SJohn Marino extern void explain_non_literal_class		(tree);
4976e4b17023SJohn Marino extern void defaulted_late_check		(tree);
4977e4b17023SJohn Marino extern bool defaultable_fn_check		(tree);
4978e4b17023SJohn Marino extern void fixup_type_variants			(tree);
4979e4b17023SJohn Marino extern void fixup_attribute_variants		(tree);
4980e4b17023SJohn Marino extern tree* decl_cloned_function_p		(const_tree, bool);
4981e4b17023SJohn Marino extern void clone_function_decl			(tree, int);
4982e4b17023SJohn Marino extern void adjust_clone_args			(tree);
4983e4b17023SJohn Marino extern void insert_late_enum_def_into_classtype_sorted_fields (tree, tree);
4984e4b17023SJohn Marino 
4985e4b17023SJohn Marino /* in cvt.c */
4986e4b17023SJohn Marino extern tree convert_to_reference		(tree, tree, int, int, tree);
4987e4b17023SJohn Marino extern tree convert_from_reference		(tree);
4988e4b17023SJohn Marino extern tree force_rvalue			(tree, tsubst_flags_t);
4989e4b17023SJohn Marino extern tree ocp_convert				(tree, tree, int, int);
4990e4b17023SJohn Marino extern tree cp_convert				(tree, tree);
4991e4b17023SJohn Marino extern tree cp_convert_and_check                (tree, tree);
4992e4b17023SJohn Marino extern tree cp_fold_convert			(tree, tree);
4993e4b17023SJohn Marino extern tree convert_to_void			(tree, impl_conv_void,
4994e4b17023SJohn Marino                                  		 tsubst_flags_t);
4995e4b17023SJohn Marino extern tree convert_force			(tree, tree, int);
4996e4b17023SJohn Marino extern tree build_expr_type_conversion		(int, tree, bool);
4997e4b17023SJohn Marino extern tree type_promotes_to			(tree);
4998e4b17023SJohn Marino extern tree perform_qualification_conversions	(tree, tree);
4999e4b17023SJohn Marino 
5000e4b17023SJohn Marino /* in name-lookup.c */
5001e4b17023SJohn Marino extern tree pushdecl				(tree);
5002e4b17023SJohn Marino extern tree pushdecl_maybe_friend		(tree, bool);
5003e4b17023SJohn Marino extern void maybe_push_cleanup_level		(tree);
5004e4b17023SJohn Marino extern tree pushtag				(tree, tree, tag_scope);
5005e4b17023SJohn Marino extern tree make_anon_name			(void);
5006e4b17023SJohn Marino extern tree pushdecl_top_level_maybe_friend	(tree, bool);
5007e4b17023SJohn Marino extern tree pushdecl_top_level_and_finish	(tree, tree);
5008e4b17023SJohn Marino extern tree check_for_out_of_scope_variable	(tree);
5009e4b17023SJohn Marino extern void print_other_binding_stack		(cp_binding_level *);
5010e4b17023SJohn Marino extern tree maybe_push_decl			(tree);
5011e4b17023SJohn Marino extern tree current_decl_namespace		(void);
5012e4b17023SJohn Marino 
5013e4b17023SJohn Marino /* decl.c */
5014e4b17023SJohn Marino extern tree poplevel				(int, int, int);
5015e4b17023SJohn Marino extern void cxx_init_decl_processing		(void);
5016e4b17023SJohn Marino enum cp_tree_node_structure_enum cp_tree_node_structure
5017e4b17023SJohn Marino 						(union lang_tree_node *);
5018e4b17023SJohn Marino extern void finish_scope			(void);
5019e4b17023SJohn Marino extern void push_switch				(tree);
5020e4b17023SJohn Marino extern void pop_switch				(void);
5021e4b17023SJohn Marino extern tree make_lambda_name			(void);
5022e4b17023SJohn Marino extern int decls_match				(tree, tree);
5023e4b17023SJohn Marino extern tree duplicate_decls			(tree, tree, bool);
5024e4b17023SJohn Marino extern tree declare_local_label			(tree);
5025e4b17023SJohn Marino extern tree define_label			(location_t, tree);
5026e4b17023SJohn Marino extern void check_goto				(tree);
5027e4b17023SJohn Marino extern bool check_omp_return			(void);
5028e4b17023SJohn Marino extern tree make_typename_type			(tree, tree, enum tag_types, tsubst_flags_t);
5029e4b17023SJohn Marino extern tree make_unbound_class_template		(tree, tree, tree, tsubst_flags_t);
5030e4b17023SJohn Marino extern tree build_library_fn_ptr		(const char *, tree);
5031e4b17023SJohn Marino extern tree build_cp_library_fn_ptr		(const char *, tree);
5032e4b17023SJohn Marino extern tree push_library_fn			(tree, tree, tree);
5033e4b17023SJohn Marino extern tree push_void_library_fn		(tree, tree);
5034e4b17023SJohn Marino extern tree push_throw_library_fn		(tree, tree);
5035e4b17023SJohn Marino extern tree check_tag_decl			(cp_decl_specifier_seq *);
5036e4b17023SJohn Marino extern tree shadow_tag				(cp_decl_specifier_seq *);
5037e4b17023SJohn Marino extern tree groktypename			(cp_decl_specifier_seq *, const cp_declarator *, bool);
5038e4b17023SJohn Marino extern tree start_decl				(const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
5039e4b17023SJohn Marino extern void start_decl_1			(tree, bool);
5040e4b17023SJohn Marino extern bool check_array_initializer		(tree, tree, tree);
5041e4b17023SJohn Marino extern void cp_finish_decl			(tree, tree, bool, tree, int);
5042e4b17023SJohn Marino extern int cp_complete_array_type		(tree *, tree, bool);
5043e4b17023SJohn Marino extern int cp_complete_array_type_or_error	(tree *, tree, bool, tsubst_flags_t);
5044e4b17023SJohn Marino extern tree build_ptrmemfunc_type		(tree);
5045e4b17023SJohn Marino extern tree build_ptrmem_type			(tree, tree);
5046e4b17023SJohn Marino /* the grokdeclarator prototype is in decl.h */
5047e4b17023SJohn Marino extern tree build_this_parm			(tree, cp_cv_quals);
5048e4b17023SJohn Marino extern int copy_fn_p				(const_tree);
5049e4b17023SJohn Marino extern bool move_fn_p                           (const_tree);
5050e4b17023SJohn Marino extern bool move_signature_fn_p                 (const_tree);
5051e4b17023SJohn Marino extern tree get_scope_of_declarator		(const cp_declarator *);
5052e4b17023SJohn Marino extern void grok_special_member_properties	(tree);
5053e4b17023SJohn Marino extern int grok_ctor_properties			(const_tree, const_tree);
5054e4b17023SJohn Marino extern bool grok_op_properties			(tree, bool);
5055e4b17023SJohn Marino extern tree xref_tag				(enum tag_types, tree, tag_scope, bool);
5056e4b17023SJohn Marino extern tree xref_tag_from_type			(tree, tree, tag_scope);
5057e4b17023SJohn Marino extern bool xref_basetypes			(tree, tree);
5058e4b17023SJohn Marino extern tree start_enum				(tree, tree, tree, bool, bool *);
5059e4b17023SJohn Marino extern void finish_enum_value_list		(tree);
5060e4b17023SJohn Marino extern void finish_enum				(tree);
5061e4b17023SJohn Marino extern void build_enumerator			(tree, tree, tree, location_t);
5062e4b17023SJohn Marino extern tree lookup_enumerator			(tree, tree);
5063e4b17023SJohn Marino extern void start_preparsed_function		(tree, tree, int);
5064e4b17023SJohn Marino extern int start_function			(cp_decl_specifier_seq *, const cp_declarator *, tree);
5065e4b17023SJohn Marino extern tree begin_function_body			(void);
5066e4b17023SJohn Marino extern void finish_function_body		(tree);
5067e4b17023SJohn Marino extern tree outer_curly_brace_block		(tree);
5068e4b17023SJohn Marino extern tree finish_function			(int);
5069e4b17023SJohn Marino extern tree grokmethod				(cp_decl_specifier_seq *, const cp_declarator *, tree);
5070e4b17023SJohn Marino extern void maybe_register_incomplete_var	(tree);
5071e4b17023SJohn Marino extern void maybe_commonize_var			(tree);
5072e4b17023SJohn Marino extern void complete_vars			(tree);
5073e4b17023SJohn Marino extern void finish_stmt				(void);
5074e4b17023SJohn Marino extern tree static_fn_type			(tree);
5075e4b17023SJohn Marino extern void revert_static_member_fn		(tree);
5076e4b17023SJohn Marino extern void fixup_anonymous_aggr		(tree);
5077e4b17023SJohn Marino extern tree compute_array_index_type		(tree, tree, tsubst_flags_t);
5078e4b17023SJohn Marino extern tree check_default_argument		(tree, tree);
5079e4b17023SJohn Marino typedef int (*walk_namespaces_fn)		(tree, void *);
5080e4b17023SJohn Marino extern int walk_namespaces			(walk_namespaces_fn,
5081e4b17023SJohn Marino 						 void *);
5082e4b17023SJohn Marino extern int wrapup_globals_for_namespace		(tree, void *);
5083e4b17023SJohn Marino extern tree create_implicit_typedef		(tree, tree);
5084e4b17023SJohn Marino extern int local_variable_p			(const_tree);
5085e4b17023SJohn Marino extern tree register_dtor_fn			(tree);
5086e4b17023SJohn Marino extern tmpl_spec_kind current_tmpl_spec_kind	(int);
5087e4b17023SJohn Marino extern tree cp_fname_init			(const char *, tree *);
5088e4b17023SJohn Marino extern tree cxx_builtin_function		(tree decl);
5089e4b17023SJohn Marino extern tree cxx_builtin_function_ext_scope	(tree decl);
5090e4b17023SJohn Marino extern tree check_elaborated_type_specifier	(enum tag_types, tree, bool);
5091e4b17023SJohn Marino extern void warn_extern_redeclared_static	(tree, tree);
5092e4b17023SJohn Marino extern tree cxx_comdat_group			(tree);
5093e4b17023SJohn Marino extern bool cp_missing_noreturn_ok_p		(tree);
5094e4b17023SJohn Marino extern void initialize_artificial_var		(tree, VEC(constructor_elt,gc) *);
5095e4b17023SJohn Marino extern tree check_var_type			(tree, tree);
5096e4b17023SJohn Marino extern tree reshape_init                        (tree, tree, tsubst_flags_t);
5097e4b17023SJohn Marino extern tree next_initializable_field (tree);
5098e4b17023SJohn Marino 
5099e4b17023SJohn Marino extern bool defer_mark_used_calls;
5100e4b17023SJohn Marino extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls;
5101e4b17023SJohn Marino extern tree finish_case_label			(location_t, tree, tree);
5102e4b17023SJohn Marino extern tree cxx_maybe_build_cleanup		(tree, tsubst_flags_t);
5103e4b17023SJohn Marino 
5104e4b17023SJohn Marino /* in decl2.c */
5105e4b17023SJohn Marino extern bool check_java_method			(tree);
5106e4b17023SJohn Marino extern tree build_memfn_type			(tree, tree, cp_cv_quals);
5107e4b17023SJohn Marino extern tree change_return_type			(tree, tree);
5108e4b17023SJohn Marino extern void maybe_retrofit_in_chrg		(tree);
5109e4b17023SJohn Marino extern void maybe_make_one_only			(tree);
5110e4b17023SJohn Marino extern bool vague_linkage_p			(tree);
5111e4b17023SJohn Marino extern void grokclassfn				(tree, tree,
5112e4b17023SJohn Marino 						 enum overload_flags);
5113e4b17023SJohn Marino extern tree grok_array_decl			(tree, tree);
5114e4b17023SJohn Marino extern tree delete_sanity			(tree, tree, bool, int, tsubst_flags_t);
5115e4b17023SJohn Marino extern tree check_classfn			(tree, tree, tree);
5116e4b17023SJohn Marino extern void check_member_template		(tree);
5117e4b17023SJohn Marino extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
5118e4b17023SJohn Marino 		       tree, bool, tree, tree);
5119e4b17023SJohn Marino extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
5120e4b17023SJohn Marino 			  tree, tree);
5121e4b17023SJohn Marino extern tree cp_reconstruct_complex_type		(tree, tree);
5122e4b17023SJohn Marino extern void cplus_decl_attributes		(tree *, tree, int);
5123e4b17023SJohn Marino extern void finish_anon_union			(tree);
5124e4b17023SJohn Marino extern void cp_write_global_declarations	(void);
5125e4b17023SJohn Marino extern tree coerce_new_type			(tree);
5126e4b17023SJohn Marino extern tree coerce_delete_type			(tree);
5127e4b17023SJohn Marino extern void comdat_linkage			(tree);
5128e4b17023SJohn Marino extern void determine_visibility		(tree);
5129e4b17023SJohn Marino extern void constrain_class_visibility		(tree);
5130e4b17023SJohn Marino extern void import_export_decl			(tree);
5131e4b17023SJohn Marino extern tree build_cleanup			(tree);
5132e4b17023SJohn Marino extern tree build_offset_ref_call_from_tree	(tree, VEC(tree,gc) **);
5133e4b17023SJohn Marino extern bool decl_constant_var_p			(tree);
5134e4b17023SJohn Marino extern bool decl_maybe_constant_var_p		(tree);
5135e4b17023SJohn Marino extern void check_default_args			(tree);
5136e4b17023SJohn Marino extern bool mark_used				(tree);
5137e4b17023SJohn Marino extern void finish_static_data_member_decl	(tree, tree, bool, tree, int);
5138e4b17023SJohn Marino extern tree cp_build_parm_decl			(tree, tree);
5139e4b17023SJohn Marino extern tree get_guard				(tree);
5140e4b17023SJohn Marino extern tree get_guard_cond			(tree);
5141e4b17023SJohn Marino extern tree set_guard				(tree);
5142e4b17023SJohn Marino extern tree cxx_callgraph_analyze_expr		(tree *, int *);
5143e4b17023SJohn Marino extern void mark_needed				(tree);
5144e4b17023SJohn Marino extern bool decl_needed_p			(tree);
5145e4b17023SJohn Marino extern void note_vague_linkage_fn		(tree);
5146e4b17023SJohn Marino extern tree build_artificial_parm		(tree, tree);
5147e4b17023SJohn Marino extern bool possibly_inlined_p			(tree);
5148e4b17023SJohn Marino extern int parm_index                           (tree);
5149e4b17023SJohn Marino 
5150e4b17023SJohn Marino /* in error.c */
5151e4b17023SJohn Marino extern void init_error				(void);
5152e4b17023SJohn Marino extern const char *type_as_string		(tree, int);
5153e4b17023SJohn Marino extern const char *type_as_string_translate	(tree, int);
5154e4b17023SJohn Marino extern const char *decl_as_string		(tree, int);
5155e4b17023SJohn Marino extern const char *decl_as_string_translate	(tree, int);
5156e4b17023SJohn Marino extern const char *expr_as_string		(tree, int);
5157e4b17023SJohn Marino extern const char *lang_decl_name		(tree, int, bool);
5158e4b17023SJohn Marino extern const char *language_to_string		(enum languages);
5159e4b17023SJohn Marino extern const char *class_key_or_enum_as_string	(tree);
5160e4b17023SJohn Marino extern void print_instantiation_context		(void);
5161e4b17023SJohn Marino extern void maybe_warn_variadic_templates       (void);
5162e4b17023SJohn Marino extern void maybe_warn_cpp0x			(cpp0x_warn_str str);
5163e4b17023SJohn Marino extern bool pedwarn_cxx98                       (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4);
5164e4b17023SJohn Marino extern location_t location_of                   (tree);
5165e4b17023SJohn Marino extern void qualified_name_lookup_error		(tree, tree, tree,
5166e4b17023SJohn Marino 						 location_t);
5167e4b17023SJohn Marino 
5168e4b17023SJohn Marino /* in except.c */
5169e4b17023SJohn Marino extern void init_exception_processing		(void);
5170e4b17023SJohn Marino extern tree expand_start_catch_block		(tree);
5171e4b17023SJohn Marino extern void expand_end_catch_block		(void);
5172e4b17023SJohn Marino extern tree build_exc_ptr			(void);
5173e4b17023SJohn Marino extern tree build_throw				(tree);
5174e4b17023SJohn Marino extern int nothrow_libfn_p			(const_tree);
5175e4b17023SJohn Marino extern void check_handlers			(tree);
5176e4b17023SJohn Marino extern tree finish_noexcept_expr		(tree, tsubst_flags_t);
5177e4b17023SJohn Marino extern bool expr_noexcept_p			(tree, tsubst_flags_t);
5178e4b17023SJohn Marino extern void perform_deferred_noexcept_checks	(void);
5179e4b17023SJohn Marino extern bool nothrow_spec_p			(const_tree);
5180e4b17023SJohn Marino extern bool type_noexcept_p			(const_tree);
5181e4b17023SJohn Marino extern bool type_throw_all_p			(const_tree);
5182e4b17023SJohn Marino extern tree build_noexcept_spec			(tree, int);
5183e4b17023SJohn Marino extern void choose_personality_routine		(enum languages);
5184e4b17023SJohn Marino extern tree build_must_not_throw_expr		(tree,tree);
5185e4b17023SJohn Marino extern tree eh_type_info			(tree);
5186e4b17023SJohn Marino extern tree begin_eh_spec_block			(void);
5187e4b17023SJohn Marino extern void finish_eh_spec_block		(tree, tree);
5188e4b17023SJohn Marino extern tree build_eh_type_type			(tree);
5189e4b17023SJohn Marino extern tree cp_protect_cleanup_actions		(void);
5190e4b17023SJohn Marino 
5191e4b17023SJohn Marino /* in expr.c */
5192e4b17023SJohn Marino extern tree cplus_expand_constant		(tree);
5193e4b17023SJohn Marino extern tree mark_rvalue_use			(tree);
5194e4b17023SJohn Marino extern tree mark_lvalue_use			(tree);
5195e4b17023SJohn Marino extern tree mark_type_use			(tree);
5196e4b17023SJohn Marino extern void mark_exp_read			(tree);
5197e4b17023SJohn Marino 
5198e4b17023SJohn Marino /* friend.c */
5199e4b17023SJohn Marino extern int is_friend				(tree, tree);
5200e4b17023SJohn Marino extern void make_friend_class			(tree, tree, bool);
5201e4b17023SJohn Marino extern void add_friend				(tree, tree, bool);
5202e4b17023SJohn Marino extern tree do_friend				(tree, tree, tree, tree, enum overload_flags, bool);
5203e4b17023SJohn Marino 
5204e4b17023SJohn Marino /* in init.c */
5205e4b17023SJohn Marino extern tree expand_member_init			(tree);
5206e4b17023SJohn Marino extern void emit_mem_initializers		(tree);
5207e4b17023SJohn Marino extern tree build_aggr_init			(tree, tree, int,
5208e4b17023SJohn Marino                                                  tsubst_flags_t);
5209e4b17023SJohn Marino extern int is_class_type			(tree, int);
5210e4b17023SJohn Marino extern tree get_type_value			(tree);
5211e4b17023SJohn Marino extern tree build_zero_init			(tree, tree, bool);
5212e4b17023SJohn Marino extern tree build_value_init			(tree, tsubst_flags_t);
5213e4b17023SJohn Marino extern tree build_value_init_noctor		(tree, tsubst_flags_t);
5214e4b17023SJohn Marino extern tree build_offset_ref			(tree, tree, bool);
5215e4b17023SJohn Marino extern tree build_new				(VEC(tree,gc) **, tree, tree,
5216e4b17023SJohn Marino 						 VEC(tree,gc) **, int,
5217e4b17023SJohn Marino                                                  tsubst_flags_t);
5218e4b17023SJohn Marino extern tree get_temp_regvar			(tree, tree);
5219e4b17023SJohn Marino extern tree build_vec_init			(tree, tree, tree, bool, int,
5220e4b17023SJohn Marino                                                  tsubst_flags_t);
5221e4b17023SJohn Marino extern tree build_delete			(tree, tree,
5222e4b17023SJohn Marino 						 special_function_kind,
5223e4b17023SJohn Marino 						 int, int, tsubst_flags_t);
5224e4b17023SJohn Marino extern void push_base_cleanups			(void);
5225e4b17023SJohn Marino extern tree build_vec_delete			(tree, tree,
5226e4b17023SJohn Marino 						 special_function_kind, int,
5227e4b17023SJohn Marino 						 tsubst_flags_t);
5228e4b17023SJohn Marino extern tree create_temporary_var		(tree);
5229e4b17023SJohn Marino extern void initialize_vtbl_ptrs		(tree);
5230e4b17023SJohn Marino extern tree build_java_class_ref		(tree);
5231e4b17023SJohn Marino extern tree integral_constant_value		(tree);
5232e4b17023SJohn Marino extern tree decl_constant_value_safe	        (tree);
5233e4b17023SJohn Marino extern int diagnose_uninitialized_cst_or_ref_member (tree, bool, bool);
5234e4b17023SJohn Marino 
5235e4b17023SJohn Marino /* in lex.c */
5236e4b17023SJohn Marino extern void cxx_dup_lang_specific_decl		(tree);
5237e4b17023SJohn Marino extern void yyungetc				(int, int);
5238e4b17023SJohn Marino 
5239e4b17023SJohn Marino extern tree unqualified_name_lookup_error	(tree);
5240e4b17023SJohn Marino extern tree unqualified_fn_lookup_error		(tree);
5241e4b17023SJohn Marino extern tree build_lang_decl			(enum tree_code, tree, tree);
5242e4b17023SJohn Marino extern tree build_lang_decl_loc			(location_t, enum tree_code, tree, tree);
5243e4b17023SJohn Marino extern void retrofit_lang_decl			(tree);
5244e4b17023SJohn Marino extern tree copy_decl				(tree);
5245e4b17023SJohn Marino extern tree copy_type				(tree);
5246e4b17023SJohn Marino extern tree cxx_make_type			(enum tree_code);
5247e4b17023SJohn Marino extern tree make_class_type			(enum tree_code);
5248e4b17023SJohn Marino extern bool cxx_init				(void);
5249e4b17023SJohn Marino extern void cxx_finish				(void);
5250e4b17023SJohn Marino extern bool in_main_input_context		(void);
5251e4b17023SJohn Marino 
5252e4b17023SJohn Marino /* in method.c */
5253e4b17023SJohn Marino extern void init_method				(void);
5254e4b17023SJohn Marino extern tree make_thunk				(tree, bool, tree, tree);
5255e4b17023SJohn Marino extern void finish_thunk			(tree);
5256e4b17023SJohn Marino extern void use_thunk				(tree, bool);
5257e4b17023SJohn Marino extern bool trivial_fn_p			(tree);
5258e4b17023SJohn Marino extern bool maybe_explain_implicit_delete	(tree);
5259e4b17023SJohn Marino extern void explain_implicit_non_constexpr	(tree);
5260e4b17023SJohn Marino extern void synthesize_method			(tree);
5261e4b17023SJohn Marino extern tree lazily_declare_fn			(special_function_kind,
5262e4b17023SJohn Marino 						 tree);
5263e4b17023SJohn Marino extern tree skip_artificial_parms_for		(const_tree, tree);
5264e4b17023SJohn Marino extern int num_artificial_parms_for		(const_tree);
5265e4b17023SJohn Marino extern tree make_alias_for			(tree, tree);
5266e4b17023SJohn Marino extern tree get_copy_ctor			(tree, tsubst_flags_t);
5267e4b17023SJohn Marino extern tree get_copy_assign			(tree);
5268e4b17023SJohn Marino extern tree get_default_ctor			(tree);
5269e4b17023SJohn Marino extern tree get_dtor				(tree, tsubst_flags_t);
5270e4b17023SJohn Marino extern tree locate_ctor				(tree);
5271e4b17023SJohn Marino 
5272e4b17023SJohn Marino /* In optimize.c */
5273e4b17023SJohn Marino extern bool maybe_clone_body			(tree);
5274e4b17023SJohn Marino 
5275e4b17023SJohn Marino /* in pt.c */
5276e4b17023SJohn Marino extern bool check_template_shadow		(tree);
5277e4b17023SJohn Marino extern tree get_innermost_template_args		(tree, int);
5278e4b17023SJohn Marino extern void maybe_begin_member_template_processing (tree);
5279e4b17023SJohn Marino extern void maybe_end_member_template_processing (void);
5280e4b17023SJohn Marino extern tree finish_member_template_decl		(tree);
5281e4b17023SJohn Marino extern void begin_template_parm_list		(void);
5282e4b17023SJohn Marino extern bool begin_specialization		(void);
5283e4b17023SJohn Marino extern void reset_specialization		(void);
5284e4b17023SJohn Marino extern void end_specialization			(void);
5285e4b17023SJohn Marino extern void begin_explicit_instantiation	(void);
5286e4b17023SJohn Marino extern void end_explicit_instantiation		(void);
5287e4b17023SJohn Marino extern tree check_explicit_specialization	(tree, tree, int, int);
5288e4b17023SJohn Marino extern tree make_auto				(void);
5289e4b17023SJohn Marino extern tree do_auto_deduction			(tree, tree, tree);
5290e4b17023SJohn Marino extern tree type_uses_auto			(tree);
5291e4b17023SJohn Marino extern void append_type_to_template_for_access_check (tree, tree, tree,
5292e4b17023SJohn Marino 						      location_t);
5293e4b17023SJohn Marino extern tree splice_late_return_type		(tree, tree);
5294e4b17023SJohn Marino extern bool is_auto				(const_tree);
5295e4b17023SJohn Marino extern tree process_template_parm		(tree, location_t, tree,
52965ce9237cSJohn Marino 						 bool, bool);
5297e4b17023SJohn Marino extern tree end_template_parm_list		(tree);
5298e4b17023SJohn Marino extern void end_template_decl			(void);
5299e4b17023SJohn Marino extern tree maybe_update_decl_type		(tree, tree);
5300e4b17023SJohn Marino extern bool check_default_tmpl_args             (tree, tree, int, int, int);
5301e4b17023SJohn Marino extern tree push_template_decl			(tree);
5302e4b17023SJohn Marino extern tree push_template_decl_real		(tree, bool);
5303e4b17023SJohn Marino extern bool redeclare_class_template		(tree, tree);
5304e4b17023SJohn Marino extern tree lookup_template_class		(tree, tree, tree, tree,
5305e4b17023SJohn Marino 						 int, tsubst_flags_t);
5306e4b17023SJohn Marino extern tree lookup_template_function		(tree, tree);
5307e4b17023SJohn Marino extern int uses_template_parms			(tree);
5308e4b17023SJohn Marino extern int uses_template_parms_level		(tree, int);
5309e4b17023SJohn Marino extern tree instantiate_class_template		(tree);
5310e4b17023SJohn Marino extern tree instantiate_template		(tree, tree, tsubst_flags_t);
5311e4b17023SJohn Marino extern int fn_type_unification			(tree, tree, tree,
5312e4b17023SJohn Marino 						 const tree *, unsigned int,
5313e4b17023SJohn Marino 						 tree, unification_kind_t, int,
5314e4b17023SJohn Marino 						 bool);
5315e4b17023SJohn Marino extern void mark_decl_instantiated		(tree, int);
5316e4b17023SJohn Marino extern int more_specialized_fn			(tree, tree, int);
5317e4b17023SJohn Marino extern void do_decl_instantiation		(tree, tree);
5318e4b17023SJohn Marino extern void do_type_instantiation		(tree, tree, tsubst_flags_t);
5319e4b17023SJohn Marino extern bool always_instantiate_p		(tree);
5320e4b17023SJohn Marino extern void maybe_instantiate_noexcept		(tree);
5321e4b17023SJohn Marino extern tree instantiate_decl			(tree, int, bool);
5322e4b17023SJohn Marino extern int comp_template_parms			(const_tree, const_tree);
5323e4b17023SJohn Marino extern bool uses_parameter_packs                (tree);
5324e4b17023SJohn Marino extern bool template_parameter_pack_p           (const_tree);
5325e4b17023SJohn Marino extern bool function_parameter_pack_p		(const_tree);
5326e4b17023SJohn Marino extern bool function_parameter_expanded_from_pack_p (tree, tree);
5327e4b17023SJohn Marino extern tree make_pack_expansion                 (tree);
5328e4b17023SJohn Marino extern bool check_for_bare_parameter_packs      (tree);
5329e4b17023SJohn Marino extern tree build_template_info			(tree, tree);
5330e4b17023SJohn Marino extern tree get_template_info			(const_tree);
5331e4b17023SJohn Marino extern VEC(qualified_typedef_usage_t,gc)* get_types_needing_access_check (tree);
5332e4b17023SJohn Marino extern int template_class_depth			(tree);
5333e4b17023SJohn Marino extern int is_specialization_of			(tree, tree);
5334e4b17023SJohn Marino extern bool is_specialization_of_friend		(tree, tree);
5335e4b17023SJohn Marino extern tree get_pattern_parm			(tree, tree);
5336e4b17023SJohn Marino extern int comp_template_args			(tree, tree);
5337e4b17023SJohn Marino extern tree maybe_process_partial_specialization (tree);
5338e4b17023SJohn Marino extern tree most_specialized_instantiation	(tree);
5339e4b17023SJohn Marino extern void print_candidates			(tree);
5340e4b17023SJohn Marino extern void instantiate_pending_templates	(int);
5341e4b17023SJohn Marino extern tree tsubst_default_argument		(tree, tree, tree);
5342e4b17023SJohn Marino extern tree tsubst (tree, tree, tsubst_flags_t, tree);
5343e4b17023SJohn Marino extern tree tsubst_copy_and_build		(tree, tree, tsubst_flags_t,
5344e4b17023SJohn Marino 						 tree, bool, bool);
5345e4b17023SJohn Marino extern tree most_general_template		(tree);
5346e4b17023SJohn Marino extern tree get_mostly_instantiated_function_type (tree);
5347e4b17023SJohn Marino extern int problematic_instantiation_changed	(void);
5348e4b17023SJohn Marino extern void record_last_problematic_instantiation (void);
5349e4b17023SJohn Marino extern struct tinst_level *current_instantiation(void);
5350e4b17023SJohn Marino extern tree maybe_get_template_decl_from_type_decl (tree);
5351e4b17023SJohn Marino extern int processing_template_parmlist;
5352e4b17023SJohn Marino extern bool dependent_type_p			(tree);
5353e4b17023SJohn Marino extern bool dependent_scope_p			(tree);
5354e4b17023SJohn Marino extern bool any_dependent_template_arguments_p  (const_tree);
5355e4b17023SJohn Marino extern bool dependent_template_p		(tree);
5356e4b17023SJohn Marino extern bool dependent_template_id_p		(tree, tree);
5357e4b17023SJohn Marino extern bool type_dependent_expression_p		(tree);
5358e4b17023SJohn Marino extern bool any_type_dependent_arguments_p      (const VEC(tree,gc) *);
5359e4b17023SJohn Marino extern bool any_type_dependent_elements_p       (const_tree);
5360e4b17023SJohn Marino extern bool type_dependent_expression_p_push	(tree);
5361e4b17023SJohn Marino extern bool value_dependent_expression_p	(tree);
5362e4b17023SJohn Marino extern bool any_value_dependent_elements_p      (const_tree);
5363e4b17023SJohn Marino extern bool dependent_omp_for_p			(tree, tree, tree, tree);
5364e4b17023SJohn Marino extern tree resolve_typename_type		(tree, bool);
5365e4b17023SJohn Marino extern tree template_for_substitution		(tree);
5366e4b17023SJohn Marino extern tree build_non_dependent_expr		(tree);
5367e4b17023SJohn Marino extern void make_args_non_dependent		(VEC(tree,gc) *);
5368e4b17023SJohn Marino extern bool reregister_specialization		(tree, tree, tree);
5369e4b17023SJohn Marino extern tree fold_non_dependent_expr		(tree);
5370e4b17023SJohn Marino extern bool alias_type_or_template_p            (tree);
5371e4b17023SJohn Marino extern bool alias_template_specialization_p     (tree);
5372e4b17023SJohn Marino extern bool explicit_class_specialization_p     (tree);
5373e4b17023SJohn Marino extern int push_tinst_level                     (tree);
5374e4b17023SJohn Marino extern void pop_tinst_level                     (void);
5375e4b17023SJohn Marino extern struct tinst_level *outermost_tinst_level(void);
5376e4b17023SJohn Marino extern bool parameter_of_template_p		(tree, tree);
5377e4b17023SJohn Marino extern void init_template_processing		(void);
5378e4b17023SJohn Marino extern void print_template_statistics		(void);
5379e4b17023SJohn Marino bool template_template_parameter_p		(const_tree);
5380e4b17023SJohn Marino extern bool primary_template_instantiation_p    (const_tree);
5381e4b17023SJohn Marino extern tree get_primary_template_innermost_parameters	(const_tree);
5382e4b17023SJohn Marino extern tree get_template_parms_at_level (tree, int);
5383e4b17023SJohn Marino extern tree get_template_innermost_arguments	(const_tree);
5384e4b17023SJohn Marino extern tree get_template_argument_pack_elems	(const_tree);
5385e4b17023SJohn Marino extern tree get_function_template_decl		(const_tree);
5386e4b17023SJohn Marino extern tree resolve_nondeduced_context		(tree);
5387e4b17023SJohn Marino extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
5388e4b17023SJohn Marino 
5389e4b17023SJohn Marino /* in repo.c */
5390e4b17023SJohn Marino extern void init_repo				(void);
5391e4b17023SJohn Marino extern int repo_emit_p				(tree);
5392e4b17023SJohn Marino extern bool repo_export_class_p			(const_tree);
5393e4b17023SJohn Marino extern void finish_repo				(void);
5394e4b17023SJohn Marino 
5395e4b17023SJohn Marino /* in rtti.c */
5396e4b17023SJohn Marino /* A vector of all tinfo decls that haven't been emitted yet.  */
5397e4b17023SJohn Marino extern GTY(()) VEC(tree,gc) *unemitted_tinfo_decls;
5398e4b17023SJohn Marino 
5399e4b17023SJohn Marino extern void init_rtti_processing		(void);
5400e4b17023SJohn Marino extern tree build_typeid			(tree);
5401e4b17023SJohn Marino extern tree get_tinfo_decl			(tree);
5402e4b17023SJohn Marino extern tree get_typeid				(tree);
5403e4b17023SJohn Marino extern tree build_headof			(tree);
5404e4b17023SJohn Marino extern tree build_dynamic_cast			(tree, tree, tsubst_flags_t);
5405e4b17023SJohn Marino extern void emit_support_tinfos			(void);
5406e4b17023SJohn Marino extern bool emit_tinfo_decl			(tree);
5407e4b17023SJohn Marino 
5408e4b17023SJohn Marino /* in search.c */
5409e4b17023SJohn Marino extern bool accessible_base_p			(tree, tree, bool);
5410e4b17023SJohn Marino extern tree lookup_base				(tree, tree, base_access,
5411e4b17023SJohn Marino 						 base_kind *);
5412e4b17023SJohn Marino extern tree dcast_base_hint			(tree, tree);
5413e4b17023SJohn Marino extern int accessible_p				(tree, tree, bool);
5414e4b17023SJohn Marino extern tree lookup_field_1			(tree, tree, bool);
5415e4b17023SJohn Marino extern tree lookup_field			(tree, tree, int, bool);
5416e4b17023SJohn Marino extern int lookup_fnfields_1			(tree, tree);
5417e4b17023SJohn Marino extern tree lookup_fnfields_slot		(tree, tree);
5418e4b17023SJohn Marino extern tree lookup_fnfields_slot_nolazy		(tree, tree);
5419e4b17023SJohn Marino extern int class_method_index_for_fn		(tree, tree);
5420e4b17023SJohn Marino extern tree lookup_fnfields			(tree, tree, int);
5421e4b17023SJohn Marino extern tree lookup_member			(tree, tree, int, bool,
5422e4b17023SJohn Marino 						 tsubst_flags_t);
5423e4b17023SJohn Marino extern int look_for_overrides			(tree, tree);
5424e4b17023SJohn Marino extern void get_pure_virtuals			(tree);
5425e4b17023SJohn Marino extern void maybe_suppress_debug_info		(tree);
5426e4b17023SJohn Marino extern void note_debug_info_needed		(tree);
5427e4b17023SJohn Marino extern void print_search_statistics		(void);
5428e4b17023SJohn Marino extern void reinit_search_statistics		(void);
5429e4b17023SJohn Marino extern tree current_scope			(void);
5430e4b17023SJohn Marino extern int at_function_scope_p			(void);
5431e4b17023SJohn Marino extern bool at_class_scope_p			(void);
5432e4b17023SJohn Marino extern bool at_namespace_scope_p		(void);
5433e4b17023SJohn Marino extern tree context_for_name_lookup		(tree);
5434e4b17023SJohn Marino extern tree lookup_conversions			(tree);
5435e4b17023SJohn Marino extern tree binfo_from_vbase			(tree);
5436e4b17023SJohn Marino extern tree binfo_for_vbase			(tree, tree);
5437e4b17023SJohn Marino extern tree look_for_overrides_here		(tree, tree);
5438e4b17023SJohn Marino #define dfs_skip_bases ((tree)1)
5439e4b17023SJohn Marino extern tree dfs_walk_all (tree, tree (*) (tree, void *),
5440e4b17023SJohn Marino 			  tree (*) (tree, void *), void *);
5441e4b17023SJohn Marino extern tree dfs_walk_once (tree, tree (*) (tree, void *),
5442e4b17023SJohn Marino 			   tree (*) (tree, void *), void *);
5443e4b17023SJohn Marino extern tree binfo_via_virtual			(tree, tree);
5444e4b17023SJohn Marino extern tree build_baselink			(tree, tree, tree, tree);
5445e4b17023SJohn Marino extern tree adjust_result_of_qualified_name_lookup
5446e4b17023SJohn Marino 						(tree, tree, tree);
5447e4b17023SJohn Marino extern tree copied_binfo			(tree, tree);
5448e4b17023SJohn Marino extern tree original_binfo			(tree, tree);
5449e4b17023SJohn Marino extern int shared_member_p			(tree);
5450e4b17023SJohn Marino 
5451e4b17023SJohn Marino 
5452e4b17023SJohn Marino /* The representation of a deferred access check.  */
5453e4b17023SJohn Marino 
5454e4b17023SJohn Marino typedef struct GTY(()) deferred_access_check {
5455e4b17023SJohn Marino   /* The base class in which the declaration is referenced. */
5456e4b17023SJohn Marino   tree binfo;
5457e4b17023SJohn Marino   /* The declaration whose access must be checked.  */
5458e4b17023SJohn Marino   tree decl;
5459e4b17023SJohn Marino   /* The declaration that should be used in the error message.  */
5460e4b17023SJohn Marino   tree diag_decl;
5461e4b17023SJohn Marino } deferred_access_check;
5462e4b17023SJohn Marino DEF_VEC_O(deferred_access_check);
5463e4b17023SJohn Marino DEF_VEC_ALLOC_O(deferred_access_check,gc);
5464e4b17023SJohn Marino 
5465e4b17023SJohn Marino /* in semantics.c */
5466e4b17023SJohn Marino extern void push_deferring_access_checks	(deferring_kind);
5467e4b17023SJohn Marino extern void resume_deferring_access_checks	(void);
5468e4b17023SJohn Marino extern void stop_deferring_access_checks	(void);
5469e4b17023SJohn Marino extern void pop_deferring_access_checks		(void);
5470e4b17023SJohn Marino extern VEC (deferred_access_check,gc)* get_deferred_access_checks		(void);
5471e4b17023SJohn Marino extern void pop_to_parent_deferring_access_checks (void);
5472e4b17023SJohn Marino extern void perform_access_checks		(VEC (deferred_access_check,gc)*);
5473e4b17023SJohn Marino extern void perform_deferred_access_checks	(void);
5474e4b17023SJohn Marino extern void perform_or_defer_access_check	(tree, tree, tree);
5475e4b17023SJohn Marino extern bool speculative_access_check		(tree, tree, tree, bool);
5476e4b17023SJohn Marino extern int stmts_are_full_exprs_p		(void);
5477e4b17023SJohn Marino extern void init_cp_semantics			(void);
5478e4b17023SJohn Marino extern tree do_poplevel				(tree);
5479e4b17023SJohn Marino extern void add_decl_expr			(tree);
5480e4b17023SJohn Marino extern tree maybe_cleanup_point_expr_void	(tree);
5481e4b17023SJohn Marino extern tree finish_expr_stmt			(tree);
5482e4b17023SJohn Marino extern tree begin_if_stmt			(void);
5483e4b17023SJohn Marino extern void finish_if_stmt_cond			(tree, tree);
5484e4b17023SJohn Marino extern tree finish_then_clause			(tree);
5485e4b17023SJohn Marino extern void begin_else_clause			(tree);
5486e4b17023SJohn Marino extern void finish_else_clause			(tree);
5487e4b17023SJohn Marino extern void finish_if_stmt			(tree);
5488e4b17023SJohn Marino extern tree begin_while_stmt			(void);
5489e4b17023SJohn Marino extern void finish_while_stmt_cond		(tree, tree);
5490e4b17023SJohn Marino extern void finish_while_stmt			(tree);
5491e4b17023SJohn Marino extern tree begin_do_stmt			(void);
5492e4b17023SJohn Marino extern void finish_do_body			(tree);
5493e4b17023SJohn Marino extern void finish_do_stmt			(tree, tree);
5494e4b17023SJohn Marino extern tree finish_return_stmt			(tree);
5495e4b17023SJohn Marino extern tree begin_for_scope			(tree *);
5496e4b17023SJohn Marino extern tree begin_for_stmt			(tree, tree);
5497e4b17023SJohn Marino extern void finish_for_init_stmt		(tree);
5498e4b17023SJohn Marino extern void finish_for_cond			(tree, tree);
5499e4b17023SJohn Marino extern void finish_for_expr			(tree, tree);
5500e4b17023SJohn Marino extern void finish_for_stmt			(tree);
5501e4b17023SJohn Marino extern tree begin_range_for_stmt		(tree, tree);
5502e4b17023SJohn Marino extern void finish_range_for_decl		(tree, tree, tree);
5503e4b17023SJohn Marino extern void finish_range_for_stmt		(tree);
5504e4b17023SJohn Marino extern tree finish_break_stmt			(void);
5505e4b17023SJohn Marino extern tree finish_continue_stmt		(void);
5506e4b17023SJohn Marino extern tree begin_switch_stmt			(void);
5507e4b17023SJohn Marino extern void finish_switch_cond			(tree, tree);
5508e4b17023SJohn Marino extern void finish_switch_stmt			(tree);
5509e4b17023SJohn Marino extern tree finish_goto_stmt			(tree);
5510e4b17023SJohn Marino extern tree begin_try_block			(void);
5511e4b17023SJohn Marino extern void finish_try_block			(tree);
5512e4b17023SJohn Marino extern void finish_handler_sequence		(tree);
5513e4b17023SJohn Marino extern tree begin_function_try_block		(tree *);
5514e4b17023SJohn Marino extern void finish_function_try_block		(tree);
5515e4b17023SJohn Marino extern void finish_function_handler_sequence    (tree, tree);
5516e4b17023SJohn Marino extern void finish_cleanup_try_block		(tree);
5517e4b17023SJohn Marino extern tree begin_handler			(void);
5518e4b17023SJohn Marino extern void finish_handler_parms		(tree, tree);
5519e4b17023SJohn Marino extern void finish_handler			(tree);
5520e4b17023SJohn Marino extern void finish_cleanup			(tree, tree);
5521e4b17023SJohn Marino extern bool literal_type_p (tree);
5522e4b17023SJohn Marino extern tree register_constexpr_fundef (tree, tree);
5523e4b17023SJohn Marino extern bool check_constexpr_ctor_body (tree, tree);
5524e4b17023SJohn Marino extern tree ensure_literal_type_for_constexpr_object (tree);
5525e4b17023SJohn Marino extern bool potential_constant_expression (tree);
5526e4b17023SJohn Marino extern bool potential_rvalue_constant_expression (tree);
5527e4b17023SJohn Marino extern bool require_potential_constant_expression (tree);
5528e4b17023SJohn Marino extern bool require_potential_rvalue_constant_expression (tree);
5529e4b17023SJohn Marino extern tree cxx_constant_value (tree);
5530e4b17023SJohn Marino extern tree maybe_constant_value (tree);
5531e4b17023SJohn Marino extern tree maybe_constant_init (tree);
5532e4b17023SJohn Marino extern bool is_sub_constant_expr (tree);
5533e4b17023SJohn Marino extern bool reduced_constant_expression_p (tree);
5534e4b17023SJohn Marino extern void explain_invalid_constexpr_fn (tree);
5535e4b17023SJohn Marino extern VEC(tree,heap)* cx_error_context (void);
5536e4b17023SJohn Marino 
5537e4b17023SJohn Marino enum {
5538e4b17023SJohn Marino   BCS_NO_SCOPE = 1,
5539e4b17023SJohn Marino   BCS_TRY_BLOCK = 2,
5540e4b17023SJohn Marino   BCS_FN_BODY = 4
5541e4b17023SJohn Marino };
5542e4b17023SJohn Marino extern tree begin_compound_stmt			(unsigned int);
5543e4b17023SJohn Marino 
5544e4b17023SJohn Marino extern void finish_compound_stmt		(tree);
5545e4b17023SJohn Marino extern tree finish_asm_stmt			(int, tree, tree, tree, tree,
5546e4b17023SJohn Marino 						 tree);
5547e4b17023SJohn Marino extern tree finish_label_stmt			(tree);
5548e4b17023SJohn Marino extern void finish_label_decl			(tree);
5549e4b17023SJohn Marino extern tree finish_parenthesized_expr		(tree);
5550e4b17023SJohn Marino extern tree finish_non_static_data_member       (tree, tree, tree);
5551e4b17023SJohn Marino extern tree begin_stmt_expr			(void);
5552e4b17023SJohn Marino extern tree finish_stmt_expr_expr		(tree, tree);
5553e4b17023SJohn Marino extern tree finish_stmt_expr			(tree, bool);
5554e4b17023SJohn Marino extern tree stmt_expr_value_expr		(tree);
5555e4b17023SJohn Marino bool empty_expr_stmt_p				(tree);
5556e4b17023SJohn Marino extern tree perform_koenig_lookup		(tree, VEC(tree,gc) *, bool,
5557e4b17023SJohn Marino 						 tsubst_flags_t);
5558e4b17023SJohn Marino extern tree finish_call_expr			(tree, VEC(tree,gc) **, bool,
5559e4b17023SJohn Marino 						 bool, tsubst_flags_t);
5560e4b17023SJohn Marino extern tree finish_increment_expr		(tree, enum tree_code);
5561e4b17023SJohn Marino extern tree finish_this_expr			(void);
5562e4b17023SJohn Marino extern tree finish_pseudo_destructor_expr       (tree, tree, tree);
5563e4b17023SJohn Marino extern tree finish_unary_op_expr		(enum tree_code, tree);
5564e4b17023SJohn Marino extern tree finish_compound_literal		(tree, tree, tsubst_flags_t);
5565e4b17023SJohn Marino extern tree finish_fname			(tree);
5566e4b17023SJohn Marino extern void finish_translation_unit		(void);
5567e4b17023SJohn Marino extern tree finish_template_type_parm		(tree, tree);
5568e4b17023SJohn Marino extern tree finish_template_template_parm       (tree, tree);
5569e4b17023SJohn Marino extern tree begin_class_definition		(tree);
5570e4b17023SJohn Marino extern void finish_template_decl		(tree);
5571e4b17023SJohn Marino extern tree finish_template_type		(tree, tree, int);
5572e4b17023SJohn Marino extern tree finish_base_specifier		(tree, tree, bool);
5573e4b17023SJohn Marino extern void finish_member_declaration		(tree);
5574e4b17023SJohn Marino extern tree finish_id_expression		(tree, tree, tree,
5575e4b17023SJohn Marino 						 cp_id_kind *,
5576e4b17023SJohn Marino 						 bool, bool, bool *,
5577e4b17023SJohn Marino 						 bool, bool, bool, bool,
5578e4b17023SJohn Marino 						 const char **,
5579e4b17023SJohn Marino                                                  location_t);
5580e4b17023SJohn Marino extern tree finish_typeof			(tree);
5581e4b17023SJohn Marino extern tree finish_underlying_type	        (tree);
5582e4b17023SJohn Marino extern tree calculate_bases                     (tree);
5583e4b17023SJohn Marino extern tree finish_bases                        (tree, bool);
5584e4b17023SJohn Marino extern tree calculate_direct_bases              (tree);
5585e4b17023SJohn Marino extern tree finish_offsetof			(tree);
5586e4b17023SJohn Marino extern void finish_decl_cleanup			(tree, tree);
5587e4b17023SJohn Marino extern void finish_eh_cleanup			(tree);
5588e4b17023SJohn Marino extern void emit_associated_thunks		(tree);
5589e4b17023SJohn Marino extern void finish_mem_initializers		(tree);
5590e4b17023SJohn Marino extern tree check_template_template_default_arg (tree);
5591e4b17023SJohn Marino extern bool expand_or_defer_fn_1		(tree);
5592e4b17023SJohn Marino extern void expand_or_defer_fn			(tree);
5593e4b17023SJohn Marino extern void add_typedef_to_current_template_for_access_check (tree, tree,
5594e4b17023SJohn Marino 							      location_t);
5595e4b17023SJohn Marino extern void check_accessibility_of_qualified_id (tree, tree, tree);
5596e4b17023SJohn Marino extern tree finish_qualified_id_expr		(tree, tree, bool, bool,
5597e4b17023SJohn Marino 						 bool, bool);
5598e4b17023SJohn Marino extern void simplify_aggr_init_expr		(tree *);
5599e4b17023SJohn Marino extern void finalize_nrv			(tree *, tree, tree);
5600e4b17023SJohn Marino extern void note_decl_for_pch			(tree);
5601e4b17023SJohn Marino extern tree finish_omp_clauses			(tree);
5602e4b17023SJohn Marino extern void finish_omp_threadprivate		(tree);
5603e4b17023SJohn Marino extern tree begin_omp_structured_block		(void);
5604e4b17023SJohn Marino extern tree finish_omp_structured_block		(tree);
5605e4b17023SJohn Marino extern tree begin_omp_parallel			(void);
5606e4b17023SJohn Marino extern tree finish_omp_parallel			(tree, tree);
5607e4b17023SJohn Marino extern tree begin_omp_task			(void);
5608e4b17023SJohn Marino extern tree finish_omp_task			(tree, tree);
5609e4b17023SJohn Marino extern tree finish_omp_for			(location_t, tree, tree,
5610e4b17023SJohn Marino 						 tree, tree, tree, tree, tree);
5611e4b17023SJohn Marino extern void finish_omp_atomic			(enum tree_code, enum tree_code,
5612e4b17023SJohn Marino 						 tree, tree, tree, tree, tree);
5613e4b17023SJohn Marino extern void finish_omp_barrier			(void);
5614e4b17023SJohn Marino extern void finish_omp_flush			(void);
5615e4b17023SJohn Marino extern void finish_omp_taskwait			(void);
5616e4b17023SJohn Marino extern tree begin_transaction_stmt		(location_t, tree *, int);
5617e4b17023SJohn Marino extern void finish_transaction_stmt		(tree, tree, int, tree);
5618e4b17023SJohn Marino extern tree build_transaction_expr		(location_t, tree, int, tree);
5619e4b17023SJohn Marino extern void finish_omp_taskyield		(void);
5620e4b17023SJohn Marino extern bool cxx_omp_create_clause_info		(tree, tree, bool, bool, bool);
5621e4b17023SJohn Marino extern tree baselink_for_fns                    (tree);
5622e4b17023SJohn Marino extern void finish_static_assert                (tree, tree, location_t,
5623e4b17023SJohn Marino                                                  bool);
5624e4b17023SJohn Marino extern tree finish_decltype_type                (tree, bool, tsubst_flags_t);
5625e4b17023SJohn Marino extern tree finish_trait_expr			(enum cp_trait_kind, tree, tree);
5626e4b17023SJohn Marino extern tree build_lambda_expr                   (void);
5627e4b17023SJohn Marino extern tree build_lambda_object			(tree);
5628e4b17023SJohn Marino extern tree begin_lambda_type                   (tree);
5629e4b17023SJohn Marino extern tree lambda_capture_field_type		(tree);
5630e4b17023SJohn Marino extern tree lambda_return_type			(tree);
5631e4b17023SJohn Marino extern tree lambda_proxy_type			(tree);
5632e4b17023SJohn Marino extern tree lambda_function			(tree);
5633e4b17023SJohn Marino extern void apply_lambda_return_type            (tree, tree);
5634e4b17023SJohn Marino extern tree add_capture                         (tree, tree, tree, bool, bool);
5635e4b17023SJohn Marino extern tree add_default_capture                 (tree, tree, tree);
5636e4b17023SJohn Marino extern tree build_capture_proxy			(tree);
5637e4b17023SJohn Marino extern void insert_capture_proxy		(tree);
5638e4b17023SJohn Marino extern void insert_pending_capture_proxies	(void);
5639e4b17023SJohn Marino extern bool is_capture_proxy			(tree);
5640e4b17023SJohn Marino extern bool is_normal_capture_proxy             (tree);
5641e4b17023SJohn Marino extern void register_capture_members		(tree);
5642e4b17023SJohn Marino extern tree lambda_expr_this_capture            (tree);
5643e4b17023SJohn Marino extern tree nonlambda_method_basetype		(void);
5644e4b17023SJohn Marino extern void maybe_add_lambda_conv_op            (tree);
5645e4b17023SJohn Marino extern bool is_lambda_ignored_entity            (tree);
5646e4b17023SJohn Marino 
5647e4b17023SJohn Marino /* in tree.c */
5648e4b17023SJohn Marino extern int cp_tree_operand_length		(const_tree);
5649e4b17023SJohn Marino void cp_free_lang_data 				(tree t);
5650e4b17023SJohn Marino extern tree force_target_expr			(tree, tree, tsubst_flags_t);
5651e4b17023SJohn Marino extern tree build_target_expr_with_type		(tree, tree, tsubst_flags_t);
5652e4b17023SJohn Marino extern void lang_check_failed			(const char *, int,
5653e4b17023SJohn Marino 						 const char *) ATTRIBUTE_NORETURN;
5654e4b17023SJohn Marino extern tree stabilize_expr			(tree, tree *);
5655e4b17023SJohn Marino extern void stabilize_call			(tree, tree *);
5656e4b17023SJohn Marino extern void stabilize_aggr_init			(tree, tree *);
5657e4b17023SJohn Marino extern bool stabilize_init			(tree, tree *);
5658e4b17023SJohn Marino extern tree add_stmt_to_compound		(tree, tree);
5659e4b17023SJohn Marino extern void init_tree				(void);
5660e4b17023SJohn Marino extern bool pod_type_p				(const_tree);
5661e4b17023SJohn Marino extern bool layout_pod_type_p			(const_tree);
5662e4b17023SJohn Marino extern bool std_layout_type_p			(const_tree);
5663e4b17023SJohn Marino extern bool trivial_type_p			(const_tree);
5664e4b17023SJohn Marino extern bool trivially_copyable_p		(const_tree);
5665e4b17023SJohn Marino extern bool type_has_nontrivial_default_init	(const_tree);
5666e4b17023SJohn Marino extern bool type_has_nontrivial_copy_init	(const_tree);
5667e4b17023SJohn Marino extern bool class_tmpl_impl_spec_p		(const_tree);
5668e4b17023SJohn Marino extern int zero_init_p				(const_tree);
5669e4b17023SJohn Marino extern tree strip_typedefs			(tree);
56705ce9237cSJohn Marino extern tree strip_typedefs_expr			(tree);
5671e4b17023SJohn Marino extern tree copy_binfo				(tree, tree, tree,
5672e4b17023SJohn Marino 						 tree *, int);
5673e4b17023SJohn Marino extern int member_p				(const_tree);
5674e4b17023SJohn Marino extern cp_lvalue_kind real_lvalue_p		(const_tree);
5675e4b17023SJohn Marino extern cp_lvalue_kind lvalue_kind		(const_tree);
5676e4b17023SJohn Marino extern bool lvalue_or_rvalue_with_address_p	(const_tree);
5677e4b17023SJohn Marino extern bool builtin_valid_in_constant_expr_p    (const_tree);
5678e4b17023SJohn Marino extern tree build_min				(enum tree_code, tree, ...);
5679e4b17023SJohn Marino extern tree build_min_nt			(enum tree_code, ...);
5680e4b17023SJohn Marino extern tree build_min_non_dep			(enum tree_code, tree, ...);
5681e4b17023SJohn Marino extern tree build_min_non_dep_call_vec		(tree, tree, VEC(tree,gc) *);
5682e4b17023SJohn Marino extern tree build_cplus_new			(tree, tree, tsubst_flags_t);
5683e4b17023SJohn Marino extern tree build_aggr_init_expr		(tree, tree, tsubst_flags_t);
5684e4b17023SJohn Marino extern tree get_target_expr			(tree);
5685e4b17023SJohn Marino extern tree get_target_expr_sfinae		(tree, tsubst_flags_t);
5686e4b17023SJohn Marino extern tree build_cplus_array_type		(tree, tree);
5687e4b17023SJohn Marino extern tree build_array_of_n_type		(tree, int);
5688e4b17023SJohn Marino extern tree build_array_copy			(tree);
5689e4b17023SJohn Marino extern tree build_vec_init_expr			(tree, tree, tsubst_flags_t);
5690e4b17023SJohn Marino extern void diagnose_non_constexpr_vec_init	(tree);
5691e4b17023SJohn Marino extern tree hash_tree_cons			(tree, tree, tree);
5692e4b17023SJohn Marino extern tree hash_tree_chain			(tree, tree);
5693e4b17023SJohn Marino extern tree build_qualified_name		(tree, tree, tree, bool);
5694e4b17023SJohn Marino extern int is_overloaded_fn			(tree);
5695e4b17023SJohn Marino extern tree dependent_name			(tree);
5696e4b17023SJohn Marino extern tree get_fns				(tree);
5697e4b17023SJohn Marino extern tree get_first_fn			(tree);
5698e4b17023SJohn Marino extern tree ovl_cons				(tree, tree);
5699e4b17023SJohn Marino extern tree build_overload			(tree, tree);
5700e4b17023SJohn Marino extern tree ovl_scope				(tree);
5701e4b17023SJohn Marino extern bool non_static_member_function_p        (tree);
5702e4b17023SJohn Marino extern const char *cxx_printable_name		(tree, int);
5703e4b17023SJohn Marino extern const char *cxx_printable_name_translate	(tree, int);
5704e4b17023SJohn Marino extern tree build_exception_variant		(tree, tree);
5705e4b17023SJohn Marino extern tree bind_template_template_parm		(tree, tree);
5706e4b17023SJohn Marino extern tree array_type_nelts_total		(tree);
5707e4b17023SJohn Marino extern tree array_type_nelts_top		(tree);
5708e4b17023SJohn Marino extern tree break_out_target_exprs		(tree);
5709e4b17023SJohn Marino extern tree get_type_decl			(tree);
5710e4b17023SJohn Marino extern tree decl_namespace_context		(tree);
5711e4b17023SJohn Marino extern bool decl_anon_ns_mem_p			(const_tree);
5712e4b17023SJohn Marino extern tree lvalue_type				(tree);
5713e4b17023SJohn Marino extern tree error_type				(tree);
5714e4b17023SJohn Marino extern int varargs_function_p			(const_tree);
5715e4b17023SJohn Marino extern bool really_overloaded_fn		(tree);
5716e4b17023SJohn Marino extern bool cp_tree_equal			(tree, tree);
5717e4b17023SJohn Marino extern tree no_linkage_check			(tree, bool);
5718e4b17023SJohn Marino extern void debug_binfo				(tree);
5719e4b17023SJohn Marino extern tree build_dummy_object			(tree);
5720e4b17023SJohn Marino extern tree maybe_dummy_object			(tree, tree *);
5721e4b17023SJohn Marino extern int is_dummy_object			(const_tree);
5722e4b17023SJohn Marino extern const struct attribute_spec cxx_attribute_table[];
5723e4b17023SJohn Marino extern tree make_ptrmem_cst			(tree, tree);
5724e4b17023SJohn Marino extern tree cp_build_type_attribute_variant     (tree, tree);
5725e4b17023SJohn Marino extern tree cp_build_reference_type		(tree, bool);
5726e4b17023SJohn Marino extern tree move				(tree);
5727e4b17023SJohn Marino extern tree cp_build_qualified_type_real	(tree, int, tsubst_flags_t);
5728e4b17023SJohn Marino #define cp_build_qualified_type(TYPE, QUALS) \
5729e4b17023SJohn Marino   cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
5730e4b17023SJohn Marino extern bool cv_qualified_p			(const_tree);
5731e4b17023SJohn Marino extern tree cv_unqualified			(tree);
5732e4b17023SJohn Marino extern special_function_kind special_function_p (const_tree);
5733e4b17023SJohn Marino extern int count_trees				(tree);
5734e4b17023SJohn Marino extern int char_type_p				(tree);
5735e4b17023SJohn Marino extern void verify_stmt_tree			(tree);
5736e4b17023SJohn Marino extern linkage_kind decl_linkage		(tree);
5737e4b17023SJohn Marino extern duration_kind decl_storage_duration	(tree);
5738e4b17023SJohn Marino extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
5739e4b17023SJohn Marino 			      void*, struct pointer_set_t*);
5740e4b17023SJohn Marino #define cp_walk_tree(a,b,c,d) \
5741e4b17023SJohn Marino 	walk_tree_1 (a, b, c, d, cp_walk_subtrees)
5742e4b17023SJohn Marino #define cp_walk_tree_without_duplicates(a,b,c) \
5743e4b17023SJohn Marino 	walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees)
5744e4b17023SJohn Marino extern tree fold_if_not_in_template		(tree);
5745e4b17023SJohn Marino extern tree rvalue				(tree);
5746e4b17023SJohn Marino extern tree convert_bitfield_to_declared_type   (tree);
5747e4b17023SJohn Marino extern tree cp_save_expr			(tree);
5748e4b17023SJohn Marino extern bool cast_valid_in_integral_constant_expression_p (tree);
5749e4b17023SJohn Marino extern bool cxx_type_hash_eq			(const_tree, const_tree);
5750e4b17023SJohn Marino 
5751e4b17023SJohn Marino extern void cxx_print_statistics		(void);
5752e4b17023SJohn Marino 
5753e4b17023SJohn Marino /* in ptree.c */
5754e4b17023SJohn Marino extern void cxx_print_xnode			(FILE *, tree, int);
5755e4b17023SJohn Marino extern void cxx_print_decl			(FILE *, tree, int);
5756e4b17023SJohn Marino extern void cxx_print_type			(FILE *, tree, int);
5757e4b17023SJohn Marino extern void cxx_print_identifier		(FILE *, tree, int);
5758e4b17023SJohn Marino extern void cxx_print_error_function		(diagnostic_context *,
5759e4b17023SJohn Marino 						 const char *,
5760e4b17023SJohn Marino 						 struct diagnostic_info *);
5761e4b17023SJohn Marino 
5762e4b17023SJohn Marino /* in typeck.c */
5763e4b17023SJohn Marino extern bool cxx_mark_addressable		(tree);
5764e4b17023SJohn Marino extern int string_conv_p			(const_tree, const_tree, int);
5765e4b17023SJohn Marino extern tree cp_truthvalue_conversion		(tree);
5766e4b17023SJohn Marino extern tree condition_conversion		(tree);
5767e4b17023SJohn Marino extern tree require_complete_type		(tree);
5768e4b17023SJohn Marino extern tree require_complete_type_sfinae	(tree, tsubst_flags_t);
5769e4b17023SJohn Marino extern tree complete_type			(tree);
5770e4b17023SJohn Marino extern tree complete_type_or_else		(tree, tree);
5771e4b17023SJohn Marino extern tree complete_type_or_maybe_complain	(tree, tree, tsubst_flags_t);
5772e4b17023SJohn Marino extern int type_unknown_p			(const_tree);
5773e4b17023SJohn Marino enum { ce_derived, ce_normal, ce_exact };
5774e4b17023SJohn Marino extern bool comp_except_specs			(const_tree, const_tree, int);
5775e4b17023SJohn Marino extern bool comptypes				(tree, tree, int);
5776e4b17023SJohn Marino extern bool same_type_ignoring_top_level_qualifiers_p (tree, tree);
5777e4b17023SJohn Marino extern bool compparms				(const_tree, const_tree);
5778e4b17023SJohn Marino extern int comp_cv_qualification		(const_tree, const_tree);
5779e4b17023SJohn Marino extern int comp_cv_qual_signature		(tree, tree);
5780e4b17023SJohn Marino extern tree cxx_sizeof_or_alignof_expr		(tree, enum tree_code, bool);
5781e4b17023SJohn Marino extern tree cxx_sizeof_or_alignof_type		(tree, enum tree_code, bool);
5782e4b17023SJohn Marino extern tree cxx_sizeof_nowarn                   (tree);
5783e4b17023SJohn Marino extern tree is_bitfield_expr_with_lowered_type  (const_tree);
5784e4b17023SJohn Marino extern tree unlowered_expr_type                 (const_tree);
5785e4b17023SJohn Marino extern tree decay_conversion			(tree);
5786e4b17023SJohn Marino extern tree build_class_member_access_expr      (tree, tree, tree, bool,
5787e4b17023SJohn Marino 						 tsubst_flags_t);
5788e4b17023SJohn Marino extern tree finish_class_member_access_expr     (tree, tree, bool,
5789e4b17023SJohn Marino 						 tsubst_flags_t);
5790e4b17023SJohn Marino extern tree build_x_indirect_ref		(tree, ref_operator,
5791e4b17023SJohn Marino                                                  tsubst_flags_t);
5792e4b17023SJohn Marino extern tree cp_build_indirect_ref		(tree, ref_operator,
5793e4b17023SJohn Marino                                                  tsubst_flags_t);
5794e4b17023SJohn Marino extern tree build_array_ref			(location_t, tree, tree);
5795e4b17023SJohn Marino extern tree cp_build_array_ref			(location_t, tree, tree,
5796e4b17023SJohn Marino 						 tsubst_flags_t);
5797e4b17023SJohn Marino extern tree get_member_function_from_ptrfunc	(tree *, tree);
5798e4b17023SJohn Marino extern tree cp_build_function_call              (tree, tree, tsubst_flags_t);
5799e4b17023SJohn Marino extern tree cp_build_function_call_nary         (tree, tsubst_flags_t, ...)
5800e4b17023SJohn Marino 						ATTRIBUTE_SENTINEL;
5801e4b17023SJohn Marino extern tree cp_build_function_call_vec		(tree, VEC(tree,gc) **,
5802e4b17023SJohn Marino 						 tsubst_flags_t);
5803e4b17023SJohn Marino extern tree build_x_binary_op			(enum tree_code, tree,
5804e4b17023SJohn Marino 						 enum tree_code, tree,
5805e4b17023SJohn Marino 						 enum tree_code, tree *,
5806e4b17023SJohn Marino 						 tsubst_flags_t);
5807e4b17023SJohn Marino extern tree build_x_array_ref			(tree, tree, tsubst_flags_t);
5808e4b17023SJohn Marino extern tree build_x_unary_op			(enum tree_code, tree,
5809e4b17023SJohn Marino                                                  tsubst_flags_t);
5810e4b17023SJohn Marino extern tree cp_build_addr_expr			(tree, tsubst_flags_t);
5811e4b17023SJohn Marino extern tree cp_build_addr_expr_strict		(tree, tsubst_flags_t);
5812e4b17023SJohn Marino extern tree cp_build_unary_op                   (enum tree_code, tree, int,
5813e4b17023SJohn Marino                                                  tsubst_flags_t);
5814e4b17023SJohn Marino extern tree unary_complex_lvalue		(enum tree_code, tree);
5815e4b17023SJohn Marino extern tree build_x_conditional_expr		(tree, tree, tree,
5816e4b17023SJohn Marino                                                  tsubst_flags_t);
5817e4b17023SJohn Marino extern tree build_x_compound_expr_from_list	(tree, expr_list_kind,
5818e4b17023SJohn Marino 						 tsubst_flags_t);
5819e4b17023SJohn Marino extern tree build_x_compound_expr_from_vec	(VEC(tree,gc) *, const char *);
5820e4b17023SJohn Marino extern tree build_x_compound_expr		(tree, tree, tsubst_flags_t);
5821e4b17023SJohn Marino extern tree build_compound_expr                 (location_t, tree, tree);
5822e4b17023SJohn Marino extern tree cp_build_compound_expr		(tree, tree, tsubst_flags_t);
5823e4b17023SJohn Marino extern tree build_static_cast			(tree, tree, tsubst_flags_t);
5824e4b17023SJohn Marino extern tree build_reinterpret_cast		(tree, tree, tsubst_flags_t);
5825e4b17023SJohn Marino extern tree build_const_cast			(tree, tree, tsubst_flags_t);
5826e4b17023SJohn Marino extern tree build_c_cast			(location_t, tree, tree);
5827e4b17023SJohn Marino extern tree cp_build_c_cast			(tree, tree, tsubst_flags_t);
5828e4b17023SJohn Marino extern tree build_x_modify_expr			(tree, enum tree_code, tree,
5829e4b17023SJohn Marino 						 tsubst_flags_t);
5830e4b17023SJohn Marino extern tree cp_build_modify_expr		(tree, enum tree_code, tree,
5831e4b17023SJohn Marino 						 tsubst_flags_t);
5832e4b17023SJohn Marino extern tree convert_for_initialization		(tree, tree, tree, int,
5833e4b17023SJohn Marino 						 impl_conv_rhs, tree, int,
5834e4b17023SJohn Marino                                                  tsubst_flags_t);
5835e4b17023SJohn Marino extern int comp_ptr_ttypes			(tree, tree);
5836e4b17023SJohn Marino extern bool comp_ptr_ttypes_const		(tree, tree);
5837e4b17023SJohn Marino extern bool error_type_p			(const_tree);
5838e4b17023SJohn Marino extern int ptr_reasonably_similar		(const_tree, const_tree);
5839e4b17023SJohn Marino extern tree build_ptrmemfunc			(tree, tree, int, bool,
5840e4b17023SJohn Marino 						 tsubst_flags_t);
5841e4b17023SJohn Marino extern int cp_type_quals			(const_tree);
5842e4b17023SJohn Marino extern int type_memfn_quals			(const_tree);
5843e4b17023SJohn Marino extern tree apply_memfn_quals			(tree, cp_cv_quals);
5844e4b17023SJohn Marino extern bool cp_has_mutable_p			(const_tree);
5845e4b17023SJohn Marino extern bool at_least_as_qualified_p		(const_tree, const_tree);
5846e4b17023SJohn Marino extern void cp_apply_type_quals_to_decl		(int, tree);
5847e4b17023SJohn Marino extern tree build_ptrmemfunc1			(tree, tree, tree);
5848e4b17023SJohn Marino extern void expand_ptrmemfunc_cst		(tree, tree *, tree *);
5849e4b17023SJohn Marino extern tree type_after_usual_arithmetic_conversions (tree, tree);
5850e4b17023SJohn Marino extern tree common_pointer_type                 (tree, tree);
5851e4b17023SJohn Marino extern tree composite_pointer_type		(tree, tree, tree, tree,
5852e4b17023SJohn Marino 						 composite_pointer_operation,
5853e4b17023SJohn Marino 						 tsubst_flags_t);
5854e4b17023SJohn Marino extern tree merge_types				(tree, tree);
5855e4b17023SJohn Marino extern tree strip_array_domain			(tree);
5856e4b17023SJohn Marino extern tree check_return_expr			(tree, bool *);
5857e4b17023SJohn Marino extern tree cp_build_binary_op                  (location_t,
5858e4b17023SJohn Marino 						 enum tree_code, tree, tree,
5859e4b17023SJohn Marino 						 tsubst_flags_t);
5860e4b17023SJohn Marino #define cxx_sizeof(T)  cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
5861e4b17023SJohn Marino extern tree build_ptrmemfunc_access_expr	(tree, tree);
5862e4b17023SJohn Marino extern tree build_address			(tree);
5863e4b17023SJohn Marino extern tree build_typed_address			(tree, tree);
5864e4b17023SJohn Marino extern tree build_nop				(tree, tree);
5865e4b17023SJohn Marino extern tree non_reference			(tree);
5866e4b17023SJohn Marino extern tree lookup_anon_field			(tree, tree);
5867e4b17023SJohn Marino extern bool invalid_nonstatic_memfn_p		(const_tree, tsubst_flags_t);
5868e4b17023SJohn Marino extern tree convert_member_func_to_ptr		(tree, tree);
5869e4b17023SJohn Marino extern tree convert_ptrmem			(tree, tree, bool, bool,
5870e4b17023SJohn Marino 						 tsubst_flags_t);
5871e4b17023SJohn Marino extern int lvalue_or_else			(tree, enum lvalue_use,
5872e4b17023SJohn Marino                                                  tsubst_flags_t);
5873e4b17023SJohn Marino extern void check_template_keyword		(tree);
5874e4b17023SJohn Marino extern bool check_raw_literal_operator		(const_tree decl);
5875e4b17023SJohn Marino extern bool check_literal_operator_args		(const_tree, bool *, bool *);
5876e4b17023SJohn Marino 
5877e4b17023SJohn Marino /* in typeck2.c */
5878e4b17023SJohn Marino extern void require_complete_eh_spec_types	(tree, tree);
5879e4b17023SJohn Marino extern void cxx_incomplete_type_diagnostic	(const_tree, const_tree, diagnostic_t);
5880e4b17023SJohn Marino #undef cxx_incomplete_type_error
5881e4b17023SJohn Marino extern void cxx_incomplete_type_error		(const_tree, const_tree);
5882e4b17023SJohn Marino #define cxx_incomplete_type_error(V,T) \
5883e4b17023SJohn Marino   (cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
5884e4b17023SJohn Marino extern tree error_not_base_type			(tree, tree);
5885e4b17023SJohn Marino extern tree binfo_or_else			(tree, tree);
5886e4b17023SJohn Marino extern void cxx_readonly_error			(tree, enum lvalue_use);
5887e4b17023SJohn Marino extern void complete_type_check_abstract	(tree);
5888e4b17023SJohn Marino extern int abstract_virtuals_error		(tree, tree);
5889e4b17023SJohn Marino extern int abstract_virtuals_error_sfinae	(tree, tree, tsubst_flags_t);
5890e4b17023SJohn Marino 
5891e4b17023SJohn Marino extern tree store_init_value			(tree, tree, VEC(tree,gc)**, int);
5892e4b17023SJohn Marino extern void check_narrowing			(tree, tree);
5893e4b17023SJohn Marino extern tree digest_init				(tree, tree, tsubst_flags_t);
5894e4b17023SJohn Marino extern tree digest_init_flags			(tree, tree, int);
5895e4b17023SJohn Marino extern tree build_scoped_ref			(tree, tree, tree *);
5896e4b17023SJohn Marino extern tree build_x_arrow			(tree);
5897e4b17023SJohn Marino extern tree build_m_component_ref		(tree, tree);
5898e4b17023SJohn Marino extern tree build_functional_cast		(tree, tree, tsubst_flags_t);
5899e4b17023SJohn Marino extern tree add_exception_specifier		(tree, tree, int);
5900e4b17023SJohn Marino extern tree merge_exception_specifiers		(tree, tree, tree);
5901e4b17023SJohn Marino 
5902e4b17023SJohn Marino /* in mangle.c */
5903e4b17023SJohn Marino extern void init_mangle				(void);
5904e4b17023SJohn Marino extern void mangle_decl				(tree);
5905e4b17023SJohn Marino extern const char *mangle_type_string		(tree);
5906e4b17023SJohn Marino extern tree mangle_typeinfo_for_type		(tree);
5907e4b17023SJohn Marino extern tree mangle_typeinfo_string_for_type	(tree);
5908e4b17023SJohn Marino extern tree mangle_vtbl_for_type		(tree);
5909e4b17023SJohn Marino extern tree mangle_vtt_for_type			(tree);
5910e4b17023SJohn Marino extern tree mangle_ctor_vtbl_for_type		(tree, tree);
5911e4b17023SJohn Marino extern tree mangle_thunk			(tree, int, tree, tree);
5912e4b17023SJohn Marino extern tree mangle_conv_op_name_for_type	(tree);
5913e4b17023SJohn Marino extern tree mangle_guard_variable		(tree);
5914e4b17023SJohn Marino extern tree mangle_ref_init_variable		(tree);
5915e4b17023SJohn Marino 
5916e4b17023SJohn Marino /* in dump.c */
5917e4b17023SJohn Marino extern bool cp_dump_tree			(void *, tree);
5918e4b17023SJohn Marino 
5919e4b17023SJohn Marino /* In cp/cp-objcp-common.c.  */
5920e4b17023SJohn Marino 
5921e4b17023SJohn Marino extern alias_set_type cxx_get_alias_set		(tree);
5922e4b17023SJohn Marino extern bool cxx_warn_unused_global_decl		(const_tree);
5923e4b17023SJohn Marino extern size_t cp_tree_size			(enum tree_code);
5924e4b17023SJohn Marino extern bool cp_var_mod_type_p			(tree, tree);
5925e4b17023SJohn Marino extern void cxx_initialize_diagnostics		(diagnostic_context *);
5926e4b17023SJohn Marino extern int cxx_types_compatible_p		(tree, tree);
5927e4b17023SJohn Marino extern void init_shadowed_var_for_decl		(void);
59285ce9237cSJohn Marino extern bool cxx_block_may_fallthru		(const_tree);
5929e4b17023SJohn Marino 
5930e4b17023SJohn Marino /* in cp-gimplify.c */
5931e4b17023SJohn Marino extern int cp_gimplify_expr			(tree *, gimple_seq *,
5932e4b17023SJohn Marino 						 gimple_seq *);
5933e4b17023SJohn Marino extern void cp_genericize			(tree);
5934e4b17023SJohn Marino extern bool cxx_omp_const_qual_no_mutable	(tree);
5935e4b17023SJohn Marino extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
5936e4b17023SJohn Marino extern tree cxx_omp_clause_default_ctor		(tree, tree, tree);
5937e4b17023SJohn Marino extern tree cxx_omp_clause_copy_ctor		(tree, tree, tree);
5938e4b17023SJohn Marino extern tree cxx_omp_clause_assign_op		(tree, tree, tree);
5939e4b17023SJohn Marino extern tree cxx_omp_clause_dtor			(tree, tree);
5940e4b17023SJohn Marino extern void cxx_omp_finish_clause		(tree);
5941e4b17023SJohn Marino extern bool cxx_omp_privatize_by_reference	(const_tree);
5942e4b17023SJohn Marino 
5943e4b17023SJohn Marino /* in name-lookup.c */
5944e4b17023SJohn Marino extern void suggest_alternatives_for            (location_t, tree);
5945e4b17023SJohn Marino extern tree strip_using_decl                    (tree);
5946e4b17023SJohn Marino 
5947e4b17023SJohn Marino /* -- end of C++ */
5948e4b17023SJohn Marino 
5949e4b17023SJohn Marino #endif /* ! GCC_CP_TREE_H */
5950