home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cc-61.0.1 / cc / cplus-tree.h < prev    next >
C/C++ Source or Header  |  1991-06-04  |  68KB  |  1,728 lines

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