|
|
1.1 root 1: /* Definitions for C++ parsing and type checking.
2: Copyright (C) 1987 Free Software Foundation, Inc.
3: Hacked by Michael Tiemann ([email protected])
4:
5: This file is part of GNU CC.
6:
7: GNU CC is free software; you can redistribute it and/or modify
8: it under the terms of the GNU General Public License as published by
9: the Free Software Foundation; either version 2, or (at your option)
10: any later version.
11:
12: GNU CC is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: GNU General Public License for more details.
16:
17: You should have received a copy of the GNU General Public License
18: along with GNU CC; see the file COPYING. If not, write to
19: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20:
21:
22: /* Borrow everything that is C from c-tree.h,
23: but do so by copy, not by inclusion, since c-tree.h defines
24: lang_identifier. */
25:
26: #ifndef PARANOID
27: #define PARANOID 0
28: #endif
29: #if PARANOID
30: #include <assert.h>
31: #endif
32:
33: /* Language-dependent contents of an identifier. */
34:
35: struct lang_identifier
36: {
37: struct tree_identifier ignore;
38: tree global_value, local_value;
39: tree class_value;
40: tree class_template_info;
41: struct lang_id2 *x;
42: };
43:
44: struct lang_id2
45: {
46: tree label_value, implicit_decl;
47: tree type_desc, as_list, error_locus;
48: };
49:
50: /* Macros for access to language-specific slots in an identifier. */
51:
52: #if !PARANOID
53: #define IDENTIFIER_GLOBAL_VALUE(NODE) \
54: (((struct lang_identifier *)(NODE))->global_value)
55: #define IDENTIFIER_CLASS_VALUE(NODE) \
56: (((struct lang_identifier *)(NODE))->class_value)
57: #define IDENTIFIER_LOCAL_VALUE(NODE) \
58: (((struct lang_identifier *)(NODE))->local_value)
59: #define IDENTIFIER_TEMPLATE(NODE) \
60: (((struct lang_identifier *)(NODE))->class_template_info)
61: #else
62: #define IDENTIFIER_LANG_SPECIFIC_PTR(NODE) \
63: (assert (TREE_CODE (NODE) == IDENTIFIER_NODE), \
64: (struct lang_identifier *) (NODE))
65: #define IDENTIFIER_GLOBAL_VALUE(NODE) \
66: (((struct lang_identifier *)(NODE))->global_value)
67: #define IDENTIFIER_CLASS_VALUE(NODE) \
68: (((struct lang_identifier *)(NODE))->class_value)
69: #define IDENTIFIER_LOCAL_VALUE(NODE) \
70: (((struct lang_identifier *)(NODE))->local_value)
71: #define IDENTIFIER_TEMPLATE(NODE) \
72: (IDENTIFIER_LANG_SPECIFIC_PTR (NODE) -> class_template_info)
73: #endif
74:
75: #if !PARANOID
76: #define IDENTIFIER_TYPE_VALUE(NODE) (TREE_TYPE (NODE))
77: #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = TYPE)
78: #else
79: #define IDENTIFIER_TYPE_VALUE(NODE) (*IDENTIFIER_TYPE_VALUE_PTR(NODE))
80: #ifdef __GNUC__
81: __inline
82: #endif
83: static tree * IDENTIFIER_TYPE_VALUE_PTR(NODE) tree NODE; { return
84: (assert (TREE_CODE (NODE) == IDENTIFIER_NODE),
85: &TREE_TYPE (NODE)) ;}
86: #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (IDENTIFIER_TYPE_VALUE(NODE)=TYPE)
87: #endif
88: #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (TREE_TYPE (NODE) ? 1 : 0)
89: extern tree identifier_typedecl_value ();
90: #define IDENTIFIER_TYPEDECL_VALUE(NODE) identifier_typedecl_value (NODE)
91:
92: #define IDENTIFIER_LABEL_VALUE(NODE) \
93: (((struct lang_identifier *)(NODE))->x \
94: ? ((struct lang_identifier *)(NODE))->x->label_value : 0)
95: #define SET_IDENTIFIER_LABEL_VALUE(NODE,VALUE) \
96: (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
97: ((struct lang_identifier *)(NODE))->x->label_value = (VALUE))
98: #define IDENTIFIER_IMPLICIT_DECL(NODE) \
99: (((struct lang_identifier *)(NODE))->x \
100: ? ((struct lang_identifier *)(NODE))->x->implicit_decl : 0)
101: #define SET_IDENTIFIER_IMPLICIT_DECL(NODE,VALUE) \
102: (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
103: ((struct lang_identifier *)(NODE))->x->implicit_decl = (VALUE))
104: #define IDENTIFIER_AS_DESC(NODE) \
105: (((struct lang_identifier *)(NODE))->x \
106: ? ((struct lang_identifier *)(NODE))->x->type_desc : 0)
107: #define SET_IDENTIFIER_AS_DESC(NODE,DESC) \
108: (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
109: ((struct lang_identifier *)(NODE))->x->type_desc = (DESC))
110: #define IDENTIFIER_AS_LIST(NODE) \
111: (((struct lang_identifier *)(NODE))->x \
112: ? ((struct lang_identifier *)(NODE))->x->as_list : 0)
113: #define SET_IDENTIFIER_AS_LIST(NODE,LIST) \
114: (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
115: ((struct lang_identifier *)(NODE))->x->as_list = (LIST))
116: #define IDENTIFIER_ERROR_LOCUS(NODE) \
117: (((struct lang_identifier *)(NODE))->x \
118: ? ((struct lang_identifier *)(NODE))->x->error_locus : 0)
119: #define SET_IDENTIFIER_ERROR_LOCUS(NODE,VALUE) \
120: (((struct lang_identifier *)(NODE))->x == 0 ? ((struct lang_identifier *)(NODE))->x = (struct lang_id2 *)perm_calloc (1, sizeof (struct lang_id2)) : 0, \
121: ((struct lang_identifier *)(NODE))->x->error_locus = (VALUE))
122:
123: /* Nonzero if this identifier is the prefix for a mangled C++ operator name. */
124: #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2(NODE)
125:
126: #define IDENTIFIER_TYPENAME_P(NODE) \
127: (! strncmp (IDENTIFIER_POINTER (NODE), \
128: IDENTIFIER_POINTER (ansi_opname[TYPE_EXPR]), \
129: IDENTIFIER_LENGTH (ansi_opname[TYPE_EXPR])))
130:
131: /* Nonzero means reject anything that ANSI standard C forbids. */
132: extern int pedantic;
133:
134: /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
135: #define C_TYPE_FIELDS_READONLY(type) TYPE_LANG_FLAG_0 (type)
136:
137: /* in tree.c */
138: extern tree purpose_member (), value_member ();
139: extern tree binfo_member ();
140:
141: /* in cp-typeck.c */
142: extern tree build_component_ref(), build_conditional_expr();
143: extern tree build_x_compound_expr (), build_compound_expr();
144: extern tree build_unary_op(), build_binary_op(), build_function_call();
145: extern tree build_binary_op_nodefault ();
146: extern tree build_indirect_ref(), build_array_ref(), build_c_cast();
147: extern tree build_modify_expr();
148: extern tree c_sizeof (), c_alignof ();
149: extern tree store_init_value ();
150: extern tree digest_init ();
151: extern tree c_expand_start_case ();
152: extern tree default_conversion ();
153:
154: /* Given two integer or real types, return the type for their sum.
155: Given two compatible ANSI C types, returns the merged type. */
156:
157: extern tree common_type ();
158:
159: /* in cp-decl.c */
160: extern tree build_label ();
161:
162: /* If non-zero, a VAR_DECL whose cleanup will cause a throw to the
163: next exception handler. */
164: extern tree exception_throw_decl;
165:
166: extern int start_function ();
167: extern void finish_function ();
168: extern void store_parm_decls ();
169: extern tree get_parm_info ();
170:
171: extern void pushlevel ();
172: extern tree poplevel ();
173:
174: extern tree groktypename(), lookup_name();
175:
176: extern tree lookup_label(), define_label();
177:
178: extern tree implicitly_declare(), getdecls(), gettags ();
179:
180: extern tree start_decl();
181: extern void finish_decl();
182:
183: extern tree start_struct(), finish_struct(), xref_tag(), xref_defn_tag();
184: extern tree finish_exception ();
185: extern tree grokfield(), grokbitfield ();
186:
187: extern tree start_enum(), finish_enum();
188: extern tree build_enumerator();
189:
190: extern tree make_index_type ();
191: extern tree make_anon_name ();
192:
193: /* Functions in c-common.c: */
194:
195: /* Concatenate a list of STRING_CST nodes into one STRING_CST. */
196: extern tree combine_strings ();
197:
198: /* Validate the expression after `case' and apply default promotions. */
199: extern tree check_case_value ();
200:
201: /* Print an error message for invalid operands to arith operation CODE.
202: NOP_EXPR is used as a special case (see truthvalue_conversion). */
203:
204: extern void binary_op_error ();
205:
206: /* Subroutine of build_binary_op_nodefault, used for comparison operations.
207: See if the operands have both been converted from subword integer types
208: and, if so, perhaps change them both back to their original type. */
209:
210: extern tree shorten_compare ();
211:
212: extern tree double_type_node, long_double_type_node, float_type_node;
213: extern tree char_type_node, unsigned_char_type_node, signed_char_type_node;
214: extern tree ptrdiff_type_node;
215:
216: extern tree short_integer_type_node, short_unsigned_type_node;
217: extern tree long_integer_type_node, long_unsigned_type_node;
218: extern tree long_long_integer_type_node, long_long_unsigned_type_node;
219: extern tree unsigned_type_node;
220: extern tree string_type_node, char_array_type_node, int_array_type_node;
221: extern tree wchar_array_type_node;
222: extern tree wchar_type_node, signed_wchar_type_node, unsigned_wchar_type_node;
223:
224: extern int current_function_returns_value;
225: extern int current_function_returns_null;
226: extern tree current_function_return_value;
227:
228: extern tree ridpointers[];
229: extern tree ansi_opname[];
230: extern tree ansi_assopname[];
231:
232: /* Nonzero means `$' can be in an identifier. */
233:
234: extern int dollars_in_ident;
235:
236: /* Nonzero means allow type mismatches in conditional expressions;
237: just make their values `void'. */
238:
239: extern int flag_cond_mismatch;
240:
241: /* Nonzero means don't recognize the keyword `asm'. */
242:
243: extern int flag_no_asm;
244:
245: /* For cross referencing. */
246:
247: extern int flag_gnu_xref;
248:
249: /* For environments where you can use GNU binutils (as, ld in particular). */
250:
251: extern int flag_gnu_binutils;
252:
253: /* Nonzero means warn about implicit declarations. */
254:
255: extern int warn_implicit;
256:
257: /* Nonzero means warn about function definitions that default the return type
258: or that use a null return and have a return-type other than void. */
259:
260: extern int warn_return_type, explicit_warn_return_type;
261:
262: /* Nonzero means give string constants the type `const char *'
263: to get extra warnings from them. These warnings will be too numerous
264: to be useful, except in thoroughly ANSIfied programs. */
265:
266: extern int warn_write_strings;
267:
268: /* Nonzero means warn about sizeof(function) or addition/subtraction
269: of function pointers. */
270:
271: extern int warn_pointer_arith;
272:
273: /* Nonzero means warn for all old-style non-prototype function decls. */
274:
275: extern int warn_strict_prototypes;
276:
277: /* Nonzero means warn about suggesting putting in ()'s. */
278:
279: extern int warn_parentheses;
280:
281: /* Nonzero means warn about pointer casts that can drop a type qualifier
282: from the pointer target type. */
283:
284: extern int warn_cast_qual;
285:
286: /* Nonzero means do some things the same way PCC does. */
287:
288: extern int flag_traditional;
289:
290: /* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
291:
292: extern int flag_signed_bitfields;
293:
294: /* 2 means write out only specific virtual function tables
295: and give them (C) public visibility.
296: 1 means write out virtual function tables and give them
297: (C) public visibility.
298: 0 means write out virtual function tables and give them
299: (C) static visibility.
300: -1 means declare virtual function tables extern. */
301:
302: extern int write_virtuals;
303:
304: /* INTERFACE_ONLY nonzero means that we are in an "interface"
305: section of the compiler. INTERFACE_UNKNOWN nonzero means
306: we cannot trust the value of INTERFACE_ONLY. If INTERFACE_UNKNOWN
307: is zero and INTERFACE_ONLY is zero, it means that we are responsible
308: for exporting definitions that others might need. */
309: extern int interface_only, interface_unknown;
310:
311: /* Nonzero means we should attempt to elide constructors when possible. */
312:
313: extern int flag_elide_constructors;
314:
315: /* Nonzero means recognize and handle exception handling constructs. */
316:
317: extern int flag_handle_exceptions;
318:
319: /* Nonzero means recognize and handle ansi-style exception handling constructs. */
320:
321: extern int flag_ansi_exceptions;
322:
323: /* Nonzero means that member functions defined in class scope are
324: inline by default. */
325:
326: extern int flag_default_inline;
327:
328: /* Nonzero means emit cadillac protocol. */
329:
330: extern int flag_cadillac;
331:
332: /* C++ language-specific tree codes. */
333: #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
334: enum cplus_tree_code {
335: __DUMMY = LAST_AND_UNUSED_TREE_CODE,
336: #include "cp-tree.def"
337: LAST_CPLUS_TREE_CODE
338: };
339: #undef DEFTREECODE
340:
341: enum languages { lang_c, lang_cplusplus };
342:
343: /* Macros to make error reporting functions' lives easier. */
344: #if !PARANOID
345: #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
346: #else
347: #define TYPE_IDENTIFIER(NODE) (*TYPE_IDENTIFIER_PTR (NODE))
348: #ifdef __GNUC__
349: __inline
350: #endif
351: static tree *
352: TYPE_IDENTIFIER_PTR(NODE) tree NODE; { return
353: (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'),
354: &DECL_NAME (TYPE_NAME (NODE))) ;}
355: #endif
356:
357: #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (NODE))))
358: #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (DECL_NAME (TYPE_NAME (NODE))))
359:
360: #define IS_AGGR_TYPE_2(TYPE1,TYPE2) \
361: (TREE_CODE (TYPE1) == TREE_CODE (TYPE2) \
362: && IS_AGGR_TYPE (TYPE1)&IS_AGGR_TYPE (TYPE2))
363:
364: /* Macros which might want to be replaced by function calls. */
365:
366: #if 1
367: /* Virtual function addresses can be gotten from a virtual function
368: table entry using this macro. */
369: #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) \
370: TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY))))
371: #define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
372: (TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CONSTRUCTOR_ELTS (ENTRY)))) = (VALUE))
373:
374: #define FUNCTION_ARG_CHAIN(NODE) (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE))))
375: #define PROMOTES_TO_AGGR_TYPE(NODE,CODE) \
376: (((CODE) == TREE_CODE (NODE) \
377: && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
378: || IS_AGGR_TYPE (NODE))
379:
380: #else
381: extern tree fnaddr_from_vtable_entry ();
382: extern void set_fnaddr_from_vtable_entry ();
383: extern tree function_arg_chain ();
384: extern int promotes_to_aggr_type ();
385: extern int is_aggr_type_2 ();
386: #define FNADDR_FROM_VTABLE_ENTRY(ENTRY) (fnaddr_from_vtable_entry (ENTRY))
387: #define SET_FNADDR_FROM_VTABLE_ENTRY(ENTRY,VALUE) \
388: (set_fnaddr_from_vtable_entry (ENTRY, VALUE))
389: /* #define TYPE_NAME_STRING(NODE) (type_name_string (NODE)) */
390: #define FUNCTION_ARG_CHAIN(NODE) (function_arg_chain (NODE))
391: #define PROMOTES_TO_AGGR_TYPE(NODE,CODE) (promotes_to_aggr_type (NODE, CODE))
392: /* #define IS_AGGR_TYPE_2(TYPE1, TYPE2) (is_aggr_type_2 (TYPE1, TYPE2)) */
393: #endif
394: /* Nonzero iff TYPE is derived from PARENT. */
395: #define DERIVED_FROM_P(PARENT, TYPE) (get_base_distance (PARENT, TYPE, 0, 0) >= 0)
396:
397: enum conversion_type { ptr_conv, constptr_conv, int_conv, real_conv, last_conversion_type };
398:
399: /* Statistics show that while the GNU C++ compiler may generate
400: thousands of different types during a compilation run, it
401: generates relatively few (tens) of classtypes. Because of this,
402: it is not costly to store a generous amount of information
403: in classtype nodes. This struct must fill out to a multiple of 4 bytes. */
404: struct lang_type
405: {
406: struct
407: {
408: unsigned has_type_conversion : 1;
409: unsigned has_int_conversion : 1;
410: unsigned has_float_conversion : 1;
411: unsigned has_init_ref : 1;
412: unsigned gets_init_ref : 1;
413: unsigned gets_init_aggr : 1;
414: unsigned has_assignment : 1;
415: unsigned gets_assignment : 1;
416:
417: unsigned needs_constructor : 1;
418: unsigned has_default_ctor : 1;
419: unsigned uses_multiple_inheritance : 1;
420: unsigned const_needs_init : 1;
421: unsigned ref_needs_init : 1;
422: unsigned gets_const_init_ref : 1;
423: unsigned has_const_assign_ref : 1;
424: unsigned gets_const_assign_ref : 1;
425:
426: unsigned vtable_needs_writing : 1;
427: unsigned has_assign_ref : 1;
428: unsigned gets_assign_ref : 1;
429: unsigned gets_new : 1;
430: unsigned gets_delete : 1;
431: unsigned has_call_overloaded : 1;
432: unsigned has_array_ref_overloaded : 1;
433: unsigned has_arrow_overloaded : 1;
434:
435: unsigned local_typedecls : 1;
436: unsigned interface_only : 1;
437: unsigned interface_unknown : 1;
438: unsigned needs_virtual_reinit : 1;
439: unsigned declared_exception : 1;
440: unsigned declared_class : 1;
441: unsigned being_defined : 1;
442: unsigned redefined : 1;
443:
444: unsigned marked : 1;
445: unsigned marked2 : 1;
446: unsigned marked3 : 1;
447: unsigned marked4 : 1;
448: unsigned marked5 : 1;
449: unsigned marked6 : 1;
450: unsigned use_template : 2;
451:
452: unsigned debug_requested : 1;
453: unsigned dynamic : 1;
454: unsigned has_wrapper_pred : 1;
455: unsigned has_method_call_overloaded : 1;
456: unsigned private_attr : 1;
457: unsigned alters_visibilities : 1;
458: unsigned got_semicolon : 1;
459: unsigned dummy : 1;
460:
461: /* The MIPS compiler gets it wrong if this struct also
462: does not fill out to a multiple of 4 bytes. */
463: unsigned n_vancestors : 16;
464: } type_flags;
465:
466: int cid;
467: int n_ancestors;
468: int vsize;
469: int max_depth;
470:
471: union tree_node *vbinfo[2];
472: union tree_node *baselink_vec;
473: union tree_node *vfields;
474: union tree_node *vbases;
475: union tree_node *vbase_size;
476:
477: union tree_node *tags;
478: char *memoized_table_entry;
479:
480: char *search_slot;
481:
482: #ifdef ONLY_INT_FIELDS
483: unsigned int mode : 8;
484: #else
485: enum machine_mode mode : 8;
486: #endif
487:
488: unsigned char size_unit;
489: unsigned char align;
490: unsigned char sep_unit;
491:
492: union tree_node *sep;
493: union tree_node *size;
494:
495: union tree_node *base_init_list;
496: union tree_node *abstract_virtuals;
497: union tree_node *as_list;
498: union tree_node *id_as_list;
499: union tree_node *binfo_as_list;
500: union tree_node *vtbl_ptr;
501: union tree_node *instance_variable;
502: union tree_node *friend_classes;
503:
504: char *mi_matrix;
505: union tree_node *conversions[last_conversion_type];
506: union tree_node *wrap_type;
507:
508: union tree_node *dossier;
509:
510: #ifdef SOS
511: union tree_node *typename_as_string;
512: union tree_node *dynamic_filename;
513: union tree_node *dynamic_table;
514: #endif
515: };
516:
517: /* Indicates whether a template should be (or has been) expanded for this
518: class definition. 0=do, 1=did, 2=don't, 3=didn't. */
519: #define CLASSTYPE_USE_TEMPLATE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.use_template)
520:
521: /* Fields used for storing information before the class is defined.
522: After the class is defined, these fields hold other information. */
523:
524: /* List of friends which were defined inline in this class definition. */
525: #define CLASSTYPE_INLINE_FRIENDS(NODE) (TYPE_NONCOPIED_PARTS (NODE))
526:
527: /* Nonzero for _CLASSTYPE means that the _CLASSTYPE either has
528: a special meaning for the assignment operator ("operator="),
529: or one of its fields (or base members) has a special meaning
530: defined. */
531: #define TYPE_HAS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assignment)
532: #define TYPE_GETS_ASSIGNMENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assignment)
533:
534: /* Nonzero for _CLASSTYPE means that operator new and delete are defined,
535: respectively. */
536: #define TREE_GETS_NEW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_new)
537: #define TREE_GETS_DELETE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_delete)
538:
539: /* Nonzero for TREE_LIST or _TYPE node means that this node is class-local. */
540: #define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
541:
542: /* Ditto, for `private' declarations. */
543: #define TREE_VIA_PRIVATE(NODE) ((NODE)->common.private_flag)
544:
545: /* Nonzero for TREE_LIST node means that the path to the
546: base class is via a `protected' declaration, which preserves
547: protected fields from the base class as protected.
548: OVERLOADED. */
549: #define TREE_VIA_PROTECTED(NODE) ((NODE)->common.static_flag)
550:
551: /* Nonzero for a _CLASSTYPE node which we know to be private. */
552: #define TYPE_PRIVATE_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.private_attr)
553:
554: /* Nonzero means that this _CLASSTYPE node defines ways of converting
555: itself to other types. */
556: #define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
557:
558: /* Nonzero means that this _CLASSTYPE node can convert itself to an
559: INTEGER_TYPE. */
560: #define TYPE_HAS_INT_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_int_conversion)
561:
562: /* Nonzero means that this _CLASSTYPE node can convert itself to an
563: REAL_TYPE. */
564: #define TYPE_HAS_REAL_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_float_conversion)
565:
566: /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
567: #define TYPE_HAS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_assign_ref)
568: #define TYPE_GETS_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_assign_ref)
569: #define TYPE_HAS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_const_assign_ref)
570: #define TYPE_GETS_CONST_ASSIGN_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_const_assign_ref)
571:
572: /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
573: #define TYPE_HAS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_init_ref)
574: #define TYPE_GETS_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_ref)
575: #define TYPE_GETS_CONST_INIT_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_const_init_ref)
576:
577: /* Nonzero means that this _CLASSTYPE node has an X(X ...) constructor.
578: Note that there must be other arguments, or this constructor is flaged
579: as being erroneous. */
580: #define TYPE_GETS_INIT_AGGR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.gets_init_aggr)
581:
582: /* Nonzero means that this type is being defined. I.e., the left brace
583: starting the definition of this type has been seen. */
584: #define TYPE_BEING_DEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.being_defined)
585: /* Nonzero means that this type has been redefined. In this case, if
586: convenient, don't reprocess any methods that appear in its redefinition. */
587: #define TYPE_REDEFINED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.redefined)
588:
589: /* Nonzero means that this _CLASSTYPE node overloads the method call
590: operator. In this case, all method calls go through `operator->()(...). */
591: #define TYPE_OVERLOADS_METHOD_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_method_call_overloaded)
592:
593: /* The is the VAR_DECL that contains NODE's dossier. */
594: #define CLASSTYPE_DOSSIER(NODE) (TYPE_LANG_SPECIFIC(NODE)->dossier)
595:
596: #define TYPE_WRAP_TYPE(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type)
597:
598: #define TYPE_HAS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type == TYPE_MAIN_VARIANT (NODE))
599: #define TYPE_NEEDS_WRAPPER(NODE) (TYPE_LANG_SPECIFIC(NODE)->wrap_type != 0 && TYPE_LANG_SPECIFIC(NODE)->wrap_type != TYPE_MAIN_VARIANT (NODE))
600: #define TYPE_HAS_WRAPPER_PRED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_wrapper_pred)
601:
602: /* Nonzero means that this _CLASSTYPE node overloads operator(). */
603: #define TYPE_OVERLOADS_CALL_EXPR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_call_overloaded)
604:
605: /* Nonzero means that this _CLASSTYPE node overloads operator[]. */
606: #define TYPE_OVERLOADS_ARRAY_REF(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_array_ref_overloaded)
607:
608: /* Nonzero means that this _CLASSTYPE node overloads operator->. */
609: #define TYPE_OVERLOADS_ARROW(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_arrow_overloaded)
610:
611: /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
612: multiple inheritance. If this is 0 for the root of a type
613: hierarchy, then we can use more efficient search techniques. */
614: #define TYPE_USES_MULTIPLE_INHERITANCE(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.uses_multiple_inheritance)
615:
616: /* Nonzero means that this _CLASSTYPE (or one of its ancestors) uses
617: virtual base classes. If this is 0 for the root of a type
618: hierarchy, then we can use more efficient search techniques. */
619: #define TYPE_USES_VIRTUAL_BASECLASSES(NODE) (TREE_LANG_FLAG_3(NODE))
620:
621: /* List of lists of member functions defined in this class. */
622: #define CLASSTYPE_METHOD_VEC(NODE) TYPE_METHODS(NODE)
623:
624: /* Pointer from any member function to the head of the list of
625: member functions of the type that member function belongs to. */
626: #define CLASSTYPE_BASELINK_VEC(NODE) (TYPE_LANG_SPECIFIC(NODE)->baselink_vec)
627:
628: /* Mark bits for depth-first and breath-first searches. */
629: #if !PARANOID
630: #define CLASSTYPE_MARKED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
631: #define CLASSTYPE_MARKED2(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
632: #define CLASSTYPE_MARKED3(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
633: #define CLASSTYPE_MARKED4(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
634: #define CLASSTYPE_MARKED5(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
635: #define CLASSTYPE_MARKED6(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
636: /* Macros to modify the above flags */
637: #define SET_CLASSTYPE_MARKED(NODE) (CLASSTYPE_MARKED(NODE) = 1)
638: #define CLEAR_CLASSTYPE_MARKED(NODE) (CLASSTYPE_MARKED(NODE) = 0)
639: #define SET_CLASSTYPE_MARKED2(NODE) (CLASSTYPE_MARKED2(NODE) = 1)
640: #define CLEAR_CLASSTYPE_MARKED2(NODE) (CLASSTYPE_MARKED2(NODE) = 0)
641: #define SET_CLASSTYPE_MARKED3(NODE) (CLASSTYPE_MARKED3(NODE) = 1)
642: #define CLEAR_CLASSTYPE_MARKED3(NODE) (CLASSTYPE_MARKED3(NODE) = 0)
643: #define SET_CLASSTYPE_MARKED4(NODE) (CLASSTYPE_MARKED4(NODE) = 1)
644: #define CLEAR_CLASSTYPE_MARKED4(NODE) (CLASSTYPE_MARKED4(NODE) = 0)
645: #define SET_CLASSTYPE_MARKED5(NODE) (CLASSTYPE_MARKED5(NODE) = 1)
646: #define CLEAR_CLASSTYPE_MARKED5(NODE) (CLASSTYPE_MARKED5(NODE) = 0)
647: #define SET_CLASSTYPE_MARKED6(NODE) (CLASSTYPE_MARKED6(NODE) = 1)
648: #define CLEAR_CLASSTYPE_MARKED6(NODE) (CLASSTYPE_MARKED6(NODE) = 0)
649: #else
650: #define CLASSTYPE_MARKED(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked)
651: #define CLASSTYPE_MARKED2(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2)
652: #define CLASSTYPE_MARKED3(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3)
653: #define CLASSTYPE_MARKED4(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4)
654: #define CLASSTYPE_MARKED5(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5)
655: #define CLASSTYPE_MARKED6(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6)
656: /* Macros to modify the above flags */
657: #define SET_CLASSTYPE_MARKED(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked = 1)
658: #define CLEAR_CLASSTYPE_MARKED(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked = 0)
659: #define SET_CLASSTYPE_MARKED2(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2 = 1)
660: #define CLEAR_CLASSTYPE_MARKED2(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked2 = 0)
661: #define SET_CLASSTYPE_MARKED3(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3 = 1)
662: #define CLEAR_CLASSTYPE_MARKED3(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked3 = 0)
663: #define SET_CLASSTYPE_MARKED4(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4 = 1)
664: #define CLEAR_CLASSTYPE_MARKED4(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked4 = 0)
665: #define SET_CLASSTYPE_MARKED5(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5 = 1)
666: #define CLEAR_CLASSTYPE_MARKED5(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked5 = 0)
667: #define SET_CLASSTYPE_MARKED6(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6 = 1)
668: #define CLEAR_CLASSTYPE_MARKED6(NODE) (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 't'), TYPE_LANG_SPECIFIC(NODE)->type_flags.marked6 = 0)
669: #endif
670:
671: #define CLASSTYPE_TAGS(NODE) (TYPE_LANG_SPECIFIC(NODE)->tags)
672: #define CLASSTYPE_NAMES(NODE) (TYPE_LANG_SPECIFIC(NODE)->names)
673:
674: /* Remove when done merging. */
675: #define CLASSTYPE_VFIELD(NODE) TYPE_VFIELD(NODE)
676:
677: /* The number of virtual functions defined for this
678: _CLASSTYPE node. */
679: #define CLASSTYPE_VSIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vsize)
680: /* The virtual base classes that this type uses. */
681: #define CLASSTYPE_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbases)
682: /* The virtual function pointer fields that this type contains. */
683: #define CLASSTYPE_VFIELDS(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfields)
684:
685: /* Number of baseclasses defined for this type.
686: 0 means no base classes. */
687: #define CLASSTYPE_N_BASECLASSES(NODE) \
688: (TYPE_BINFO_BASETYPES (NODE) ? TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES(NODE)) : 0)
689:
690: /* Memoize the number of super classes (base classes) tha this node
691: has. That way we can know immediately (albeit conservatively how
692: large a multiple-inheritance matrix we need to build to find
693: derivation information. */
694: #define CLASSTYPE_N_SUPERCLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->n_ancestors)
695: #define CLASSTYPE_N_VBASECLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.n_vancestors)
696:
697: /* Record how deep the inheritance is for this class so `void*' conversions
698: are less favorable than a conversion to the most base type. */
699: #define CLASSTYPE_MAX_DEPTH(NODE) (TYPE_LANG_SPECIFIC(NODE)->max_depth)
700:
701: /* Used for keeping search-specific information. Any search routine
702: which uses this must define what exactly this slot is used for. */
703: #define CLASSTYPE_SEARCH_SLOT(NODE) (TYPE_LANG_SPECIFIC(NODE)->search_slot)
704:
705: /* Entry for keeping memoization tables for this type to
706: hopefully speed up search routines. Since it is a pointer,
707: it can mean almost anything. */
708: #define CLASSTYPE_MTABLE_ENTRY(NODE) (TYPE_LANG_SPECIFIC(NODE)->memoized_table_entry)
709:
710: /* This is the total size of the baseclasses defined for this type.
711: Needed because it is desirable to layout such information
712: before begining to process the class itself, and we
713: don't want to compute it second time when actually laying
714: out the type for real. */
715: #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size)
716: #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit)
717: #define CLASSTYPE_MODE(NODE) (TYPE_LANG_SPECIFIC(NODE)->mode)
718: #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align)
719:
720: /* This is the space needed for virtual base classes. NULL if
721: there are no virtual basetypes. */
722: #define CLASSTYPE_VBASE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->vbase_size)
723:
724: /* A cons list of structure elements which either have constructors
725: to be called, or virtual function table pointers which
726: need initializing. Depending on what is being initialized,
727: the TREE_PURPOSE and TREE_VALUE fields have different meanings:
728:
729: Member initialization: <FIELD_DECL, TYPE>
730: Base class construction: <NULL_TREE, BASETYPE>
731: Base class initialization: <BASE_INITIALIZAION, THESE_INITIALIZATIONS>
732: Whole type: <MEMBER_INIT, BASE_INIT>. */
733: #define CLASSTYPE_BASE_INIT_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->base_init_list)
734:
735: /* A cons list of virtual functions which cannot be inherited by
736: derived classes. When deriving from this type, the derived
737: class must provide its own definition for each of these functions. */
738: #define CLASSTYPE_ABSTRACT_VIRTUALS(NODE) (TYPE_LANG_SPECIFIC(NODE)->abstract_virtuals)
739:
740: #define CLASSTYPE_ALTERS_VISIBILITIES_P(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.alters_visibilities)
741:
742: /* Nonzero means that this aggr type has been `closed' by a semicolon. */
743: #define CLASSTYPE_GOT_SEMICOLON(NODE) (TYPE_LANG_SPECIFIC (NODE)->type_flags.got_semicolon)
744:
745: /* Nonzero means that the main virtual function table pointer needs to be
746: set because base constructors have placed the wrong value there.
747: If this is zero, it means that they placed the right value there,
748: and there is no need to change it. */
749: #define CLASSTYPE_NEEDS_VIRTUAL_REINIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_virtual_reinit)
750:
751: /* Nonzero means that if this type has virtual functions, that
752: the virtual function table will be written out. */
753: #define CLASSTYPE_VTABLE_NEEDS_WRITING(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.vtable_needs_writing)
754:
755: /* Nonzero means that this type defines its own local type declarations. */
756: #define CLASSTYPE_LOCAL_TYPEDECLS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.local_typedecls)
757:
758: /* Nonzero means that this type has an X() constructor. */
759: #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_default_ctor)
760:
761: /* Many routines need to cons up a list of basetypes for visibility
762: checking. This field contains a TREE_LIST node whose TREE_VALUE
763: is the main variant of the type, and whose TREE_VIA_PUBLIC
764: and TREE_VIA_VIRTUAL bits are correctly set. */
765: #define CLASSTYPE_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->as_list)
766: /* Same, but cache a list whose value is the name of this type. */
767: #define CLASSTYPE_ID_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->id_as_list)
768: /* Same, but cache a list whose value is the binfo of this type. */
769: #define CLASSTYPE_BINFO_AS_LIST(NODE) (TYPE_LANG_SPECIFIC(NODE)->binfo_as_list)
770:
771: /* Slot in which to cache a copy of the local vtable pointer. */
772: #define CLASSTYPE_VTBL_PTR(NODE) (TYPE_LANG_SPECIFIC(NODE)->vtbl_ptr)
773:
774: /* Hold the instance object associated with this method. */
775: #define CLASSTYPE_INST_VAR(NODE) (TYPE_LANG_SPECIFIC(NODE)->instance_variable)
776:
777: /* A list of class types with which this type is a friend. */
778: #define CLASSTYPE_FRIEND_CLASSES(NODE) (TYPE_LANG_SPECIFIC(NODE)->friend_classes)
779:
780: /* Keep an inheritance lattice around so we can quickly tell whether
781: a type is derived from another or not. */
782: #define CLASSTYPE_MI_MATRIX(NODE) (TYPE_LANG_SPECIFIC(NODE)->mi_matrix)
783:
784: /* If there is exactly one conversion to a non-void, non-const pointer type,
785: remember that here. If there are more than one, put
786: `error_mark_node' here. If there are none, this holds NULL_TREE. */
787: #define CLASSTYPE_CONVERSION(NODE,KIND) \
788: (TYPE_LANG_SPECIFIC(NODE)->conversions[(int) KIND])
789:
790: /* Nonzero means that class is "dynamic" in SOS sense. (IRIA-specific.) */
791: #define TYPE_DYNAMIC(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.dynamic)
792:
793: #ifdef SOS
794: /* The name of this type as a STRING. */
795: #define CLASSTYPE_TYPENAME_AS_STRING(NODE) (TYPE_LANG_SPECIFIC(NODE)->typename_as_string)
796: /* The name of the file which defines this type. */
797: #define CLASSTYPE_DYNAMIC_FILENAME(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_filename)
798: /* The table of all member functions, linearized. */
799: #define CLASSTYPE_DYNAMIC_TABLE(NODE) (TYPE_LANG_SPECIFIC(NODE)->dynamic_table)
800: #endif
801:
802: /* Say whether this node was declared as a "class" or a "struct". */
803: #define CLASSTYPE_DECLARED_CLASS(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_class)
804: /* Say whether this node was declared as a "class" or a "struct". */
805: #define CLASSTYPE_DECLARED_EXCEPTION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.declared_exception)
806:
807: /* Nonzero if this class has const members which have no specified initialization. */
808: #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.const_needs_init)
809:
810: /* Nonzero if this class has ref members which have no specified initialization. */
811: #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ref_needs_init)
812:
813: /* Nonzero if this class is included from a header file which employs
814: `#pragma interface', and it is not included in its implementation file. */
815: #define CLASSTYPE_INTERFACE_ONLY(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_only)
816:
817: /* Same as above, but for classes whose purpose we do not know. */
818: #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.interface_unknown)
819:
820: /* Nonzero if a _DECL node requires us to output debug info for this class. */
821: #define CLASSTYPE_DEBUG_REQUESTED(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.debug_requested)
822:
823: /* Additional macros for inheritance information. */
824:
825: #define CLASSTYPE_VBINFO(NODE,VIA_PUBLIC) \
826: (TYPE_LANG_SPECIFIC (NODE)->vbinfo[VIA_PUBLIC])
827:
828: /* When following an binfo-specific chain, this is the cumulative
829: via-public flag. */
830: #define BINFO_VIA_PUBLIC(NODE) TREE_LANG_FLAG_5 (NODE)
831:
832: /* When building a matrix to determine by a single lookup
833: whether one class is derived from another or not,
834: this field is the index of the class in the table. */
835: #define CLASSTYPE_CID(NODE) (TYPE_LANG_SPECIFIC(NODE)->cid)
836: #define BINFO_CID(NODE) CLASSTYPE_CID(BINFO_TYPE(NODE))
837:
838: /* Nonzero means marked by DFS or BFS search, including searches
839: by `get_binfo' and `get_base_distance'. */
840: #define BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED(BINFO_TYPE(NODE)):TREE_LANG_FLAG_0(NODE))
841: /* Macros needed because of C compilers that don't allow conditional
842: expressions to be lvalues. Grr! */
843: #define SET_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=1))
844: #define CLEAR_BINFO_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_0(NODE)=0))
845:
846: /* Nonzero means marked in building initialization list. */
847: #define BINFO_BASEINIT_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
848: /* Modifier macros */
849: #define SET_BINFO_BASEINIT_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
850: #define CLEAR_BINFO_BASEINIT_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
851:
852: /* Nonzero means marked in search through virtual inheritance hierarchy. */
853: #define BINFO_VBASE_MARKED(NODE) CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
854: /* Modifier macros */
855: #define SET_BINFO_VBASE_MARKED(NODE) SET_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
856: #define CLEAR_BINFO_VBASE_MARKED(NODE) CLEAR_CLASSTYPE_MARKED2 (BINFO_TYPE (NODE))
857:
858: /* Nonzero means marked in search for members or member functions. */
859: #define BINFO_FIELDS_MARKED(NODE) \
860: (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED2 (BINFO_TYPE (NODE)):TREE_LANG_FLAG_2(NODE))
861: #define SET_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=1))
862: #define CLEAR_BINFO_FIELDS_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED2(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_2(NODE)=0))
863:
864: /* Nonzero means that this class is on a path leading to a new vtable. */
865: #define BINFO_VTABLE_PATH_MARKED(NODE) \
866: (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):TREE_LANG_FLAG_3(NODE))
867: #define SET_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=1))
868: #define CLEAR_BINFO_VTABLE_PATH_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED3(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_3(NODE)=0))
869:
870: /* Nonzero means that this class has a new vtable. */
871: #define BINFO_NEW_VTABLE_MARKED(NODE) \
872: (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):TREE_LANG_FLAG_4(NODE))
873: #define SET_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=1))
874: #define CLEAR_BINFO_NEW_VTABLE_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED4(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_4(NODE)=0))
875:
876: /* Nonzero means this class has initialized its virtual baseclasses. */
877: #define BINFO_VBASE_INIT_MARKED(NODE) \
878: (TREE_VIA_VIRTUAL(NODE)?CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):TREE_LANG_FLAG_5(NODE))
879: #define SET_BINFO_VBASE_INIT_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?SET_CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_5(NODE)=1))
880: #define CLEAR_BINFO_VBASE_INIT_MARKED(NODE) (TREE_VIA_VIRTUAL(NODE)?CLEAR_CLASSTYPE_MARKED5(BINFO_TYPE(NODE)):(TREE_LANG_FLAG_5(NODE)=0))
881:
882: /* Accessor macros for the vfield slots in structures. */
883:
884: /* Get the assoc info that caused this vfield to exist. */
885: #define VF_BINFO_VALUE(NODE) TREE_PURPOSE (NODE)
886:
887: /* Get that same information as a _TYPE. */
888: #define VF_BASETYPE_VALUE(NODE) TREE_VALUE (NODE)
889:
890: /* Get the value of the top-most type dominating the non-`normal' vfields. */
891: #define VF_DERIVED_VALUE(NODE) (VF_BINFO_VALUE (NODE) ? BINFO_TYPE (VF_BINFO_VALUE (NODE)) : NULL_TREE)
892:
893: /* Get the value of the top-most type that's `normal' for the vfield. */
894: #define VF_NORMAL_VALUE(NODE) TREE_TYPE (NODE)
895:
896: /* Nonzero for TREE_LIST node means that this list of things
897: is a list of parameters, as opposed to a list of expressions. */
898: #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */
899:
900: /* Nonzero for FIELD_DECL node means that this FIELD_DECL is
901: a member of an anonymous union construct. The name of the
902: union is . */
903: #define TREE_ANON_UNION_ELEM(NODE) ((NODE)->decl.regdecl_flag) /* overloaded! */
904:
905: /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
906: this type can raise. */
907: #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
908:
909: struct lang_decl_flags
910: {
911: #ifdef ONLY_INT_FIELDS
912: int language : 8;
913: #else
914: enum languages language : 8;
915: #endif
916:
917: unsigned operator_attr : 1;
918: unsigned constructor_attr : 1;
919: unsigned returns_first_arg : 1;
920: unsigned preserves_first_arg : 1;
921: unsigned friend_attr : 1;
922: unsigned static_function : 1;
923: unsigned const_memfunc : 1;
924: unsigned volatile_memfunc : 1;
925:
926: unsigned abstract_virtual : 1;
927: unsigned permanent_attr : 1 ;
928: unsigned constructor_for_vbase_attr : 1;
929: unsigned dummy : 13;
930:
931: tree visibility;
932: tree context;
933: };
934:
935: struct lang_decl
936: {
937: struct lang_decl_flags decl_flags;
938:
939: struct template_info *template_info;
940: tree main_decl_variant;
941: struct pending_inline *pending_inline_info;
942: tree vbase_init_list;
943: tree chain;
944:
945: #ifdef SOS
946: tree dynamic_index;
947: #endif
948: };
949:
950: /* Non-zero if NODE is a _DECL with TREE_READONLY set. */
951: #define TREE_READONLY_DECL_P(NODE) \
952: (TREE_READONLY (NODE) && TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd')
953:
954: /* For FUNCTION_DECLs: return the language in which this decl
955: was declared. */
956: #define DECL_LANGUAGE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.language)
957:
958: /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
959: #define DECL_CONSTRUCTOR_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_attr)
960: /* For FUNCTION_DECLs: nonzero means that this function is a constructor
961: for an object with virtual baseclasses. */
962: #define DECL_CONSTRUCTOR_FOR_VBASE_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.constructor_for_vbase_attr)
963:
964: /* For FUNCTION_DECLs: nonzero means that the constructor
965: is known to return a non-zero `this' unchanged. */
966: #define DECL_RETURNS_FIRST_ARG(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.returns_first_arg)
967:
968: /* Nonzero for FUNCTION_DECL means that this constructor is known to
969: not make any assignment to `this', and therefore can be trusted
970: to return it unchanged. Otherwise, we must re-assign `current_class_decl'
971: after performing base initializations. */
972: #define DECL_PRESERVES_THIS(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.preserves_first_arg)
973:
974: /* Nonzero for _DECL means that this decl appears in (or will appear
975: in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
976: detecting circularity in case members are multiply defined. In the
977: case of a VAR_DECL, it is also used to determince how program storage
978: should be allocated. */
979: #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3(NODE))
980:
981: /* Nonzero for FUNCTION_DECL means that this decl is just a
982: friend declaration, and should not be added to the list of
983: member functions for this class. */
984: #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.friend_attr)
985:
986: /* Nonzero for FUNCTION_DECL means that this decl is a static
987: member function. */
988: #define DECL_STATIC_FUNCTION_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.static_function)
989:
990: /* Nonzero for FUNCTION_DECL means that this member function
991: has `this' as const X *const. */
992: #define DECL_CONST_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.const_memfunc)
993:
994: /* Nonzero for FUNCTION_DECL means that this member function
995: has `this' as volatile X *const. */
996: #define DECL_VOLATILE_MEMFUNC_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.volatile_memfunc)
997:
998: /* Nonzero for FUNCTION_DECL means that this member function
999: exists only as part of an abstract class's interface. */
1000: #define DECL_ABSTRACT_VIRTUAL_P(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.abstract_virtual)
1001:
1002: /* Nonzero if allocated on permanent_obstack. */
1003: #define LANG_DECL_PERMANENT(LANGDECL) ((LANGDECL)->decl_flags.permanent_attr)
1004:
1005: /* The _TYPE context in which this _DECL appears. This field is used
1006: only to compute visibility information. */
1007: #define DECL_CLASS_CONTEXT(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.context)
1008:
1009: /* For a FUNCTION_DECL: the chain through which the next method
1010: in the method chain is found. We now use TREE_CHAIN to
1011: link into the FIELD_DECL chain. */
1012: #if 1
1013: #define DECL_CHAIN(NODE) (DECL_LANG_SPECIFIC(NODE)->chain)
1014: #else
1015: #define DECL_CHAIN(NODE) (TREE_CHAIN (NODE))
1016: #endif
1017:
1018: /* Points back to the decl which caused this lang_decl to be allocated. */
1019: #define DECL_MAIN_VARIANT(NODE) (DECL_LANG_SPECIFIC(NODE)->main_decl_variant)
1020:
1021: /* For a FUNCTION_DECL: if this function was declared inline inside of
1022: a class declaration, this is where the text for the function is
1023: squirreled away. */
1024: #define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
1025:
1026: /* Holds information about how virtual base classes should be initialized
1027: by this constructor *if* this constructor is the one to perform
1028: such initialization. */
1029: #define DECL_VBASE_INIT_LIST(NODE) (DECL_LANG_SPECIFIC(NODE)->vbase_init_list)
1030:
1031: /* For a TEMPLATE_DECL: template-specific information. */
1032: #define DECL_TEMPLATE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->template_info)
1033:
1034: /* Nonzero in INT_CST means that this int is negative by dint of
1035: using a twos-complement negated operand. */
1036: #define TREE_NEGATED_INT(NODE) (TREE_LANG_FLAG_0 (NODE))
1037:
1038: /* Nonzero in any kind of _EXPR or _REF node means that it is a call
1039: to a storage allocation routine. If, later, alternate storage
1040: is found to hold the object, this call can be ignored. */
1041: #define TREE_CALLS_NEW(NODE) (TREE_LANG_FLAG_1 (NODE))
1042:
1043: /* Nonzero in any kind of _TYPE that uses multiple inheritance
1044: or virtual baseclasses. */
1045: #define TYPE_USES_COMPLEX_INHERITANCE(NODE) (TREE_LANG_FLAG_1 (NODE))
1046:
1047: /* Nonzero in IDENTIFIER_NODE means that this name is overloaded, and
1048: should be looked up in a non-standard way. */
1049: #define TREE_OVERLOADED(NODE) (TREE_LANG_FLAG_0 (NODE))
1050: #define DECL_OVERLOADED(NODE) (DECL_LANG_FLAG_4 (NODE))
1051:
1052: /* Nonzero if this (non-TYPE)_DECL has its virtual attribute set.
1053: For a FUNCTION_DECL, this is when the function is a virtual function.
1054: For a VAR_DECL, this is when the variable is a virtual function table.
1055: For a FIELD_DECL, when the field is the field for the virtual function table.
1056: For an IDENTIFIER_NODE, nonzero if any function with this name
1057: has been declared virtual.
1058:
1059: For a _TYPE if it uses virtual functions (or is derived from
1060: one that does). */
1061: #define TYPE_VIRTUAL_P(NODE) (TREE_LANG_FLAG_2 (NODE))
1062:
1063: /* Same, but tells if this field is private in current context. */
1064: #define DECL_PRIVATE(NODE) (DECL_LANG_FLAG_5 (NODE))
1065:
1066: /* Same, but tells if this field is private in current context. */
1067: #define DECL_PROTECTED(NODE) (DECL_LANG_FLAG_6(NODE))
1068:
1069: #define DECL_PUBLIC(NODE) (DECL_LANG_FLAG_7(NODE))
1070:
1071: /* Record whether a typedef for type `int' was actually `signed int'. */
1072: #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
1073:
1074: /* Record whether a type or decl was written with nonconstant size.
1075: Note that TYPE_SIZE may have simplified to a constant. */
1076: #define C_TYPE_VARIABLE_SIZE(type) TREE_LANG_FLAG_4 (type)
1077: #define C_DECL_VARIABLE_SIZE(type) DECL_LANG_FLAG_8 (type)
1078:
1079: /* Nonzero for _TYPE means that the _TYPE defines
1080: at least one constructor. */
1081: #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1(NODE))
1082:
1083: /* When appearing in an INDIRECT_REF, it means that the tree structure
1084: underneath is actually a call to a constructor. This is needed
1085: when the constructor must initialize local storage (which can
1086: be automatically destroyed), rather than allowing it to allocate
1087: space from the heap.
1088:
1089: When appearing in a SAVE_EXPR, it means that underneath
1090: is a call to a constructor.
1091:
1092: When appearing in a CONSTRUCTOR, it means that it was
1093: a GNU C constructor expression.
1094:
1095: When appearing in a FIELD_DECL, it means that this field
1096: has been duly initialized in its constructor. */
1097: #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4(NODE))
1098:
1099: /* Indicates that a NON_LVALUE_EXPR came from a C++ reference.
1100: Used to generate more helpful error message in case somebody
1101: tries to take its address. */
1102: #define TREE_REFERENCE_EXPR(NODE) (TREE_LANG_FLAG_3(NODE))
1103:
1104: /* Nonzero for _TYPE means that the _TYPE defines a destructor. */
1105: #define TYPE_HAS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_2(NODE))
1106:
1107: /* Nonzero for _TYPE node means that creating an object of this type
1108: will involve a call to a constructor. This can apply to objects
1109: of ARRAY_TYPE if the type of the elements needs a constructor. */
1110: #define TYPE_NEEDS_CONSTRUCTING(NODE) (TYPE_LANG_FLAG_3(NODE))
1111: #define TYPE_NEEDS_CONSTRUCTOR(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.needs_constructor)
1112:
1113: /* Nonzero for _TYPE node means that destroying an object of this type
1114: will involve a call to a destructor. This can apply to objects
1115: of ARRAY_TYPE is the type of the elements needs a destructor. */
1116: #define TYPE_NEEDS_DESTRUCTOR(NODE) (TYPE_LANG_FLAG_4(NODE))
1117:
1118: /* Nonzero for VAR_DECL node means that `external' was specified in
1119: its declaration. */
1120: #define DECL_EXTERNAL(NODE) (DECL_LANG_FLAG_2(NODE))
1121:
1122: /* Nonzero for SAVE_EXPR if used to initialize a PARM_DECL. */
1123: #define PARM_DECL_EXPR(NODE) (TREE_LANG_FLAG_2(NODE))
1124:
1125: /* Nonzero in FUNCTION_DECL means it is really an operator.
1126: Just used to communicate formatting information to dbxout.c. */
1127: #define DECL_OPERATOR(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.operator_attr)
1128:
1129: /* Define fields and accessors for nodes representing declared names. */
1130:
1131: /* C++: A derived class may be able to directly use the virtual
1132: function table of a base class. When it does so, it may
1133: still have a decl node used to access the virtual function
1134: table (so that variables of this type can initialize their
1135: virtual function table pointers by name). When such thievery
1136: is commited, know exactly which base class's virtual function
1137: table is the one being stolen. This effectively computes the
1138: transitive closure. */
1139: #define DECL_VPARENT(NODE) ((NODE)->decl.arguments)
1140:
1141: /* Make a slot so we can implement nested types. This slot holds
1142: the IDENTIFIER_NODE that uniquely names the nested type. This
1143: is for TYPE_DECLs only. */
1144: #if !PARANOID
1145: #define DECL_NESTED_TYPENAME(NODE) ((NODE)->decl.arguments)
1146: #else
1147: #define DECL_NESTED_TYPENAME(NODE) (*DECL_NESTED_TYPENAME_PTR(NODE))
1148: #ifdef __GNUC__
1149: __inline
1150: #endif
1151: static tree * DECL_NESTED_TYPENAME_PTR(NODE) tree NODE; { return
1152: (assert (TREE_CODE_CLASS (TREE_CODE (NODE)) == 'd'),
1153: &(NODE)->decl.arguments) ;}
1154: #endif
1155:
1156: /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
1157: #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
1158: #define DECL_UNDEFINED_FRIENDS(NODE) ((NODE)->decl.result)
1159: #define DECL_WAITING_FRIENDS(NODE) ((tree)(NODE)->decl.rtl)
1160: #define SET_DECL_WAITING_FRIENDS(NODE,VALUE) ((NODE)->decl.rtl=(struct rtx_def*)VALUE)
1161:
1162: /* The DECL_VISIBILITY is used to record under which context
1163: special visibility rules apply. */
1164: #define DECL_VISIBILITY(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.visibility)
1165:
1166: /* C++: all of these are overloaded!
1167: These apply to PARM_DECLs and VAR_DECLs. */
1168: #define DECL_REFERENCE_SLOT(NODE) ((tree)(NODE)->decl.arguments)
1169: #define SET_DECL_REFERENCE_SLOT(NODE,VAL) ((NODE)->decl.arguments=VAL)
1170:
1171: /* For local VAR_DECLs, holds index into gc-protected obstack. */
1172: #define DECL_GC_OFFSET(NODE) ((NODE)->decl.result)
1173:
1174: /* Accessor macros for C++ template decl nodes. */
1175: #define DECL_TEMPLATE_IS_CLASS(NODE) (DECL_RESULT(NODE) == NULL_TREE)
1176: #define DECL_TEMPLATE_PARMS(NODE) DECL_ARGUMENTS(NODE)
1177: /* For class templates. */
1178: #define DECL_TEMPLATE_MEMBERS(NODE) DECL_INITIAL(NODE)
1179: /* For function, method, class-data templates. */
1180: #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT(NODE)
1181: #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX(NODE)
1182:
1183: /* ...and for unexpanded-parameterized-type nodes. */
1184: #define UPT_TEMPLATE(NODE) TREE_PURPOSE(TYPE_VALUES(NODE))
1185: #define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
1186:
1187: #ifdef SOS
1188: #define DECL_DINDEX(NODE) (DECL_LANG_SPECIFIC(NODE)->dynamic_index)
1189: #endif
1190:
1191: /* An enumeration of the kind of tags that C++ accepts. */
1192: enum tag_types { record_type, class_type, union_type, enum_type, exception_type };
1193:
1194: /* Zero means prototype weakly, as in ANSI C (no args means nothing).
1195: Each language context defines how this variable should be set. */
1196: extern int strict_prototype;
1197: extern int strict_prototypes_lang_c, strict_prototypes_lang_cplusplus;
1198:
1199: /* Non-zero means that if a label exists, and no other identifier
1200: applies, use the value of the label. */
1201: extern int flag_labels_ok;
1202:
1203: /* Non-zero means to collect statistics which might be expensive
1204: and to print them when we are done. */
1205: extern int flag_detailed_statistics;
1206:
1207: /* Non-zero means warn in function declared in derived class has the
1208: same name as a virtual in the base class, but fails to match the
1209: type signature of any virtual function in the base class. */
1210: extern int warn_overloaded_virtual;
1211:
1212: /* in cp-decl{2}.c */
1213: extern tree void_list_node;
1214: extern tree void_zero_node;
1215: extern tree default_function_type;
1216: extern tree define_function ();
1217: extern tree build_member_type ();
1218: extern tree build_push_scope ();
1219:
1220: extern tree vtable_entry_type;
1221: extern tree __t_desc_type_node, __i_desc_type_node, __m_desc_type_node;
1222: extern tree class_star_type_node;
1223: extern tree build_vtable_entry ();
1224: extern tree build_vfn_ref ();
1225: extern tree finish_table ();
1226:
1227: extern tree typedecl_for_tag ();
1228: extern tree identifier_class_value ();
1229: extern tree constructor_name ();
1230:
1231: extern int complete_array_type ();
1232: extern tree coerce_new_type (), coerce_delete_type ();
1233:
1234: /* A node that is a list (length 1) of error_mark_nodes. */
1235: extern tree error_mark_list;
1236:
1237: extern tree ptr_type_node;
1238: extern tree class_type_node, record_type_node, union_type_node, enum_type_node;
1239: extern tree exception_type_node, unknown_type_node;
1240:
1241: extern tree get_temp_name (), get_temp_aggr (), get_temp_regvar ();
1242: extern tree cleanup_after_call ();
1243: extern tree build_type_conversion ();
1244: extern tree convert_force ();
1245: extern tree maybe_convert_decl_to_const ();
1246: extern char *lang_printable_name ();
1247: extern char *fndecl_as_string ();
1248: extern char *build_overload_name ();
1249:
1250: /* The largest size a virtual function table can be.
1251: Must be a (power of 2). */
1252: #ifndef VINDEX_MAX
1253: #define VINDEX_MAX ((unsigned)128)
1254: /* This is the integer ~ (vindex_max - 1). */
1255: #endif
1256: extern tree vtbl_mask;
1257:
1258: /* Array type `(void *)[]' */
1259: extern tree vtbl_type_node;
1260:
1261: extern tree get_parm_types ();
1262: extern tree grokopexpr (), getaggrs (), groktypefield ();
1263: extern tree grok_method_quals (), grok_enum_decls ();
1264: extern void finish_anon_union();
1265: extern tree long_long_integer_type_node, long_long_unsigned_type_node;
1266: /* For building calls to `delete'. */
1267: extern tree integer_two_node, integer_three_node;
1268: extern tree get_first_matching_virtual (), get_abstract_virtuals ();
1269:
1270: /* in cp-typeck.c */
1271: extern tree build_x_conditional_expr ();
1272: extern tree merge_component_comparisons ();
1273: extern tree build_x_unary_op (), build_x_binary_op ();
1274: extern tree build_component_addr ();
1275: extern tree build_x_function_call ();
1276: extern tree require_complete_type ();
1277: extern tree build_x_indirect_ref (), build_x_array_ref ();
1278: extern tree build_x_modify_expr (), build_x_modify_op_expr ();
1279:
1280: extern tree build_m_component_ref ();
1281: extern tree build_component_type_expr ();
1282: extern tree build_x_arrow ();
1283: extern tree build_component_ref_1 ();
1284: extern tree datatype (), unary_complex_lvalue (), target_type ();
1285: extern tree build_return_stmt ();
1286: extern tree convert_arguments (), commonparms ();
1287: extern tree cplus_size_in_bytes ();
1288: extern tree cplus_sizeof (), cplus_sizeof_nowarn ();
1289: extern tree error_not_base_type ();
1290:
1291: /* in cp-type2.c */
1292: extern tree binfo_or_else ();
1293:
1294: /* in tree.c */
1295: extern tree build_let ();
1296: extern tree decl_type_context ();
1297:
1298: /* in cp-tree.c */
1299: extern tree build1 ();
1300: extern tree build_cplus_new ();
1301: extern tree build_cplus_array_type ();
1302: extern tree build_cplus_method_type ();
1303: extern tree build_classtype_variant ();
1304: extern tree hash_tree_cons (), hash_tree_chain ();
1305: extern tree list_hash_lookup_or_cons ();
1306: extern tree layout_basetypes ();
1307: extern tree copy_to_permanent ();
1308: extern tree get_decl_list ();
1309: extern tree break_out_cleanups ();
1310:
1311: /* in cp-except.c */
1312: extern tree current_exception_type;
1313: extern tree current_exception_decl;
1314: extern tree current_exception_object;
1315: extern tree build_exception_variant ();
1316: extern tree lookup_exception_type (), lookup_exception_cname ();
1317: extern tree lookup_exception_object ();
1318: extern tree cplus_expand_start_catch ();
1319: extern tree cplus_expand_end_try ();
1320:
1321: /* in cp-class.c */
1322: extern tree current_class_name;
1323: extern tree current_class_type;
1324:
1325: extern tree current_lang_name, lang_name_cplusplus, lang_name_c;
1326:
1327: extern tree convert_pointer_to (), convert_pointer_to_vbase ();
1328: extern tree convert_to_reference (), convert_to_aggr (), convert_aggr ();
1329: extern tree build_x_new (), build_x_delete ();
1330: extern tree build_new (), build_vec_new (), build_delete (), build_vec_delete ();
1331: extern tree make_destructor_name ();
1332: extern tree build_scoped_ref (), build_vfield_ref ();
1333: extern tree build_method_call (), build_overload_call ();
1334: extern tree build_type_pathname ();
1335: extern tree start_method (), start_type_method ();
1336: extern tree finish_method ();
1337:
1338: extern tree lookup_field (), lookup_fnfields ();
1339:
1340: void pushclass (), popclass (), pushclasstype ();
1341: extern tree build_operator_fnname (), build_opfncall (), build_type_conversion ();
1342: extern tree build_wrapper ();
1343:
1344: /* Points to the name of that function. May not be the DECL_NAME
1345: of CURRENT_FUNCTION_DECL due to overloading */
1346: extern tree original_function_name;
1347:
1348: # define IS_AGGR_TYPE(t) (TYPE_LANG_FLAG_5 (t))
1349:
1350: # define IS_AGGR_TYPE_CODE(t) \
1351: (t == RECORD_TYPE || t == UNION_TYPE)
1352:
1353: extern tree build_decl_overload (), build_typename_overload ();
1354: extern tree build_destructor_call ();
1355: extern tree resolve_scope_to_name ();
1356: extern tree build_scoped_method_call ();
1357: extern tree current_class_name, current_class_type, current_class_decl, C_C_D;
1358: extern tree current_vtable_decl;
1359:
1360: /* in cp-init.c */
1361: extern tree resolve_offset_ref ();
1362: extern void check_base_init ();
1363: extern void do_member_init ();
1364: extern tree global_base_init_list;
1365: extern tree current_base_init_list, current_member_init_list;
1366: #ifdef SOS
1367: extern tree get_linktable_name (), get_dtable_name (), get_sos_dtable ();
1368: #endif
1369: extern tree get_member_function ();
1370: extern tree build_member_call (), build_offset_ref ();
1371:
1372: extern int current_function_assigns_this;
1373: extern int current_function_just_assigned_this;
1374: extern int current_function_parms_stored;
1375:
1376: /* Here's where we control how name mangling takes place. */
1377:
1378: #define OPERATOR_ASSIGN_FORMAT "__a%s"
1379: #define OPERATOR_FORMAT "__%s"
1380: #define OPERATOR_TYPENAME_FORMAT "__op"
1381:
1382: /* Cannot use '$' up front, because this confuses gdb.
1383: Note that any format of this kind *must* make the
1384: format for `this' lexicgraphically less than any other
1385: parameter name, i.e. "$this" is less than anything else can be.
1386:
1387: Note that all forms in which the '$' is significant are long enough
1388: for direct indexing. */
1389:
1390: /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
1391: doesn't allow '$' in symbol names. */
1392: #ifndef NO_DOLLAR_IN_LABEL
1393:
1394: #define JOINER '$'
1395:
1396: #define THIS_NAME "$t"
1397: #define VPTR_NAME "$v"
1398: #define THROW_NAME "$eh_throw"
1399: #define DESTRUCTOR_DECL_PREFIX "_$_"
1400: #define WRAPPER_DECL_FORMAT "__W$%s"
1401: #define WRAPPER_PRED_DECL_FORMAT "__P$%s"
1402: #define ANTI_WRAPPER_DECL_FORMAT "__w$%s"
1403: #define IN_CHARGE_NAME "__in$chrg"
1404: #define AUTO_VTABLE_NAME "__vtbl$me__"
1405: #define AUTO_TEMP_NAME "_$tmp_"
1406: #define AUTO_TEMP_FORMAT "_$tmp_%d"
1407: #define VTBL_PTR_TYPE "$vtbl_ptr_type"
1408: #define VTABLE_NAME_FORMAT "_vt$%s"
1409: #define VFIELD_NAME "_vptr$"
1410: #define VFIELD_NAME_FORMAT "_vptr$%s"
1411: #define VBASE_NAME "_vb$"
1412: #define VBASE_NAME_FORMAT "_vb$%s"
1413: #define STATIC_NAME_FORMAT "_%s$%s"
1414: #define FILE_FUNCTION_FORMAT "_GLOBAL_$D$%s"
1415: #define ANON_AGGRNAME_FORMAT "$_%d"
1416:
1417: #else /* NO_DOLLAR_IN_LABEL */
1418:
1419: #define JOINER '.'
1420:
1421: #define THIS_NAME ".t"
1422: #define VPTR_NAME ".v"
1423: #define THROW_NAME ".eh_throw"
1424: #define DESTRUCTOR_DECL_PREFIX "_._"
1425: #define WRAPPER_DECL_FORMAT "__W.%s"
1426: #define WRAPPER_PRED_DECL_FORMAT "__P.%s"
1427: #define ANTI_WRAPPER_DECL_FORMAT "__w.%s"
1428: #define IN_CHARGE_NAME "__in.chrg"
1429: #define AUTO_VTABLE_NAME "__vtbl.me__"
1430: #define AUTO_TEMP_NAME "_.tmp_"
1431: #define AUTO_TEMP_FORMAT "_.tmp_%d"
1432: #define VTBL_PTR_TYPE ".vtbl_ptr_type"
1433: #define VTABLE_NAME_FORMAT "_vt.%s"
1434: #define VFIELD_NAME "_vptr."
1435: #define VFIELD_NAME_FORMAT "_vptr.%s"
1436: #define VBASE_NAME "_vb."
1437: #define VBASE_NAME_FORMAT "_vb.%s"
1438: #define STATIC_NAME_FORMAT "_%s.%s"
1439: #define FILE_FUNCTION_FORMAT "_GLOBAL_.D.%s"
1440:
1441: #define ANON_AGGRNAME_FORMAT "._%d"
1442:
1443: #endif /* NO_DOLLAR_IN_LABEL */
1444:
1445: #define DESTRUCTOR_NAME_FORMAT "~%s"
1446: #define WRAPPER_NAME_FORMAT "()%s"
1447: #define WRAPPER_PRED_NAME_FORMAT "()?%s"
1448: #define ANTI_WRAPPER_NAME_FORMAT "~()%s"
1449: #define FILE_FUNCTION_PREFIX_LEN 9
1450: #define VTABLE_DELTA_NAME "delta"
1451: #define VTABLE_DELTA2_NAME "delta2"
1452: #define VTABLE_INDEX_NAME "index"
1453: #define VTABLE_PFN_NAME "pfn"
1454: #define EXCEPTION_CLEANUP_NAME "exception cleanup"
1455:
1456: #define THIS_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
1457: && IDENTIFIER_POINTER (ID_NODE)[1] == 't')
1458: #define VPTR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
1459: && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
1460: #define DESTRUCTOR_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == JOINER)
1461:
1462: #define WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1463: && IDENTIFIER_POINTER (ID_NODE)[2] == 'W' \
1464: && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1465: #define WRAPPER_PRED_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1466: && IDENTIFIER_POINTER (ID_NODE)[2] == 'P' \
1467: && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1468: #define ANTI_WRAPPER_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1469: && IDENTIFIER_POINTER (ID_NODE)[2] == 'w' \
1470: && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1471: #define WRAPPER_OR_ANTI_WRAPPER_NAME_P(ID_NODE) \
1472: (IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1473: && (IDENTIFIER_POINTER (ID_NODE)[2]|('W'^'w')) == 'w' \
1474: && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
1475:
1476: #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == JOINER \
1477: && IDENTIFIER_POINTER (ID_NODE)[2] == 't'\
1478: && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
1479:
1480: #define VBASE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[3] == JOINER \
1481: && IDENTIFIER_POINTER (ID_NODE)[2] == 'b'\
1482: && IDENTIFIER_POINTER (ID_NODE)[1] == 'v')
1483:
1484: #define OPERATOR_TYPENAME_P(ID_NODE) \
1485: (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
1486: && IDENTIFIER_POINTER (ID_NODE)[1] == '_' \
1487: && IDENTIFIER_POINTER (ID_NODE)[2] == 'o' \
1488: && IDENTIFIER_POINTER (ID_NODE)[3] == 'p')
1489:
1490: #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
1491: #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
1492:
1493: /* For anonymous aggregate types, we need some sort of name to
1494: hold on to. In practice, this should not appear, but it should
1495: not be harmful if it does. */
1496: #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER)
1497: #define ANON_PARMNAME_FORMAT "_%d"
1498: #define ANON_PARMNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == '_' \
1499: && IDENTIFIER_POINTER (ID_NODE)[1] <= '9')
1500:
1501: /* Define the sets of attributes that member functions and baseclasses
1502: can have. These are sensible combinations of {public,private,protected}
1503: cross {virtual,non-virtual}. */
1504:
1505: enum visibility_type {
1506: visibility_default,
1507: visibility_public,
1508: visibility_private,
1509: visibility_protected,
1510: visibility_default_virtual,
1511: visibility_public_virtual,
1512: visibility_private_virtual
1513: };
1514:
1515: enum visibility_type compute_visibility ();
1516:
1517: /* in cp-lex.c */
1518: extern tree current_unit_name, current_unit_language;
1519: extern char *operator_name_string ();
1520:
1521: /* Things for handling inline functions. */
1522:
1523: struct pending_inline
1524: {
1525: struct pending_inline *next; /* pointer to next in chain */
1526: int lineno; /* line number we got the text from */
1527: char *filename; /* name of file we were processing */
1528: tree fndecl; /* FUNCTION_DECL that brought us here */
1529: int token; /* token we were scanning */
1530: int token_value; /* value of token we were scanning (YYSTYPE) */
1531:
1532: char *buf; /* pointer to character stream */
1533: int len; /* length of stream */
1534: tree parm_vec, bindings; /* in case this is derived from a template */
1535: unsigned int can_free : 1; /* free this after we're done with it? */
1536: unsigned int deja_vu : 1; /* set iff we don't want to see it again. */
1537: };
1538:
1539: extern tree combine_strings ();
1540: extern int yylex ();
1541:
1542: /* in cp-method.c */
1543: extern tree wrapper_name, wrapper_pred_name, anti_wrapper_name;
1544: extern struct pending_inline *pending_inlines;
1545: extern char *print_fndecl_with_types ();
1546: extern tree hack_identifier ();
1547: extern tree hack_operator (), hack_wrapper ();
1548:
1549: /* 1 for -fall-virtual: make every member function (except
1550: constructors) lay down in the virtual function table.
1551: Calls can then either go through the virtual function table or not,
1552: depending on whether we know what function will actually be called.
1553:
1554: 2 for -fSOS: make every member function (including constructors)
1555: lay down in the virtual function table. All calls go through the
1556: virtual function table: this takes the place of using a linker. */
1557:
1558: extern int flag_all_virtual;
1559:
1560: /* Nonzero means that we cannot make optimizing assumptions about `this'. */
1561:
1562: extern int flag_this_is_variable;
1563:
1564: /* Nonzero means layout structures so that we can do garbage collection. */
1565:
1566: extern int flag_gc;
1567:
1568: /* Nonzero means generate 'dossiers' that give run-time type information. */
1569:
1570: extern int flag_dossier;
1571:
1572: /* Current end of entries in the gc obstack for stack pointer variables. */
1573:
1574: extern int current_function_obstack_index;
1575:
1576: /* Flag saying whether we have used the obstack in this function or not. */
1577:
1578: extern int current_function_obstack_usage;
1579:
1580: enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG, WRAPPER_FLAG, WRAPPER_PRED_FLAG, ANTI_WRAPPER_FLAG };
1581:
1582: extern tree default_conversion (), pushdecl (), pushdecl_top_level ();
1583: extern tree push_overloaded_decl ();
1584: extern void push_overloaded_decl_top_level ();
1585: extern tree make_instance_name (), do_decl_overload ();
1586: extern tree maybe_build_cleanup ();
1587: extern tree build_instantiated_decl (), instantiate_type ();
1588: extern tree require_instantiated_type ();
1589: extern tree build_vtbl_ref ();
1590: extern tree make_anon_parm_name ();
1591: extern int resolves_to_fixed_type_p ();
1592:
1593: extern tree do_friend ();
1594: extern void grokclassfn ();
1595:
1596: extern tree current_class_decl, C_C_D; /* PARM_DECL: the class instance variable */
1597:
1598: /* The following two can be derived from the previous one */
1599: extern tree current_class_name; /* IDENTIFIER_NODE: name of current class */
1600: extern tree current_class_type; /* _TYPE: the type of the current class */
1601:
1602: /* Some macros for char-based bitfields. */
1603: #define B_SET(a,x) (a[x>>3] |= (1 << (x&7)))
1604: #define B_CLR(a,x) (a[x>>3] &= ~(1 << (x&7)))
1605: #define B_TST(a,x) (a[x>>3] & (1 << (x&7)))
1606:
1607: /* These are uses as bits in flags passed to build_method_call
1608: to control its error reporting behavior.
1609:
1610: LOOKUP_PROTECT means flag visibility violations.
1611: LOOKUP_COMPLAIN mean complain if no suitable member function
1612: matching the arguments is found.
1613: LOOKUP_NORMAL is just a combination of these two.
1614: LOOKUP_AGGR requires the instance to be of aggregate type.
1615: LOOKUP_NONVIRTUAL means make a direct call to the member function found
1616: LOOKUP_GLOBAL means search through the space of overloaded functions,
1617: rather than the space of member functions.
1618: LOOKUP_HAS_IN_CHARGE means that the "in charge" variable is already
1619: in the parameter list.
1620: LOOKUP_PROTECTED_OK means that even if the constructor we find appears
1621: to be non-visibile to current scope, call it anyway.
1622: LOOKUP_DYNAMIC means call dynamic functions, a la SOS.
1623: LOOKUP_NO_CONVERSION means that user-defined conversions are not
1624: permitted. Built-in conversions are permitted.
1625: LOOKUP_DESTRUCTOR means explicit call to destructor. */
1626:
1627: #define LOOKUP_PROTECT (1)
1628: #define LOOKUP_COMPLAIN (2)
1629: #define LOOKUP_NORMAL (3)
1630: #define LOOKUP_AGGR (4)
1631: #define LOOKUP_NONVIRTUAL (8)
1632: #define LOOKUP_GLOBAL (16)
1633: #define LOOKUP_HAS_IN_CHARGE (32)
1634: #define LOOKUP_SPECULATIVELY (64)
1635: #define LOOKUP_PROTECTED_OK (128)
1636: #define LOOKUP_DYNAMIC (256)
1637: #define LOOKUP_NO_CONVERSION (512)
1638: #define LOOKUP_DESTRUCTOR (512)
1639:
1640: /* Anatomy of a DECL_FRIENDLIST (which is a TREE_LIST):
1641: purpose = friend name (IDENTIFIER_NODE);
1642: value = TREE_LIST of FUNCTION_DECLS;
1643: chain, type = EMPTY; */
1644: #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
1645: #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
1646:
1647: extern tree get_temp_name (), get_temp_aggr (), get_temp_regvar ();
1648: extern tree get_decl_list ();
1649: extern tree build_method_call ();
1650: extern tree build_type_conversion ();
1651: extern tree build_functional_cast ();
1652: extern tree decl_constant_value ();
1653:
1654: /* These macros are for accessing the fields of TEMPLATE...PARM nodes. */
1655: #define TEMPLATE_TYPE_TPARMLIST(NODE) TREE_PURPOSE (TYPE_FIELDS (NODE))
1656: #define TEMPLATE_TYPE_IDX(NODE) TREE_INT_CST_LOW (TREE_VALUE (TYPE_FIELDS (NODE)))
1657: #define TEMPLATE_TYPE_SET_INFO(NODE,P,I) \
1658: (TYPE_FIELDS (NODE) = build_tree_list (P, build_int_2 (I, 0)))
1659: #define TEMPLATE_CONST_TPARMLIST(NODE) (*(tree*)&TREE_INT_CST_LOW(NODE))
1660: #define TEMPLATE_CONST_IDX(NODE) (TREE_INT_CST_HIGH(NODE))
1661: #define TEMPLATE_CONST_SET_INFO(NODE,P,I) \
1662: (TEMPLATE_CONST_TPARMLIST (NODE) = saved_parmlist, \
1663: TEMPLATE_CONST_IDX (NODE) = I)
1664:
1665: /* in cp-init.c */
1666: extern tree resolve_offset_ref ();
1667:
1668: /* in cp-lex.c */
1669: extern char *operator_name_string ();
1670:
1671: extern tree build_opid ();
1672: extern tree do_identifier ();
1673: extern tree arbitrate_lookup ();
1674:
1675: /* Indexed by TREE_CODE, these tables give C-looking names to
1676: operators represented by TREE_CODES. For example,
1677: opname_tab[(int) MINUS_EXPR] == "-". */
1678: extern char **opname_tab, **assignop_tab;
1679:
1680: extern tree build_lang_decl (), build_lang_field_decl ();
1681: extern tree make_lang_type ();
1682: extern tree cons_up_default_function ();
1683:
1684: /* in cp-convert.c */
1685: extern tree convert_from_reference ();
1686:
1687: /* in cp-search.c */
1688: extern tree init_vbase_pointers ();
1689: extern tree build_vbase_pointer (), build_vbase_path ();
1690: extern tree lookup_fnfield (), next_baselink ();
1691:
1692: extern tree get_binfo ();
1693: extern tree get_vbase_types ();
1694: extern tree get_baselinks ();
1695: extern tree get_wrapper ();
1696: extern tree make_binfo (), copy_binfo ();
1697: extern tree binfo_value (), virtual_member ();
1698: extern tree virtual_offset ();
1699: extern tree reverse_path ();
1700:
1701: /* in cp-gc.c */
1702: tree protect_value_from_gc ();
1703: tree build_headof ();
1704: tree build_classof ();
1705: tree build_t_desc ();
1706: tree build_i_desc ();
1707: tree build_m_desc ();
1708:
1709: /* in cp-template.c */
1710: /* PARM_VEC is a vector of template parameters, either IDENTIFIER_NODEs or
1711: PARM_DECLs. BINDINGS, if non-null, is a vector of bindings for those
1712: parameters. */
1713: struct template_info {
1714: /* Vector of template parameters, either PARM_DECLs or IDENTIFIER_NODEs. */
1715: tree parm_vec;
1716: /* If non-null, a vector of bindings for the template parms. */
1717: tree bindings;
1718:
1719: /* Text of template, and length. */
1720: char *text;
1721: int length;
1722: /* Where it came from. */
1723: char *filename;
1724: int lineno;
1725:
1726: /* What kind of aggregate -- struct, class, or null. */
1727: tree aggr;
1728: };
1729:
1730: extern tree end_template_parm_list ();
1731: extern tree process_template_parm ();
1732: extern tree lookup_template_class ();
1733: extern tree instantiate_template ();
1734: extern tree instantiate_class_template ();
1735: extern int processing_template_decl, processing_template_defn;
1736:
1737: #define PRINT_LANG_DECL
1738: #define PRINT_LANG_TYPE
1739:
1740: #define UNKNOWN_TYPE LANG_TYPE
1741:
1742: /* -- end of C++ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.