]> gcc.gnu.org Git - gcc.git/blame - gcc/cp/cp-tree.h
re PR target/16300 (Bug in vendor /usr/include/net/if.h needs fixincluding)
[gcc.git] / gcc / cp / cp-tree.h
CommitLineData
8d08fdba 1/* Definitions for C++ parsing and type checking.
357a4089 2 Copyright (C) 1987, 93, 94, 95, 1996 Free Software Foundation, Inc.
8d08fdba
MS
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
e9fa0c7c
RK
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
8d08fdba
MS
21
22#ifndef _CP_TREE_H
23#define _CP_TREE_H
24
faf5394a 25#include "gansidecl.h"
8d08fdba 26
cfdd0551
PB
27/* Usage of TREE_LANG_FLAG_?:
28 0: TREE_NONLOCAL_FLAG (in TREE_LIST or _TYPE).
29 BINFO_MARKED (BINFO nodes).
cfdd0551
PB
30 COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
31 NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
32 DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
33 LOOKUP_EXPR_GLOBAL (in LOOKUP_EXPR).
34 TREE_NEGATED_INT (in INTEGER_CST).
35 (TREE_MANGLED) (in IDENTIFIER_NODE) (commented-out).
36 1: IDENTIFIER_VIRTUAL_P.
37 TI_PENDING_TEMPLATE_FLAG.
38 TI_PENDING_SPECIALIZATION_FLAG.
39 TEMPLATE_PARMS_FOR_INLINE.
40 DELETE_EXPR_USE_VEC (in DELETE_EXPR).
41 (TREE_CALLS_NEW) (in _EXPR or _REF) (commented-out).
42 TYPE_USES_COMPLEX_INHERITANCE (in _TYPE).
43 C_DECLARED_LABEL_FLAG.
44 2: IDENTIFIER_OPNAME_P.
45 BINFO_FIELDS_MARKED.
46 TYPE_VIRTUAL_P.
47 PARM_DECL_EXPR (in SAVE_EXPR).
48 3: TYPE_USES_VIRTUAL_BASECLASSES (in a class TYPE).
49 BINFO_VTABLE_PATH_MARKED.
50 (TREE_REFERENCE_EXPR) (in NON_LVALUE_EXPR) (commented-out).
51 4: BINFO_NEW_VTABLE_MARKED.
52 TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR,
53 or FIELD_DECL).
54 5: BINFO_VIA_PUBLIC.
55 BINFO_VBASE_INIT_MARKED.
56 6: Not used.
57
58 Usage of TYPE_LANG_FLAG_?:
59 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
60 1: TYPE_HAS_CONSTRUCTOR.
61 2: TYPE_HAS_DESTRUCTOR.
ea419909 62 3: TYPE_FOR_JAVA.
cfdd0551
PB
63 4: TYPE_NEEDS_DESTRUCTOR.
64 5: IS_AGGR_TYPE.
ea419909 65 6: TYPE_BUILT_IN.
cfdd0551
PB
66
67 Usage of DECL_LANG_FLAG_?:
68 0: DECL_ERROR_REPORTED (in VAR_DECL).
69 1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
70 2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
71 3: DECL_IN_AGGR_P.
72 4: DECL_MAYBE_TEMPLATE.
73 5: DECL_INTERFACE_KNOWN.
74 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL).
75 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL).
76*/
77
8d08fdba
MS
78/* Language-dependent contents of an identifier. */
79
80struct lang_identifier
81{
82 struct tree_identifier ignore;
32e02ee0 83 tree namespace_bindings, local_value;
8d08fdba
MS
84 tree class_value;
85 tree class_template_info;
86 struct lang_id2 *x;
87};
88
89struct lang_id2
90{
91 tree label_value, implicit_decl;
92 tree type_desc, as_list, error_locus;
93};
94
46b02c6d
MS
95typedef struct
96{
97 tree t;
98 int new_type_flag;
99} flagged_type_tree;
100
f84b4be9
JM
101typedef struct
102{
103 char common[sizeof (struct tree_common)];
104 struct rtx_def *rtl; /* Unused, but required to match up with what
105 the middle-end expects. */
106 HOST_WIDE_INT index;
107 HOST_WIDE_INT level;
108 HOST_WIDE_INT orig_level;
109 tree decl;
110} template_parm_index;
111
2c73f9f5
ML
112/* For a binding between a name and an entity, defines the scope
113 where the binding is declared. Currently always points to a
114 namespace declaration. */
115#define BINDING_SCOPE(NODE) (((struct tree_binding*)NODE)->scope)
116/* This is the declaration bound to the name. Possible values:
117 variable, overloaded function, namespace, template, enumerator. */
118#define BINDING_VALUE(NODE) (((struct tree_binding*)NODE)->value)
119/* If name is bound to a type, this is the type (struct, union, enum). */
120#define BINDING_TYPE(NODE) TREE_TYPE(NODE)
30394414 121#define IDENTIFIER_GLOBAL_VALUE(NODE) \
2c73f9f5
ML
122 namespace_binding (NODE, global_namespace)
123#define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
124 set_namespace_binding (NODE, global_namespace, VAL)
30394414 125#define IDENTIFIER_NAMESPACE_VALUE(NODE) \
2c73f9f5
ML
126 namespace_binding (NODE, current_namespace)
127#define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
128 set_namespace_binding (NODE, current_namespace, VAL)
30394414
JM
129
130struct tree_binding
131{
132 char common[sizeof (struct tree_common)];
133 tree scope;
134 tree value;
135};
136
2c73f9f5
ML
137/* The overloaded FUNCTION_DECL. */
138#define OVL_FUNCTION(NODE) (((struct tree_overload*)NODE)->function)
139#define OVL_CHAIN(NODE) TREE_CHAIN(NODE)
140/* Polymorphic access to FUNCTION and CHAIN. */
141#define OVL_CURRENT(NODE) \
142 ((TREE_CODE(NODE)==OVERLOAD) ? OVL_FUNCTION(NODE) : NODE)
143#define OVL_NEXT(NODE) \
144 ((TREE_CODE(NODE)==OVERLOAD) ? TREE_CHAIN(NODE) : NULL_TREE)
145/* If set, this was imported in a using declaration.
146 This is not to confuse with being used somewhere, which
147 is not important for this node. */
148#define OVL_USED(NODE) TREE_USED(NODE)
149
150struct tree_overload
151{
152 char common[sizeof (struct tree_common)];
153 tree function;
154};
155
5ffe581d
JM
156#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr)
157#define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i)
158
159struct tree_wrapper
160{
161 char common[sizeof (struct tree_common)];
162 union {
163 void *ptr;
164 int i;
165 } u;
166};
167
1139b3d8
JM
168#define SRCLOC_FILE(NODE) (((struct tree_srcloc*)NODE)->filename)
169#define SRCLOC_LINE(NODE) (((struct tree_srcloc*)NODE)->linenum)
170struct tree_srcloc
171{
172 char common[sizeof (struct tree_common)];
173 char *filename;
174 int linenum;
175};
176
8d08fdba
MS
177/* To identify to the debug emitters if it should pay attention to the
178 flag `-Wtemplate-debugging'. */
179#define HAVE_TEMPLATES 1
180
181/* Macros for access to language-specific slots in an identifier. */
182
30394414 183#define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
32e02ee0 184 (((struct lang_identifier *)(NODE))->namespace_bindings)
8d08fdba
MS
185#define IDENTIFIER_CLASS_VALUE(NODE) \
186 (((struct lang_identifier *)(NODE))->class_value)
187#define IDENTIFIER_LOCAL_VALUE(NODE) \
188 (((struct lang_identifier *)(NODE))->local_value)
189#define IDENTIFIER_TEMPLATE(NODE) \
190 (((struct lang_identifier *)(NODE))->class_template_info)
191
2c73f9f5
ML
192/* TREE_TYPE only indicates on local and class scope the current
193 type. For namespace scope, the presence of a type in any namespace
194 is indicated with global_type_node, and the real type behind must
195 be found through lookup. */
196#define IDENTIFIER_TYPE_VALUE(NODE) (identifier_type_value(NODE))
197#define REAL_IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
8d08fdba 198#define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
2c73f9f5 199#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
8d08fdba
MS
200
201#define LANG_ID_FIELD(NAME,NODE) \
202 (((struct lang_identifier *)(NODE))->x \
203 ? ((struct lang_identifier *)(NODE))->x->NAME : 0)
204#define SET_LANG_ID(NODE,VALUE,NAME) \
205 (((struct lang_identifier *)(NODE))->x == 0 \
206 ? ((struct lang_identifier *)(NODE))->x \
207 = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
208 ((struct lang_identifier *)(NODE))->x->NAME = (VALUE))
209
210#define IDENTIFIER_LABEL_VALUE(NODE) LANG_ID_FIELD(label_value, NODE)
211#define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
212 SET_LANG_ID(NODE, VALUE, label_value)
213
214#define IDENTIFIER_IMPLICIT_DECL(NODE) LANG_ID_FIELD(implicit_decl, NODE)
215#define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
216 SET_LANG_ID(NODE, VALUE, implicit_decl)
217
218#define IDENTIFIER_AS_DESC(NODE) LANG_ID_FIELD(type_desc, NODE)
219#define SET_IDENTIFIER_AS_DESC(NODE,DESC) \
220 SET_LANG_ID(NODE, DESC, type_desc)
221
222#define IDENTIFIER_AS_LIST(NODE) LANG_ID_FIELD(as_list, NODE)
223#define SET_IDENTIFIER_AS_LIST(NODE,LIST) \
224 SET_LANG_ID(NODE, LIST, as_list)
225
226#define IDENTIFIER_ERROR_LOCUS(NODE) LANG_ID_FIELD(error_locus, NODE)
227#define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
228 SET_LANG_ID(NODE, VALUE, error_locus)
229
230
231#define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1(NODE)
232
233/* Nonzero if this identifier is the prefix for a mangled C++ operator name. */
234#define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
235
236#define IDENTIFIER_TYPENAME_P(NODE) \
237 (! strncmp (IDENTIFIER_POINTER (NODE), \
238 IDENTIFIER_POINTER (ansi_opname[(int) TYPE_EXPR]), \
239 IDENTIFIER_LENGTH (ansi_opname[(int) TYPE_EXPR])))
240
241/* Nonzero means reject anything that ANSI standard C forbids. */
242extern int pedantic;
243
244/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
245#define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
e1cd6e56
MS
246
247/* Record in each node resulting from a binary operator
248 what operator was specified for it. */
249#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))
250
251/* Store a value in that field. */
252#define C_SET_EXP_ORIGINAL_CODE(exp, code) \
253 (TREE_COMPLEXITY (exp) = (int)(code))
8d08fdba
MS
254\f
255/* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
256 next exception handler. */
257extern tree exception_throw_decl;
258
259extern tree double_type_node, long_double_type_node, float_type_node;
260extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
261extern tree ptrdiff_type_node;
262
263extern tree short_integer_type_node, short_unsigned_type_node;
264extern tree long_integer_type_node, long_unsigned_type_node;
265extern tree long_long_integer_type_node, long_long_unsigned_type_node;
266extern tree unsigned_type_node;
267extern tree string_type_node, char_array_type_node, int_array_type_node;
268extern tree wchar_array_type_node;
269extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
37c46b43
MS
270
271extern tree complex_integer_type_node;
272extern tree complex_float_type_node;
273extern tree complex_double_type_node;
274extern tree complex_long_double_type_node;
275
8d08fdba
MS
276extern tree intQI_type_node, unsigned_intQI_type_node;
277extern tree intHI_type_node, unsigned_intHI_type_node;
278extern tree intSI_type_node, unsigned_intSI_type_node;
279extern tree intDI_type_node, unsigned_intDI_type_node;
f7554e8c 280extern tree intTI_type_node, unsigned_intTI_type_node;
8d08fdba 281
ea419909
PB
282extern tree java_byte_type_node;
283extern tree java_short_type_node;
284extern tree java_int_type_node;
285extern tree java_long_type_node;
286extern tree java_float_type_node;
287extern tree java_double_type_node;
288extern tree java_char_type_node;
289extern tree java_boolean_type_node;
290
8d08fdba
MS
291extern int current_function_returns_value;
292extern int current_function_returns_null;
293extern tree current_function_return_value;
294
30394414
JM
295extern tree current_namespace;
296extern tree global_namespace;
297
8d08fdba
MS
298extern tree ridpointers[];
299extern tree ansi_opname[];
300extern tree ansi_assopname[];
301
302/* Nonzero means `$' can be in an identifier. */
303
304extern int dollars_in_ident;
305
306/* Nonzero means allow type mismatches in conditional expressions;
307 just make their values `void'. */
308
309extern int flag_cond_mismatch;
310
311/* Nonzero means don't recognize the keyword `asm'. */
312
313extern int flag_no_asm;
314
315/* For cross referencing. */
316
317extern int flag_gnu_xref;
318
319/* For environments where you can use GNU binutils (as, ld in particular). */
320
321extern int flag_gnu_binutils;
322
323/* Nonzero means ignore `#ident' directives. */
324
325extern int flag_no_ident;
326
327/* Nonzero means warn about implicit declarations. */
328
329extern int warn_implicit;
330
795add94
VM
331/* Nonzero means warn about usage of long long when `-pedantic'. */
332
333extern int warn_long_long;
334
8d08fdba
MS
335/* Nonzero means warn when all ctors or dtors are private, and the class
336 has no friends. */
337
338extern int warn_ctor_dtor_privacy;
339
340/* Nonzero means warn about function definitions that default the return type
341 or that use a null return and have a return-type other than void. */
342
343extern int warn_return_type;
344
d9cf7c82
JM
345/* Nonzero means give string constants the type `const char *', as mandated
346 by the standard. */
347
348extern int flag_const_strings;
349
350/* Nonzero means warn about deprecated conversion from string constant to
351 `char *'. */
8d08fdba
MS
352
353extern int warn_write_strings;
354
355/* Nonzero means warn about sizeof(function) or addition/subtraction
356 of function pointers. */
357
358extern int warn_pointer_arith;
359
8d08fdba
MS
360/* Nonzero means warn about suggesting putting in ()'s. */
361
362extern int warn_parentheses;
363
364/* Nonzero means warn about multiple (redundant) decls for the same single
365 variable or function. */
366
367extern int warn_redundant_decls;
368
369/* Warn if initializer is not completely bracketed. */
370
371extern int warn_missing_braces;
372
2ee887f2
MS
373/* Warn about comparison of signed and unsigned values. */
374
375extern int warn_sign_compare;
376
8d08fdba
MS
377/* Warn about a subscript that has type char. */
378
379extern int warn_char_subscripts;
380
381/* Nonzero means warn about pointer casts that can drop a type qualifier
382 from the pointer target type. */
383
384extern int warn_cast_qual;
385
e92cc029 386/* Warn about *printf or *scanf format/argument anomalies. */
8d08fdba
MS
387
388extern int warn_format;
389
390/* Nonzero means warn about non virtual destructors in classes that have
e92cc029 391 virtual functions. */
8d08fdba
MS
392
393extern int warn_nonvdtor;
394
9a3b49ac
MS
395/* Non-zero means warn when we convert a pointer to member function
396 into a pointer to (void or function). */
397
398extern int warn_pmf2ptr;
399
eb448459
MS
400/* Nonzero means warn about violation of some Effective C++ style rules. */
401
402extern int warn_ecpp;
403
da20811c
JM
404/* Nonzero means warn where overload resolution chooses a promotion from
405 unsigned to signed over a conversion to an unsigned of the same size. */
406
407extern int warn_sign_promo;
408
8d08fdba 409/* Non-zero means warn when a function is declared extern and later inline. */
eb448459 410
8d08fdba
MS
411extern int warn_extern_inline;
412
0c4b14c4
JM
413/* Non-zero means warn when an old-style cast is used. */
414
415extern int warn_old_style_cast;
416
8d08fdba
MS
417/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
418
419extern int flag_signed_bitfields;
420
421/* 3 means write out only virtuals function tables `defined'
422 in this implementation file.
423 2 means write out only specific virtual function tables
424 and give them (C) public access.
425 1 means write out virtual function tables and give them
426 (C) public access.
427 0 means write out virtual function tables and give them
428 (C) static access (default).
429 -1 means declare virtual function tables extern. */
430
431extern int write_virtuals;
432
38e01259 433/* True for more efficient but incompatible (not fully tested)
8926095f 434 vtable implementation (using thunks).
e92cc029 435 0 is old behavior; 1 is new behavior. */
8926095f 436extern int flag_vtable_thunks;
51c184be 437
8d08fdba
MS
438/* INTERFACE_ONLY nonzero means that we are in an "interface"
439 section of the compiler. INTERFACE_UNKNOWN nonzero means
440 we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
441 is zero and INTERFACE_ONLY is zero, it means that we are responsible
442 for exporting definitions that others might need. */
443extern int interface_only, interface_unknown;
444
445/* Nonzero means we should attempt to elide constructors when possible. */
446
447extern int flag_elide_constructors;
448
e1cd6e56
MS
449/* Nonzero means enable obscure ANSI features and disable GNU extensions
450 that might cause ANSI-compliant code to be miscompiled. */
39211cd5
MS
451
452extern int flag_ansi;
453
8d08fdba
MS
454/* Nonzero means recognize and handle signature language constructs. */
455
456extern int flag_handle_signatures;
457
458/* Nonzero means that member functions defined in class scope are
459 inline by default. */
460
461extern int flag_default_inline;
386b8a85
JM
462
463/* The name-mangling scheme to use. Versions of gcc before 2.8 use
464 version 0. */
465extern int name_mangling_version;
466
467/* Nonzero means that guiding declarations are allowed. */
468extern int flag_guiding_decls;
469
5bd17905
AM
470/* Nonzero if squashed mangling is to be performed.
471 This uses the B and K codes to reference previously seen class types
472 and class qualifiers. */
473extern int flag_do_squangling;
474
dc8263bc
JM
475/* Nonzero if we want to issue diagnostics that the standard says are not
476 required. */
477extern int flag_optional_diags;
8d08fdba
MS
478\f
479/* C++ language-specific tree codes. */
480#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
481enum cplus_tree_code {
482 __DUMMY = LAST_AND_UNUSED_TREE_CODE,
e92cc029 483#include "cp-tree.def"
8d08fdba
MS
484 LAST_CPLUS_TREE_CODE
485};
486#undef DEFTREECODE
487
fcad5cf5 488enum languages { lang_c, lang_cplusplus, lang_java };
8d08fdba
MS
489
490/* Macros to make error reporting functions' lives easier. */
491#define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
492#define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
493#define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
494
495#define TYPE_ASSEMBLER_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
496#define TYPE_ASSEMBLER_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_ASSEMBLER_NAME (TYPE_NAME (NODE))))
497
a4443a08 498/* The _DECL for this _TYPE. */
d2e5ee5c 499#define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
a4443a08 500
c92366fb
MM
501/* Nonzero if T is a class (or struct or union) type. Also nonzero
502 for template type parameters. Despite its name, this macro has
503 nothing to do with the definition of aggregate given in the
504 standard. Think of this macro as MAYBE_CLASS_TYPE_P. */
8d08fdba 505#define IS_AGGR_TYPE(t) (TYPE_LANG_FLAG_5 (t))
c92366fb
MM
506
507/* Nonzero if T is a class type. Zero for template type parameters. */
508#define CLASS_TYPE_P(t) \
509 (IS_AGGR_TYPE (t) && TREE_CODE (t) != TEMPLATE_TYPE_PARM)
510
5566b478 511#define IS_AGGR_TYPE_CODE(t) (t == RECORD_TYPE || t == UNION_TYPE)
8d08fdba
MS
512#define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
513 (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
514 && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
6467930b
MS
515#define IS_OVERLOAD_TYPE(t) \
516 (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
8d08fdba
MS
517
518/* In a *_TYPE, nonzero means a built-in type. */
519#define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6(NODE)
520
ea419909
PB
521/* True if this a "Java" type, defined in 'extern "Java"'. */
522#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE)
523
21474714
MS
524#define DELTA_FROM_VTABLE_ENTRY(ENTRY) \
525 (!flag_vtable_thunks ? \
526 TREE_VALUE (CONSTRUCTOR_ELTS (ENTRY)) \
527 : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? integer_zero_node \
528 : build_int_2 (THUNK_DELTA (TREE_OPERAND ((ENTRY), 0)), 0))
bd6dd845 529
8d08fdba
MS
530/* Virtual function addresses can be gotten from a virtual function
531 table entry using this macro. */
532#define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
8926095f
MS
533 (!flag_vtable_thunks ? \
534 TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) \
535 : TREE_CODE (TREE_OPERAND ((ENTRY), 0)) != THUNK_DECL ? (ENTRY) \
536 : DECL_INITIAL (TREE_OPERAND ((ENTRY), 0)))
8d08fdba
MS
537#define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
538 (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
8d08fdba
MS
539#define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
540#define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
541 (((CODE) == TREE_CODE (NODE) \
542 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
543 || IS_AGGR_TYPE (NODE))
544
8d08fdba
MS
545/* Nonzero iff TYPE is uniquely derived from PARENT. Under MI, PARENT can
546 be an ambiguous base class of TYPE, and this macro will be false. */
547#define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) >= 0)
548#define ACCESSIBLY_DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, -1, (tree *)0) >= 0)
549#define ACCESSIBLY_UNIQUELY_DERIVED_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 1, (tree *)0) >= 0)
a0a33927 550#define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, (tree *)0) != -1)
8d08fdba 551\f
8d08fdba
MS
552/* Statistics show that while the GNU C++ compiler may generate
553 thousands of different types during a compilation run, it
554 generates relatively few (tens) of classtypes. Because of this,
555 it is not costly to store a generous amount of information
556 in classtype nodes. This struct must fill out to a multiple of 4 bytes. */
557struct lang_type
558{
559 struct
560 {
561 unsigned has_type_conversion : 1;
8d08fdba 562 unsigned has_init_ref : 1;
8d08fdba
MS
563 unsigned has_assignment : 1;
564 unsigned has_default_ctor : 1;
565 unsigned uses_multiple_inheritance : 1;
8d08fdba
MS
566 unsigned const_needs_init : 1;
567 unsigned ref_needs_init : 1;
568 unsigned has_const_assign_ref : 1;
8d08fdba 569
0b41abe6
JM
570 unsigned has_nonpublic_ctor : 2;
571 unsigned has_nonpublic_assign_ref : 2;
572 unsigned vtable_needs_writing : 1;
8d08fdba 573 unsigned has_assign_ref : 1;
a28e3c7f 574 unsigned gets_new : 2;
0b41abe6 575
a28e3c7f 576 unsigned gets_delete : 2;
8d08fdba
MS
577 unsigned has_call_overloaded : 1;
578 unsigned has_array_ref_overloaded : 1;
579 unsigned has_arrow_overloaded : 1;
a28e3c7f 580 unsigned local_typedecls : 1;
8d08fdba
MS
581 unsigned interface_only : 1;
582 unsigned interface_unknown : 1;
0b41abe6 583
8d08fdba 584 unsigned needs_virtual_reinit : 1;
db5ae43f 585 unsigned vec_delete_takes_size : 1;
8d08fdba
MS
586 unsigned declared_class : 1;
587 unsigned being_defined : 1;
588 unsigned redefined : 1;
8d08fdba
MS
589 unsigned marked : 1;
590 unsigned marked2 : 1;
591 unsigned marked3 : 1;
0b41abe6 592
8d08fdba
MS
593 unsigned marked4 : 1;
594 unsigned marked5 : 1;
595 unsigned marked6 : 1;
fc378698 596 unsigned debug_requested : 1;
a28e3c7f 597 unsigned use_template : 2;
8d08fdba
MS
598 unsigned got_semicolon : 1;
599 unsigned ptrmemfunc_flag : 1;
0b41abe6 600
8d08fdba
MS
601 unsigned is_signature : 1;
602 unsigned is_signature_pointer : 1;
a28e3c7f 603 unsigned is_signature_reference : 1;
8d08fdba
MS
604 unsigned has_opaque_typedecls : 1;
605 unsigned sigtable_has_been_generated : 1;
606 unsigned was_anonymous : 1;
607 unsigned has_real_assignment : 1;
608 unsigned has_real_assign_ref : 1;
0b41abe6 609
8d08fdba 610 unsigned has_const_init_ref : 1;
8d08fdba
MS
611 unsigned has_complex_init_ref : 1;
612 unsigned has_complex_assign_ref : 1;
f0e01782 613 unsigned has_abstract_assign_ref : 1;
f30432d7 614 unsigned non_aggregate : 1;
8d08fdba
MS
615
616 /* The MIPS compiler gets it wrong if this struct also
617 does not fill out to a multiple of 4 bytes. Add a
618 member `dummy' with new bits if you go over the edge. */
0b41abe6 619 unsigned dummy : 11;
8d08fdba
MS
620 } type_flags;
621
0b41abe6 622#ifdef MI_MATRIX
8d08fdba 623 int cid;
0b41abe6 624#endif
8d08fdba 625 int n_ancestors;
0b41abe6 626 int n_vancestors;
8d08fdba
MS
627 int vsize;
628 int max_depth;
629 int vfield_parent;
630
8d08fdba
MS
631 union tree_node *baselink_vec;
632 union tree_node *vfields;
633 union tree_node *vbases;
8d08fdba
MS
634
635 union tree_node *tags;
636 char *memoized_table_entry;
637
fc378698 638 union tree_node *search_slot;
8d08fdba 639
8d08fdba 640 unsigned char align;
0b41abe6 641 /* Room for another three unsigned chars. */
8d08fdba 642
8d08fdba
MS
643 union tree_node *size;
644
645 union tree_node *base_init_list;
646 union tree_node *abstract_virtuals;
647 union tree_node *as_list;
648 union tree_node *id_as_list;
649 union tree_node *binfo_as_list;
8d08fdba
MS
650 union tree_node *friend_classes;
651
0b41abe6 652#ifdef MI_MATRIX
8d08fdba 653 char *mi_matrix;
0b41abe6 654#endif
8d08fdba 655
db5ae43f 656 union tree_node *rtti;
8d08fdba 657
51c184be
MS
658 union tree_node *methods;
659
8d08fdba
MS
660 union tree_node *signature;
661 union tree_node *signature_pointer_to;
662 union tree_node *signature_reference_to;
f376e137 663
5566b478
MS
664 union tree_node *template_info;
665
f376e137 666 int linenum;
8d08fdba
MS
667};
668
f376e137
MS
669#define CLASSTYPE_SOURCE_LINE(NODE) (TYPE_LANG_SPECIFIC(NODE)->linenum)
670
a0a33927
MS
671/* Indicates whether or not (and how) a template was expanded for this class.
672 0=no information yet/non-template class
673 1=implicit template instantiation
674 2=explicit template specialization
675 3=explicit template instantiation */
8d08fdba
MS
676#define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
677
678/* Fields used for storing information before the class is defined.
679 After the class is defined, these fields hold other information. */
680
681/* List of friends which were defined inline in this class definition. */
682#define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
683
684/* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
685 a special meaning for the assignment operator ("operator="),
686 or one of its fields (or base members) has a special meaning
687 defined. */
688#define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
689#define TYPE_HAS_REAL_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assignment)
690
691/* Nonzero for _CLASSTYPE means that operator new and delete are defined,
692 respectively. */
a28e3c7f
MS
693#define TYPE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
694#define TYPE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
695#define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
696
697/* Nonzero for _CLASSTYPE means that operator vec delete is defined and
698 takes the optional size_t argument. */
699#define TYPE_VEC_DELETE_TAKES_SIZE(NODE) \
700 (TYPE_LANG_SPECIFIC(NODE)->type_flags.vec_delete_takes_size)
701#define TYPE_VEC_NEW_USES_COOKIE(NODE) \
702 (TYPE_NEEDS_DESTRUCTOR (NODE) \
703 || (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
8d08fdba
MS
704
705/* Nonzero for TREE_LIST or _TYPE node means that this node is class-local. */
706#define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
707
8d08fdba
MS
708/* Nonzero means that this _CLASSTYPE node defines ways of converting
709 itself to other types. */
710#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
711
8d08fdba
MS
712/* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
713#define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
714#define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
715
716/* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
717#define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
718#define TYPE_HAS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_init_ref)
719
8d08fdba
MS
720/* Nonzero means that this type is being defined. I.e., the left brace
721 starting the definition of this type has been seen. */
722#define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
723/* Nonzero means that this type has been redefined. In this case, if
724 convenient, don't reprocess any methods that appear in its redefinition. */
725#define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
726
8d08fdba
MS
727/* Nonzero means that this type is a signature. */
728# define IS_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)?TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature:0)
729# define SET_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=1)
730# define CLEAR_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature=0)
731
732/* Nonzero means that this type is a signature pointer type. */
733# define IS_SIGNATURE_POINTER(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_pointer)
734
735/* Nonzero means that this type is a signature reference type. */
736# define IS_SIGNATURE_REFERENCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.is_signature_reference)
737
8d08fdba
MS
738/* Nonzero means that this signature contains opaque type declarations. */
739#define SIGNATURE_HAS_OPAQUE_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_opaque_typedecls)
740
741/* Nonzero means that a signature table has been generated
742 for this signature. */
743#define SIGTABLE_HAS_BEEN_GENERATED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.sigtable_has_been_generated)
744
745/* If NODE is a class, this is the signature type that contains NODE's
746 signature after it has been computed using sigof(). */
747#define CLASSTYPE_SIGNATURE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
748
749/* If NODE is a signature pointer or signature reference, this is the
750 signature type the pointer/reference points to. */
751#define SIGNATURE_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
752
753/* If NODE is a signature, this is a vector of all methods defined
754 in the signature or in its base types together with their default
755 implementations. */
756#define SIGNATURE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature)
757
758/* If NODE is a signature, this is the _TYPE node that contains NODE's
759 signature pointer type. */
760#define SIGNATURE_POINTER_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_pointer_to)
761
762/* If NODE is a signature, this is the _TYPE node that contains NODE's
763 signature reference type. */
764#define SIGNATURE_REFERENCE_TO(NODE) (TYPE_LANG_SPECIFIC(NODE)->signature_reference_to)
765
db5ae43f
MS
766/* The is the VAR_DECL that contains NODE's rtti. */
767#define CLASSTYPE_RTTI(NODE) (TYPE_LANG_SPECIFIC(NODE)->rtti)
8d08fdba
MS
768
769/* Nonzero means that this _CLASSTYPE node overloads operator(). */
770#define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
771
772/* Nonzero means that this _CLASSTYPE node overloads operator[]. */
773#define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
774
775/* Nonzero means that this _CLASSTYPE node overloads operator->. */
776#define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
777
778/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
779 multiple inheritance. If this is 0 for the root of a type
780 hierarchy, then we can use more efficient search techniques. */
781#define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
782
783/* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
784 virtual base classes. If this is 0 for the root of a type
785 hierarchy, then we can use more efficient search techniques. */
786#define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
787
788/* List of lists of member functions defined in this class. */
72b7eeff 789#define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->methods)
8d08fdba 790
e1cd6e56
MS
791/* The first type conversion operator in the class (the others can be
792 searched with TREE_CHAIN), or the first non-constructor function if
793 there are no type conversion operators. */
794#define CLASSTYPE_FIRST_CONVERSION(NODE) \
fc378698
MS
795 TREE_VEC_LENGTH (CLASSTYPE_METHOD_VEC (NODE)) > 2 \
796 ? TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (NODE), 2) \
8ccc31eb 797 : NULL_TREE;
e1cd6e56 798
8d08fdba
MS
799/* Pointer from any member function to the head of the list of
800 member functions of the type that member function belongs to. */
801#define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
802
803/* Mark bits for depth-first and breath-first searches. */
804#define CLASSTYPE_MARKED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
805#define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
806#define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
807#define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
808#define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
809#define CLASSTYPE_MARKED6(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
810/* Macros to modify the above flags */
811#define SET_CLASSTYPE_MARKED(NODE) (CLASSTYPE_MARKED(NODE) = 1)
812#define CLEAR_CLASSTYPE_MARKED(NODE) (CLASSTYPE_MARKED(NODE) = 0)
813#define SET_CLASSTYPE_MARKED2(NODE) (CLASSTYPE_MARKED2(NODE) = 1)
814#define CLEAR_CLASSTYPE_MARKED2(NODE) (CLASSTYPE_MARKED2(NODE) = 0)
815#define SET_CLASSTYPE_MARKED3(NODE) (CLASSTYPE_MARKED3(NODE) = 1)
816#define CLEAR_CLASSTYPE_MARKED3(NODE) (CLASSTYPE_MARKED3(NODE) = 0)
817#define SET_CLASSTYPE_MARKED4(NODE) (CLASSTYPE_MARKED4(NODE) = 1)
818#define CLEAR_CLASSTYPE_MARKED4(NODE) (CLASSTYPE_MARKED4(NODE) = 0)
819#define SET_CLASSTYPE_MARKED5(NODE) (CLASSTYPE_MARKED5(NODE) = 1)
820#define CLEAR_CLASSTYPE_MARKED5(NODE) (CLASSTYPE_MARKED5(NODE) = 0)
821#define SET_CLASSTYPE_MARKED6(NODE) (CLASSTYPE_MARKED6(NODE) = 1)
822#define CLEAR_CLASSTYPE_MARKED6(NODE) (CLASSTYPE_MARKED6(NODE) = 0)
823
35acd3f2
MM
824/* A list of the nested tag-types (class, struct, union, or enum)
825 found within this class. The TREE_PURPOSE of each node is the name
826 of the type; the TREE_VALUE is the type itself. This list includes
827 nested member class templates. */
8d08fdba
MS
828#define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
829
830/* If this class has any bases, this is the number of the base class from
831 which our VFIELD is based, -1 otherwise. If this class has no base
832 classes, this is not used.
833 In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
e92cc029 834 1, if D's vtable came from B2. */
8d08fdba
MS
835#define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
836
837/* Remove when done merging. */
838#define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
839
840/* The number of virtual functions defined for this
841 _CLASSTYPE node. */
842#define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
843/* The virtual base classes that this type uses. */
844#define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
845/* The virtual function pointer fields that this type contains. */
846#define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
847
848/* Number of baseclasses defined for this type.
849 0 means no base classes. */
850#define CLASSTYPE_N_BASECLASSES(NODE) \
851 (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
852
853/* Memoize the number of super classes (base classes) tha this node
854 has. That way we can know immediately (albeit conservatively how
855 large a multiple-inheritance matrix we need to build to find
856 derivation information. */
857#define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
0b41abe6 858#define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_vancestors)
8d08fdba
MS
859
860/* Record how deep the inheritance is for this class so `void*' conversions
861 are less favorable than a conversion to the most base type. */
862#define CLASSTYPE_MAX_DEPTH(NODE) (TYPE_LANG_SPECIFIC(NODE)->max_depth)
863
864/* Used for keeping search-specific information. Any search routine
865 which uses this must define what exactly this slot is used for. */
866#define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
867
868/* Entry for keeping memoization tables for this type to
869 hopefully speed up search routines. Since it is a pointer,
870 it can mean almost anything. */
871#define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)
872
0b41abe6 873/* These are the size, mode and alignment of the type without its
9a71c18b 874 virtual base classes, for when we use this type as a base itself. */
8d08fdba 875#define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
8d08fdba
MS
876#define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
877
8d08fdba
MS
878/* A cons list of structure elements which either have constructors
879 to be called, or virtual function table pointers which
880 need initializing. Depending on what is being initialized,
881 the TREE_PURPOSE and TREE_VALUE fields have different meanings:
882
883 Member initialization: <FIELD_DECL, TYPE>
884 Base class construction: <NULL_TREE, BASETYPE>
885 Base class initialization: <BASE_INITIALIZATION, THESE_INITIALIZATIONS>
886 Whole type: <MEMBER_INIT, BASE_INIT>. */
887#define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
888
889/* A cons list of virtual functions which cannot be inherited by
890 derived classes. When deriving from this type, the derived
891 class must provide its own definition for each of these functions. */
892#define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
893
894/* Nonzero means that this aggr type has been `closed' by a semicolon. */
895#define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
896
897/* Nonzero means that the main virtual function table pointer needs to be
898 set because base constructors have placed the wrong value there.
899 If this is zero, it means that they placed the right value there,
900 and there is no need to change it. */
901#define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
902
903/* Nonzero means that if this type has virtual functions, that
904 the virtual function table will be written out. */
905#define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
906
907/* Nonzero means that this type defines its own local type declarations. */
908#define CLASSTYPE_LOCAL_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.local_typedecls)
909
910/* Nonzero means that this type has an X() constructor. */
911#define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
912
913/* Nonzero means the type declared a ctor as private or protected. We
914 use this to make sure we don't try to generate a copy ctor for a
915 class that has a member of type NODE. */
916#define TYPE_HAS_NONPUBLIC_CTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_ctor)
917
918/* Ditto, for operator=. */
919#define TYPE_HAS_NONPUBLIC_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_nonpublic_assign_ref)
920
921/* Many routines need to cons up a list of basetypes for access
922 checking. This field contains a TREE_LIST node whose TREE_VALUE
923 is the main variant of the type, and whose TREE_VIA_PUBLIC
924 and TREE_VIA_VIRTUAL bits are correctly set. */
925#define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
926/* Same, but cache a list whose value is the name of this type. */
927#define CLASSTYPE_ID_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->id_as_list)
928/* Same, but cache a list whose value is the binfo of this type. */
929#define CLASSTYPE_BINFO_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->binfo_as_list)
930
ea4e080b
MM
931/* A list of class types with which this type is a friend. The
932 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
933 case of a template friend. */
8d08fdba
MS
934#define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
935
0b41abe6 936#ifdef MI_MATRIX
8d08fdba
MS
937/* Keep an inheritance lattice around so we can quickly tell whether
938 a type is derived from another or not. */
939#define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)
0b41abe6 940#endif
8d08fdba 941
8d08fdba
MS
942/* Say whether this node was declared as a "class" or a "struct". */
943#define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
8d08fdba
MS
944
945/* Nonzero if this class has const members which have no specified initialization. */
946#define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
947
948/* Nonzero if this class has ref members which have no specified initialization. */
949#define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
950
951/* Nonzero if this class is included from a header file which employs
952 `#pragma interface', and it is not included in its implementation file. */
953#define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
954
955/* Same as above, but for classes whose purpose we do not know. */
956#define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
957#define CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown == 0)
958#define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = !!(X))
959#define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 1)
960#define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown = 0)
961
962/* Nonzero if a _DECL node requires us to output debug info for this class. */
963#define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
964\f
965/* Additional macros for inheritance information. */
966
8d08fdba
MS
967/* When following an binfo-specific chain, this is the cumulative
968 via-public flag. */
969#define BINFO_VIA_PUBLIC(NODE) TREE_LANG_FLAG_5 (NODE)
970
0b41abe6 971#ifdef MI_MATRIX
8d08fdba
MS
972/* When building a matrix to determine by a single lookup
973 whether one class is derived from another or not,
974 this field is the index of the class in the table. */
975#define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(NODE)->cid)
976#define BINFO_CID(NODE) CLASSTYPE_CID(BINFO_TYPE(NODE))
0b41abe6 977#endif
8d08fdba
MS
978
979/* Nonzero means marked by DFS or BFS search, including searches
980 by `get_binfo' and `get_base_distance'. */
981#define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
982/* Macros needed because of C compilers that don't allow conditional
983 expressions to be lvalues. Grr! */
984#define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
985#define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
986
987/* Nonzero means marked in building initialization list. */
988#define BINFO_BASEINIT_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
989/* Modifier macros */
990#define SET_BINFO_BASEINIT_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
991#define CLEAR_BINFO_BASEINIT_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
992
993/* Nonzero means marked in search through virtual inheritance hierarchy. */
994#define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
995/* Modifier macros */
996#define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
997#define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
998
999/* Nonzero means marked in search for members or member functions. */
1000#define BINFO_FIELDS_MARKED(NODE) \
1001 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
1002#define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
1003#define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
1004
1005/* Nonzero means that this class is on a path leading to a new vtable. */
1006#define BINFO_VTABLE_PATH_MARKED(NODE) \
1007 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
1008#define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
1009#define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
1010
1011/* Nonzero means that this class has a new vtable. */
1012#define BINFO_NEW_VTABLE_MARKED(NODE) \
1013 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
1014#define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
1015#define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
1016
1017/* Nonzero means this class has initialized its virtual baseclasses. */
1018#define BINFO_VBASE_INIT_MARKED(NODE) \
1019 (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):TREE_LANG_FLAG_5(NODE))
1020#define SET_BINFO_VBASE_INIT_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_5(NODE)=1))
1021#define CLEAR_BINFO_VBASE_INIT_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_5(NODE)=0))
1022\f
1023/* Accessor macros for the vfield slots in structures. */
1024
1025/* Get the assoc info that caused this vfield to exist. */
1026#define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
1027
1028/* Get that same information as a _TYPE. */
1029#define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
1030
1031/* Get the value of the top-most type dominating the non-`normal' vfields. */
1032#define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
1033
1034/* Get the value of the top-most type that's `normal' for the vfield. */
1035#define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
1036\f
1037/* Nonzero for TREE_LIST node means that this list of things
1038 is a list of parameters, as opposed to a list of expressions. */
1039#define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
1040
1041/* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
1042 this type can raise. */
1043#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
a9aedbc2 1044
e92cc029 1045/* The binding level associated with the namespace. */
72b7eeff 1046#define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
8d08fdba
MS
1047\f
1048struct lang_decl_flags
1049{
1050#ifdef ONLY_INT_FIELDS
1051 int language : 8;
1052#else
1053 enum languages language : 8;
1054#endif
1055
1056 unsigned operator_attr : 1;
1057 unsigned constructor_attr : 1;
1058 unsigned returns_first_arg : 1;
1059 unsigned preserves_first_arg : 1;
1060 unsigned friend_attr : 1;
1061 unsigned static_function : 1;
1062 unsigned const_memfunc : 1;
1063 unsigned volatile_memfunc : 1;
1064
1065 unsigned abstract_virtual : 1;
1066 unsigned permanent_attr : 1 ;
1067 unsigned constructor_for_vbase_attr : 1;
1068 unsigned mutable_flag : 1;
1069 unsigned is_default_implementation : 1;
8926095f 1070 unsigned saved_inline : 1;
a0a33927
MS
1071 unsigned use_template : 2;
1072
db5ae43f 1073 unsigned nonconverting : 1;
faae18ab
MS
1074 unsigned declared_inline : 1;
1075 unsigned not_really_extern : 1;
77be6f82 1076 unsigned comdat : 1;
cdcb673e
MH
1077 unsigned needs_final_overrider : 1;
1078 unsigned dummy : 3;
8d08fdba
MS
1079
1080 tree access;
1081 tree context;
1082 tree memfunc_pointer_to;
5566b478 1083 tree template_info;
72b7eeff 1084 struct binding_level *level;
8d08fdba
MS
1085};
1086
1087struct lang_decl
1088{
1089 struct lang_decl_flags decl_flags;
1090
8d08fdba
MS
1091 tree main_decl_variant;
1092 struct pending_inline *pending_inline_info;
8d08fdba
MS
1093};
1094
1095/* Non-zero if NODE is a _DECL with TREE_READONLY set. */
1096#define TREE_READONLY_DECL_P(NODE) \
1097 (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
1098
cffa8729
MS
1099/* Non-zero iff DECL is memory-based. The DECL_RTL of
1100 certain const variables might be a CONST_INT, or a REG
1101 in some cases. We cannot use `memory_operand' as a test
1102 here because on most RISC machines, a variable's address
1103 is not, by itself, a legitimate address. */
1104#define DECL_IN_MEMORY_P(NODE) \
1105 (DECL_RTL (NODE) != NULL_RTX && GET_CODE (DECL_RTL (NODE)) == MEM)
1106
8d08fdba
MS
1107/* For FUNCTION_DECLs: return the language in which this decl
1108 was declared. */
1109#define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
1110
1111/* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
1112#define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
711734a9
JM
1113#define DECL_DESTRUCTOR_P(NODE) (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME(NODE)))
1114
8d08fdba
MS
1115/* For FUNCTION_DECLs: nonzero means that this function is a constructor
1116 for an object with virtual baseclasses. */
1117#define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
1118
1119/* For FUNCTION_DECLs: nonzero means that this function is a default
1120 implementation of a signature method. */
1121#define IS_DEFAULT_IMPLEMENTATION(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.is_default_implementation)
1122
1123/* For FUNCTION_DECLs: nonzero means that the constructor
1124 is known to return a non-zero `this' unchanged. */
1125#define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
1126
1127/* Nonzero for FUNCTION_DECL means that this constructor is known to
1128 not make any assignment to `this', and therefore can be trusted
4ac14744 1129 to return it unchanged. Otherwise, we must re-assign `current_class_ptr'
8d08fdba
MS
1130 after performing base initializations. */
1131#define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
1132
1133/* Nonzero for _DECL means that this decl appears in (or will appear
1134 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
1135 detecting circularity in case members are multiply defined. In the
1136 case of a VAR_DECL, it is also used to determine how program storage
1137 should be allocated. */
1138#define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
1139
1140/* Nonzero for FUNCTION_DECL means that this decl is just a
1141 friend declaration, and should not be added to the list of
1142 member functions for this class. */
1143#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
1144
1145/* Nonzero for FUNCTION_DECL means that this decl is a static
1146 member function. */
1147#define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
1148
700f8a87
MS
1149/* Nonzero for a class member means that it is shared between all objects
1150 of that class. */
1151#define SHARED_MEMBER_P(NODE) \
1152 (TREE_CODE (NODE) == VAR_DECL || TREE_CODE (NODE) == TYPE_DECL \
1153 || TREE_CODE (NODE) == CONST_DECL)
1154
8857f91e
MM
1155/* Nonzero for FUNCTION_DECL means that this decl is a non-static
1156 member function. */
1157#define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
1158 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
1159
8926095f
MS
1160/* Nonzero for FUNCTION_DECL means that this decl is a member function
1161 (static or non-static). */
1162#define DECL_FUNCTION_MEMBER_P(NODE) \
8857f91e 1163 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
8926095f 1164
8d08fdba
MS
1165/* Nonzero for FUNCTION_DECL means that this member function
1166 has `this' as const X *const. */
1167#define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
1168
1169/* Nonzero for FUNCTION_DECL means that this member function
1170 has `this' as volatile X *const. */
1171#define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
1172
1173/* Nonzero for _DECL means that this member object type
1174 is mutable. */
1175#define DECL_MUTABLE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.mutable_flag)
1176
db5ae43f
MS
1177/* Nonzero for _DECL means that this constructor is a non-converting
1178 constructor. */
1179#define DECL_NONCONVERTING_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.nonconverting)
1180
8d08fdba
MS
1181/* Nonzero for FUNCTION_DECL means that this member function
1182 exists as part of an abstract class's interface. */
1183#define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
1184
cdcb673e
MH
1185/* Nonzero for FUNCTION_DECL means that this member function
1186 must be overridden by derived classes. */
1187#define DECL_NEEDS_FINAL_OVERRIDER_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.needs_final_overrider)
1188
8d08fdba
MS
1189/* Nonzero if allocated on permanent_obstack. */
1190#define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
1191
8926095f
MS
1192/* The _TYPE context in which this _DECL appears. This field holds the
1193 class where a virtual function instance is actually defined, and the
30394414 1194 lexical scope of a friend function defined in a class body. */
8d08fdba 1195#define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
f30432d7
MS
1196#define DECL_REAL_CONTEXT(NODE) \
1197 ((TREE_CODE (NODE) == FUNCTION_DECL && DECL_FUNCTION_MEMBER_P (NODE)) \
cb0dbb9a
JM
1198 ? DECL_CLASS_CONTEXT (NODE) : CP_DECL_CONTEXT (NODE))
1199
1200/* NULL_TREE in DECL_CONTEXT represents the global namespace. */
1201#define CP_DECL_CONTEXT(NODE) \
1202 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
1203#define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
8d08fdba 1204
42c7b807 1205/* 1 iff NODE has namespace scope, including the global namespace. */
6eb3bb27 1206#define DECL_NAMESPACE_SCOPE_P(NODE) \
42c7b807
JM
1207 (DECL_CONTEXT (NODE) == NULL_TREE \
1208 || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
1209
1210/* 1 iff NODE is a class member. */
6eb3bb27 1211#define DECL_CLASS_SCOPE_P(NODE) \
42c7b807
JM
1212 (DECL_CONTEXT (NODE) \
1213 && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
1214
2c73f9f5 1215/* For a NAMESPACE_DECL: the list of using namespace directives
30394414 1216 The PURPOSE is the used namespace, the value is the namespace
2c73f9f5
ML
1217 that is the common ancestor. */
1218#define DECL_NAMESPACE_USING(NODE) DECL_VINDEX(NODE)
30394414
JM
1219
1220/* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
2c73f9f5 1221 of a namespace, to record the transitive closure of using namespace. */
30394414
JM
1222#define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NODE)
1223
3e3f722c
ML
1224/* In a NAMESPACE_DECL, points to the original namespace if this is
1225 a namespace alias. */
1226#define DECL_NAMESPACE_ALIAS(NODE) DECL_ABSTRACT_ORIGIN (NODE)
1227#define ORIGINAL_NAMESPACE(NODE) \
1228 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
1229
30394414
JM
1230/* In a TREE_LIST concatenating using directives, indicate indirekt
1231 directives */
1232#define TREE_INDIRECT_USING(NODE) ((NODE)->common.lang_flag_0)
8d08fdba 1233
d2ad151f 1234/* In a VAR_DECL for a variable declared in a for statement,
e92cc029 1235 this is the shadowed (local) variable. */
d2ad151f
PB
1236#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
1237
8d08fdba
MS
1238/* Points back to the decl which caused this lang_decl to be allocated. */
1239#define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
1240
1241/* For a FUNCTION_DECL: if this function was declared inline inside of
1242 a class declaration, this is where the text for the function is
1243 squirreled away. */
1244#define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
1245
e92cc029 1246/* True if on the saved_inlines (see decl2.c) list. */
8926095f
MS
1247#define DECL_SAVED_INLINE(DECL) \
1248 (DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
1249
8d08fdba
MS
1250/* For a FUNCTION_DECL: if this function was declared inside a signature
1251 declaration, this is the corresponding member function pointer that was
1252 created for it. */
1253#define DECL_MEMFUNC_POINTER_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
1254
1255/* For a FIELD_DECL: this points to the signature member function from
1256 which this signature member function pointer was created. */
1257#define DECL_MEMFUNC_POINTING_TO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.memfunc_pointer_to)
1258
5566b478
MS
1259/* For a VAR_DECL or FUNCTION_DECL: template-specific information. */
1260#define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.template_info)
ed44da02
MM
1261
1262/* Template information for a RECORD_TYPE or UNION_TYPE. */
5566b478 1263#define CLASSTYPE_TEMPLATE_INFO(NODE) (TYPE_LANG_SPECIFIC(NODE)->template_info)
ed44da02
MM
1264
1265/* Template information for an ENUMERAL_TYPE. Although an enumeration may
1266 not be a primary template, it may be declared within the scope of a
1267 primary template and the enumeration constants may depend on
1268 non-type template parameters. */
1269#define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (NODE))
1270
1271/* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1272#define TYPE_TEMPLATE_INFO(NODE) \
1273 (TREE_CODE (NODE) == ENUMERAL_TYPE \
1274 ? ENUM_TEMPLATE_INFO (NODE) : CLASSTYPE_TEMPLATE_INFO (NODE))
1275
1276/* Set the template information for an ENUMERAL_, RECORD_, or
1277 UNION_TYPE to VAL. */
1278#define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
1279 (TREE_CODE (NODE) == ENUMERAL_TYPE \
1280 ? (ENUM_TEMPLATE_INFO (NODE) = VAL) \
1281 : (CLASSTYPE_TEMPLATE_INFO (NODE) = VAL))
1282
5566b478
MS
1283#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
1284#define TI_ARGS(NODE) (TREE_VALUE (NODE))
6633d636 1285#define TI_SPEC_INFO(NODE) (TREE_CHAIN (NODE))
824b9a4c 1286#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
ed44da02 1287
e1467ff2
MM
1288/* TI_PENDING_SPECIALIZATION_FLAG on a template-info node indicates
1289 that the template is a specialization of a member template, but
1290 that we don't yet know which one. */
1291#define TI_PENDING_SPECIALIZATION_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
ed44da02 1292
36a117a5
MM
1293/* The TEMPLATE_DECL instantiated or specialized by NODE. This
1294 TEMPLATE_DECL will be the immediate parent, not the most general
1295 template. For example, in:
1296
1297 template <class T> struct S { template <class U> void f(U); }
1298
1299 the FUNCTION_DECL for S<int>::f<double> will have, as its
1300 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
1301
1302 As a special case, for a member friend template of a template
1303 class, this value will not be a TEMPLATE_DECL, but rather a
672476cb
MM
1304 LOOKUP_EXPR or IDENTIFIER_NODE indicating the name of the template
1305 and any explicit template arguments provided. For example, in:
36a117a5
MM
1306
1307 template <class T> struct S { friend void f<int>(int, double); }
1308
1309 the DECL_TI_TEMPLATE will be a LOOKUP_EXPR for `f' and the
1310 DECL_TI_ARGS will be {int}. */
5566b478 1311#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
ed44da02 1312
36a117a5
MM
1313/* The template arguments used to obtain this decl from the most
1314 general form of DECL_TI_TEMPLATE. For the example given for
1315 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
1316 are always the full set of arguments required to instantiate this
1317 declaration from the most general template specialized here. */
5566b478
MS
1318#define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
1319#define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
1320#define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
6633d636 1321#define CLASSTYPE_TI_SPEC_INFO(NODE) TI_SPEC_INFO (CLASSTYPE_TEMPLATE_INFO (NODE))
ed44da02
MM
1322#define ENUM_TI_TEMPLATE(NODE) \
1323 TI_TEMPLATE (ENUM_TEMPLATE_INFO (NODE))
1324#define ENUM_TI_ARGS(NODE) \
1325 TI_ARGS (ENUM_TEMPLATE_INFO (NODE))
1326
1327/* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1328#define TYPE_TI_TEMPLATE(NODE) \
1329 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
1330
1331/* Like DECL_TI_ARGS, , but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
1332#define TYPE_TI_ARGS(NODE) \
1333 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
1334
98c1c668 1335#define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE(NODE)
5566b478 1336
cae40af6
JM
1337#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
1338
5566b478
MS
1339#define DECL_SAVED_TREE(NODE) DECL_MEMFUNC_POINTER_TO (NODE)
1340#define COMPOUND_STMT_NO_SCOPE(NODE) TREE_LANG_FLAG_0 (NODE)
1341#define NEW_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1342#define DELETE_EXPR_USE_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
1343#define DELETE_EXPR_USE_VEC(NODE) TREE_LANG_FLAG_1 (NODE)
1344#define LOOKUP_EXPR_GLOBAL(NODE) TREE_LANG_FLAG_0 (NODE)
8d08fdba 1345
6757edfe
MM
1346/* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
1347 TEMPLATE_DECL. This macro determines whether or not a given class
1348 type is really a template type, as opposed to an instantiation or
1349 specialization of one. */
1350#define CLASSTYPE_IS_TEMPLATE(NODE) \
1351 (CLASSTYPE_TEMPLATE_INFO (NODE) \
1352 && !CLASSTYPE_USE_TEMPLATE (NODE) \
1353 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
1354
ca40b399
JM
1355#define TYPENAME_TYPE_FULLNAME(NODE) CLASSTYPE_SIZE (NODE)
1356
cfdd0551 1357/* Nonzero in INTEGER_CST means that this int is negative by dint of
8d08fdba
MS
1358 using a twos-complement negated operand. */
1359#define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
1360
a0d5fba7 1361#if 0 /* UNUSED */
8d08fdba
MS
1362/* Nonzero in any kind of _EXPR or _REF node means that it is a call
1363 to a storage allocation routine. If, later, alternate storage
1364 is found to hold the object, this call can be ignored. */
1365#define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
a0d5fba7 1366#endif
8d08fdba
MS
1367
1368/* Nonzero in any kind of _TYPE that uses multiple inheritance
1369 or virtual baseclasses. */
1370#define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
1371
a80e4195 1372#if 0 /* UNUSED */
8d2733ca
MS
1373/* Nonzero in IDENTIFIER_NODE means that this name is not the name the user
1374 gave; it's a DECL_NESTED_TYPENAME. Someone may want to set this on
1375 mangled function names, too, but it isn't currently. */
1376#define TREE_MANGLED(NODE) (TREE_LANG_FLAG_0 (NODE))
a80e4195 1377#endif
8d2733ca 1378
7177d104 1379#if 0 /* UNUSED */
8d08fdba
MS
1380/* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
1381 should be looked up in a non-standard way. */
73aad9b9 1382#define DECL_OVERLOADED(NODE) (FOO)
8926095f 1383#endif
8d08fdba
MS
1384
1385/* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
1386 For a FUNCTION_DECL, this is when the function is a virtual function.
1387 For a VAR_DECL, this is when the variable is a virtual function table.
1388 For a FIELD_DECL, when the field is the field for the virtual function table.
1389 For an IDENTIFIER_NODE, nonzero if any function with this name
1390 has been declared virtual.
1391
1392 For a _TYPE if it uses virtual functions (or is derived from
1393 one that does). */
1394#define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
1395
d2ad151f
PB
1396extern int flag_new_for_scope;
1397
1398/* This flag is true of a local VAR_DECL if it was declared in a for
e92cc029 1399 statement, but we are no longer in the scope of the for. */
d2ad151f
PB
1400#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
1401
1402/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
1403 if we already emitted a warning about using it. */
1404#define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (NODE)
1405
700f8a87 1406/* This _DECL represents a compiler-generated entity. */
863adfc0 1407#define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
8d08fdba
MS
1408
1409/* Record whether a typedef for type `int' was actually `signed int'. */
1410#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
1411
1412/* Nonzero if the type T promotes to itself.
1413 ANSI C states explicitly the list of types that promote;
1414 in particular, short promotes to int even if they have the same width. */
1415#define C_PROMOTING_INTEGER_TYPE_P(t) \
1416 (TREE_CODE ((t)) == INTEGER_TYPE \
1417 && (TYPE_MAIN_VARIANT (t) == char_type_node \
1418 || TYPE_MAIN_VARIANT (t) == signed_char_type_node \
1419 || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node \
1420 || TYPE_MAIN_VARIANT (t) == short_integer_type_node \
1421 || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node))
1422
2986ae00
MS
1423#define INTEGRAL_CODE_P(CODE) \
1424 (CODE == INTEGER_TYPE || CODE == ENUMERAL_TYPE || CODE == BOOLEAN_TYPE)
1425#define ARITHMETIC_TYPE_P(TYPE) (INTEGRAL_TYPE_P (TYPE) || FLOAT_TYPE_P (TYPE))
1426
8d08fdba
MS
1427/* Mark which labels are explicitly declared.
1428 These may be shadowed, and may be referenced from nested functions. */
1429#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)
1430
8d08fdba
MS
1431/* Nonzero for _TYPE means that the _TYPE defines
1432 at least one constructor. */
1433#define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
1434
1435/* When appearing in an INDIRECT_REF, it means that the tree structure
1436 underneath is actually a call to a constructor. This is needed
1437 when the constructor must initialize local storage (which can
1438 be automatically destroyed), rather than allowing it to allocate
1439 space from the heap.
1440
1441 When appearing in a SAVE_EXPR, it means that underneath
1442 is a call to a constructor.
1443
1444 When appearing in a CONSTRUCTOR, it means that it was
1445 a GNU C constructor expression.
1446
1447 When appearing in a FIELD_DECL, it means that this field
1448 has been duly initialized in its constructor. */
1449#define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
1450
a3203465
MS
1451#define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
1452 && CONSTRUCTOR_ELTS (NODE) == NULL_TREE)
1453
eb66be0e 1454#if 0
8d08fdba
MS
1455/* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
1456 Used to generate more helpful error message in case somebody
1457 tries to take its address. */
1458#define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
eb66be0e 1459#endif
8d08fdba
MS
1460
1461/* Nonzero for _TYPE means that the _TYPE defines a destructor. */
1462#define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
1463
f55c7d88 1464#if 0
8d08fdba
MS
1465/* Nonzero for _TYPE node means that creating an object of this type
1466 will involve a call to a constructor. This can apply to objects
1467 of ARRAY_TYPE if the type of the elements needs a constructor. */
cfdd0551 1468#define TYPE_NEEDS_CONSTRUCTING(NODE) ... defined in ../tree.h ...
f55c7d88 1469#endif
8d08fdba 1470
f30432d7
MS
1471/* Nonzero means that an object of this type can not be initialized using
1472 an initializer list. */
1473#define CLASSTYPE_NON_AGGREGATE(NODE) \
1474 (TYPE_LANG_SPECIFIC (NODE)->type_flags.non_aggregate)
1475#define TYPE_NON_AGGREGATE_CLASS(NODE) \
1476 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
1477
8d08fdba
MS
1478/* Nonzero if there is a user-defined X::op=(x&) for this class. */
1479#define TYPE_HAS_REAL_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_real_assign_ref)
1480#define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_assign_ref)
f0e01782 1481#define TYPE_HAS_ABSTRACT_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_abstract_assign_ref)
8d08fdba
MS
1482#define TYPE_HAS_COMPLEX_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_complex_init_ref)
1483
1484/* Nonzero for _TYPE node means that destroying an object of this type
1485 will involve a call to a destructor. This can apply to objects
1486 of ARRAY_TYPE is the type of the elements needs a destructor. */
1487#define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
1488
e8abc66f
MS
1489/* Nonzero for class type means that initialization of this type can use
1490 a bitwise copy. */
1491#define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
1492 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
1493
1494/* Nonzero for class type means that assignment of this type can use
1495 a bitwise copy. */
1496#define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
1497 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
1498
c11b6f21
MS
1499#define TYPE_PTRMEM_P(NODE) \
1500 (TREE_CODE (NODE) == POINTER_TYPE \
1501 && TREE_CODE (TREE_TYPE (NODE)) == OFFSET_TYPE)
1502#define TYPE_PTR_P(NODE) \
1503 (TREE_CODE (NODE) == POINTER_TYPE \
1504 && TREE_CODE (TREE_TYPE (NODE)) != OFFSET_TYPE)
1505#define TYPE_PTROB_P(NODE) \
1506 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE \
1507 && TREE_CODE (TREE_TYPE (NODE)) != VOID_TYPE)
1508#define TYPE_PTROBV_P(NODE) \
1509 (TYPE_PTR_P (NODE) && TREE_CODE (TREE_TYPE (NODE)) != FUNCTION_TYPE)
1510#define TYPE_PTRFN_P(NODE) \
1511 (TREE_CODE (NODE) == POINTER_TYPE \
1512 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
1513
8d08fdba 1514/* Nonzero for _TYPE node means that this type is a pointer to member
e92cc029 1515 function type. */
8d08fdba
MS
1516#define TYPE_PTRMEMFUNC_P(NODE) (TREE_CODE(NODE) == RECORD_TYPE && TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
1517#define TYPE_PTRMEMFUNC_FLAG(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
1518/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
1519 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
e92cc029 1520 before using this macro. */
8d08fdba 1521#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
ceab47eb
MM
1522
1523/* Returns `A' for a type like `int (A::*)(double)' */
1524#define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
1525 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
1526
38e01259 1527/* These are use to manipulate the canonical RECORD_TYPE from the
e92cc029 1528 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
8d08fdba
MS
1529#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
1530#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
e92cc029 1531/* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
4dabb379
MS
1532#define DELTA2_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), delta2_identifier, NULL_TREE, 0))
1533#define PFN_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), pfn_identifier, NULL_TREE, 0))
8d08fdba 1534
faae18ab 1535/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
8926095f 1536 specified in its declaration. */
8d08fdba
MS
1537#define DECL_THIS_EXTERN(NODE) (DECL_LANG_FLAG_2(NODE))
1538
faae18ab
MS
1539/* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
1540 specified in its declaration. */
1541#define DECL_THIS_STATIC(NODE) (DECL_LANG_FLAG_6(NODE))
1542
8d08fdba
MS
1543/* Nonzero for SAVE_EXPR if used to initialize a PARM_DECL. */
1544#define PARM_DECL_EXPR(NODE) (TREE_LANG_FLAG_2(NODE))
1545
1546/* Nonzero in FUNCTION_DECL means it is really an operator.
1547 Just used to communicate formatting information to dbxout.c. */
1548#define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
1549
1550#define ANON_UNION_P(NODE) (DECL_NAME (NODE) == 0)
1551
67ffc812
MM
1552/* Nonzero if TYPE is an anonymous union type. */
1553#define ANON_UNION_TYPE_P(TYPE) \
1554 (TREE_CODE (TYPE) == UNION_TYPE \
1555 && ANON_AGGRNAME_P (TYPE_IDENTIFIER (TYPE)))
1556
8d08fdba
MS
1557#define UNKNOWN_TYPE LANG_TYPE
1558
1559/* Define fields and accessors for nodes representing declared names. */
1560
1561#if 0
1562/* C++: A derived class may be able to directly use the virtual
1563 function table of a base class. When it does so, it may
1564 still have a decl node used to access the virtual function
1565 table (so that variables of this type can initialize their
1566 virtual function table pointers by name). When such thievery
1567 is committed, know exactly which base class's virtual function
1568 table is the one being stolen. This effectively computes the
1569 transitive closure. */
1570#define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
1571#endif
1572
8d08fdba
MS
1573#define TYPE_WAS_ANONYMOUS(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.was_anonymous)
1574
1575/* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
f84b4be9
JM
1576
1577/* The format of each node in the DECL_FRIENDLIST is as follows:
1578
1579 The TREE_PURPOSE will be the name of a function, i.e., an
1580 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, the
1581 list of functions with that name which are friends. The
1582 TREE_PURPOSE of each node in this sublist will be error_mark_node,
1583 if the function was declared a friend individually, in which case
1584 the TREE_VALUE will be the function_decl. If, however, all
1585 functions with a given name in a class were declared to be friends,
1586 the TREE_PUROSE will be the class type, and the TREE_VALUE will be
1587 NULL_TREE. */
8d08fdba 1588#define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
8d08fdba
MS
1589
1590/* The DECL_ACCESS is used to record under which context
1591 special access rules apply. */
1592#define DECL_ACCESS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.access)
1593
1594/* C++: all of these are overloaded!
1595 These apply to PARM_DECLs and VAR_DECLs. */
1596#define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
1597#define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
1598
8d08fdba 1599/* Accessor macros for C++ template decl nodes. */
f84b4be9
JM
1600
1601/* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
36a117a5
MM
1602 is a INT_CST whose TREE_INT_CST_HIGH indicates the level of the
1603 template parameters, with 1 being the outermost set of template
1604 parameters. The TREE_VALUE is a vector, whose elements are the
1605 template parameters at each level. Each element in the vector is a
1606 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
1607 non-type parameter), or a TYPE_DECL (if the parameter is a type
1608 parameter). The TREE_PURPOSE is the default value, if any. The
1609 TEMPLATE_PARM_INDEX for the parameter is avilable as the
1610 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
1611 TYPE_DECL). */
8d08fdba 1612#define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
98c1c668
JM
1613#define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
1614 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
1615#define DECL_NTPARMS(NODE) \
1616 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
8d08fdba
MS
1617/* For function, method, class-data templates. */
1618#define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
36a117a5
MM
1619/* For a static member variable template, the
1620 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
1621 implicitly generated instantiations of the variable. There are no
1622 partial instantiations of static member variables, so all of these
1623 will be full instantiations.
1624
1625 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
1626 all instantiations and specializations of the class type, including
1627 partial instantiations and partial specializations.
1628
1629 In both cases, the TREE_PURPOSE of each node contains the arguments
1630 used; the TREE_VALUE contains the generated variable. The template
1631 arguments are always complete. For example, given:
1632
1633 template <class T> struct S1 {
1634 template <class U> struct S2 {};
1635 template <class U> struct S2<U*> {};
1636 };
1637
1638 the record for the partial specialization will contain, as its
1639 argument list, { {T}, {U*} }, and will be on the
1640 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
1641 <class U> struct S1<T>::S2'.
1642
1643 This list is not used for function templates. */
8d08fdba 1644#define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
36a117a5
MM
1645/* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
1646 contains all instantiations and specializations of the function,
1647 including partial instantiations. For a partial instantiation
1648 which is a specialization, this list holds only full
1649 specializations of the template that are instantiations of the
1650 partial instantiation. For example, given:
1651
1652 template <class T> struct S {
1653 template <class U> void f(U);
1654 template <> void f(T);
1655 };
1656
1657 the `S<int>::f<int>(int)' function will appear on the
1658 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
1659 template <class U> void S<T>::f(U)' and `template <class T> void
1660 S<int>::f(T)'. In the latter case, however, it will have only the
1661 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
1662 for the function declaration will point at the specialization, not
1663 the fully general template.
1664
1665 For a class template, this list contains the partial
1666 specializations of this template. (Full specializations are not
1667 recorded on this list.) The TREE_PURPOSE holds the innermost
1668 arguments used in the partial specialization (e.g., for `template
1669 <class T> struct S<T*, int>' this will be `T*'.) The TREE_VALUE
1670 holds the innermost template parameters for the specialization
1671 (e.g., `T' in the example above.) The TREE_TYPE is the _TYPE node
1672 for the partial specialization.
1673
1674 This list is not used for static variable templates. */
1675#define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE(NODE)
5566b478
MS
1676#define DECL_TEMPLATE_INJECT(NODE) DECL_INITIAL(NODE)
1677
73b0fce8
KL
1678/* Nonzero for TEMPLATE_DECL nodes that represents template template
1679 parameters */
1680#define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
1681 (TREE_CODE (NODE) == TEMPLATE_DECL && TREE_TYPE (NODE) \
1682 && TREE_CODE (TREE_TYPE (NODE)) == TEMPLATE_TEMPLATE_PARM)
1683
5566b478
MS
1684#define DECL_FUNCTION_TEMPLATE_P(NODE) \
1685 (TREE_CODE (NODE) == TEMPLATE_DECL \
1686 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
1687
6757edfe
MM
1688/* Nonzero for a DECL that represents a template class. */
1689#define DECL_CLASS_TEMPLATE_P(NODE) \
1690 (TREE_CODE (NODE) == TEMPLATE_DECL \
1691 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
1692 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
1693
35acd3f2
MM
1694/* Nonzero if NODE which declares a type. */
1695#define DECL_DECLARES_TYPE_P(NODE) \
1696 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
1697
93cdc044
JM
1698/* A `primary' template is one that has its own template header. A
1699 member function of a class template is a template, but not primary.
6757edfe
MM
1700 A member template is primary. Friend templates are primary, too. */
1701
1702/* Returns the primary template corresponding to these parameters. */
1703#define DECL_PRIMARY_TEMPLATE(NODE) \
1704 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
1705
1706/* Returns non-zero if NODE is a primary template. */
1707#define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == NODE)
5566b478
MS
1708
1709#define CLASSTYPE_TEMPLATE_LEVEL(NODE) \
1710 (TREE_INT_CST_HIGH (TREE_PURPOSE (CLASSTYPE_TI_TEMPLATE (NODE))))
8d08fdba 1711
a0a33927
MS
1712/* Indicates whether or not (and how) a template was expanded for this
1713 FUNCTION_DECL or VAR_DECL.
1714 0=normal declaration, e.g. int min (int, int);
1715 1=implicit template instantiation
1716 2=explicit template specialization, e.g. int min<int> (int, int);
e92cc029 1717 3=explicit template instantiation, e.g. template int min<int> (int, int); */
a0a33927
MS
1718#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
1719
1720#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
1721#define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
1722 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
1723
1724#define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
1725#define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
1726#define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
1727 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
1728#define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
1729 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
1730
1731#define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
1732#define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
1733#define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
1734 (CLASSTYPE_USE_TEMPLATE(NODE) == 1)
1735#define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
1736 (CLASSTYPE_USE_TEMPLATE(NODE) = 1)
1737
1738#define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
1739#define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
1740#define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
1741 (CLASSTYPE_USE_TEMPLATE(NODE) == 3)
1742#define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
1743 (CLASSTYPE_USE_TEMPLATE(NODE) = 3)
7177d104 1744
39c01e4c
MM
1745/* Non-zero iff we are currently processing a declaration for an
1746 entity with its own template parameter list, and which is not a
1747 full specialization. */
1748#define PROCESSING_REAL_TEMPLATE_DECL_P() \
1749 (processing_template_decl > template_class_depth (current_class_type))
1750
73aad9b9
JM
1751/* This function may be a guiding decl for a template. */
1752#define DECL_MAYBE_TEMPLATE(NODE) DECL_LANG_FLAG_4 (NODE)
db5ae43f 1753/* We know what we're doing with this decl now. */
e3417fcd 1754#define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
db5ae43f 1755
faae18ab
MS
1756/* This function was declared inline. This flag controls the linkage
1757 semantics of 'inline'; whether or not the function is inlined is
1758 controlled by DECL_INLINE. */
1759#define DECL_THIS_INLINE(NODE) \
1760 (DECL_LANG_SPECIFIC (NODE)->decl_flags.declared_inline)
1761
1762/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
1763 so that assemble_external will work properly. So we have this flag to
1764 tell us whether the decl is really not external. */
1765#define DECL_NOT_REALLY_EXTERN(NODE) \
1766 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
db5ae43f 1767
6b5fbb55
MS
1768#define DECL_REALLY_EXTERN(NODE) \
1769 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
1770
77be6f82
JM
1771/* Used to tell cp_finish_decl that it should approximate comdat linkage
1772 as best it can for this decl. */
1773#define DECL_COMDAT(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.comdat)
1774
39211cd5 1775#define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
8926095f 1776
8d08fdba
MS
1777/* ...and for unexpanded-parameterized-type nodes. */
1778#define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
1779#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
1780
42976354 1781/* An un-parsed default argument looks like an identifier. */
2b9dc906
JM
1782#define DEFARG_NODE_CHECK(t) TREE_CHECK(t, DEFAULT_ARG)
1783#define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length)
1784#define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
42976354 1785
72b7eeff 1786#define builtin_function(NAME, TYPE, CODE, LIBNAME) \
49c249e1 1787 define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME)
72b7eeff 1788
ad321293
MM
1789/* These macros provide convenient access to the various _STMT nodes
1790 created when parsing template declarations. */
1791#define IF_COND(NODE) TREE_OPERAND (NODE, 0)
1792#define THEN_CLAUSE(NODE) TREE_OPERAND (NODE, 1)
1793#define ELSE_CLAUSE(NODE) TREE_OPERAND (NODE, 2)
1794#define WHILE_COND(NODE) TREE_OPERAND (NODE, 0)
1795#define WHILE_BODY(NODE) TREE_OPERAND (NODE, 1)
1796#define DO_COND(NODE) TREE_OPERAND (NODE, 0)
1797#define DO_BODY(NODE) TREE_OPERAND (NODE, 1)
1798#define RETURN_EXPR(NODE) TREE_OPERAND (NODE, 0)
1799#define EXPR_STMT_EXPR(NODE) TREE_OPERAND (NODE, 0)
1800#define FOR_INIT_STMT(NODE) TREE_OPERAND (NODE, 0)
1801#define FOR_COND(NODE) TREE_OPERAND (NODE, 1)
1802#define FOR_EXPR(NODE) TREE_OPERAND (NODE, 2)
1803#define FOR_BODY(NODE) TREE_OPERAND (NODE, 3)
1804#define SWITCH_COND(NODE) TREE_OPERAND (NODE, 0)
1805#define SWITCH_BODY(NODE) TREE_OPERAND (NODE, 1)
1806#define CASE_LOW(NODE) TREE_OPERAND (NODE, 0)
1807#define CASE_HIGH(NODE) TREE_OPERAND (NODE, 1)
1808#define GOTO_DESTINATION(NODE) TREE_OPERAND (NODE, 0)
1809#define TRY_STMTS(NODE) TREE_OPERAND (NODE, 0)
1810#define TRY_HANDLERS(NODE) TREE_OPERAND (NODE, 1)
1811#define HANDLER_PARMS(NODE) TREE_OPERAND (NODE, 0)
1812#define HANDLER_BODY(NODE) TREE_OPERAND (NODE, 1)
1813#define COMPOUND_BODY(NODE) TREE_OPERAND (NODE, 0)
1814#define ASM_CV_QUAL(NODE) TREE_OPERAND (NODE, 0)
1815#define ASM_STRING(NODE) TREE_OPERAND (NODE, 1)
1816#define ASM_OUTPUTS(NODE) TREE_OPERAND (NODE, 2)
1817#define ASM_INPUTS(NODE) TREE_OPERAND (NODE, 3)
1818#define ASM_CLOBBERS(NODE) TREE_OPERAND (NODE, 4)
1819
8d08fdba
MS
1820/* An enumeration of the kind of tags that C++ accepts. */
1821enum tag_types { record_type, class_type, union_type, enum_type,
db5ae43f 1822 signature_type };
8d08fdba
MS
1823
1824/* Zero means prototype weakly, as in ANSI C (no args means nothing).
1825 Each language context defines how this variable should be set. */
1826extern int strict_prototype;
1827extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
1828
1829/* Non-zero means that if a label exists, and no other identifier
1830 applies, use the value of the label. */
1831extern int flag_labels_ok;
1832
1833/* Non-zero means to collect statistics which might be expensive
1834 and to print them when we are done. */
1835extern int flag_detailed_statistics;
1836
1837/* Non-zero means warn in function declared in derived class has the
1838 same name as a virtual in the base class, but fails to match the
1839 type signature of any virtual function in the base class. */
1840extern int warn_overloaded_virtual;
1841
dc8263bc
JM
1842/* Nonzero means warn about use of multicharacter literals. */
1843extern int warn_multichar;
1844
8d08fdba
MS
1845/* in c-common.c */
1846extern void declare_function_name PROTO((void));
820b778a 1847extern void decl_attributes PROTO((tree, tree, tree));
8d08fdba
MS
1848extern void init_function_format_info PROTO((void));
1849extern void record_function_format PROTO((tree, tree, int, int, int));
1850extern void check_function_format PROTO((tree, tree, tree));
1851/* Print an error message for invalid operands to arith operation CODE.
1852 NOP_EXPR is used as a special case (see truthvalue_conversion). */
1853extern void binary_op_error PROTO((enum tree_code));
f376e137 1854extern tree cp_build_type_variant PROTO((tree, int, int));
53929c47 1855extern tree canonical_type_variant PROTO((tree));
8d08fdba
MS
1856extern void c_expand_expr_stmt PROTO((tree));
1857/* Validate the expression after `case' and apply default promotions. */
1858extern tree check_case_value PROTO((tree));
1859/* Concatenate a list of STRING_CST nodes into one STRING_CST. */
1860extern tree combine_strings PROTO((tree));
1861extern void constant_expression_warning PROTO((tree));
1862extern tree convert_and_check PROTO((tree, tree));
1863extern void overflow_warning PROTO((tree));
1864extern void unsigned_conversion_warning PROTO((tree, tree));
1865/* Read the rest of the current #-directive line. */
d4dfe7d6
DB
1866#if USE_CPPLIB
1867extern char *get_directive_line PROTO((void));
1868#define GET_DIRECTIVE_LINE() get_directive_line ()
1869#else
da20811c 1870extern char *get_directive_line PROTO((FILE *));
d4dfe7d6
DB
1871#define GET_DIRECTIVE_LINE() get_directive_line (finput)
1872#endif
8d08fdba
MS
1873/* Subroutine of build_binary_op, used for comparison operations.
1874 See if the operands have both been converted from subword integer types
1875 and, if so, perhaps change them both back to their original type. */
1876extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
1877/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
e92cc029 1878 or validate its data type for an `if' or `while' statement or ?..: exp. */
8d08fdba
MS
1879extern tree truthvalue_conversion PROTO((tree));
1880extern tree type_for_mode PROTO((enum machine_mode, int));
1881extern tree type_for_size PROTO((unsigned, int));
501ba25a 1882extern int c_get_alias_set PROTO((tree));
8d08fdba 1883
51c184be 1884/* in decl{2}.c */
8d08fdba
MS
1885extern tree void_list_node;
1886extern tree void_zero_node;
1887extern tree default_function_type;
1888extern tree vtable_entry_type;
1889extern tree sigtable_entry_type;
db5ae43f 1890extern tree __t_desc_type_node;
5566b478 1891#if 0
db5ae43f 1892extern tree __tp_desc_type_node;
5566b478 1893#endif
db5ae43f
MS
1894extern tree __access_mode_type_node;
1895extern tree __bltn_desc_type_node, __user_desc_type_node;
1896extern tree __class_desc_type_node, __attr_desc_type_node;
1897extern tree __ptr_desc_type_node, __func_desc_type_node;
1898extern tree __ptmf_desc_type_node, __ptmd_desc_type_node;
1899extern tree type_info_type_node;
8d08fdba
MS
1900extern tree class_star_type_node;
1901extern tree this_identifier;
fc378698 1902extern tree ctor_identifier, dtor_identifier;
8d08fdba
MS
1903extern tree pfn_identifier;
1904extern tree index_identifier;
1905extern tree delta_identifier;
1906extern tree delta2_identifier;
1907extern tree pfn_or_delta2_identifier;
46b49f6c 1908extern tree tag_identifier;
4abea095 1909extern tree vt_off_identifier;
8d08fdba
MS
1910
1911/* A node that is a list (length 1) of error_mark_nodes. */
1912extern tree error_mark_list;
1913
0776059e 1914extern tree ptr_type_node;
8d08fdba 1915extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
db5ae43f 1916extern tree unknown_type_node;
8d08fdba
MS
1917extern tree opaque_type_node, signature_type_node;
1918
700f8a87 1919/* Node for "pointer to (virtual) function".
e92cc029 1920 This may be distinct from ptr_type_node so gdb can distinguish them. */
700f8a87
MS
1921#define vfunc_ptr_type_node \
1922 (flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
1923
8d08fdba
MS
1924/* Array type `(void *)[]' */
1925extern tree vtbl_type_node;
1926extern tree delta_type_node;
6633d636 1927extern tree std_node;
8d08fdba
MS
1928
1929extern tree long_long_integer_type_node, long_long_unsigned_type_node;
1930/* For building calls to `delete'. */
1931extern tree integer_two_node, integer_three_node;
28ed4616 1932extern tree boolean_type_node, boolean_true_node, boolean_false_node;
8d08fdba 1933
d11ad92e
MS
1934extern tree null_node;
1935
51c184be 1936/* in pt.c */
5566b478 1937
830bfa74
MM
1938/* These values are used for the `STRICT' parameter to type_unfication and
1939 fn_type_unification. Their meanings are described with the
1940 documentation for fn_type_unification. */
1941
1942typedef enum unification_kind_t {
1943 DEDUCE_CALL,
1944 DEDUCE_CONV,
1945 DEDUCE_EXACT
1946} unification_kind_t;
1947
5566b478
MS
1948extern tree current_template_parms;
1949extern HOST_WIDE_INT processing_template_decl;
75650646 1950extern tree last_tree;
8d08fdba
MS
1951
1952/* The template currently being instantiated, and where the instantiation
1953 was triggered. */
1954struct tinst_level
1955{
5566b478 1956 tree decl;
8d08fdba
MS
1957 int line;
1958 char *file;
1959 struct tinst_level *next;
1960};
1961
5566b478
MS
1962extern int minimal_parse_mode;
1963
bcb80729
KG
1964extern void maybe_print_template_context PROTO ((void));
1965
51c184be 1966/* in class.c */
8d08fdba
MS
1967extern tree current_class_name;
1968extern tree current_class_type;
824b9a4c 1969extern tree current_class_ptr;
8d08fdba 1970extern tree previous_class_type;
824b9a4c 1971extern tree current_class_ref;
b4c4a9ec 1972extern int current_class_depth;
8d08fdba 1973
fcad5cf5
BK
1974extern tree current_lang_name;
1975extern tree lang_name_cplusplus, lang_name_c, lang_name_java;
8d08fdba
MS
1976
1977/* Points to the name of that function. May not be the DECL_NAME
1978 of CURRENT_FUNCTION_DECL due to overloading */
1979extern tree original_function_name;
1980
51c184be 1981/* in init.c */
8d08fdba
MS
1982extern tree global_base_init_list;
1983extern tree current_base_init_list, current_member_init_list;
1984
8d08fdba
MS
1985extern int current_function_just_assigned_this;
1986extern int current_function_parms_stored;
1987\f
1988/* Here's where we control how name mangling takes place. */
1989
1990#define OPERATOR_ASSIGN_FORMAT "__a%s"
1991#define OPERATOR_FORMAT "__%s"
1992#define OPERATOR_TYPENAME_FORMAT "__op"
1993#define OPERATOR_TYPENAME_P(ID_NODE) \
1994 (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
1995 && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1996 && IDENTIFIER_POINTER (ID_NODE)[2] == 'o' \
1997 && IDENTIFIER_POINTER (ID_NODE)[3] == 'p')
1998
1999
2000/* Cannot use '$' up front, because this confuses gdb
2001 (names beginning with '$' are gdb-local identifiers).
2002
2003 Note that all forms in which the '$' is significant are long enough
2004 for direct indexing (meaning that if we know there is a '$'
2005 at a particular location, we can index into the string at
2006 any other location that provides distinguishing characters). */
2007
2008/* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
2009 doesn't allow '$' in symbol names. */
2010#ifndef NO_DOLLAR_IN_LABEL
2011
2012#define JOINER '$'
2013
2014#define VPTR_NAME "$v"
2015#define THROW_NAME "$eh_throw"
2016#define DESTRUCTOR_DECL_PREFIX "_$_"
2017#define AUTO_VTABLE_NAME "__vtbl$me__"
2018#define AUTO_TEMP_NAME "_$tmp_"
2019#define AUTO_TEMP_FORMAT "_$tmp_%d"
2020#define VTABLE_BASE "$vb"
a0a33927 2021#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt$%s")
8d08fdba
MS
2022#define VFIELD_BASE "$vf"
2023#define VFIELD_NAME "_vptr$"
2024#define VFIELD_NAME_FORMAT "_vptr$%s"
2025#define VBASE_NAME "_vb$"
2026#define VBASE_NAME_FORMAT "_vb$%s"
2027#define STATIC_NAME_FORMAT "_%s$%s"
2028#define ANON_AGGRNAME_FORMAT "$_%d"
2029
2030#else /* NO_DOLLAR_IN_LABEL */
2031
2032#ifndef NO_DOT_IN_LABEL
2033
2034#define JOINER '.'
2035
2036#define VPTR_NAME ".v"
2037#define THROW_NAME ".eh_throw"
2038#define DESTRUCTOR_DECL_PREFIX "_._"
2039#define AUTO_VTABLE_NAME "__vtbl.me__"
2040#define AUTO_TEMP_NAME "_.tmp_"
2041#define AUTO_TEMP_FORMAT "_.tmp_%d"
2042#define VTABLE_BASE ".vb"
a0a33927 2043#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt.%s")
8d08fdba
MS
2044#define VFIELD_BASE ".vf"
2045#define VFIELD_NAME "_vptr."
2046#define VFIELD_NAME_FORMAT "_vptr.%s"
2047#define VBASE_NAME "_vb."
2048#define VBASE_NAME_FORMAT "_vb.%s"
2049#define STATIC_NAME_FORMAT "_%s.%s"
2050
2051#define ANON_AGGRNAME_FORMAT "._%d"
2052
2053#else /* NO_DOT_IN_LABEL */
2054
2055#define VPTR_NAME "__vptr"
2056#define VPTR_NAME_P(ID_NODE) \
2057 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VPTR_NAME, sizeof (VPTR_NAME) - 1))
2058#define THROW_NAME "__eh_throw"
2059#define DESTRUCTOR_DECL_PREFIX "__destr_"
2060#define DESTRUCTOR_NAME_P(ID_NODE) \
2061 (!strncmp (IDENTIFIER_POINTER (ID_NODE), DESTRUCTOR_DECL_PREFIX, \
2062 sizeof (DESTRUCTOR_DECL_PREFIX) - 1))
2063#define IN_CHARGE_NAME "__in_chrg"
2064#define AUTO_VTABLE_NAME "__vtbl_me__"
2065#define AUTO_TEMP_NAME "__tmp_"
2066#define TEMP_NAME_P(ID_NODE) \
2067 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
2068 sizeof (AUTO_TEMP_NAME) - 1))
2069#define AUTO_TEMP_FORMAT "__tmp_%d"
2070#define VTABLE_BASE "__vtb"
2071#define VTABLE_NAME "__vt_"
a0a33927 2072#define VTABLE_NAME_FORMAT (flag_vtable_thunks ? "__vt_%s" : "_vt_%s")
8d08fdba
MS
2073#define VTABLE_NAME_P(ID_NODE) \
2074 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
2075 sizeof (VTABLE_NAME) - 1))
2076#define VFIELD_BASE "__vfb"
2077#define VFIELD_NAME "__vptr_"
2078#define VFIELD_NAME_P(ID_NODE) \
2079 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
2080 sizeof (VFIELD_NAME) - 1))
2081#define VFIELD_NAME_FORMAT "_vptr_%s"
2082#define VBASE_NAME "__vb_"
2083#define VBASE_NAME_P(ID_NODE) \
2084 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VBASE_NAME, \
2085 sizeof (VBASE_NAME) - 1))
2086#define VBASE_NAME_FORMAT "__vb_%s"
2087#define STATIC_NAME_FORMAT "__static_%s_%s"
2088
2089#define ANON_AGGRNAME_PREFIX "__anon_"
2090#define ANON_AGGRNAME_P(ID_NODE) \
2091 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
2092 sizeof (ANON_AGGRNAME_PREFIX) - 1))
2093#define ANON_AGGRNAME_FORMAT "__anon_%d"
2094#define ANON_PARMNAME_FORMAT "__%d"
2095#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2096 && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
2097 && IDENTIFIER_POINTER (ID_NODE)[2] <= '9')
2098
2099#endif /* NO_DOT_IN_LABEL */
2100#endif /* NO_DOLLAR_IN_LABEL */
2101
2102#define THIS_NAME "this"
2103#define DESTRUCTOR_NAME_FORMAT "~%s"
2104#define FILE_FUNCTION_PREFIX_LEN 9
fc378698
MS
2105#define CTOR_NAME "__ct"
2106#define DTOR_NAME "__dt"
8d08fdba
MS
2107
2108#define IN_CHARGE_NAME "__in_chrg"
2109
2110#define VTBL_PTR_TYPE "__vtbl_ptr_type"
2111#define VTABLE_DELTA_NAME "__delta"
2112#define VTABLE_INDEX_NAME "__index"
2113#define VTABLE_PFN_NAME "__pfn"
2114#define VTABLE_DELTA2_NAME "__delta2"
2115
2116#define SIGNATURE_FIELD_NAME "__s_"
2117#define SIGNATURE_FIELD_NAME_FORMAT "__s_%s"
2118#define SIGNATURE_OPTR_NAME "__optr"
2119#define SIGNATURE_SPTR_NAME "__sptr"
8d08fdba
MS
2120#define SIGNATURE_POINTER_NAME "__sp_"
2121#define SIGNATURE_POINTER_NAME_FORMAT "__%s%ssp_%s"
2122#define SIGNATURE_REFERENCE_NAME "__sr_"
2123#define SIGNATURE_REFERENCE_NAME_FORMAT "__%s%ssr_%s"
2124
2125#define SIGTABLE_PTR_TYPE "__sigtbl_ptr_type"
2126#define SIGTABLE_NAME_FORMAT "__st_%s_%s"
2127#define SIGTABLE_NAME_FORMAT_LONG "__st_%s_%s_%d"
46b49f6c 2128#define SIGTABLE_TAG_NAME "__tag"
4abea095
GB
2129#define SIGTABLE_VB_OFF_NAME "__vb_off"
2130#define SIGTABLE_VT_OFF_NAME "__vt_off"
8d08fdba
MS
2131#define EXCEPTION_CLEANUP_NAME "exception cleanup"
2132
2133#define THIS_NAME_P(ID_NODE) (strcmp(IDENTIFIER_POINTER (ID_NODE), "this") == 0)
2134
2135#if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
2136
2137#define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2138 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
2139#define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER \
2140 && IDENTIFIER_POINTER (ID_NODE)[2] == '_')
2141
2142#define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2143 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
2144 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2145
2146#define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
2147 && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \
2148 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
2149
2150#define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
2151#define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
2152
2153/* For anonymous aggregate types, we need some sort of name to
2154 hold on to. In practice, this should not appear, but it should
2155 not be harmful if it does. */
2156#define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
2157 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
2158#define ANON_PARMNAME_FORMAT "_%d"
2159#define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
2160 && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
2161#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
35680744
MM
2162
2163/* Returns non-zero iff ID_NODE is an IDENTIFIER_NODE whose name is
2164 `main'. */
2165#define MAIN_NAME_P(ID_NODE) \
2166 (strcmp (IDENTIFIER_POINTER (ID_NODE), "main") == 0)
2167
2168/* Returns non-zero iff NODE is a declaration for the global function
2169 `main'. */
2170#define DECL_MAIN_P(NODE) \
2171 (TREE_CODE (NODE) == FUNCTION_DECL \
cb0dbb9a 2172 && DECL_CONTEXT (NODE) == NULL_TREE \
35680744
MM
2173 && DECL_NAME (NODE) != NULL_TREE \
2174 && MAIN_NAME_P (DECL_NAME (NODE)))
2175
8d08fdba
MS
2176\f
2177/* Define the sets of attributes that member functions and baseclasses
2178 can have. These are sensible combinations of {public,private,protected}
2179 cross {virtual,non-virtual}. */
2180
e92cc029 2181/* in class.c. */
be99da77
MS
2182extern tree access_default_node; /* 0 */
2183extern tree access_public_node; /* 1 */
2184extern tree access_protected_node; /* 2 */
2185extern tree access_private_node; /* 3 */
2186extern tree access_default_virtual_node; /* 4 */
2187extern tree access_public_virtual_node; /* 5 */
d8b55a76
JM
2188extern tree access_protected_virtual_node; /* 6 */
2189extern tree access_private_virtual_node; /* 7 */
8d08fdba 2190
8d08fdba
MS
2191/* Things for handling inline functions. */
2192
2193struct pending_inline
2194{
2195 struct pending_inline *next; /* pointer to next in chain */
2196 int lineno; /* line number we got the text from */
2197 char *filename; /* name of file we were processing */
2198 tree fndecl; /* FUNCTION_DECL that brought us here */
2199 int token; /* token we were scanning */
2200 int token_value; /* value of token we were scanning (YYSTYPE) */
2201
2202 char *buf; /* pointer to character stream */
2203 int len; /* length of stream */
8d08fdba
MS
2204 unsigned int can_free : 1; /* free this after we're done with it? */
2205 unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
2206 unsigned int interface : 2; /* 0=interface 1=unknown 2=implementation */
2207};
2208
51c184be 2209/* in method.c */
8d08fdba
MS
2210extern struct pending_inline *pending_inlines;
2211
2212/* 1 for -fall-virtual: make every member function (except
2213 constructors) lay down in the virtual function table.
2214 Calls can then either go through the virtual function table or not,
2215 depending on whether we know what function will actually be called. */
2216
2217extern int flag_all_virtual;
2218
2219/* Positive values means that we cannot make optimizing assumptions about
2220 `this'. Negative values means we know `this' to be of static type. */
2221
2222extern int flag_this_is_variable;
2223
2224/* Controls whether enums and ints freely convert.
2225 1 means with complete freedom.
2226 0 means enums can convert to ints, but not vice-versa. */
2227
2228extern int flag_int_enum_equivalence;
2229
db5ae43f 2230/* Nonzero means generate 'rtti' that give run-time type information. */
8d08fdba 2231
db5ae43f 2232extern int flag_rtti;
8d08fdba 2233
a0a33927
MS
2234/* Nonzero means do emit exported implementations of functions even if
2235 they can be inlined. */
2236
2237extern int flag_implement_inlines;
2238
8d08fdba
MS
2239/* Nonzero means templates obey #pragma interface and implementation. */
2240
2241extern int flag_external_templates;
2242
2243/* Nonzero means templates are emitted where they are instantiated. */
2244
2245extern int flag_alt_external_templates;
2246
ddd5a7c1 2247/* Nonzero means implicit template instantiations are emitted. */
a0a33927
MS
2248
2249extern int flag_implicit_templates;
2250
72b7eeff
MS
2251/* Nonzero if we want to emit defined symbols with common-like linkage as
2252 weak symbols where possible, in order to conform to C++ semantics.
2253 Otherwise, emit them as local symbols. */
2254
2255extern int flag_weak;
2256
732dcb6f
JM
2257/* Nonzero to enable experimental ABI changes. */
2258
2259extern int flag_new_abi;
2260
2c73f9f5
ML
2261/* Nonzero to not ignore namespace std. */
2262
2263extern int flag_honor_std;
2264
5566b478
MS
2265/* Nonzero if we're done parsing and into end-of-file activities. */
2266
2267extern int at_eof;
2268
8d08fdba
MS
2269enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
2270
8d08fdba
MS
2271/* The following two can be derived from the previous one */
2272extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
2273extern tree current_class_type; /* _TYPE: the type of the current class */
2274
2275/* Some macros for char-based bitfields. */
2276#define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
2277#define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
2278#define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
2279
2280/* These are uses as bits in flags passed to build_method_call
2281 to control its error reporting behavior.
2282
2283 LOOKUP_PROTECT means flag access violations.
2284 LOOKUP_COMPLAIN mean complain if no suitable member function
2285 matching the arguments is found.
2286 LOOKUP_NORMAL is just a combination of these two.
8d08fdba
MS
2287 LOOKUP_NONVIRTUAL means make a direct call to the member function found
2288 LOOKUP_GLOBAL means search through the space of overloaded functions,
2289 as well as the space of member functions.
2290 LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
2291 in the parameter list.
6060a796 2292 LOOKUP_ONLYCONVERTING means that non-conversion constructors are not tried.
9a3b49ac
MS
2293 DIRECT_BIND means that if a temporary is created, it should be created so
2294 that it lives as long as the current variable bindings; otherwise it
2295 only lives until the end of the complete-expression.
878cd289
MS
2296 LOOKUP_SPECULATIVELY means return NULL_TREE if we cannot find what we are
2297 after. Note, LOOKUP_COMPLAIN is checked and error messages printed
2298 before LOOKUP_SPECULATIVELY is checked.
8d08fdba
MS
2299 LOOKUP_NO_CONVERSION means that user-defined conversions are not
2300 permitted. Built-in conversions are permitted.
c73964b2 2301 LOOKUP_DESTRUCTOR means explicit call to destructor.
52c11ef6
JM
2302 LOOKUP_NO_TEMP_BIND means temporaries will not be bound to references.
2303
2304 These are used in global lookup to support elaborated types and
2305 qualifiers.
2306
2307 LOOKUP_PREFER_TYPES means not to accept objects, and possibly namespaces.
2308 LOOKUP_PREFER_NAMESPACES means not to accept objects, and possibly types.
2309 LOOKUP_PREFER_BOTH means class-or-namespace-name.
2310 LOOKUP_TEMPLATES_EXPECTED means that class templates also count
2311 as types. */
8d08fdba
MS
2312
2313#define LOOKUP_PROTECT (1)
2314#define LOOKUP_COMPLAIN (2)
2315#define LOOKUP_NORMAL (3)
4ac14744 2316/* #define LOOKUP_UNUSED (4) */
8d08fdba
MS
2317#define LOOKUP_NONVIRTUAL (8)
2318#define LOOKUP_GLOBAL (16)
2319#define LOOKUP_HAS_IN_CHARGE (32)
2320#define LOOKUP_SPECULATIVELY (64)
db5ae43f 2321#define LOOKUP_ONLYCONVERTING (128)
9a3b49ac 2322#define DIRECT_BIND (256)
8d08fdba
MS
2323#define LOOKUP_NO_CONVERSION (512)
2324#define LOOKUP_DESTRUCTOR (512)
c73964b2 2325#define LOOKUP_NO_TEMP_BIND (1024)
52c11ef6
JM
2326#define LOOKUP_PREFER_TYPES (2048)
2327#define LOOKUP_PREFER_NAMESPACES (4096)
2328#define LOOKUP_PREFER_BOTH (6144)
2329#define LOOKUP_TEMPLATES_EXPECTED (8192)
2330
2331#define LOOKUP_NAMESPACES_ONLY(f) \
2332 (((f) & LOOKUP_PREFER_NAMESPACES) && !((f) & LOOKUP_PREFER_TYPES))
2333#define LOOKUP_TYPES_ONLY(f) \
2334 (!((f) & LOOKUP_PREFER_NAMESPACES) && ((f) & LOOKUP_PREFER_TYPES))
2335#define LOOKUP_QUALIFIERS_ONLY(f) ((f) & LOOKUP_PREFER_BOTH)
2336
8d08fdba 2337
a4443a08
MS
2338/* These flags are used by the conversion code.
2339 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
2340 CONV_STATIC : Perform the explicit conversions for static_cast.
2341 CONV_CONST : Perform the explicit conversions for const_cast.
2342 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
6060a796 2343 CONV_PRIVATE : Perform upcasts to private bases.
8ccc31eb
MS
2344 CONV_FORCE_TEMP : Require a new temporary when converting to the same
2345 aggregate type. */
a4443a08
MS
2346
2347#define CONV_IMPLICIT 1
2348#define CONV_STATIC 2
2349#define CONV_CONST 4
2350#define CONV_REINTERPRET 8
2351#define CONV_PRIVATE 16
faf5394a 2352/* #define CONV_NONCONVERTING 32 */
8ccc31eb
MS
2353#define CONV_FORCE_TEMP 64
2354#define CONV_STATIC_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_FORCE_TEMP)
a4443a08
MS
2355#define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
2356 | CONV_REINTERPRET)
2357#define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
8ccc31eb 2358 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
a4443a08 2359
b7484fbe
MS
2360/* Used by build_expr_type_conversion to indicate which types are
2361 acceptable as arguments to the expression under consideration. */
2362
2363#define WANT_INT 1 /* integer types, including bool */
2364#define WANT_FLOAT 2 /* floating point types */
2365#define WANT_ENUM 4 /* enumerated types */
2366#define WANT_POINTER 8 /* pointer types */
2367#define WANT_NULL 16 /* null pointer constant */
2368
2369#define WANT_ARITH (WANT_INT | WANT_FLOAT)
2370
8d08fdba
MS
2371#define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
2372#define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
2373
f84b4be9
JM
2374/* These macros are used to access a TEMPLATE_PARM_INDEX. */
2375#define TEMPLATE_PARM_IDX(NODE) (((template_parm_index*) NODE)->index)
2376#define TEMPLATE_PARM_LEVEL(NODE) (((template_parm_index*) NODE)->level)
2377#define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
2378#define TEMPLATE_PARM_ORIG_LEVEL(NODE) (((template_parm_index*) NODE)->orig_level)
2379#define TEMPLATE_PARM_DECL(NODE) (((template_parm_index*) NODE)->decl)
2380
73b0fce8
KL
2381/* These macros are for accessing the fields of TEMPLATE_TYPE_PARM
2382 and TEMPLATE_TEMPLATE_PARM nodes. */
f84b4be9
JM
2383#define TEMPLATE_TYPE_PARM_INDEX(NODE) (TYPE_FIELDS (NODE))
2384#define TEMPLATE_TYPE_IDX(NODE) \
2385 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2386#define TEMPLATE_TYPE_LEVEL(NODE) \
2387 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2388#define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
2389 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
2390#define TEMPLATE_TYPE_DECL(NODE) \
2391 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
8d08fdba 2392
51c184be 2393/* in lex.c */
8d08fdba
MS
2394/* Indexed by TREE_CODE, these tables give C-looking names to
2395 operators represented by TREE_CODES. For example,
2396 opname_tab[(int) MINUS_EXPR] == "-". */
2397extern char **opname_tab, **assignop_tab;
2398\f
51c184be 2399/* in call.c */
63d088b7 2400extern int check_dtor_name PROTO((tree, tree));
824b9a4c 2401extern int get_arglist_len_in_bytes PROTO((tree));
8d08fdba 2402
8d08fdba 2403extern tree build_vfield_ref PROTO((tree, tree));
8d08fdba
MS
2404extern tree resolve_scope_to_name PROTO((tree, tree));
2405extern tree build_scoped_method_call PROTO((tree, tree, tree, tree));
824b9a4c
MS
2406extern tree build_addr_func PROTO((tree));
2407extern tree build_call PROTO((tree, tree, tree));
8d08fdba 2408extern tree build_method_call PROTO((tree, tree, tree, tree, int));
824b9a4c
MS
2409extern int null_ptr_cst_p PROTO((tree));
2410extern tree type_decays_to PROTO((tree));
faf5394a 2411extern tree build_user_type_conversion PROTO((tree, tree, int));
9babbf20 2412extern tree build_new_function_call PROTO((tree, tree));
c73964b2 2413extern tree build_new_op PROTO((enum tree_code, int, tree, tree, tree));
da4768fe 2414extern tree build_op_new_call PROTO((enum tree_code, tree, tree, int));
519ebd1e 2415extern tree build_op_delete_call PROTO((enum tree_code, tree, tree, int, tree));
824b9a4c
MS
2416extern int can_convert PROTO((tree, tree));
2417extern int can_convert_arg PROTO((tree, tree, tree));
38afd588 2418extern void enforce_access PROTO((tree, tree));
41efda8f
MM
2419extern tree convert_default_arg PROTO((tree, tree));
2420extern tree convert_arg_to_ellipsis PROTO((tree));
8d08fdba 2421
51c184be 2422/* in class.c */
8d08fdba 2423extern tree build_vbase_path PROTO((enum tree_code, tree, tree, tree, int));
6b5fbb55 2424extern tree build_vtbl_ref PROTO((tree, tree));
8d08fdba
MS
2425extern tree build_vfn_ref PROTO((tree *, tree, tree));
2426extern void add_method PROTO((tree, tree *, tree));
77dc0938 2427extern int currently_open_class PROTO((tree));
51c184be 2428extern tree get_vfield_offset PROTO((tree));
8d08fdba 2429extern void duplicate_tag_error PROTO((tree));
2ee887f2 2430extern tree finish_struct PROTO((tree, tree, tree, int));
6467930b 2431extern tree finish_struct_1 PROTO((tree, int));
5566b478 2432extern tree finish_struct_methods PROTO((tree, tree, int));
8d08fdba
MS
2433extern int resolves_to_fixed_type_p PROTO((tree, int *));
2434extern void init_class_processing PROTO((void));
77dc0938 2435extern int is_empty_class PROTO((tree));
8d08fdba
MS
2436extern void pushclass PROTO((tree, int));
2437extern void popclass PROTO((int));
2438extern void push_nested_class PROTO((tree, int));
2439extern void pop_nested_class PROTO((int));
2440extern void push_lang_context PROTO((tree));
2441extern void pop_lang_context PROTO((void));
8d08fdba
MS
2442extern tree instantiate_type PROTO((tree, tree, int));
2443extern void print_class_statistics PROTO((void));
2444extern void maybe_push_cache_obstack PROTO((void));
f30432d7 2445extern unsigned HOST_WIDE_INT skip_rtti_stuff PROTO((tree *));
c91a56d2 2446extern tree build_self_reference PROTO((void));
49c249e1 2447extern void warn_hidden PROTO((tree));
8d08fdba 2448
51c184be 2449/* in cvt.c */
a4443a08 2450extern tree convert_to_reference PROTO((tree, tree, int, int, tree));
8d08fdba 2451extern tree convert_from_reference PROTO((tree));
8d08fdba 2452extern tree convert_pointer_to_real PROTO((tree, tree));
824b9a4c 2453extern tree convert_pointer_to PROTO((tree, tree));
37c46b43
MS
2454extern tree ocp_convert PROTO((tree, tree, int, int));
2455extern tree cp_convert PROTO((tree, tree));
824b9a4c 2456extern tree convert PROTO((tree, tree));
6060a796 2457extern tree convert_force PROTO((tree, tree, int));
8d08fdba 2458extern tree build_type_conversion PROTO((enum tree_code, tree, tree, int));
b7484fbe 2459extern tree build_expr_type_conversion PROTO((int, tree, int));
39211cd5 2460extern tree type_promotes_to PROTO((tree));
75650646 2461extern tree perform_qualification_conversions PROTO((tree, tree));
8d08fdba 2462
51c184be 2463/* decl.c */
824b9a4c 2464/* resume_binding_level */
69789cfc 2465extern void set_identifier_local_value PROTO((tree, tree));
8d08fdba 2466extern int global_bindings_p PROTO((void));
a9aedbc2 2467extern int toplevel_bindings_p PROTO((void));
8d08fdba
MS
2468extern void keep_next_level PROTO((void));
2469extern int kept_level_p PROTO((void));
2470extern void declare_parm_level PROTO((void));
8d08fdba
MS
2471extern void declare_pseudo_global_level PROTO((void));
2472extern int pseudo_global_level_p PROTO((void));
824b9a4c 2473extern void set_class_shadows PROTO((tree));
8d08fdba 2474extern void pushlevel PROTO((int));
824b9a4c 2475extern void note_level_for_for PROTO((void));
8d08fdba
MS
2476extern void pushlevel_temporary PROTO((int));
2477extern tree poplevel PROTO((int, int, int));
49c249e1 2478extern void resume_level PROTO((struct binding_level *));
8d08fdba
MS
2479extern void delete_block PROTO((tree));
2480extern void insert_block PROTO((tree));
2481extern void add_block_current_level PROTO((tree));
2482extern void set_block PROTO((tree));
2483extern void pushlevel_class PROTO((void));
700f8a87 2484extern tree poplevel_class PROTO((int));
8d08fdba 2485extern void print_binding_stack PROTO((void));
49c249e1 2486extern void print_binding_level PROTO((struct binding_level *));
824b9a4c
MS
2487extern void push_namespace PROTO((tree));
2488extern void pop_namespace PROTO((void));
2489extern void maybe_push_to_top_level PROTO((int));
8d08fdba
MS
2490extern void push_to_top_level PROTO((void));
2491extern void pop_from_top_level PROTO((void));
2c73f9f5 2492extern tree identifier_type_value PROTO((tree));
8d08fdba 2493extern void set_identifier_type_value PROTO((tree, tree));
c6160f8f 2494extern void set_identifier_local_value PROTO((tree, tree));
8926095f 2495extern void pop_everything PROTO((void));
8d08fdba
MS
2496extern void pushtag PROTO((tree, tree, int));
2497extern tree make_anon_name PROTO((void));
2498extern void clear_anon_tags PROTO((void));
824b9a4c
MS
2499extern int decls_match PROTO((tree, tree));
2500extern int duplicate_decls PROTO((tree, tree));
8d08fdba
MS
2501extern tree pushdecl PROTO((tree));
2502extern tree pushdecl_top_level PROTO((tree));
8d08fdba 2503extern tree pushdecl_class_level PROTO((tree));
bd6dd845 2504#if 0
5566b478 2505extern void pushdecl_nonclass_level PROTO((tree));
bd6dd845 2506#endif
2c73f9f5
ML
2507extern tree pushdecl_namespace_level PROTO((tree));
2508extern tree push_using_decl PROTO((tree, tree));
9ed182dc 2509extern tree push_using_directive PROTO((tree));
824b9a4c 2510extern void push_class_level_binding PROTO((tree, tree));
ea9635c7 2511extern tree push_using_decl PROTO((tree, tree));
8d08fdba
MS
2512extern tree implicitly_declare PROTO((tree));
2513extern tree lookup_label PROTO((tree));
2514extern tree shadow_label PROTO((tree));
2515extern tree define_label PROTO((char *, int, tree));
824b9a4c
MS
2516extern void push_switch PROTO((void));
2517extern void pop_switch PROTO((void));
8d08fdba
MS
2518extern void define_case_label PROTO((tree));
2519extern tree getdecls PROTO((void));
2520extern tree gettags PROTO((void));
bd6dd845 2521#if 0
8d08fdba 2522extern void set_current_level_tags_transparency PROTO((int));
bd6dd845 2523#endif
30394414 2524extern tree binding_for_name PROTO((tree, tree));
2c73f9f5
ML
2525extern tree namespace_binding PROTO((tree, tree));
2526extern void set_namespace_binding PROTO((tree, tree, tree));
a9aedbc2 2527extern tree lookup_namespace_name PROTO((tree, tree));
824b9a4c
MS
2528extern tree make_typename_type PROTO((tree, tree));
2529extern tree lookup_name_nonclass PROTO((tree));
2c73f9f5 2530extern tree lookup_function_nonclass PROTO((tree, tree));
824b9a4c 2531extern tree lookup_name PROTO((tree, int));
8d08fdba 2532extern tree lookup_name_current_level PROTO((tree));
9ed182dc 2533extern tree lookup_type_current_level PROTO((tree));
3e3f722c
ML
2534extern tree lookup_name_namespace_only PROTO((tree));
2535extern void begin_only_namespace_names PROTO((void));
2536extern void end_only_namespace_names PROTO((void));
9ed182dc 2537extern tree namespace_ancestor PROTO((tree, tree));
52c11ef6
JM
2538extern int lookup_using_namespace PROTO((tree,tree,tree,tree,int));
2539extern int qualified_lookup_using_namespace PROTO((tree,tree,tree,int));
824b9a4c 2540extern tree auto_function PROTO((tree, tree, enum built_in_function));
8d08fdba 2541extern void init_decl_processing PROTO((void));
5566b478 2542extern int init_type_desc PROTO((void));
49c249e1
JM
2543extern tree define_function
2544 PROTO((char *, tree, enum built_in_function,
2545 void (*) (tree), char *));
8d08fdba 2546extern void shadow_tag PROTO((tree));
8d08fdba 2547extern tree groktypename PROTO((tree));
fcad5cf5 2548extern tree start_decl PROTO((tree, tree, int, tree, tree));
824b9a4c 2549extern void start_decl_1 PROTO((tree));
b3417a04 2550extern void cp_finish_decl PROTO((tree, tree, tree, int, int));
824b9a4c 2551extern void finish_decl PROTO((tree, tree, tree));
8d08fdba
MS
2552extern void expand_static_init PROTO((tree, tree));
2553extern int complete_array_type PROTO((tree, tree, int));
2554extern tree build_ptrmemfunc_type PROTO((tree));
f30432d7 2555/* the grokdeclarator prototype is in decl.h */
8926095f 2556extern int parmlist_is_exprlist PROTO((tree));
824b9a4c
MS
2557extern int copy_args_p PROTO((tree));
2558extern int grok_ctor_properties PROTO((tree, tree));
2559extern void grok_op_properties PROTO((tree, int, int));
8d08fdba 2560extern tree xref_tag PROTO((tree, tree, tree, int));
fc378698 2561extern tree xref_tag_from_type PROTO((tree, tree, int));
8ccc31eb 2562extern void xref_basetypes PROTO((tree, tree, tree, tree));
8d08fdba
MS
2563extern tree start_enum PROTO((tree));
2564extern tree finish_enum PROTO((tree, tree));
2565extern tree build_enumerator PROTO((tree, tree));
86052cc3 2566extern tree grok_enum_decls PROTO((tree));
c11b6f21 2567extern int start_function PROTO((tree, tree, tree, int));
f30432d7 2568extern void expand_start_early_try_stmts PROTO((void));
824b9a4c 2569extern void store_parm_decls PROTO((void));
8d08fdba 2570extern void store_return_init PROTO((tree, tree));
db5ae43f 2571extern void finish_function PROTO((int, int, int));
c11b6f21 2572extern tree start_method PROTO((tree, tree));
8d08fdba
MS
2573extern tree finish_method PROTO((tree));
2574extern void hack_incomplete_structures PROTO((tree));
c73964b2 2575extern tree maybe_build_cleanup_and_delete PROTO((tree));
824b9a4c 2576extern tree maybe_build_cleanup PROTO((tree));
8d08fdba
MS
2577extern void cplus_expand_expr_stmt PROTO((tree));
2578extern void finish_stmt PROTO((void));
5566b478
MS
2579extern int id_in_current_class PROTO((tree));
2580extern void push_cp_function_context PROTO((tree));
2581extern void pop_cp_function_context PROTO((tree));
824b9a4c 2582extern int in_function_p PROTO((void));
49c249e1
JM
2583extern void replace_defarg PROTO((tree, tree));
2584extern void print_other_binding_stack PROTO((struct binding_level *));
8857f91e 2585extern void revert_static_member_fn PROTO((tree*, tree*, tree*));
2c73f9f5 2586extern void cat_namespace_levels PROTO((void));
8d08fdba 2587
51c184be 2588/* in decl2.c */
264a8100 2589extern int check_java_method PROTO((tree, tree));
6b5fbb55 2590extern int flag_assume_nonnull_objects;
297441fd 2591extern int lang_decode_option PROTO((int, char **));
8d08fdba 2592extern tree grok_method_quals PROTO((tree, tree, tree));
824b9a4c
MS
2593extern void warn_if_unknown_interface PROTO((tree));
2594extern tree grok_x_components PROTO((tree, tree));
711734a9 2595extern void maybe_retrofit_in_chrg PROTO((tree));
bcb80729 2596extern void maybe_make_one_only PROTO((tree));
8d08fdba
MS
2597extern void grokclassfn PROTO((tree, tree, tree, enum overload_flags, tree));
2598extern tree grok_alignof PROTO((tree));
2599extern tree grok_array_decl PROTO((tree, tree));
2600extern tree delete_sanity PROTO((tree, tree, int, int));
5566b478 2601extern tree check_classfn PROTO((tree, tree));
98c1c668 2602extern void check_member_template PROTO((tree));
c11b6f21 2603extern tree grokfield PROTO((tree, tree, tree, tree, tree));
8d08fdba
MS
2604extern tree grokbitfield PROTO((tree, tree, tree));
2605extern tree groktypefield PROTO((tree, tree));
51c184be 2606extern tree grokoptypename PROTO((tree, tree));
5566b478 2607extern int copy_assignment_arg_p PROTO((tree, int));
f6abb50a 2608extern void cplus_decl_attributes PROTO((tree, tree, tree));
8d08fdba
MS
2609extern tree constructor_name_full PROTO((tree));
2610extern tree constructor_name PROTO((tree));
2611extern void setup_vtbl_ptr PROTO((void));
2612extern void mark_inline_for_output PROTO((tree));
2613extern void clear_temp_name PROTO((void));
2614extern tree get_temp_name PROTO((tree, int));
2615extern tree get_temp_regvar PROTO((tree, tree));
2616extern void finish_anon_union PROTO((tree));
2617extern tree finish_table PROTO((tree, tree, tree, int));
2618extern void finish_builtin_type PROTO((tree, char *, tree *, int, tree));
2619extern tree coerce_new_type PROTO((tree));
2620extern tree coerce_delete_type PROTO((tree));
824b9a4c 2621extern void comdat_linkage PROTO((tree));
7e776093 2622extern void import_export_class PROTO((tree));
5566b478 2623extern void import_export_vtable PROTO((tree, tree, int));
c73964b2 2624extern int finish_prevtable_vardecl PROTO((tree, tree));
49c249e1
JM
2625extern int walk_vtables PROTO((void (*)(tree, tree),
2626 int (*)(tree, tree)));
2627extern void walk_sigtables PROTO((void (*)(tree, tree),
2628 void (*)(tree, tree)));
824b9a4c
MS
2629extern void import_export_decl PROTO((tree));
2630extern tree build_cleanup PROTO((tree));
8d08fdba 2631extern void finish_file PROTO((void));
51c184be
MS
2632extern tree reparse_absdcl_as_expr PROTO((tree, tree));
2633extern tree reparse_absdcl_as_casts PROTO((tree, tree));
5566b478 2634extern tree build_expr_from_tree PROTO((tree));
51c184be
MS
2635extern tree reparse_decl_as_expr PROTO((tree, tree));
2636extern tree finish_decl_parsing PROTO((tree));
2986ae00 2637extern tree check_cp_case_value PROTO((tree));
2c73f9f5
ML
2638extern void set_decl_namespace PROTO((tree, tree));
2639extern tree current_decl_namespace PROTO((void));
2640extern void push_decl_namespace PROTO((tree));
2641extern void pop_decl_namespace PROTO((void));
824b9a4c 2642extern void do_namespace_alias PROTO((tree, tree));
6b5fbb55 2643extern void do_toplevel_using_decl PROTO((tree));
ea9635c7 2644extern void do_local_using_decl PROTO((tree));
a9aedbc2 2645extern tree do_class_using_decl PROTO((tree));
824b9a4c 2646extern void do_using_directive PROTO((tree));
f30432d7 2647extern void check_default_args PROTO((tree));
5566b478 2648extern void mark_used PROTO((tree));
49c249e1 2649extern tree handle_class_head PROTO((tree, tree, tree));
2c73f9f5 2650extern tree lookup_arg_dependent PROTO((tree, tree, tree));
8d08fdba 2651
824b9a4c
MS
2652/* in errfn.c */
2653extern void cp_error ();
2654extern void cp_error_at ();
2655extern void cp_warning ();
2656extern void cp_warning_at ();
2657extern void cp_pedwarn ();
2658extern void cp_pedwarn_at ();
2659extern void cp_compiler_error ();
2660extern void cp_sprintf ();
2661
2662/* in error.c */
2663extern void init_error PROTO((void));
2664extern char *fndecl_as_string PROTO((tree, int));
2665extern char *type_as_string PROTO((tree, int));
294471c3 2666extern char *type_as_string_real PROTO((tree, int, int));
824b9a4c
MS
2667extern char *args_as_string PROTO((tree, int));
2668extern char *decl_as_string PROTO((tree, int));
2669extern char *expr_as_string PROTO((tree, int));
2670extern char *code_as_string PROTO((enum tree_code, int));
2671extern char *language_as_string PROTO((enum languages, int));
2672extern char *parm_as_string PROTO((int, int));
2673extern char *op_as_string PROTO((enum tree_code, int));
2674extern char *assop_as_string PROTO((enum tree_code, int));
2675extern char *cv_as_string PROTO((tree, int));
2ba25f50 2676extern char *lang_decl_name PROTO((tree, int));
49c249e1
JM
2677extern char *cp_file_of PROTO((tree));
2678extern int cp_line_of PROTO((tree));
824b9a4c 2679
51c184be 2680/* in except.c */
8d08fdba 2681extern void init_exception_processing PROTO((void));
824b9a4c
MS
2682extern void expand_start_catch_block PROTO((tree, tree));
2683extern void expand_end_catch_block PROTO((void));
f30432d7
MS
2684extern void expand_builtin_throw PROTO((void));
2685extern void expand_start_eh_spec PROTO((void));
824b9a4c 2686extern void expand_exception_blocks PROTO((void));
72b7eeff 2687extern tree start_anon_func PROTO((void));
824b9a4c
MS
2688extern void end_anon_func PROTO((void));
2689extern void expand_throw PROTO((tree));
2690extern tree build_throw PROTO((tree));
9c606f69 2691extern void mark_all_runtime_matches PROTO((void));
8d08fdba 2692
51c184be 2693/* in expr.c */
8d08fdba
MS
2694extern void init_cplus_expand PROTO((void));
2695extern void fixup_result_decl PROTO((tree, struct rtx_def *));
824b9a4c
MS
2696extern int extract_init PROTO((tree, tree));
2697extern void do_case PROTO((tree, tree));
8d08fdba 2698
bd6dd845
MS
2699/* friend.c */
2700extern int is_friend PROTO((tree, tree));
2701extern void make_friend_class PROTO((tree, tree));
2702extern tree do_friend PROTO((tree, tree, tree, tree, enum overload_flags, tree, int));
2703
51c184be 2704/* in init.c */
824b9a4c
MS
2705extern void init_init_processing PROTO((void));
2706extern void expand_direct_vtbls_init PROTO((tree, tree, int, int, tree));
8d08fdba
MS
2707extern void emit_base_init PROTO((tree, int));
2708extern void check_base_init PROTO((tree));
8d08fdba 2709extern void expand_member_init PROTO((tree, tree, tree));
6060a796 2710extern void expand_aggr_init PROTO((tree, tree, int, int));
8d08fdba 2711extern int is_aggr_typedef PROTO((tree, int));
5566b478 2712extern int is_aggr_type PROTO((tree, int));
8d08fdba
MS
2713extern tree get_aggr_from_typedef PROTO((tree, int));
2714extern tree get_type_value PROTO((tree));
2715extern tree build_member_call PROTO((tree, tree, tree));
2716extern tree build_offset_ref PROTO((tree, tree));
8d08fdba
MS
2717extern tree resolve_offset_ref PROTO((tree));
2718extern tree decl_constant_value PROTO((tree));
8d08fdba 2719extern tree build_new PROTO((tree, tree, tree, int));
a0d5fba7 2720extern tree build_new_1 PROTO((tree));
8d08fdba
MS
2721extern tree expand_vec_init PROTO((tree, tree, tree, tree, int));
2722extern tree build_x_delete PROTO((tree, tree, int, tree));
2723extern tree build_delete PROTO((tree, tree, tree, int, int));
2724extern tree build_vbase_delete PROTO((tree, tree));
5566b478 2725extern tree build_vec_delete PROTO((tree, tree, tree, tree, int));
8d08fdba 2726
51c184be 2727/* in input.c */
8d08fdba 2728
51c184be 2729/* in lex.c */
46c04501 2730extern char *file_name_nondirectory PROTO((char *));
8d08fdba
MS
2731extern tree make_pointer_declarator PROTO((tree, tree));
2732extern tree make_reference_declarator PROTO((tree, tree));
c11b6f21
MS
2733extern tree make_call_declarator PROTO((tree, tree, tree, tree));
2734extern void set_quals_and_spec PROTO((tree, tree, tree));
8d08fdba
MS
2735extern char *operator_name_string PROTO((tree));
2736extern void lang_init PROTO((void));
2737extern void lang_finish PROTO((void));
2738extern void init_filename_times PROTO((void));
bd6dd845 2739#if 0
8d08fdba 2740extern void reinit_lang_specific PROTO((void));
bd6dd845 2741#endif
8d08fdba 2742extern void reinit_parse_for_function PROTO((void));
8d08fdba
MS
2743extern void print_parse_statistics PROTO((void));
2744extern void extract_interface_info PROTO((void));
8d08fdba
MS
2745extern void do_pending_inlines PROTO((void));
2746extern void process_next_inline PROTO((tree));
49c249e1
JM
2747extern struct pending_input *save_pending_input PROTO((void));
2748extern void restore_pending_input PROTO((struct pending_input *));
8d08fdba
MS
2749extern void yyungetc PROTO((int, int));
2750extern void reinit_parse_for_method PROTO((int, tree));
bd6dd845 2751extern void reinit_parse_for_block PROTO((int, struct obstack *));
f376e137 2752extern tree cons_up_default_function PROTO((tree, tree, int));
8d08fdba
MS
2753extern void check_for_missing_semicolon PROTO((tree));
2754extern void note_got_semicolon PROTO((tree));
2755extern void note_list_got_semicolon PROTO((tree));
824b9a4c 2756extern void do_pending_lang_change PROTO((void));
8d08fdba
MS
2757extern int identifier_type PROTO((tree));
2758extern void see_typename PROTO((void));
a759e627 2759extern tree do_identifier PROTO((tree, int, tree));
5566b478 2760extern tree do_scoped_id PROTO((tree, int));
8d08fdba
MS
2761extern tree identifier_typedecl_value PROTO((tree));
2762extern int real_yylex PROTO((void));
824b9a4c 2763extern int is_rid PROTO((tree));
8d08fdba
MS
2764extern tree build_lang_decl PROTO((enum tree_code, tree, tree));
2765extern tree build_lang_field_decl PROTO((enum tree_code, tree, tree));
2766extern void copy_lang_decl PROTO((tree));
2767extern tree make_lang_type PROTO((enum tree_code));
8d08fdba
MS
2768extern void dump_time_statistics PROTO((void));
2769/* extern void compiler_error PROTO((char *, HOST_WIDE_INT, HOST_WIDE_INT)); */
8d08fdba 2770extern void yyerror PROTO((char *));
49c249e1
JM
2771extern void clear_inline_text_obstack PROTO((void));
2772extern void maybe_snarf_defarg PROTO((void));
2773extern tree snarf_defarg PROTO((void));
2774extern void add_defarg_fn PROTO((tree));
2775extern void do_pending_defargs PROTO((void));
2776extern int identifier_type PROTO((tree));
9f617717 2777extern void yyhook PROTO((int));
8d08fdba 2778
51c184be 2779/* in method.c */
8d08fdba 2780extern void init_method PROTO((void));
8d08fdba 2781extern void do_inline_function_hair PROTO((tree, tree));
8d08fdba 2782extern char *build_overload_name PROTO((tree, int, int));
f376e137 2783extern tree build_static_name PROTO((tree, tree));
8d08fdba 2784extern tree build_decl_overload PROTO((tree, tree, int));
36a117a5
MM
2785extern tree build_decl_overload_real PROTO((tree, tree, tree, tree,
2786 tree, int));
c1def683 2787extern void set_mangled_name_for_decl PROTO((tree));
8d08fdba 2788extern tree build_typename_overload PROTO((tree));
6b5fbb55 2789extern tree build_overload_with_type PROTO((tree, tree));
711734a9 2790extern tree build_destructor_name PROTO((tree));
8d08fdba 2791extern tree build_opfncall PROTO((enum tree_code, int, tree, tree, tree));
5566b478 2792extern tree hack_identifier PROTO((tree, tree));
6b5fbb55 2793extern tree make_thunk PROTO((tree, int));
824b9a4c 2794extern void emit_thunk PROTO((tree));
5566b478 2795extern void synthesize_method PROTO((tree));
49c249e1 2796extern tree get_id_2 PROTO((char *, tree));
8d08fdba 2797
51c184be 2798/* in pt.c */
36a117a5 2799extern tree innermost_args PROTO ((tree));
f7d98d58
JM
2800extern tree tsubst PROTO ((tree, tree, tree));
2801extern tree tsubst_expr PROTO ((tree, tree, tree));
2802extern tree tsubst_copy PROTO ((tree, tree, tree));
5566b478 2803extern tree tsubst_chain PROTO((tree, tree));
f84b4be9
JM
2804extern void maybe_begin_member_template_processing PROTO((tree));
2805extern void maybe_end_member_template_processing PROTO((tree));
e1467ff2 2806extern tree finish_member_template_decl PROTO((tree, tree));
8d08fdba 2807extern void begin_template_parm_list PROTO((void));
386b8a85
JM
2808extern void begin_specialization PROTO((void));
2809extern void reset_specialization PROTO((void));
2810extern void end_specialization PROTO((void));
75650646
MM
2811extern void begin_explicit_instantiation PROTO((void));
2812extern void end_explicit_instantiation PROTO((void));
2813extern tree determine_specialization PROTO((tree, tree, tree *, int, int));
e1467ff2 2814extern tree check_explicit_specialization PROTO((tree, tree, int, int));
8d08fdba
MS
2815extern tree process_template_parm PROTO((tree, tree));
2816extern tree end_template_parm_list PROTO((tree));
5566b478 2817extern void end_template_decl PROTO((void));
9a3b49ac 2818extern tree current_template_args PROTO((void));
3ac3d9ea 2819extern tree push_template_decl PROTO((tree));
6757edfe
MM
2820extern tree push_template_decl_real PROTO((tree, int));
2821extern void redeclare_class_template PROTO((tree, tree));
36a117a5 2822extern tree lookup_template_class PROTO((tree, tree, tree, tree, int));
386b8a85 2823extern tree lookup_template_function PROTO((tree, tree));
8d08fdba 2824extern int uses_template_parms PROTO((tree));
5566b478 2825extern tree instantiate_class_template PROTO((tree));
98c1c668 2826extern tree instantiate_template PROTO((tree, tree));
6b5fbb55 2827extern void overload_template_name PROTO((tree));
830bfa74
MM
2828extern int fn_type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t, tree));
2829extern int type_unification PROTO((tree, tree, tree, tree, tree, unification_kind_t, int));
8d08fdba 2830struct tinst_level *tinst_for_decl PROTO((void));
5566b478 2831extern void mark_decl_instantiated PROTO((tree, int));
e1467ff2 2832extern int more_specialized PROTO((tree, tree, tree));
5566b478 2833extern void mark_class_instantiated PROTO((tree, int));
6633d636 2834extern void do_decl_instantiation PROTO((tree, tree, tree));
f0e01782 2835extern void do_type_instantiation PROTO((tree, tree));
5566b478 2836extern tree instantiate_decl PROTO((tree));
5566b478 2837extern tree do_poplevel PROTO((void));
e1467ff2 2838extern tree get_bindings PROTO((tree, tree, tree));
824b9a4c
MS
2839/* CONT ... */
2840extern void add_tree PROTO((tree));
75650646
MM
2841extern void begin_tree PROTO((void));
2842extern void end_tree PROTO((void));
824b9a4c 2843extern void add_maybe_template PROTO((tree, tree));
49c249e1 2844extern void pop_tinst_level PROTO((void));
49c249e1
JM
2845extern int more_specialized_class PROTO((tree, tree));
2846extern void do_pushlevel PROTO((void));
98c1c668 2847extern int is_member_template PROTO((tree));
75650646 2848extern int comp_template_parms PROTO((tree, tree));
2450bb7d 2849extern int decl_template_parm_p PROTO((tree));
f84b4be9 2850extern int template_class_depth PROTO((tree));
6757edfe
MM
2851extern int is_specialization_of PROTO((tree, tree));
2852extern int comp_template_args PROTO((tree, tree));
36a117a5 2853extern void maybe_process_partial_specialization PROTO((tree));
39c01e4c 2854extern void maybe_check_template_type PROTO((tree));
6757edfe 2855
92eca640 2856extern int processing_specialization;
75650646 2857extern int processing_explicit_instantiation;
67ffc812 2858extern int processing_template_parmlist;
824b9a4c
MS
2859
2860/* in repo.c */
2861extern void repo_template_used PROTO((tree));
2862extern void repo_template_instantiated PROTO((tree, int));
2863extern void init_repo PROTO((char*));
2864extern void finish_repo PROTO((void));
2865
2866/* in rtti.c */
2867extern void init_rtti_processing PROTO((void));
2868extern tree get_tinfo_fn_dynamic PROTO((tree));
2869extern tree build_typeid PROTO((tree));
2870extern tree build_x_typeid PROTO((tree));
2871extern tree get_tinfo_fn PROTO((tree));
2872extern tree get_typeid PROTO((tree));
2873extern tree build_dynamic_cast PROTO((tree, tree));
2874extern void synthesize_tinfo_fn PROTO((tree));
8d08fdba 2875
51c184be 2876/* in search.c */
7dee3f36 2877extern int types_overlap_p PROTO((tree, tree));
8d08fdba
MS
2878extern void push_memoized_context PROTO((tree, int));
2879extern void pop_memoized_context PROTO((int));
bd6dd845 2880extern tree get_vbase PROTO((tree, tree));
8d08fdba
MS
2881extern tree get_binfo PROTO((tree, tree, int));
2882extern int get_base_distance PROTO((tree, tree, int, tree *));
be99da77 2883extern tree compute_access PROTO((tree, tree));
8d08fdba
MS
2884extern tree lookup_field PROTO((tree, tree, int, int));
2885extern tree lookup_nested_field PROTO((tree, int));
2886extern tree lookup_fnfields PROTO((tree, tree, int));
d23a1bb1 2887extern tree lookup_member PROTO((tree, tree, int, int));
a28e3c7f 2888extern tree lookup_nested_tag PROTO((tree, tree));
7177d104 2889extern tree get_matching_virtual PROTO((tree, tree, int));
8d08fdba
MS
2890extern tree get_abstract_virtuals PROTO((tree));
2891extern tree get_baselinks PROTO((tree, tree, tree));
2892extern tree next_baselink PROTO((tree));
2893extern tree init_vbase_pointers PROTO((tree, tree));
9e9ff709 2894extern void expand_indirect_vtbls_init PROTO((tree, tree, tree));
8d08fdba
MS
2895extern void clear_search_slots PROTO((tree));
2896extern tree get_vbase_types PROTO((tree));
2897extern void build_mi_matrix PROTO((tree));
2898extern void free_mi_matrix PROTO((void));
2899extern void build_mi_virtuals PROTO((int, int));
2900extern void add_mi_virtuals PROTO((int, tree));
2901extern void report_ambiguous_mi_virtuals PROTO((int, tree));
2902extern void note_debug_info_needed PROTO((tree));
45537677 2903extern void push_class_decls PROTO((tree));
49c249e1 2904extern void pop_class_decls PROTO((void));
8d08fdba
MS
2905extern void unuse_fields PROTO((tree));
2906extern void unmark_finished_struct PROTO((tree));
2907extern void print_search_statistics PROTO((void));
2908extern void init_search_processing PROTO((void));
2909extern void reinit_search_statistics PROTO((void));
2910extern tree current_scope PROTO((void));
e1cd6e56 2911extern tree lookup_conversions PROTO((tree));
c73964b2 2912extern tree get_template_base PROTO((tree, tree));
8d08fdba 2913
ad321293
MM
2914/* in semantics.c */
2915extern void finish_expr_stmt PROTO((tree));
2916extern tree begin_if_stmt PROTO((void));
2917extern void finish_if_stmt_cond PROTO((tree, tree));
2918extern tree finish_then_clause PROTO((tree));
2919extern void begin_else_clause PROTO((void));
2920extern void finish_else_clause PROTO((tree));
2921extern void finish_if_stmt PROTO((void));
2922extern tree begin_while_stmt PROTO((void));
2923extern void finish_while_stmt_cond PROTO((tree, tree));
2924extern void finish_while_stmt PROTO((tree));
2925extern tree begin_do_stmt PROTO((void));
2926extern void finish_do_body PROTO((tree));
2927extern void finish_do_stmt PROTO((tree, tree));
2928extern void finish_return_stmt PROTO((tree));
2929extern tree begin_for_stmt PROTO((void));
2930extern void finish_for_init_stmt PROTO((tree));
2931extern void finish_for_cond PROTO((tree, tree));
e4959d7c 2932extern void finish_for_expr PROTO((tree, tree));
ad321293
MM
2933extern void finish_for_stmt PROTO((tree, tree));
2934extern void finish_break_stmt PROTO((void));
2935extern void finish_continue_stmt PROTO((void));
2936extern void begin_switch_stmt PROTO((void));
2937extern tree finish_switch_cond PROTO((tree));
2938extern void finish_switch_stmt PROTO((tree, tree));
2939extern void finish_case_label PROTO((tree, tree));
2940extern void finish_goto_stmt PROTO((tree));
2941extern tree begin_try_block PROTO((void));
2942extern void finish_try_block PROTO((tree));
2943extern void finish_handler_sequence PROTO((tree));
2944extern tree begin_handler PROTO((void));
2945extern void finish_handler_parms PROTO((tree));
2946extern void finish_handler PROTO((tree));
2947extern tree begin_compound_stmt PROTO((int));
2948extern tree finish_compound_stmt PROTO((int, tree));
2949extern void finish_asm_stmt PROTO((tree, tree, tree, tree, tree));
b4c4a9ec
MM
2950extern tree finish_parenthesized_expr PROTO((tree));
2951extern tree begin_stmt_expr PROTO((void));
2952extern tree finish_stmt_expr PROTO((tree, tree));
a759e627 2953extern tree finish_call_expr PROTO((tree, tree, int));
b4c4a9ec
MM
2954extern tree finish_increment_expr PROTO((tree, enum tree_code));
2955extern tree finish_this_expr PROTO((void));
2956extern tree finish_object_call_expr PROTO((tree, tree, tree));
2957extern tree finish_qualified_object_call_expr PROTO((tree, tree, tree));
2958extern tree finish_pseudo_destructor_call_expr PROTO((tree, tree, tree));
2959extern tree finish_globally_qualified_member_call_expr PROTO ((tree, tree));
2960extern tree finish_label_address_expr PROTO((tree));
ce4a0391
MM
2961extern tree finish_unary_op_expr PROTO((enum tree_code, tree));
2962extern tree finish_id_expr PROTO((tree));
2963extern int begin_new_placement PROTO((void));
2964extern tree finish_new_placement PROTO((tree, int));
b4c4a9ec
MM
2965extern int begin_function_definition PROTO((tree, tree));
2966extern tree begin_constructor_declarator PROTO((tree, tree));
ce4a0391
MM
2967extern tree finish_declarator PROTO((tree, tree, tree, tree, int));
2968extern void finish_translation_unit PROTO((void));
b4c4a9ec
MM
2969extern tree finish_template_type_parm PROTO((tree, tree));
2970extern tree finish_template_template_parm PROTO((tree, tree));
ce4a0391
MM
2971extern tree finish_parmlist PROTO((tree, int));
2972extern tree begin_class_definition PROTO((tree));
2973extern tree finish_class_definition PROTO((tree, tree, tree, int));
2974extern void finish_default_args PROTO((void));
2975extern void begin_inline_definitions PROTO((void));
35acd3f2 2976extern tree finish_member_class_template PROTO((tree, tree));
36a117a5
MM
2977extern void finish_template_decl PROTO((tree));
2978extern tree finish_template_type PROTO((tree, tree, int));
648f19f6 2979extern void enter_scope_of PROTO((tree));
b4c4a9ec 2980
51c184be 2981/* in sig.c */
8d08fdba
MS
2982extern tree build_signature_pointer_type PROTO((tree, int, int));
2983extern tree build_signature_reference_type PROTO((tree, int, int));
2984extern tree build_signature_pointer_constructor PROTO((tree, tree));
c11b6f21 2985extern tree build_signature_method_call PROTO((tree, tree));
8d08fdba 2986extern tree build_optr_ref PROTO((tree));
5566b478 2987extern void append_signature_fields PROTO((tree));
8d08fdba 2988
51c184be 2989/* in spew.c */
8d08fdba 2990extern void init_spew PROTO((void));
49c249e1 2991extern int peekyylex PROTO((void));
8d08fdba
MS
2992extern int yylex PROTO((void));
2993extern tree arbitrate_lookup PROTO((tree, tree, tree));
2994
51c184be 2995/* in tree.c */
77dc0938 2996extern int member_p PROTO((tree));
5566b478
MS
2997extern int real_lvalue_p PROTO((tree));
2998extern tree build_min PVPROTO((enum tree_code, tree, ...));
2999extern tree build_min_nt PVPROTO((enum tree_code, ...));
3000extern tree min_tree_cons PROTO((tree, tree, tree));
8d08fdba
MS
3001extern int lvalue_p PROTO((tree));
3002extern int lvalue_or_else PROTO((tree, char *));
5566b478 3003extern tree build_cplus_new PROTO((tree, tree));
aa36c081 3004extern tree get_target_expr PROTO((tree));
8d08fdba
MS
3005extern tree break_out_cleanups PROTO((tree));
3006extern tree break_out_calls PROTO((tree));
3007extern tree build_cplus_method_type PROTO((tree, tree, tree));
3008extern tree build_cplus_staticfn_type PROTO((tree, tree, tree));
3009extern tree build_cplus_array_type PROTO((tree, tree));
9a71c18b
JM
3010extern int layout_basetypes PROTO((tree, int));
3011extern tree build_vbase_pointer_fields PROTO((tree));
3012extern tree build_base_fields PROTO((tree));
8d08fdba
MS
3013extern tree hash_tree_cons PROTO((int, int, int, tree, tree, tree));
3014extern tree hash_tree_chain PROTO((tree, tree));
3015extern tree hash_chainon PROTO((tree, tree));
3016extern tree get_decl_list PROTO((tree));
8d08fdba 3017extern tree make_binfo PROTO((tree, tree, tree, tree, tree));
8d08fdba
MS
3018extern tree binfo_value PROTO((tree, tree));
3019extern tree reverse_path PROTO((tree));
8926095f 3020extern int count_functions PROTO((tree));
8d08fdba
MS
3021extern int is_overloaded_fn PROTO((tree));
3022extern tree get_first_fn PROTO((tree));
2c73f9f5
ML
3023extern tree binding_init PROTO((struct tree_binding*));
3024extern tree ovl_cons PROTO((tree, tree));
3025extern tree scratch_ovl_cons PROTO((tree, tree));
3026extern int ovl_member PROTO((tree, tree));
3027extern tree build_overload PROTO((tree, tree));
8d08fdba 3028extern tree fnaddr_from_vtable_entry PROTO((tree));
8d08fdba
MS
3029extern tree function_arg_chain PROTO((tree));
3030extern int promotes_to_aggr_type PROTO((tree, enum tree_code));
3031extern int is_aggr_type_2 PROTO((tree, tree));
2ba25f50 3032extern char *lang_printable_name PROTO((tree, int));
f30432d7 3033extern tree build_exception_variant PROTO((tree, tree));
73b0fce8 3034extern tree copy_template_template_parm PROTO((tree));
8d08fdba
MS
3035extern tree copy_to_permanent PROTO((tree));
3036extern void print_lang_statistics PROTO((void));
49c249e1
JM
3037extern void __eprintf
3038 PROTO((const char *, const char *, unsigned, const char *));
8d08fdba
MS
3039extern tree array_type_nelts_total PROTO((tree));
3040extern tree array_type_nelts_top PROTO((tree));
878cd289 3041extern tree break_out_target_exprs PROTO((tree));
5566b478 3042extern tree get_type_decl PROTO((tree));
6b5fbb55 3043extern tree vec_binfo_member PROTO((tree, tree));
e76a2646 3044extern tree hack_decl_function_context PROTO((tree));
d11ad92e
MS
3045extern tree lvalue_type PROTO((tree));
3046extern tree error_type PROTO((tree));
49c249e1 3047extern tree make_temp_vec PROTO((int));
5ffe581d
JM
3048extern tree build_ptr_wrapper PROTO((void *));
3049extern tree build_expr_ptr_wrapper PROTO((void *));
3050extern tree build_int_wrapper PROTO((int));
1139b3d8
JM
3051extern tree build_srcloc PROTO((char *, int));
3052extern tree build_srcloc_here PROTO((void));
49c249e1
JM
3053extern int varargs_function_p PROTO((tree));
3054extern int really_overloaded_fn PROTO((tree));
3055extern int cp_tree_equal PROTO((tree, tree));
3056extern int can_free PROTO((struct obstack *, tree));
3057extern tree mapcar PROTO((tree, tree (*) (tree)));
50a6dbd7 3058extern tree no_linkage_check PROTO((tree));
49c249e1 3059extern void debug_binfo PROTO((tree));
00c493f2 3060extern void push_expression_obstack PROTO((void));
e66d884e
JM
3061#define scratchalloc expralloc
3062#define scratch_tree_cons expr_tree_cons
3063#define build_scratch_list build_expr_list
3064#define make_scratch_vec make_temp_vec
2c73f9f5 3065#define push_scratch_obstack push_expression_obstack
8d08fdba 3066
51c184be 3067/* in typeck.c */
8ccc31eb 3068extern tree condition_conversion PROTO((tree));
8d08fdba
MS
3069extern tree target_type PROTO((tree));
3070extern tree require_complete_type PROTO((tree));
5566b478 3071extern tree complete_type PROTO((tree));
8f259df3 3072extern tree complete_type_or_else PROTO((tree));
8d08fdba
MS
3073extern int type_unknown_p PROTO((tree));
3074extern int fntype_p PROTO((tree));
3075extern tree require_instantiated_type PROTO((tree, tree, tree));
3076extern tree commonparms PROTO((tree, tree));
f2ee215b 3077extern tree original_type PROTO((tree));
8d08fdba 3078extern tree common_type PROTO((tree, tree));
5566b478 3079extern int compexcepttypes PROTO((tree, tree));
8d08fdba
MS
3080extern int comptypes PROTO((tree, tree, int));
3081extern int comp_target_types PROTO((tree, tree, int));
8d08fdba
MS
3082extern int compparms PROTO((tree, tree, int));
3083extern int comp_target_types PROTO((tree, tree, int));
ceab47eb
MM
3084extern int comp_cv_qualification PROTO((tree, tree));
3085extern int comp_cv_qual_signature PROTO((tree, tree));
a28e3c7f 3086extern int self_promoting_args_p PROTO((tree));
8d08fdba
MS
3087extern tree unsigned_type PROTO((tree));
3088extern tree signed_type PROTO((tree));
3089extern tree signed_or_unsigned_type PROTO((int, tree));
5566b478 3090extern tree expr_sizeof PROTO((tree));
8d08fdba
MS
3091extern tree c_sizeof PROTO((tree));
3092extern tree c_sizeof_nowarn PROTO((tree));
3093extern tree c_alignof PROTO((tree));
6b5fbb55 3094extern tree inline_conversion PROTO((tree));
f30432d7 3095extern tree decay_conversion PROTO((tree));
8d08fdba
MS
3096extern tree default_conversion PROTO((tree));
3097extern tree build_object_ref PROTO((tree, tree, tree));
3098extern tree build_component_ref_1 PROTO((tree, tree, int));
3099extern tree build_component_ref PROTO((tree, tree, tree, int));
5156628f 3100extern tree build_x_component_ref PROTO((tree, tree, tree, int));
8d08fdba
MS
3101extern tree build_x_indirect_ref PROTO((tree, char *));
3102extern tree build_indirect_ref PROTO((tree, char *));
8d08fdba
MS
3103extern tree build_array_ref PROTO((tree, tree));
3104extern tree build_x_function_call PROTO((tree, tree, tree));
824b9a4c 3105extern tree get_member_function_from_ptrfunc PROTO((tree *, tree));
8d08fdba
MS
3106extern tree build_function_call_real PROTO((tree, tree, int, int));
3107extern tree build_function_call PROTO((tree, tree));
3108extern tree build_function_call_maybe PROTO((tree, tree));
3109extern tree convert_arguments PROTO((tree, tree, tree, tree, int));
3110extern tree build_x_binary_op PROTO((enum tree_code, tree, tree));
3111extern tree build_binary_op PROTO((enum tree_code, tree, tree, int));
3112extern tree build_binary_op_nodefault PROTO((enum tree_code, tree, tree, enum tree_code));
3113extern tree build_component_addr PROTO((tree, tree, char *));
3114extern tree build_x_unary_op PROTO((enum tree_code, tree));
3115extern tree build_unary_op PROTO((enum tree_code, tree, int));
3116extern tree unary_complex_lvalue PROTO((enum tree_code, tree));
3117extern int mark_addressable PROTO((tree));
3118extern tree build_x_conditional_expr PROTO((tree, tree, tree));
3119extern tree build_conditional_expr PROTO((tree, tree, tree));
3120extern tree build_x_compound_expr PROTO((tree));
3121extern tree build_compound_expr PROTO((tree));
2986ae00
MS
3122extern tree build_static_cast PROTO((tree, tree));
3123extern tree build_reinterpret_cast PROTO((tree, tree));
3124extern tree build_const_cast PROTO((tree, tree));
faf5394a 3125extern tree build_c_cast PROTO((tree, tree));
5566b478 3126extern tree build_x_modify_expr PROTO((tree, enum tree_code, tree));
8d08fdba
MS
3127extern tree build_modify_expr PROTO((tree, enum tree_code, tree));
3128extern int language_lvalue_valid PROTO((tree));
3129extern void warn_for_assignment PROTO((char *, char *, char *, tree, int, int));
3130extern tree convert_for_initialization PROTO((tree, tree, tree, int, char *, tree, int));
3131extern void c_expand_asm_operands PROTO((tree, tree, tree, tree, int, char *, int));
3132extern void c_expand_return PROTO((tree));
3133extern tree c_expand_start_case PROTO((tree));
bd6dd845 3134extern int comp_ptr_ttypes PROTO((tree, tree));
d2e5ee5c 3135extern int ptr_reasonably_similar PROTO((tree, tree));
8d08fdba
MS
3136extern tree build_ptrmemfunc PROTO((tree, tree, int));
3137
51c184be 3138/* in typeck2.c */
8d08fdba
MS
3139extern tree error_not_base_type PROTO((tree, tree));
3140extern tree binfo_or_else PROTO((tree, tree));
8d08fdba
MS
3141extern void readonly_error PROTO((tree, char *, int));
3142extern void abstract_virtuals_error PROTO((tree, tree));
5566b478 3143extern void signature_error PROTO((tree, tree));
8d08fdba
MS
3144extern void incomplete_type_error PROTO((tree, tree));
3145extern void my_friendly_abort PROTO((int));
3146extern void my_friendly_assert PROTO((int, int));
3147extern tree store_init_value PROTO((tree, tree));
3148extern tree digest_init PROTO((tree, tree, tree *));
3149extern tree build_scoped_ref PROTO((tree, tree));
3150extern tree build_x_arrow PROTO((tree));
3151extern tree build_m_component_ref PROTO((tree, tree));
3152extern tree build_functional_cast PROTO((tree, tree));
3153extern char *enum_name_string PROTO((tree, tree));
3154extern void report_case_error PROTO((int, tree, tree, tree));
49c249e1
JM
3155extern void check_for_new_type PROTO((char *,flagged_type_tree));
3156extern tree initializer_constant_valid_p PROTO((tree, tree));
8d08fdba 3157
51c184be 3158/* in xref.c */
8d08fdba
MS
3159extern void GNU_xref_begin PROTO((char *));
3160extern void GNU_xref_end PROTO((int));
3161extern void GNU_xref_file PROTO((char *));
3162extern void GNU_xref_start_scope PROTO((HOST_WIDE_INT));
5566b478 3163extern void GNU_xref_end_scope PROTO((HOST_WIDE_INT, HOST_WIDE_INT, int, int));
00595019 3164extern void GNU_xref_ref PROTO((tree, char *));
8d08fdba
MS
3165extern void GNU_xref_decl PROTO((tree, tree));
3166extern void GNU_xref_call PROTO((tree, char *));
3167extern void GNU_xref_function PROTO((tree, tree));
3168extern void GNU_xref_assign PROTO((tree));
11b5139c 3169extern void GNU_xref_hier PROTO((tree, tree, int, int, int));
8d08fdba
MS
3170extern void GNU_xref_member PROTO((tree, tree));
3171
3172/* -- end of C++ */
3173
3174#endif /* not _CP_TREE_H */
This page took 0.855209 seconds and 5 git commands to generate.