2 * This code is derived from software copyrighted by the Free Software
5 * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
7 * @(#)cplus-tree.h 6.4 (Berkeley) 5/8/91
10 /* Definitions for C++ parsing and type checking.
11 Copyright (C) 1987 Free Software Foundation, Inc.
12 Hacked by Michael Tiemann (tiemann@mcc.com)
14 This file is part of GNU CC.
16 GNU CC is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY. No author or distributor
18 accepts responsibility to anyone for the consequences of using it
19 or for whether it serves any particular purpose or works at all,
20 unless he says so in writing. Refer to the GNU CC General Public
21 License for full details.
23 Everyone is granted permission to copy, modify and redistribute
24 GNU CC, but only under the conditions described in the
25 GNU CC General Public License. A copy of this license is
26 supposed to have been given to you along with GNU CC so you
27 can know your rights and responsibilities. It should be in a
28 file named COPYING. Among other things, the copyright notice
29 and this notice must be preserved on all copies. */
31 /* Borrow everything that is C from c-tree.h,
32 but do so by copy, not by inclusion, since c-tree.h defines
35 /* Definitions for C parsing and type checking.
36 Copyright (C) 1987 Free Software Foundation, Inc.
38 This file is part of GNU CC.
40 GNU CC is free software; you can redistribute it and/or modify
41 it under the terms of the GNU General Public License as published by
42 the Free Software Foundation; either version 1, or (at your option)
45 GNU CC is distributed in the hope that it will be useful,
46 but WITHOUT ANY WARRANTY; without even the implied warranty of
47 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 GNU General Public License for more details.
50 You should have received a copy of the GNU General Public License
51 along with GNU CC; see the file COPYING. If not, write to
52 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
54 /* Language-dependent contents of an identifier. */
56 struct lang_identifier
58 struct tree_identifier ignore
;
59 tree global_value
, local_value
;
66 tree label_value
, implicit_decl
;
70 /* Macros for access to language-specific slots in an identifier. */
72 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
73 (((struct lang_identifier *)(NODE))->global_value)
74 #define IDENTIFIER_CLASS_VALUE(NODE) \
75 (((struct lang_identifier *)(NODE))->class_value)
76 #define IDENTIFIER_LOCAL_VALUE(NODE) \
77 (((struct lang_identifier *)(NODE))->local_value)
78 #define IDENTIFIER_AS_LIST(NODE) \
79 ((tree)((struct lang_identifier *)(NODE))->x)
80 #define SET_IDENTIFIER_AS_LIST(NODE,LIST) \
81 (((struct lang_identifier *)(NODE))->x = (struct lang_id2*)(LIST))
83 #define IDENTIFIER_LABEL_VALUE(NODE) \
84 (((struct lang_identifier *)(NODE))->x \
85 ? ((struct lang_identifier *)(NODE))->x->label_value : 0)
86 #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
87 (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)permalloc (sizeof (struct lang_id2)) : 0, \
88 ((struct lang_identifier *)(NODE))->x->label_value = (VALUE))
89 #define IDENTIFIER_IMPLICIT_DECL(NODE) \
90 (((struct lang_identifier *)(NODE))->x \
91 ? ((struct lang_identifier *)(NODE))->x->implicit_decl : 0)
92 #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
93 (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)permalloc (sizeof (struct lang_id2)) : 0, \
94 ((struct lang_identifier *)(NODE))->x->implicit_decl = (VALUE))
95 #define IDENTIFIER_ERROR_LOCUS(NODE) \
96 (((struct lang_identifier *)(NODE))->x \
97 ? ((struct lang_identifier *)(NODE))->x->error_locus : 0)
98 #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
99 (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)permalloc (sizeof (struct lang_id2)) : 0, \
100 ((struct lang_identifier *)(NODE))->x->error_locus = (VALUE))
102 /* Nonzero means reject anything that ANSI standard C forbids. */
105 /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
106 #define C_TYPE_FIELDS_READONLY(type) TYPE_SEP_UNIT (type)
109 extern tree
build_component_ref(), build_conditional_expr();
110 extern tree
build_x_compound_expr (), build_compound_expr();
111 extern tree
build_unary_op(), build_binary_op(), build_function_call();
112 extern tree
build_binary_op_nodefault ();
113 extern tree
build_indirect_ref(), build_array_ref(), build_c_cast();
114 extern tree
build_modify_expr();
115 extern tree
c_sizeof (), c_alignof ();
116 extern tree
store_init_value ();
117 extern tree
digest_init ();
118 extern tree
c_expand_start_case ();
119 extern tree
default_conversion ();
121 /* Given two integer or real types, return the type for their sum.
122 Given two compatible ANSI C types, returns the merged type. */
124 extern tree
commontype ();
127 extern tree
build_label ();
129 /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
130 next exception handler. */
131 extern tree exception_throw_decl
;
133 extern int start_function ();
134 extern void finish_function ();
135 extern void store_parm_decls ();
136 extern tree
get_parm_info ();
138 extern void pushlevel ();
139 extern tree
poplevel ();
141 extern tree
groktypename(), lookup_name();
143 extern tree
lookup_label(), define_label();
145 extern tree
implicitly_declare(), getdecls(), gettags ();
147 extern tree
start_decl();
148 extern void finish_decl();
150 extern tree
start_struct(), finish_struct(), xref_tag();
151 extern tree
finish_exception ();
152 extern tree
grokfield(), grokbitfield ();
154 extern tree
start_enum(), finish_enum();
155 extern tree
build_enumerator();
157 extern tree
make_index_type ();
159 extern tree double_type_node
, long_double_type_node
, float_type_node
;
160 extern tree char_type_node
, unsigned_char_type_node
, signed_char_type_node
;
162 extern tree short_integer_type_node
, short_unsigned_type_node
;
163 extern tree long_integer_type_node
, long_unsigned_type_node
;
164 extern tree long_long_integer_type_node
, long_long_unsigned_type_node
;
165 extern tree unsigned_type_node
;
166 extern tree string_type_node
, char_array_type_node
, int_array_type_node
;
168 extern int current_function_returns_value
;
169 extern int current_function_returns_null
;
171 extern tree ridpointers
[];
173 /* Nonzero means `$' can be in an identifier. */
175 extern int dollars_in_ident
;
177 /* Nonzero means allow type mismatches in conditional expressions;
178 just make their values `void'. */
180 extern int flag_cond_mismatch
;
182 /* Nonzero means don't recognize the keyword `asm'. */
184 extern int flag_no_asm
;
186 /* Nonzero means warn about implicit declarations. */
188 extern int warn_implicit
;
190 /* Nonzero means warn about function definitions that default the return type
191 or that use a null return and have a return-type other than void. */
193 extern int warn_return_type
;
195 /* Nonzero means give string constants the type `const char *'
196 to get extra warnings from them. These warnings will be too numerous
197 to be useful, except in thoroughly ANSIfied programs. */
199 extern int warn_write_strings
;
201 /* Nonzero means warn about sizeof(function) or addition/subtraction
202 of function pointers. */
204 extern int warn_pointer_arith
;
206 /* Nonzero means warn for all old-style non-prototype function decls. */
208 extern int warn_strict_prototypes
;
210 /* Nonzero means warn about pointer casts that can drop a type qualifier
211 from the pointer target type. */
213 extern int warn_cast_qual
;
215 /* Nonzero means do some things the same way PCC does. */
217 extern int flag_traditional
;
219 /* 2 means write out only specific virtual function tables
220 and give them (C) public visibility.
221 1 means write out virtual function tables and give them
222 (C) public visibility.
223 0 means write out virtual function tables and give them
224 (C) static visibility.
225 -1 means declare virtual function tables extern. */
227 extern int write_virtuals
;
229 /* Nonzero means that we are in an "interface" section of the compiler. */
230 extern int interface_only
;
232 /* Nonzero means we should attempt to elide constructors when possible. */
234 extern int flag_elide_constructors
;
236 /* Nonzero means if the type has methods, only output debugging
237 information if methods are actually written to the asm file. */
239 extern int flag_minimal_debug
;
241 /* Nonzero means recognize and handle exception handling constructs. */
243 extern int flag_handle_exceptions
;
245 /* Nonzero means that member functions defined in class scope are
246 inline by default. */
248 extern int flag_default_inline
;
250 /* Nonzero means recognize and handle exception handling constructs. */
252 extern int flag_no_inline
;
254 /* Nonzero means emit cadillac protocol. */
256 extern int flag_cadillac
;
258 #ifndef HAVE_CADILLAC
259 #define cadillac_finish_anon_union(decl)
260 #define cadillac_finish_decl(decl)
261 #define cadillac_finish_enum(enumtype)
262 #define cadillac_finish_exception(e)
263 #define cadillac_finish_function(fndecl)
264 #define cadillac_finish_stmt()
265 #define cadillac_finish_struct(t)
266 #define cadillac_note_source()
267 #define cadillac_pop_class()
268 #define cadillac_pop_lang()
269 #define cadillac_pop_source()
270 #define cadillac_push_class(type)
271 #define cadillac_push_lang(name)
272 #define cadillac_push_source()
273 #define cadillac_start()
274 #define cadillac_start_decl(value)
275 #define cadillac_start_enum(ref)
276 #define cadillac_start_function(decl1)
277 #define cadillac_start_struct(ref)
278 #define cadillac_switch_source(flag)
279 #define init_cadillac()
282 /* C++ language-specific tree codes. */
283 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
284 enum cplus_tree_code
{
285 __DUMMY
= LAST_AND_UNUSED_TREE_CODE
,
286 #include "cplus-tree.def"
291 enum languages
{ lang_c
, lang_cplusplus
};
293 /* Macros to make error reporting functions' lives easier. */
294 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (NODE))))
295 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_NAME (TYPE_NAME (NODE))))
297 /* Virtual function addresses can be gotten from a virtual function
298 table entry using this macro. */
299 #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
300 TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY))))
302 enum conversion_type
{ ptr_conv
, constptr_conv
, int_conv
, real_conv
, last_conversion_type
};
304 /* Statistics show that while the GNU C++ compiler may generate
305 thousands of different types during a compilation run, it
306 generates relatively few (tens) of classtypes. Because of this,
307 it is not costly to store a generous amount of information
308 in classtype nodes. */
311 /* This must fill out to a multiple of 4 bytes. */
314 unsigned has_type_conversion
: 1;
315 unsigned has_int_conversion
: 1;
316 unsigned has_float_conversion
: 1;
317 unsigned has_init_ref
: 1;
318 unsigned gets_init_ref
: 1;
319 unsigned gets_init_aggr
: 1;
320 unsigned has_assignment
: 1;
321 unsigned gets_assignment
: 1;
323 unsigned has_assign_ref
: 1;
324 unsigned gets_assign_ref
: 1;
325 unsigned gets_new
: 1;
326 unsigned gets_delete
: 1;
327 unsigned has_wrapper_pred
: 1;
328 unsigned has_method_call_overloaded
: 1;
329 unsigned has_call_overloaded
: 1;
330 unsigned has_array_ref_overloaded
: 1;
332 unsigned any_assigns_this
: 1;
333 unsigned none_assign_this
: 1;
335 unsigned marked2
: 1;
336 unsigned marked3
: 1;
337 unsigned marked4
: 1;
338 unsigned marked5
: 1;
339 unsigned marked6
: 1;
341 unsigned virtual_attr
: 1;
342 unsigned needs_constructor
: 1;
343 unsigned declared_class
: 1;
344 unsigned private_attr
: 1;
345 unsigned const_needs_init
: 1;
346 unsigned ref_needs_init
: 1;
347 unsigned uses_virtual_base_classes
: 1;
348 unsigned uses_multiple_inheritance
: 1;
350 unsigned got_semicolon
: 1;
351 unsigned alters_visibilities
: 1;
352 unsigned needs_virtual_reinit
: 1;
353 unsigned asm_written
: 1;
354 unsigned declared_exception
: 1;
355 unsigned vtable_needs_writing
: 1;
356 unsigned local_typedecls
: 1;
357 unsigned gets_const_init_ref
: 1;
359 unsigned dynamic
: 1;
360 unsigned has_default_ctor
: 1;
361 unsigned gets_const_assign_ref
: 1;
362 unsigned has_const_assign_ref
: 1;
363 unsigned interface_only
: 1;
364 unsigned interface_unknown
: 1;
368 unsigned n_parents
: 16;
374 union tree_node
*method_vec
, *baselink_vec
;
375 union tree_node
*offset
;
376 union tree_node
*vfield
, *vfields
;
377 union tree_node
*vbases
;
378 union tree_node
*vbase_size
;
380 union tree_node
*tags
;
381 union tree_node
*main_class_variant
;
382 union tree_node
*this_class_variant
;
383 union tree_node
*next_class_variant
;
384 void *memoized_table_entry
;
386 unsigned char *via_pub_or_virt
;
388 union tree_node
**types
;
391 enum machine_mode mode
: 8;
392 unsigned char size_unit
;
394 unsigned char sep_unit
;
396 union tree_node
*sep
;
397 union tree_node
*size
;
399 union tree_node
*base_init_list
;
400 union tree_node
*abstract_virtuals
;
401 union tree_node
*as_list
;
402 union tree_node
*as_id_list
;
403 union tree_node
*vtbl_ptr
;
404 union tree_node
*instance_variable
;
405 union tree_node
*friend_classes
;
408 union tree_node
*conversions
[last_conversion_type
];
409 union tree_node
*wrap_type
;
412 union tree_node
*typename_as_string
;
413 union tree_node
*dynamic_filename
;
414 union tree_node
*dynamic_table
;
418 /* Fields used for storing information before the class is defined.
419 After the class is defined, these fields hold other information. */
421 /* List of friends which were defined inline in this class definition. */
422 #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
424 /* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
425 a special meaning for the assignment operator ("operator="),
426 or one of its fields (or base members) has a special meaning
428 #define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
429 #define TYPE_GETS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assignment)
431 /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
433 #define TREE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
434 #define TREE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
436 /* Nonzero for TREE_LIST or _CLASSTYPE node means that the path to the
437 base class is via a `public' declaration, which preserves public
438 fields from the base class as public.
440 #define TREE_VIA_PUBLIC(NODE) ((NODE)->common.used_attr) /* overloaded! */
442 /* Nonzero for TREE_LIST node means that the path to the
443 base class is via a `protected' declaration, which preserves
444 protected fields from the base class as protected.
446 #define TREE_VIA_PROTECTED(NODE) ((NODE)->common.literal_attr) /* overloaded! */
448 /* Nonzero for a _CLASSTYPE node which we know to be private. */
449 #define TYPE_PRIVATE_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.private_attr)
451 /* Nonzero for a _CLASSTYPE node means that the derivation chain is via
452 a `virtual' declaration. */
453 #define TREE_VIA_VIRTUAL(NODE) ((NODE)->common.literal_attr) /* overloaded! */
455 /* Nonzero means that this _CLASSTYPE node defines ways of converting
456 itself to other types. */
457 #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
459 /* Nonzero means that this _CLASSTYPE node can convert itself to an
461 #define TYPE_HAS_INT_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_int_conversion)
463 /* Nonzero means that this _CLASSTYPE node can convert itself to an
465 #define TYPE_HAS_REAL_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_float_conversion)
467 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
468 #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
469 #define TYPE_GETS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assign_ref)
470 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
471 #define TYPE_GETS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_const_assign_ref)
473 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
474 #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
475 #define TYPE_GETS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_ref)
476 #define TYPE_GETS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_const_init_ref)
478 /* Nonzero means that this _CLASSTYPE node has an X(X ...) constructor.
479 Note that there must be other arguments, or this constructor is flaged
480 as being erroneous. */
481 #define TYPE_GETS_INIT_AGGR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_aggr)
483 /* Nonzero means that this _CLASSTYPE node overloads the method call
484 operator. In this case, all method calls go through `operator->()(...). */
485 #define TYPE_OVERLOADS_METHOD_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_method_call_overloaded)
487 #define TYPE_WRAP_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type)
489 #define TYPE_HAS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type == TYPE_MAIN_VARIANT (NODE))
490 #define TYPE_NEEDS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type != 0 && TYPE_LANG_SPECIFIC(NODE)->wrap_type != TYPE_MAIN_VARIANT (NODE))
491 #define TYPE_HAS_WRAPPER_PRED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_wrapper_pred)
493 /* Nonzero means that this _CLASSTYPE node overloads operator(). */
494 #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
496 /* Nonzero means that this _CLASSTYPE node overloads operator[]. */
497 #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
499 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
500 multiple inheritance. If this is 0 for the root of a type
501 hierarchy, then we can use more efficient search techniques. */
502 #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
504 /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
505 virtual base classes. If this is 0 for the root of a type
506 hierarchy, then we can use more efficient search techniques. */
507 #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_virtual_base_classes)
509 /* List of lists of member functions defined in this class. */
510 #define CLASSTYPE_METHOD_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->method_vec)
512 /* Pointer from any member function to the head of the list of
513 member functions of the type that member function belongs to. */
514 #define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
516 /* Nonzero if the Nth baseclass of this class is via `public'. */
517 #define CLASSTYPE_VIA_PUBLIC(NODE, N) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N]&1)
518 /* Nonzero if the Nth baseclass of this class is via `virtual'. */
519 #define CLASSTYPE_VIA_VIRTUAL(NODE, N) ((TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N]&2)>>1)
521 /* Accessor macros for the above two constructs. */
522 #define CLASSTYPE_VIAS(NODE) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt)
523 #define SET_CLASSTYPE_VIAS(NODE, N, PUB, VIRT) (TYPE_LANG_SPECIFIC(NODE)->via_pub_or_virt[N] = (PUB|(VIRT<<1)))
525 /* Mark bits for depth-first and breath-first searches. */
526 #define CLASSTYPE_MARKED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
527 #define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
528 #define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
529 #define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
530 #define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
531 #define CLASSTYPE_MARKED6(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
533 /* When building a matrix to determine by a single lookup
534 whether one class is derived from another or not,
535 this field is the index of the class in the table. */
536 #define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(TYPE_MAIN_VARIANT (NODE))->cid)
538 #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
539 #define CLASSTYPE_NAMES(NODE) (TYPE_LANG_SPECIFIC(NODE)->names)
541 /* When a class becomes a non-leftmost baseclass in a multiple
542 inheritance hierarchy, the number of bytes that subobjects
543 of this type are offset from the begining of the containing record.
544 This is an INTEGER_CST which holds the value of
545 DECL_OFFSET (TYPE_NAME (NODE)).
547 Note that for virtual base classes, the offset is only meaningful
548 for the construction and initialization of virtual baseclass pointers
549 and virtual function table entries. Otherwise, the offset of a
550 virtual baseclass is irrelevant, since it is accessed through a
551 pointer, and not via a delta. */
552 #define CLASSTYPE_OFFSET(NODE) (TYPE_LANG_SPECIFIC (NODE)->offset)
554 /* The virtual function table pointer field. */
555 #define CLASSTYPE_VFIELD(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield)
556 /* The number of virtual functions defined for this
558 #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
559 /* The virtual base classes that this type uses. */
560 #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
561 /* The virtual function pointer fields that this type contains. */
562 #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
564 /* Number of baseclasses defined for this type.
565 0 means no base classes. */
566 #define CLASSTYPE_N_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_parents)
567 /* Vector of base classes for this type. This vector is
568 indexed starting at 1. */
569 #define CLASSTYPE_BASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->types)
570 /* Accessor macro for the Nth baseclass of type NODE. */
571 #define CLASSTYPE_BASECLASS(NODE, N) (TYPE_LANG_SPECIFIC(NODE)->types[N])
573 /* Memoize the number of super classes (base classes) tha this node
574 has. That way we can know immediately (albeit conservatively how
575 large a multiple-inheritance matrix we need to build to find
576 derivation information. */
577 #define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
578 #define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_vancestors)
580 /* Used for keeping search-specific information. Any search routine
581 which uses this must define what exactly this slot is used for. */
582 #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
584 /* The canonical form of this base class. It also happens to be
585 TYPE_MAIN_VARIANT. */
586 #define CLASSTYPE_MAIN_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->main_class_variant)
587 /* For baseclasses with non-zero valued offsets, a chain of
588 such versions of this baseclass. */
589 #define CLASSTYPE_NEXT_VARIANT(NODE) (TYPE_LANG_SPECIFIC(NODE)->next_class_variant)
591 /* Entry for keeping memoization tables for this type to
592 hopefully speed up search routines. Since it is a pointer,
593 it can mean almost anything. */
594 #define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)
596 /* This is the total size of the baseclasses defined for this type.
597 Needed because it is desirable to layout such information
598 before begining to process the class itself, and we
599 don't want to compute it second time when actually laying
600 out the type for real. */
601 #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
602 #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
603 #define CLASSTYPE_MODE(NODE) (TYPE_LANG_SPECIFIC(NODE)->mode)
604 #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
606 /* This is the space needed for virtual base classes. */
607 #define CLASSTYPE_VBASE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbase_size)
609 /* A cons list of structure elements which either have constructors
610 to be called, or virtual function table pointers which
611 need initializing. Depending on what is being initialized,
612 the TREE_PURPOSE and TREE_VALUE fields have different meanings:
614 Member initialization: <FIELD_DECL, TYPE>
615 Base class construction: <NULL_TREE, BASETYPE>
616 Base class initialization: <BASE_INITIALIZAION, THESE_INITIALIZATIONS>
617 Whole type: <MEMBER_INIT, BASE_INIT>. */
618 #define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
620 /* A cons list of virtual functions which cannot be inherited by
621 derived classes. When deriving from this type, the derived
622 class must provide its own definition for each of these functions. */
623 #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
625 #define CLASSTYPE_ALTERS_VISIBILITIES_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.alters_visibilities)
627 /* Nonzero means that this aggr type has been `closed' by a semicolon. */
628 #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
630 /* Nonzero means that the main virtual function table pointer needs to be
631 set because base constructors have placed the wrong value there.
632 If this is zero, it means that they placed the right value there,
633 and there is no need to change it. */
634 #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
636 /* Nonzero means that a member function has actually been output for
638 #define CLASSTYPE_ASM_WRITTEN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.asm_written)
640 /* Nonzero means that if this type has virtual functions, that
641 the virtual function table will be written out. */
642 #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
644 /* Nonzero means that this type defines its own local type declarations. */
645 #define CLASSTYPE_LOCAL_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.local_typedecls)
647 /* Nonzero means that this type has an X() constructor. */
648 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
650 /* Many routines need to cons up a list of basetypes for visibility
651 checking. This field contains a TREE_LIST node whose TREE_VALUE
652 is the main variant of the type, and whose TREE_VIA_PUBLIC
653 and TREE_VIA_VIRTUAL bits are correctly set. */
654 #define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
655 /* Same, but cache a list whose value is the name of this type. */
656 #define CLASSTYPE_AS_ID_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_id_list)
658 /* Slot in which to cache a copy of the local vtable pointer. */
659 #define CLASSTYPE_VTBL_PTR(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtbl_ptr)
661 /* Hold the instance object associated with this method. */
662 #define CLASSTYPE_INST_VAR(NODE) (TYPE_LANG_SPECIFIC(NODE)->instance_variable)
664 /* A list of class types with which this type is a friend. */
665 #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
667 /* Keep an inheritance lattice around so we can quickly tell whether
668 a type is derived from another or not. */
669 #define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)
671 /* If there is exactly one conversion to a non-void, non-const pointer type,
672 remember that here. If there are more than one, put
673 `error_mark_node' here. If there are none, this holds NULL_TREE. */
674 #define CLASSTYPE_CONVERSION(NODE,KIND) (TYPE_LANG_SPECIFIC(NODE)->conversions[KIND])
676 /* Nonzero means that class is "dynamic" in SOS sense. (IRIA-specific.) */
677 #define TYPE_DYNAMIC(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.dynamic)
680 /* The name of this type as a STRING. */
681 #define CLASSTYPE_TYPENAME_AS_STRING(NODE) (TYPE_LANG_SPECIFIC(NODE)->typename_as_string)
682 /* The name of the file which defines this type. */
683 #define CLASSTYPE_DYNAMIC_FILENAME(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_filename)
684 /* The table of all member functions, linearized. */
685 #define CLASSTYPE_DYNAMIC_TABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_table)
688 /* Say whether this node was declared as a "class" or a "struct". */
689 #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
690 /* Say whether this node was declared as a "class" or a "struct". */
691 #define CLASSTYPE_DECLARED_EXCEPTION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_exception)
693 /* Nonzero if this class has const members which have no specified initialization. */
694 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
696 /* Nonzero if this class has ref members which have no specified initialization. */
697 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
699 /* Nonzero if this class is included from a header file which employs
700 `#pragma interface', and it is not included in its implementation file. */
701 #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
703 /* Same as above, but for classes whose purpose we do not know. */
704 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
706 /* Depending on a class's "owner" they may have different properties,
707 such as the offset which must be added to `this', and the
708 virtual function table with which they are initialized. This is
709 managed by an association list of type TREE_LIST. This is
710 the interfact to the association list. */
712 /* The class's virtual function table. */
713 #define ASSOC_VTABLE(NODE) TREE_VEC_ELT ((NODE), 2)
714 #define CLASS_ASSOC_VTABLE(NODE) ASSOC_VTABLE (TYPE_BASETYPES (NODE))
716 /* The virtual functions in the virtual function table. */
717 #define ASSOC_VIRTUALS(NODE) TREE_VEC_ELT ((NODE), 3)
718 #define CLASS_ASSOC_VIRTUALS(NODE) ASSOC_VIRTUALS (TYPE_BASETYPES (NODE))
720 /* The class's offset to be added to `this'. */
721 #define ASSOC_OFFSET(NODE) TREE_VEC_ELT ((NODE), 1)
722 #define CLASS_ASSOC_OFFSET(NODE) ASSOC_OFFSET (TYPE_BASETYPES (NODE))
724 /* The association key. */
725 #define ASSOC_VALUE(NODE) TREE_VEC_ELT ((NODE), 0)
726 /* And its specific value. */
727 #define ASSOC_TYPE(NODE) TREE_TYPE (NODE)
729 #define CLASSTYPE_ASSOC(NODE) (TYPE_BASETYPES (NODE))
731 /* Nonzero for TREE_LIST node means that this list of things
732 is a list of parameters, as opposed to a list of expressions. */
733 #define TREE_PARMLIST(NODE) TREE_UNSIGNED (NODE) /* overloaded! */
735 /* Nonzero for FIELD_DECL node means that this FIELD_DECL is
736 a member of an anonymous union construct. The name of the
738 #define TREE_ANON_UNION_ELEM(NODE) TREE_REGDECL (NODE) /* overloaded! */
740 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
741 this type can raise. */
742 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
744 struct lang_decl_flags
746 enum languages language
: 8;
748 unsigned this_private
: 1;
749 unsigned this_protected
: 1;
750 unsigned this_public
: 1;
751 unsigned operator_attr
: 1;
752 unsigned overloaded_attr
: 1;
753 unsigned constructor_attr
: 1;
754 unsigned returns_first_arg
: 1;
755 unsigned preserves_first_arg
: 1;
757 unsigned in_aggr
: 1;
758 unsigned friend_attr
: 1;
759 unsigned static_function
: 1;
760 unsigned const_memfunc
: 1;
761 unsigned volatile_memfunc
: 1;
762 unsigned abstract_virtual
: 1;
763 unsigned compiler_generated
: 1;
764 unsigned permanent_attr
: 1 ;
765 unsigned constructor_for_vbase_attr
: 1;
773 struct lang_decl_flags decl_flags
;
778 tree main_decl_variant
;
779 struct pending_inline
*pending_inline_info
;
780 union tree_node
*vbase_init_list
;
787 /* Non-zero if NODE is a _DECL with TREE_READONLY set. */
788 #define TREE_READONLY_DECL_P(NODE) \
789 (TREE_READONLY (NODE) && *(tree_code_type[TREE_CODE (NODE)]) == 'd')
791 /* For FUNCTION_DECLs: return the language in which this decl
793 #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
795 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
796 #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
797 /* For FUNCTION_DECLs: nonzero means that this function is a constructor
798 for an object with virtual baseclasses. */
799 #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
801 /* For FUNCTION_DECLs: nonzero means that the constructor
802 is known to return a non-zero `this' unchanged. */
803 #define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
805 /* Nonzero for FUNCTION_DECL means that this constructor is known to
806 not make any assignment to `this', and therefore can be trusted
807 to return it unchanged. Otherwise, we must re-assign `current_class_decl'
808 after performing base initializations. */
809 #define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
811 /* Nonzero for _DECL means that this decl appears in (or will appear
812 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
813 detecting circularity in case members are multiply defined. In the
814 case of a VAR_DECL, it is also used to determince how program storage
815 should be allocated. */
816 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.in_aggr)
818 /* Nonzero for FUNCTION_DECL means that this decl is just a
819 friend declaration, and should not be added to the list of
820 member functions for this class. */
821 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
823 /* Nonzero for FUNCTION_DECL means that this decl is a static
825 #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
827 /* Nonzero for FUNCTION_DECL means that this member function
828 has `this' as const X *const. */
829 #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
831 /* Nonzero for FUNCTION_DECL means that this member function
832 has `this' as volatile X *const. */
833 #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
835 /* Nonzero for FUNCTION_DECL means that this member function
836 exists only as part of an abstract class's interface. */
837 #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
839 /* Nonzero for FUNCTION_DECL means that this member function
840 was generated by the compiler. This helps us give better
842 #define DECL_COMPILER_GENERATED_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.compiler_generated)
844 /* Nonzero if allocated on permanent_obstack. */
846 /* @@ Not currently used. */
847 #define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
850 /* Nonzero for FIELD_DECL node means that this FIELD_DECL is
851 a member of an anonymous union construct. */
852 #define DECL_ANON_UNION_ELEM(NODE) TREE_REGDECL (NODE) /* overloaded! */
854 /* For a FUNCTION_DECL: the name of the function before being overloaded. */
855 #define DECL_ORIGINAL_NAME(NODE) (DECL_LANG_SPECIFIC(NODE)->original_name)
857 /* Points back to the decl which caused this lang_decl to be allocated. */
858 #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
860 /* For a FUNCTION_DECL: if this function was declared inline inside of
861 a class declaration, this is where the text for the function is
863 #define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
865 /* Holds information about how virtual base classes should be initialized
866 by this constructor *if* this constructor is the one to perform
867 such initialization. */
868 #define DECL_VBASE_INIT_LIST(NODE) (DECL_LANG_SPECIFIC(NODE)->vbase_init_list)
870 /* Nonzero in INT_CST means that this int is negative by dint of
871 using a twos-complement negated operand. */
872 #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_1 (NODE))
874 /* Nonzero in any kind of _EXPR or _REF node means that it is a call
875 to a storage allocation routine. If, later, alternate storage
876 is found to hold the object, this call can be ignored. */
877 #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_2 (NODE))
879 /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
880 should be looked up in a non-standard way. */
881 #define TREE_OVERLOADED(NODE) (TREE_LANG_FLAG_1 (NODE))
882 #define DECL_OVERLOADED(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.overloaded_attr)
884 /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
885 For a FUNCTION_DECL, this is when the function is a virtual function.
886 For a VAR_DECL, this is when the variable is a virtual function table.
887 For a FIELD_DECL, when the field is the field for the virtual function table.
888 For an IDENTIFIER_NODE, nonzero if any function with this name
889 has been declared virtual. */
890 #define DECL_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
892 /* Nonzero for FIELD_DECL means that this field is a
893 virtual baseclass field. Used for printing debugging info. */
894 #define DECL_VBASE_P(NODE) ((NODE)->common.external_attr)
896 /* Nonzero for FIELD_DECLs means that this field is private,
897 and can only be accessed within the scope of the class
898 which defines it (or its friends). */
899 #define TREE_PRIVATE(NODE) (TREE_LANG_FLAG_3 (NODE))
900 /* Same, but tells if this field is private in current context. */
901 #define TREE_FIELD_PRIVATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_private)
903 /* Nonzero for FIELD_DECLs means that this field is protected,
904 and can only be accessed within the scope of the class
905 which defines it, its friends, or if there is a path in
906 the type hierarchy from the current class scope to
907 the one that defines it. */
908 #define TREE_PROTECTED(NODE) (TREE_LANG_FLAG_4 (NODE))
909 /* Same, but tells if this field is private in current context. */
910 #define TREE_FIELD_PROTECTED(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_protected)
912 #define TREE_FIELD_PUBLIC(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.this_public)
914 /* Nonzero for _TYPE means that the _TYPE defines
915 at least one constructor. */
916 #define TYPE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_1(NODE))
918 /* When appearing in an INDIRECT_REF, it means that the tree structure
919 underneath is actually a call to a constructor. This is needed
920 when the constructor must initialize local storage (which can
921 be automatically destroyed), rather than allowing it to allocate
924 When appearing in a SAVE_EXPR, it means that underneath
925 is a call to a constructor.
927 When appearing in a CONSTRUCTOR, it means that it was
928 a GNU C constructor expression.
930 When appearing in a FIELD_DECL, it means that this field
931 has been duly initialized in its constructor. */
932 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_1(NODE))
934 /* Nonzero for _TYPE means that the _TYPE defines a destructor. */
935 #define TYPE_HAS_DESTRUCTOR(NODE) (TREE_LANG_FLAG_2(NODE))
937 /* Nonzero for _TYPE node means that creating an object of this type
938 will involve a call to a constructor. This can apply to objects
939 of ARRAY_TYPE if the type of the elements needs a constructor. */
940 #define TYPE_NEEDS_CONSTRUCTING(NODE) (TREE_LANG_FLAG_3(NODE))
941 #define TYPE_NEEDS_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_constructor)
943 /* Nonzero for _TYPE node means that destroying an object of this type
944 will involve a call to a destructor. This can apply to objects
945 of ARRAY_TYPE is the type of the elements needs a destructor. */
946 #define TYPE_NEEDS_DESTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
948 /* Nonzero for VAR_DECL node means that `external' was specified in
950 #define DECL_EXTERNAL(NODE) (TREE_LANG_FLAG_1(NODE))
952 /* Nonzero for SAVE_EXPR if used to initialize a PARM_DECL. */
953 #define PARM_DECL_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
955 /* Nonzero in FUNCTION_DECL means it is really an operator.
956 Just used to communicate formatting information to dbxout.c. */
957 #define TREE_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
959 /* Nonzero for _TYPEs means that the argument defines or uses a
960 virtual function table for some of its methods. */
961 #define TYPE_VIRTUAL_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.virtual_attr)
963 /* May be useful for optimization using strictness analysis.
964 TYPE_ANY_ASSIGNS_THIS nonzero means that there is one constructor
965 within the hierarchy of TYPE which is known to assign to `this'.
967 TYPE_NONE_ASSIGNS_THIS nonzero means that it is known that
968 no constructor within the hierarchy of TYPE makes an assignment
971 Both of these can be zero, in which case it just means that we don't
972 have sufficient information yet. They cannot, however, both be nonzero. */
973 #define TYPE_ANY_ASSIGNS_THIS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.any_assigns_this)
974 #define TYPE_NONE_ASSIGN_THIS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.none_assign_this)
976 /* Define fields and accessors for nodes representing declared names. */
978 /* C++: A derived class may be able to directly use the virtual
979 function table of a base class. When it does so, it may
980 still have a decl node used to access the virtual function
981 table (so that variables of this type can initialize their
982 virtual function table pointers by name). When such thievery
983 is commited, know exactly which base class's virtual function
984 table is the one being stolen. This effectively computes the
985 transitive closure. */
986 #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
988 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
989 #define DECL_FRIENDLIST(NODE) ((NODE)->decl.voffset)
990 #define DECL_UNDEFINED_FRIENDS(NODE) ((NODE)->decl.context)
991 #define DECL_WAITING_FRIENDS(NODE) ((tree)(NODE)->decl.rtl)
992 #define SET_DECL_WAITING_FRIENDS(NODE,VALUE) ((NODE)->decl.rtl=(struct rtx_def*)VALUE)
994 /* C++: all of these are overloaded! These apply only to FIELD_DECLs. */
995 #define DECL_STATIC_NAME(NODE) ((tree)(NODE)->decl.offset)
996 #define SET_DECL_STATIC_NAME(NODE,VAL) ((NODE)->decl.offset = (int)VAL)
998 /* The DECL_VISIBILITY is used to record under which context
999 special visibility rules apply. */
1000 #define DECL_VISIBILITY(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.visibility)
1002 /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
1003 Before the struct containing the FUNCTION_DECL is laid out,
1004 DECL_VINDEX may point to a FUNCTION_DECL in a base class which
1005 is the FUNCTION_DECL which this FUNCTION_DECL will replace as a virtual
1006 function. When the class is laid out, this pointer is changed
1007 to an INT_CST node which is suitable for use as an index
1008 into the virtual function table. */
1009 #define DECL_VINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->vindex)
1010 #define SET_DECL_VINDEX(NODE,VAL) (DECL_LANG_SPECIFIC(NODE)->vindex = VAL)
1012 /* DECL_VCONTEXT is the *first* baseclass in which this FUNCTION_DECL
1013 is defined. Contrast this with DECL_CONTEXT (or DECL_FIELD_CONTEXT),
1014 which is the *last* such baseclass. */
1015 #define DECL_VCONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->vcontext)
1017 /* DECL_FCONTEXT is the *first* baseclass in which this FIELD_DECL
1018 is defined. This only applies to vfield and vbase decls. */
1019 #define SET_DECL_FCONTEXT(NODE,VALUE) (DECL_LANG_SPECIFIC(NODE) = (struct lang_decl *)(VALUE))
1020 #define DECL_FCONTEXT(NODE) ((tree)DECL_LANG_SPECIFIC(NODE))
1022 /* For static member functions, which can never be virtual,
1023 we need to know to what class the method belongs. This
1024 is where we stash the information. */
1025 #define DECL_STATIC_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->vcontext)
1027 /* C++: all of these are overloaded!
1028 These apply to PARM_DECLs and VAR_DECLs and RESULT_DECLs. */
1029 #define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
1030 #define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
1033 #define DECL_DINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->dynamic_index)
1036 /* An enumeration of the kind of tags that C++ accepts. */
1037 enum tag_types
{ record_type
, class_type
, union_type
, enum_type
, exception_type
};
1039 /* Zero means prototype weakly, as in ANSI C (no args means nothing).
1040 Each language context defines how this variable should be set. */
1041 extern int strict_prototype
;
1042 extern int strict_prototypes_lang_c
, strict_prototypes_lang_cplusplus
;
1044 /* Non-zero means that if a label exists, and no other identifier
1045 applies, use the value of the label. */
1046 extern int flag_labels_ok
;
1048 /* Non-zero means to collect statistics which might be expensive
1049 and to print them when we are done. */
1050 extern int flag_detailed_statistics
;
1052 /* Non-zero means warn in function declared in derived class has the
1053 same name as a virtual in the base class, but fails to match the
1054 type signature of any virtual function in the base class. */
1055 extern int warn_overloaded_virtual
;
1057 /* in cplus-decl{2}.c */
1058 extern tree void_list_node
;
1059 extern tree default_function_type
;
1060 extern tree
define_function ();
1061 extern tree
build_member_type ();
1063 extern tree vtable_entry_type
;
1064 extern tree
build_vtable_entry ();
1065 extern tree
build_vfn_ref ();
1066 extern tree
finish_table ();
1068 extern tree
typedecl_for_tag ();
1069 extern tree
identifier_class_value ();
1071 extern int complete_array_type ();
1072 extern tree
coerce_new_type (), coerce_delete_type ();
1074 /* A node that is a list (length 1) of error_mark_nodes. */
1075 extern tree error_mark_list
;
1077 extern tree ptr_type_node
;
1078 extern tree class_type_node
, record_type_node
, union_type_node
, enum_type_node
;
1079 extern tree exception_type_node
, unknown_type_node
;
1081 extern tree
get_temp_name (), get_temp_aggr (), get_temp_regvar ();
1082 extern tree
cleanup_after_call ();
1083 extern tree
build_type_conversion ();
1084 extern tree
convert_force ();
1085 extern tree
maybe_convert_decl_to_const ();
1086 extern char *lang_printable_name ();
1088 /* The largest size a virtual function table can be.
1089 Must be a (power of 2). */
1091 #define VINDEX_MAX ((unsigned)128)
1092 /* This is the integer ~ (vindex_max - 1). */
1094 extern tree vtbl_mask
;
1096 /* Array type `(void *)[]' */
1097 extern tree vtbl_type_node
;
1099 extern tree
get_parm_types ();
1100 extern tree
grokopexpr (), getaggrs (), groktypefield ();
1101 extern tree
grok_method_quals (), grok_enum_decls ();
1102 extern void finish_anon_union();
1103 extern tree long_long_integer_type_node
, long_long_unsigned_type_node
;
1104 /* For building calls to `delete'. */
1105 extern tree integer_two_node
, integer_three_node
;
1106 extern tree
get_first_matching_virtual (), get_abstract_virtuals ();
1108 /* in cplus-typeck.c */
1109 extern tree
build_x_conditional_expr ();
1110 extern tree
merge_component_comparisons ();
1111 extern tree
build_x_unary_op (), build_x_binary_op ();
1112 extern tree
build_component_addr ();
1113 extern tree
build_x_function_call ();
1114 extern tree
build_x_indirect_ref (), build_x_array_ref ();
1115 extern tree
build_x_modify_expr (), build_x_modify_op_expr ();
1117 extern tree
build_m_component_ref ();
1118 extern tree
build_component_type_expr ();
1119 extern tree
build_x_arrow ();
1120 extern tree
build_component_ref_1 ();
1121 extern tree
datatype (), unary_complex_lvalue (), target_type ();
1122 extern tree
build_return_stmt ();
1123 extern tree
actualparameterlist (), commonparms ();
1124 extern tree
cplus_size_in_bytes ();
1125 extern tree
cplus_sizeof (), cplus_sizeof_nowarn ();
1126 extern tree error_mark_list
;
1128 /* in cplus-type2.c */
1129 extern tree
basetype_or_else ();
1132 extern tree
build_let ();
1133 extern tree
decl_type_context ();
1135 /* in cplus-tree.c */
1136 extern tree
build1 ();
1137 extern tree
build_cplus_new ();
1138 extern tree
build_cplus_array_type ();
1139 extern tree
build_cplus_method_type ();
1140 extern tree
build_classtype_variant ();
1141 extern tree
hash_tree_cons (), hash_tree_chain ();
1142 extern tree
list_hash_lookup_or_cons ();
1143 extern tree
layout_basetypes ();
1144 extern tree
copy_to_permanent ();
1146 /* in cplus-except.c */
1147 extern tree current_exception_type
;
1148 extern tree current_exception_decl
;
1149 extern tree current_exception_object
;
1150 extern tree
build_exception_variant ();
1151 extern tree
lookup_exception_type (), lookup_exception_cname ();
1152 extern tree
lookup_exception_object ();
1153 extern tree
cplus_expand_start_catch ();
1154 extern tree
cplus_expand_end_try ();
1156 /* in cplus-class.c */
1157 extern tree current_class_name
;
1158 extern tree current_class_type
;
1159 extern tree prev_class_type
;
1161 extern tree current_lang_name
, lang_name_cplusplus
, lang_name_c
;
1163 extern tree
do_identifier (), hack_identifier ();
1164 extern tree
hack_operator (), hack_wrapper ();
1165 extern tree
convert_pointer_to (), convert_pointer_to_vbase ();
1166 extern tree
convert_to_reference (), convert_to_aggr (), convert_aggr ();
1167 extern tree
build_x_new (), build_x_delete ();
1168 extern tree
build_new (), build_vec_new (), build_delete (), build_vec_delete ();
1169 extern tree
make_destructor_name ();
1170 extern tree
build_scoped_ref (), build_vfield_ref ();
1171 extern tree
build_method_call (), build_overload_call ();
1172 extern tree
build_type_pathname ();
1173 extern tree
start_method (), start_type_method ();
1174 extern tree
finish_method ();
1176 extern tree
lookup_field (), lookup_fnfields ();
1178 void pushclass (), popclass (), pushclasstype ();
1179 extern tree
build_operator_fnname (), build_opfncall (), build_type_conversion ();
1180 extern tree
build_wrapper ();
1182 /* Points to the name of that function. May not be the DECL_NAME
1183 of CURRENT_FUNCTION_DECL due to overloading */
1184 extern tree original_function_name
;
1186 # define IS_AGGR_TYPE(t) \
1187 (TREE_CODE (t) == RECORD_TYPE || TREE_CODE (t) == UNION_TYPE)
1189 # define IS_AGGR_TYPE_CODE(t) \
1190 (t == RECORD_TYPE || t == UNION_TYPE)
1192 extern tree
build_decl_overload (), build_typename_overload ();
1193 extern tree
build_destructor_call ();
1194 extern tree current_class_name
, current_class_type
, current_class_decl
, C_C_D
;
1195 extern tree current_vtable_decl
;
1197 /* in cplus-init.c */
1198 extern tree
resolve_offset_ref ();
1199 extern tree
purpose_member (), value_member ();
1200 extern void check_base_init ();
1201 extern void do_member_init ();
1202 extern tree global_base_init_list
;
1203 extern tree current_base_init_list
, current_member_init_list
;
1205 extern tree
get_linktable_name (), get_dtable_name (), get_sos_dtable ();
1207 extern tree
get_member_function ();
1208 extern tree
build_member_call (), build_offset_ref ();
1210 extern int current_function_assigns_this
;
1211 extern int current_function_just_assigned_this
;
1212 extern int current_function_parms_stored
;
1214 /* Cannot use '$' up front, because this confuses gdb.
1215 Note that any format of this kind *must* make the
1216 format for `this' lexicgraphically less than any other
1217 parameter name, i.e. "$this" is less than anything else can be.
1219 Note that all forms in which the '$' is significant are long enough
1220 for direct indexing. */
1222 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
1223 doesn't allow '$' in symbol names. */
1224 #ifndef NO_DOLLAR_IN_LABEL
1228 #define THIS_NAME "$t"
1229 #define VPTR_NAME "$v"
1230 #define THROW_NAME "$eh_throw"
1231 #define DESTRUCTOR_DECL_FORMAT "_$_%s"
1232 #define WRAPPER_DECL_FORMAT "__W$%s"
1233 #define WRAPPER_PRED_DECL_FORMAT "__P$%s"
1234 #define ANTI_WRAPPER_DECL_FORMAT "__w$%s"
1235 #define IN_CHARGE_NAME "__in$chrg"
1236 #define AUTO_VTABLE_NAME "__vtbl$me__"
1237 #define AUTO_TEMP_NAME "_$tmp_"
1238 #define AUTO_TEMP_FORMAT "_$tmp_%d"
1239 #define OPERATOR_ASSIGN_FORMAT "op$assign_%s"
1240 #define OPERATOR_MODIFY_FORMAT "op$modify"
1241 #define OPERATOR_METHOD_FORMAT "op$method_call"
1242 #define OPERATOR_NEW_FORMAT "op$new"
1243 #define OPERATOR_DELETE_FORMAT "op$delete"
1244 #define OPERATOR_FORMAT "op$%s"
1245 #define VTBL_PTR_TYPE "$vtbl_ptr_type"
1246 #define VTABLE_NAME_FORMAT "_vt$%s"
1247 #define VFIELD_NAME "_vptr$"
1248 #define VFIELD_NAME_FORMAT "_vptr$%s"
1249 #define VBASE_NAME "_vb$"
1250 #define VBASE_NAME_FORMAT "_vb$%s"
1251 #define STATIC_NAME_FORMAT "_%s$%s"
1252 #define OPERATOR_TYPENAME_FORMAT "type$"
1253 #define FILE_FUNCTION_FORMAT "_GLOBAL_$D$%s"
1254 #define ANON_AGGRNAME_FORMAT "$_%d"
1256 #else /* NO_DOLLAR_IN_LABEL */
1260 #define THIS_NAME ".t"
1261 #define VPTR_NAME ".v"
1262 #define THROW_NAME ".eh_throw"
1263 #define DESTRUCTOR_DECL_FORMAT "_._%s"
1264 #define WRAPPER_DECL_FORMAT "__W.%s"
1265 #define WRAPPER_PRED_DECL_FORMAT "__P.%s"
1266 #define ANTI_WRAPPER_DECL_FORMAT "__w.%s"
1267 #define IN_CHARGE_NAME "__in.chrg"
1268 #define AUTO_VTABLE_NAME "__vtbl.me__"
1269 #define AUTO_TEMP_NAME "_.tmp_"
1270 #define AUTO_TEMP_FORMAT "_.tmp_%d"
1271 #define OPERATOR_ASSIGN_FORMAT "op.assign_%s"
1272 #define OPERATOR_MODIFY_FORMAT "op.modify"
1273 #define OPERATOR_METHOD_FORMAT "op.method_call"
1274 #define OPERATOR_NEW_FORMAT "op.new"
1275 #define OPERATOR_DELETE_FORMAT "op.delete"
1276 #define OPERATOR_FORMAT "op.%s"
1277 #define VTBL_PTR_TYPE ".vtbl_ptr_type"
1278 #define VTABLE_NAME_FORMAT "_vt.%s"
1279 #define VFIELD_NAME "_vptr."
1280 #define VFIELD_NAME_FORMAT "_vptr.%s"
1281 #define VBASE_NAME "_vb."
1282 #define VBASE_NAME_FORMAT "_vb.%s"
1283 #define STATIC_NAME_FORMAT "_%s.%s"
1284 #define OPERATOR_TYPENAME_FORMAT "type."
1285 #define FILE_FUNCTION_FORMAT "_GLOBAL_.D.%s"
1287 #define ANON_AGGRNAME_FORMAT "._%d"
1289 #endif /* NO_DOLLAR_IN_LABEL */
1291 #define DESTRUCTOR_NAME_FORMAT "~%s"
1292 #define WRAPPER_NAME_FORMAT "()%s"
1293 #define WRAPPER_PRED_NAME_FORMAT "()?%s"
1294 #define ANTI_WRAPPER_NAME_FORMAT "~()%s"
1295 #define OPERATOR_MODIFY_LENGTH 8
1296 #define OPERATOR_METHOD_LENGTH 13
1297 #define OPERATOR_NEW_LENGTH 5
1298 #define OPERATOR_DELETE_LENGTH 8
1299 #define EXCEPTION_NAME_LENGTH 12
1300 #define FILE_FUNCTION_PREFIX_LEN 9
1301 #define VTABLE_DELTA_NAME "delta"
1302 #define VTABLE_DELTA2_NAME "delta2"
1303 #define VTABLE_INDEX_NAME "index"
1304 #define VTABLE_PFN_NAME "pfn"
1305 #define EXCEPTION_CLEANUP_NAME "exception cleanup"
1307 #define THIS_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
1308 && IDENTIFIER_POINTER (ID_NODE)[1] == 't')
1309 #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
1310 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
1311 #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER)
1313 #define WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1314 && IDENTIFIER_POINTER (ID_NODE)[2] == 'W' \
1315 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1316 #define WRAPPER_PRED_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1317 && IDENTIFIER_POINTER (ID_NODE)[2] == 'P' \
1318 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1319 #define ANTI_WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1320 && IDENTIFIER_POINTER (ID_NODE)[2] == 'w' \
1321 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1322 #define WRAPPER_OR_ANTI_WRAPPER_NAME_P(ID_NODE) \
1323 (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1324 && (IDENTIFIER_POINTER (ID_NODE)[2]|('W'^'w')) == 'w' \
1325 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1327 #define OPERATOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[2] == JOINER \
1328 && IDENTIFIER_POINTER (ID_NODE)[1])
1330 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == JOINER \
1331 && IDENTIFIER_POINTER (ID_NODE)[2] == 't'\
1332 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
1334 #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == JOINER \
1335 && IDENTIFIER_POINTER (ID_NODE)[2] == 'b'\
1336 && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
1338 #define OPERATOR_TYPENAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[4] == JOINER \
1339 && IDENTIFIER_POINTER (ID_NODE)[3] \
1340 && IDENTIFIER_POINTER (ID_NODE)[2] \
1341 && IDENTIFIER_POINTER (ID_NODE)[1])
1343 #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
1344 #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
1346 /* For anonymous aggregate types, we need some sort of name to
1347 hold on to. In practice, this should not appear, but it should
1348 not be harmful if it does. */
1349 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER)
1351 #define ANON_PARMNAME_FORMAT "_%d"
1352 #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
1353 && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
1355 enum visibility_type
{
1359 visibility_protected
,
1360 visibility_default_virtual
,
1361 visibility_public_virtual
,
1362 visibility_private_virtual
,
1365 enum visibility_type
compute_visibility ();
1367 /* in cplus-lex.c */
1368 extern tree current_unit_name
, current_unit_language
;
1369 extern char *operator_name_string ();
1371 /* Things for handling inline functions. */
1373 struct pending_inline
1375 struct pending_inline
*next
; /* pointer to next in chain */
1376 int lineno
; /* line number we got the text from */
1377 char *filename
; /* name of file we were processing */
1378 tree fndecl
; /* FUNCTION_DECL that brought us here */
1379 int token
; /* token we were scanning */
1380 int token_value
; /* value of token we were scanning (YYSTYPE) */
1382 char *buf
; /* pointer to character stream */
1383 int len
; /* length of stream */
1386 extern tree
combine_strings ();
1387 extern int yylex ();
1389 /* in cplus-method.c */
1390 extern tree wrapper_name
, wrapper_pred_name
, anti_wrapper_name
;
1391 extern struct pending_inline
*pending_inlines
;
1392 extern char *print_fndecl_with_types ();
1394 /* 1 for -fall-virtual: make every member function (except
1395 constructors) lay down in the virtual function table.
1396 Calls can then either go through the virtual function table or not,
1397 depending on whether we know what function will actually be called.
1399 2 for -fSOS: make every member function (including constructors)
1400 lay down in the virtual function table. All calls go through the
1401 virtual function table: this takes the place of using a linker. */
1403 extern int flag_all_virtual
;
1405 /* Nonzero means that we cannot make optimizing assumptions about `this'. */
1407 extern int flag_this_is_variable
;
1409 enum overload_flags
{ NO_SPECIAL
= 0, DTOR_FLAG
, OP_FLAG
, TYPENAME_FLAG
, WRAPPER_FLAG
, WRAPPER_PRED_FLAG
, ANTI_WRAPPER_FLAG
};
1411 extern tree
default_conversion (), pushdecl (), pushdecl_top_level ();
1412 extern tree
make_instance_name (), do_decl_overload ();
1413 extern tree
maybe_build_cleanup ();
1414 extern tree
build_instantiated_decl (), instantiate_type ();
1415 extern tree
require_instantiated_type ();
1416 extern tree
build_vtbl_ref ();
1417 extern tree
make_anon_parm_name ();
1418 extern int resolves_to_fixed_type_p ();
1420 extern tree
do_friend ();
1421 extern void grokclassfn ();
1423 extern tree current_class_decl
, C_C_D
; /* PARM_DECL: the class instance variable */
1425 /* The following two can be derived from the previous one */
1426 extern tree current_class_name
; /* IDENTIFIER_NODE: name of current class */
1427 extern tree current_class_type
; /* _TYPE: the type of the current class */
1429 /* The following structure is used when comparing various alternatives
1430 for overloading. The unsigned quantity `strikes.i' is used
1431 for fast comparison of two possibilities. This number is an
1432 aggregate of four constituents:
1434 EVIL: if this is non-zero, then the candidate should not be considered
1435 USER: if this is non-zero, then a user-defined type conversion is needed
1436 B_OR_D: if this is non-zero, then use a base pointer instead of the
1437 type of the pointer we started with.
1438 EASY: if this is non-zero, then we have a builtin conversion
1439 (such as int to long, int to float, etc) to do.
1441 If two candidates require user-defined type conversions, and the
1442 type conversions are not identical, then an ambiguity error
1445 If two candidates agree on user-defined type conversions,
1446 and one uses pointers of strictly higher type (derived where
1447 another uses base), then that alternative is silently chosen.
1449 If two candidates have a non-monotonic derived/base pointer
1450 relationship, and/or a non-monotonic easy conversion relationship,
1451 then a warning is emitted to show which paths are possible, and
1452 which one is being chosen.
1461 double f (double, double);
1463 f (i, x); // draws a warning
1474 dd->f (x); // exact match
1475 dd->f (i); // draws warning
1477 Note that this technique really only works for 255 arguments. Perhaps
1478 this is not enough. */
1482 tree function
; /* A FUNCTION_DECL */
1484 unsigned char evil
; /* ~0 if this will never convert. */
1485 unsigned char user
; /* ~0 if at least one user-defined type conv. */
1486 unsigned short b_or_d
; /* count number of derived->base conv. */
1487 unsigned short easy
; /* count number of builtin type conv. */
1488 tree arg
; /* an _EXPR node that is first parm to function */
1489 unsigned short *harshness
; /* Indexed by argument number, encodes
1490 evil, user, b_or_d, and easy strikes for
1492 At end of array, we store the index+1 where we
1493 started using default parameters, or 0
1494 if there are none. */
1497 tree field
; /* If no evil strikes, the FUNCTION_DECL of
1498 the function (if a member function). */
1499 int bad_arg
; /* the index of the first bad argument:
1500 0 if no bad arguements
1501 > 0 is first bad argument
1502 -1 if extra actual arguments
1503 -2 if too few actual arguments.
1504 -3 if const/non const method mismatch. */
1507 int rank_for_overload ();
1508 struct candidate
*ideal_candidate ();
1509 /* Some macros for char-based bitfields. */
1510 #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
1511 #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
1512 #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
1514 /* These are uses as bits in flags passed to build_method_call
1515 to control its error reporting behavior.
1517 LOOKUP_PROTECT means flag visibility violations.
1518 LOOKUP_COMPLAIN mean complain if no suitable member function
1519 matching the arguments is found.
1520 LOOKUP_NORMAL is just a combination of these two.
1521 LOOKUP_AGGR requires the instance to be of aggregate type.
1522 LOOKUP_NONVIRTUAL means make a direct call to the member function found
1523 LOOKUP_GLOBAL means search through the space of overloaded functions,
1524 rather than the space of member functions.
1525 LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
1526 in the parameter list.
1527 LOOKUP_PROTECTED_OK means that even if the constructor we find appears
1528 to be non-visibile to current scope, call it anyway.
1529 LOOKUP_DYNAMIC means call dynamic functions, a la SOS.
1530 LOOKUP_NO_CONVERSION means that user-defined conversions are not
1531 permitted. Built-in conversions are permitted.
1532 LOOKUP_DESTRUCTOR means explicit call to destructor. */
1534 #define LOOKUP_PROTECT (1)
1535 #define LOOKUP_COMPLAIN (2)
1536 #define LOOKUP_NORMAL (3)
1537 #define LOOKUP_AGGR (4)
1538 #define LOOKUP_NONVIRTUAL (8)
1539 #define LOOKUP_GLOBAL (16)
1540 #define LOOKUP_HAS_IN_CHARGE (32)
1541 #define LOOKUP_SPECULATIVELY (64)
1542 #define LOOKUP_PROTECTED_OK (128)
1543 #define LOOKUP_DYNAMIC (256)
1544 #define LOOKUP_NO_CONVERSION (512)
1545 #define LOOKUP_DESTRUCTOR (512)
1547 /* Anatomy of a DECL_FRIENDLIST (which is a TREE_LIST):
1548 purpose = friend name (IDENTIFIER_NODE);
1549 value = TREE_LIST of FUNCTION_DECLS;
1550 chain, type = EMPTY; */
1551 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
1552 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
1554 extern tree
get_temp_name (), get_temp_aggr (), get_temp_regvar ();
1555 extern tree
build_method_call ();
1556 extern tree
build_type_conversion ();
1557 extern tree
build_functional_cast ();
1558 extern tree
build_scoped_method_call ();
1559 extern tree
decl_constant_value ();
1561 /* in cplus-init.c */
1562 extern tree
resolve_offset_ref ();
1563 extern tree
build_with_cleanup ();
1565 /* in cplus-lex.c */
1566 extern char *operator_name_string ();
1568 extern tree
get_base_type ();
1569 extern tree
build_opid ();
1571 /* Indexed by TREE_CODE, these tables give C-looking names to
1572 operators represented by TREE_CODES. For example,
1573 opname_tab[(int) MINUS_EXPR] == "-". */
1574 extern char **opname_tab
, **assignop_tab
;
1576 extern tree
build_lang_decl (), build_lang_field_decl ();
1577 extern tree
make_lang_type ();
1578 extern tree
cons_up_default_function ();
1580 /* in cplus-convert.c */
1581 extern tree
convert_from_reference ();
1583 /* in cplus-search.c */
1584 extern tree
init_vbase_pointers ();
1585 extern tree
build_vbase_pointer (), build_vbase_path ();
1586 extern tree
lookup_fnfield (), next_baselink ();
1588 extern tree
get_base_type ();
1589 extern tree
get_vbase_types ();
1590 extern tree
get_baselinks ();
1591 extern tree
get_wrapper ();
1592 extern tree
make_assoc (), copy_assoc ();
1593 extern tree
assoc_value (), virtual_member ();
1595 #define PRINT_LANG_DECL
1596 #define PRINT_LANG_TYPE
1598 #define UNKNOWN_TYPE LANG_TYPE
1600 extern union tree_node ERROR_MARK_NODE
;
1602 #define error_mark_node (&ERROR_MARK_NODE)