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