1994-02-24 02:02:37 +01:00
|
|
|
|
/* Functions related to building classes and their related objects.
|
c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
From-SVN: r32068
2000-02-20 02:11:00 +01:00
|
|
|
|
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
|
2003-01-07 16:41:30 +01:00
|
|
|
|
1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
Contributed by Michael Tiemann (tiemann@cygnus.com)
|
|
|
|
|
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
|
This file is part of GCC.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
|
GCC is free software; you can redistribute it and/or modify
|
1994-02-24 02:02:37 +01:00
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
|
GCC is distributed in the hope that it will be useful,
|
1994-02-24 02:02:37 +01:00
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
call.c, [...]: Replace "GNU CC" with "GCC" in the copyright header.
* call.c, class.c, cp-lang.c, cp-tree.h, cvt.c, dump.c, error.c,
except.c, expr.c friend.c, g++spec.c, init.c, lang-options.h,
lang-specs.h, lex.c, mangle.c, method.c, optimize.c, parser.c,
pt.c, ptree.c, repo.c, rtti.c, search.c, semantics.c, tree.c,
typeck.c, typeck2.c: Replace "GNU CC" with "GCC" in the
copyright header.
* lex.h: parse.y is dead, so don't mention it. Also replace the
copyright header with the default GNU copyright header.
From-SVN: r60738
2003-01-01 12:58:58 +01:00
|
|
|
|
along with GCC; see the file COPYING. If not, write to
|
1995-06-15 14:29:51 +02:00
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
|
1996-07-11 03:13:25 +02:00
|
|
|
|
/* High-level class interface. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
#include "config.h"
|
call.c: Include system.h.
* call.c: Include system.h. Remove includes, declarations and
defines provided by system.h.
* class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
* except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
* lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
* semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
* typeck2.c, xref.c: Likewise.
* Makefile.in: Dependencies updated as appropriate.
* Make-lang.in: Likewise.
system.h cutover from the cp subdir
From-SVN: r18917
1998-03-31 15:25:46 +02:00
|
|
|
|
#include "system.h"
|
2002-12-16 19:23:00 +01:00
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
1998-04-01 19:25:12 +02:00
|
|
|
|
#include "tree.h"
|
1994-02-24 02:02:37 +01:00
|
|
|
|
#include "cp-tree.h"
|
|
|
|
|
#include "flags.h"
|
1995-03-23 01:44:31 +01:00
|
|
|
|
#include "rtl.h"
|
1995-04-24 19:27:46 +02:00
|
|
|
|
#include "output.h"
|
call.c, [...]: Add include of toplev.h.
Wed May 6 06:36:41 1998 Robert Lipe <robertl@dgii.com>
* cp/call.c, cp/class.c, cp/decl.c, cp/decl2.c,
cp/errfn.c, cp/error.c, cp/except.c, cp/expr.c,
cp/friend.c, cp/init.c, cp/lex.c, cp/method.c,
cp/pt.c, cp/repo.c, cp/rtti.c, cp/search.c,
cp/semantics.c, cp/sig.c, cp/tree.c, cp/typeck.c,
cp/typeck2.c, cp/xref.c: Add include of toplev.h.
From-SVN: r19565
1998-05-06 07:01:35 +02:00
|
|
|
|
#include "toplev.h"
|
1999-10-08 02:08:23 +02:00
|
|
|
|
#include "lex.h"
|
2002-02-05 19:01:51 +01:00
|
|
|
|
#include "target.h"
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* The number of nested classes being processed. If we are not in the
|
|
|
|
|
scope of any class, this is zero. */
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
int current_class_depth;
|
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* In order to deal with nested classes, we keep a stack of classes.
|
|
|
|
|
The topmost entry is the innermost class, and is the entry at index
|
|
|
|
|
CURRENT_CLASS_DEPTH */
|
|
|
|
|
|
|
|
|
|
typedef struct class_stack_node {
|
|
|
|
|
/* The name of the class. */
|
|
|
|
|
tree name;
|
|
|
|
|
|
|
|
|
|
/* The _TYPE node for the class. */
|
|
|
|
|
tree type;
|
|
|
|
|
|
|
|
|
|
/* The access specifier pending for new declarations in the scope of
|
|
|
|
|
this class. */
|
|
|
|
|
tree access;
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
|
|
|
|
|
/* If were defining TYPE, the names used in this class. */
|
|
|
|
|
splay_tree names_used;
|
1998-10-06 16:20:30 +02:00
|
|
|
|
}* class_stack_node_t;
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
typedef struct vtbl_init_data_s
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
2000-07-31 02:24:44 +02:00
|
|
|
|
/* The base for which we're building initializers. */
|
|
|
|
|
tree binfo;
|
2001-02-27 14:12:17 +01:00
|
|
|
|
/* The type of the most-derived type. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree derived;
|
2001-02-27 14:12:17 +01:00
|
|
|
|
/* The binfo for the dynamic type. This will be TYPE_BINFO (derived),
|
|
|
|
|
unless ctor_vtbl_p is true. */
|
|
|
|
|
tree rtti_binfo;
|
2000-06-12 22:46:28 +02:00
|
|
|
|
/* The negative-index vtable initializers built up so far. These
|
|
|
|
|
are in order from least negative index to most negative index. */
|
|
|
|
|
tree inits;
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* The last (i.e., most negative) entry in INITS. */
|
2000-06-12 22:46:28 +02:00
|
|
|
|
tree* last_init;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* The binfo for the virtual base for which we're building
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vcall offset initializers. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree vbase;
|
2000-06-12 22:46:28 +02:00
|
|
|
|
/* The functions in vbase for which we have already provided vcall
|
|
|
|
|
offsets. */
|
|
|
|
|
varray_type fns;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* The vtable index of the next vcall or vbase offset. */
|
|
|
|
|
tree index;
|
|
|
|
|
/* Nonzero if we are building the initializer for the primary
|
|
|
|
|
vtable. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
int primary_vtbl_p;
|
|
|
|
|
/* Nonzero if we are building the initializer for a construction
|
|
|
|
|
vtable. */
|
|
|
|
|
int ctor_vtbl_p;
|
2002-11-04 02:45:58 +01:00
|
|
|
|
/* True when adding vcall offset entries to the vtable. False when
|
|
|
|
|
merely computing the indices. */
|
|
|
|
|
bool generate_vcall_entries;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
} vtbl_init_data;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* The type of a function passed to walk_subobject_offsets. */
|
2003-01-23 03:47:51 +01:00
|
|
|
|
typedef int (*subobject_offset_fn) (tree, tree, splay_tree);
|
2000-10-20 08:04:59 +02:00
|
|
|
|
|
2002-12-20 17:11:41 +01:00
|
|
|
|
/* The stack itself. This is a dynamically resized array. The
|
1998-10-06 16:20:30 +02:00
|
|
|
|
number of elements allocated is CURRENT_CLASS_STACK_SIZE. */
|
|
|
|
|
static int current_class_stack_size;
|
|
|
|
|
static class_stack_node_t current_class_stack;
|
|
|
|
|
|
2000-06-04 23:12:27 +02:00
|
|
|
|
/* An array of all local classes present in this translation unit, in
|
|
|
|
|
declaration order. */
|
|
|
|
|
varray_type local_classes;
|
|
|
|
|
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static tree get_vfield_name (tree);
|
|
|
|
|
static void finish_struct_anon (tree);
|
|
|
|
|
static tree get_vtable_name (tree);
|
|
|
|
|
static tree get_basefndecls (tree, tree);
|
|
|
|
|
static int build_primary_vtable (tree, tree);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static int build_secondary_vtable (tree);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void finish_vtbls (tree);
|
|
|
|
|
static void modify_vtable_entry (tree, tree, tree, tree, tree *);
|
|
|
|
|
static tree delete_duplicate_fields_1 (tree, tree);
|
|
|
|
|
static void delete_duplicate_fields (tree);
|
|
|
|
|
static void finish_struct_bits (tree);
|
|
|
|
|
static int alter_access (tree, tree, tree);
|
|
|
|
|
static void handle_using_decl (tree, tree);
|
|
|
|
|
static void check_for_override (tree, tree);
|
|
|
|
|
static tree dfs_modify_vtables (tree, void *);
|
|
|
|
|
static tree modify_all_vtables (tree, tree);
|
|
|
|
|
static void determine_primary_base (tree);
|
|
|
|
|
static void finish_struct_methods (tree);
|
|
|
|
|
static void maybe_warn_about_overly_private_class (tree);
|
|
|
|
|
static int method_name_cmp (const void *, const void *);
|
|
|
|
|
static int resort_method_name_cmp (const void *, const void *);
|
|
|
|
|
static void add_implicitly_declared_members (tree, int, int, int);
|
|
|
|
|
static tree fixed_type_or_null (tree, int *, int *);
|
|
|
|
|
static tree resolve_address_of_overloaded_function (tree, tree, int,
|
|
|
|
|
int, int, tree);
|
|
|
|
|
static tree build_vtable_entry_ref (tree, tree, tree);
|
|
|
|
|
static tree build_vtbl_ref_1 (tree, tree);
|
|
|
|
|
static tree build_vtbl_initializer (tree, tree, tree, tree, int *);
|
|
|
|
|
static int count_fields (tree);
|
2003-07-16 20:45:56 +02:00
|
|
|
|
static int add_fields_to_record_type (tree, struct sorted_fields_type*, int);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void check_bitfield_decl (tree);
|
2002-10-15 20:07:24 +02:00
|
|
|
|
static void check_field_decl (tree, tree, int *, int *, int *, int *);
|
|
|
|
|
static void check_field_decls (tree, tree *, int *, int *, int *);
|
|
|
|
|
static tree *build_base_field (record_layout_info, tree, splay_tree, tree *);
|
|
|
|
|
static void build_base_fields (record_layout_info, splay_tree, tree *);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void check_methods (tree);
|
|
|
|
|
static void remove_zero_width_bit_fields (tree);
|
|
|
|
|
static void check_bases (tree, int *, int *, int *);
|
2002-10-15 20:07:24 +02:00
|
|
|
|
static void check_bases_and_members (tree);
|
|
|
|
|
static tree create_vtable_ptr (tree, tree *);
|
2002-09-30 18:52:19 +02:00
|
|
|
|
static void include_empty_classes (record_layout_info);
|
2002-10-26 02:44:44 +02:00
|
|
|
|
static void layout_class_type (tree, tree *);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void fixup_pending_inline (tree);
|
|
|
|
|
static void fixup_inline_methods (tree);
|
|
|
|
|
static void set_primary_base (tree, tree);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static void propagate_binfo_offsets (tree, tree);
|
2002-09-30 18:52:19 +02:00
|
|
|
|
static void layout_virtual_bases (record_layout_info, splay_tree);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void build_vbase_offset_vtbl_entries (tree, vtbl_init_data *);
|
|
|
|
|
static void add_vcall_offset_vtbl_entries_r (tree, vtbl_init_data *);
|
|
|
|
|
static void add_vcall_offset_vtbl_entries_1 (tree, vtbl_init_data *);
|
|
|
|
|
static void build_vcall_offset_vtbl_entries (tree, vtbl_init_data *);
|
2002-11-08 03:16:48 +01:00
|
|
|
|
static void add_vcall_offset (tree, tree, vtbl_init_data *);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void layout_vtable_decl (tree, int);
|
|
|
|
|
static tree dfs_find_final_overrider (tree, void *);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static tree dfs_find_final_overrider_post (tree, void *);
|
|
|
|
|
static tree dfs_find_final_overrider_q (tree, int, void *);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static tree find_final_overrider (tree, tree, tree);
|
|
|
|
|
static int make_new_vtable (tree, tree);
|
|
|
|
|
static int maybe_indent_hierarchy (FILE *, int, int);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static tree dump_class_hierarchy_r (FILE *, int, tree, tree, int);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void dump_class_hierarchy (tree);
|
|
|
|
|
static void dump_array (FILE *, tree);
|
|
|
|
|
static void dump_vtable (tree, tree, tree);
|
|
|
|
|
static void dump_vtt (tree, tree);
|
|
|
|
|
static tree build_vtable (tree, tree, tree);
|
|
|
|
|
static void initialize_vtable (tree, tree);
|
|
|
|
|
static void initialize_array (tree, tree);
|
|
|
|
|
static void layout_nonempty_base_or_field (record_layout_info,
|
|
|
|
|
tree, tree, splay_tree);
|
|
|
|
|
static tree end_of_class (tree, int);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static bool layout_empty_base (tree, tree, splay_tree);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static void accumulate_vtbl_inits (tree, tree, tree, tree, tree);
|
|
|
|
|
static tree dfs_accumulate_vtbl_inits (tree, tree, tree, tree,
|
|
|
|
|
tree);
|
|
|
|
|
static void build_rtti_vtbl_entries (tree, vtbl_init_data *);
|
|
|
|
|
static void build_vcall_and_vbase_vtbl_entries (tree,
|
|
|
|
|
vtbl_init_data *);
|
|
|
|
|
static void mark_primary_bases (tree);
|
|
|
|
|
static void clone_constructors_and_destructors (tree);
|
|
|
|
|
static tree build_clone (tree, tree);
|
2003-01-28 00:29:50 +01:00
|
|
|
|
static void update_vtable_entry_for_fn (tree, tree, tree, tree *, unsigned);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static tree copy_virtuals (tree);
|
|
|
|
|
static void build_ctor_vtbl_group (tree, tree);
|
|
|
|
|
static void build_vtt (tree);
|
|
|
|
|
static tree binfo_ctor_vtable (tree);
|
|
|
|
|
static tree *build_vtt_inits (tree, tree, tree *, tree *);
|
|
|
|
|
static tree dfs_build_secondary_vptr_vtt_inits (tree, void *);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static tree dfs_ctor_vtable_bases_queue_p (tree, int, void *data);
|
2003-01-23 03:47:51 +01:00
|
|
|
|
static tree dfs_fixup_binfo_vtbls (tree, void *);
|
|
|
|
|
static int record_subobject_offset (tree, tree, splay_tree);
|
|
|
|
|
static int check_subobject_offset (tree, tree, splay_tree);
|
|
|
|
|
static int walk_subobject_offsets (tree, subobject_offset_fn,
|
|
|
|
|
tree, splay_tree, tree, int);
|
|
|
|
|
static void record_subobject_offsets (tree, tree, splay_tree, int);
|
|
|
|
|
static int layout_conflict_p (tree, tree, splay_tree, int);
|
|
|
|
|
static int splay_tree_compare_integer_csts (splay_tree_key k1,
|
|
|
|
|
splay_tree_key k2);
|
|
|
|
|
static void warn_about_ambiguous_bases (tree);
|
|
|
|
|
static bool type_requires_array_cookie (tree);
|
2002-09-25 21:07:35 +02:00
|
|
|
|
static bool contains_empty_class_p (tree);
|
2002-10-18 11:21:06 +02:00
|
|
|
|
static bool base_derived_from (tree, tree);
|
2002-10-22 07:04:48 +02:00
|
|
|
|
static int empty_base_at_nonzero_offset_p (tree, tree, splay_tree);
|
2002-10-25 08:01:55 +02:00
|
|
|
|
static tree end_of_base (tree);
|
2002-11-04 02:45:58 +01:00
|
|
|
|
static tree get_vcall_index (tree, tree);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
|
|
|
|
/* Macros for dfs walking during vtt construction. See
|
|
|
|
|
dfs_ctor_vtable_bases_queue_p, dfs_build_secondary_vptr_vtt_inits
|
|
|
|
|
and dfs_fixup_binfo_vtbls. */
|
2002-01-08 11:18:40 +01:00
|
|
|
|
#define VTT_TOP_LEVEL_P(NODE) TREE_UNSIGNED (NODE)
|
|
|
|
|
#define VTT_MARKED_BINFO_P(NODE) TREE_USED (NODE)
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
1994-03-24 00:33:53 +01:00
|
|
|
|
/* Variables shared between class.c and call.c. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
|
#ifdef GATHER_STATISTICS
|
1994-02-24 02:02:37 +01:00
|
|
|
|
int n_vtables = 0;
|
|
|
|
|
int n_vtable_entries = 0;
|
|
|
|
|
int n_vtable_searches = 0;
|
|
|
|
|
int n_vtable_elems = 0;
|
|
|
|
|
int n_convert_harshness = 0;
|
|
|
|
|
int n_compute_conversion_costs = 0;
|
|
|
|
|
int n_build_method_call = 0;
|
|
|
|
|
int n_inner_fields_searched = 0;
|
1996-02-28 23:01:56 +01:00
|
|
|
|
#endif
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
/* Convert to or from a base subobject. EXPR is an expression of type
|
|
|
|
|
`A' or `A*', an expression of type `B' or `B*' is returned. To
|
|
|
|
|
convert A to a base B, CODE is PLUS_EXPR and BINFO is the binfo for
|
|
|
|
|
the B base instance within A. To convert base A to derived B, CODE
|
|
|
|
|
is MINUS_EXPR and BINFO is the binfo for the A instance within B.
|
|
|
|
|
In this latter case, A must not be a morally virtual base of B.
|
|
|
|
|
NONNULL is true if EXPR is known to be non-NULL (this is only
|
|
|
|
|
needed when EXPR is of pointer type). CV qualifiers are preserved
|
|
|
|
|
from EXPR. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_base_path (enum tree_code code,
|
|
|
|
|
tree expr,
|
|
|
|
|
tree binfo,
|
|
|
|
|
int nonnull)
|
2000-01-26 00:26:21 +01:00
|
|
|
|
{
|
2001-11-25 14:21:45 +01:00
|
|
|
|
tree v_binfo = NULL_TREE;
|
2002-01-22 15:37:29 +01:00
|
|
|
|
tree d_binfo = NULL_TREE;
|
2001-11-25 14:21:45 +01:00
|
|
|
|
tree probe;
|
|
|
|
|
tree offset;
|
|
|
|
|
tree target_type;
|
|
|
|
|
tree null_test = NULL;
|
|
|
|
|
tree ptr_target_type;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
int fixed_type_p;
|
2001-11-25 14:21:45 +01:00
|
|
|
|
int want_pointer = TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE;
|
2000-01-26 00:26:21 +01:00
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
if (expr == error_mark_node || binfo == error_mark_node || !binfo)
|
|
|
|
|
return error_mark_node;
|
2002-01-22 15:37:29 +01:00
|
|
|
|
|
|
|
|
|
for (probe = binfo; probe; probe = BINFO_INHERITANCE_CHAIN (probe))
|
|
|
|
|
{
|
|
|
|
|
d_binfo = probe;
|
|
|
|
|
if (!v_binfo && TREE_VIA_VIRTUAL (probe))
|
|
|
|
|
v_binfo = probe;
|
|
|
|
|
}
|
2001-11-25 14:21:45 +01:00
|
|
|
|
|
|
|
|
|
probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
|
|
|
|
|
if (want_pointer)
|
|
|
|
|
probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe));
|
|
|
|
|
|
|
|
|
|
my_friendly_assert (code == MINUS_EXPR
|
|
|
|
|
? same_type_p (BINFO_TYPE (binfo), probe)
|
|
|
|
|
: code == PLUS_EXPR
|
2002-01-22 15:37:29 +01:00
|
|
|
|
? same_type_p (BINFO_TYPE (d_binfo), probe)
|
2001-11-25 14:21:45 +01:00
|
|
|
|
: false, 20010723);
|
|
|
|
|
|
|
|
|
|
if (code == MINUS_EXPR && v_binfo)
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
error ("cannot convert from base `%T' to derived type `%T' via virtual base `%T'",
|
2002-01-22 15:37:29 +01:00
|
|
|
|
BINFO_TYPE (binfo), BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo));
|
2001-11-25 14:21:45 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
2000-01-26 00:26:21 +01:00
|
|
|
|
|
2003-01-13 10:14:47 +01:00
|
|
|
|
if (!want_pointer)
|
|
|
|
|
/* This must happen before the call to save_expr. */
|
|
|
|
|
expr = build_unary_op (ADDR_EXPR, expr, 0);
|
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
fixed_type_p = resolves_to_fixed_type_p (expr, &nonnull);
|
2002-03-18 01:00:14 +01:00
|
|
|
|
if (fixed_type_p <= 0 && TREE_SIDE_EFFECTS (expr))
|
2000-03-29 09:36:39 +02:00
|
|
|
|
expr = save_expr (expr);
|
2002-03-18 01:00:14 +01:00
|
|
|
|
|
2003-01-13 10:14:47 +01:00
|
|
|
|
if (want_pointer && !nonnull)
|
2001-11-25 14:21:45 +01:00
|
|
|
|
null_test = build (EQ_EXPR, boolean_type_node, expr, integer_zero_node);
|
|
|
|
|
|
|
|
|
|
offset = BINFO_OFFSET (binfo);
|
|
|
|
|
|
2002-03-18 01:00:14 +01:00
|
|
|
|
if (v_binfo && fixed_type_p <= 0)
|
2000-01-26 00:26:21 +01:00
|
|
|
|
{
|
2001-11-25 14:21:45 +01:00
|
|
|
|
/* Going via virtual base V_BINFO. We need the static offset
|
2002-01-22 15:37:29 +01:00
|
|
|
|
from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
|
|
|
|
|
V_BINFO. That offset is an entry in D_BINFO's vtable. */
|
2003-03-16 15:36:43 +01:00
|
|
|
|
tree v_offset;
|
|
|
|
|
|
|
|
|
|
if (fixed_type_p < 0 && in_base_initializer)
|
|
|
|
|
{
|
|
|
|
|
/* In a base member initializer, we cannot rely on
|
|
|
|
|
the vtable being set up. We have to use the vtt_parm. */
|
|
|
|
|
tree derived = BINFO_INHERITANCE_CHAIN (v_binfo);
|
|
|
|
|
|
|
|
|
|
v_offset = build (PLUS_EXPR, TREE_TYPE (current_vtt_parm),
|
|
|
|
|
current_vtt_parm, BINFO_VPTR_INDEX (derived));
|
|
|
|
|
|
|
|
|
|
v_offset = build1 (INDIRECT_REF,
|
|
|
|
|
TREE_TYPE (TYPE_VFIELD (BINFO_TYPE (derived))),
|
|
|
|
|
v_offset);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
v_offset = build_vfield_ref (build_indirect_ref (expr, NULL),
|
|
|
|
|
TREE_TYPE (TREE_TYPE (expr)));
|
2001-11-25 14:21:45 +01:00
|
|
|
|
|
|
|
|
|
v_offset = build (PLUS_EXPR, TREE_TYPE (v_offset),
|
|
|
|
|
v_offset, BINFO_VPTR_FIELD (v_binfo));
|
|
|
|
|
v_offset = build1 (NOP_EXPR,
|
|
|
|
|
build_pointer_type (ptrdiff_type_node),
|
|
|
|
|
v_offset);
|
|
|
|
|
v_offset = build_indirect_ref (v_offset, NULL);
|
2002-05-13 10:00:48 +02:00
|
|
|
|
TREE_CONSTANT (v_offset) = 1;
|
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
offset = cp_convert (ptrdiff_type_node,
|
|
|
|
|
size_diffop (offset, BINFO_OFFSET (v_binfo)));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
if (!integer_zerop (offset))
|
2002-03-18 01:00:14 +01:00
|
|
|
|
v_offset = build (code, ptrdiff_type_node, v_offset, offset);
|
|
|
|
|
|
|
|
|
|
if (fixed_type_p < 0)
|
|
|
|
|
/* Negative fixed_type_p means this is a constructor or destructor;
|
|
|
|
|
virtual base layout is fixed in in-charge [cd]tors, but not in
|
|
|
|
|
base [cd]tors. */
|
|
|
|
|
offset = build (COND_EXPR, ptrdiff_type_node,
|
|
|
|
|
build (EQ_EXPR, boolean_type_node,
|
|
|
|
|
current_in_charge_parm, integer_zero_node),
|
|
|
|
|
v_offset,
|
|
|
|
|
BINFO_OFFSET (binfo));
|
2001-11-25 14:21:45 +01:00
|
|
|
|
else
|
|
|
|
|
offset = v_offset;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-01-22 15:37:29 +01:00
|
|
|
|
target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (d_binfo);
|
2001-11-25 14:21:45 +01:00
|
|
|
|
|
|
|
|
|
target_type = cp_build_qualified_type
|
|
|
|
|
(target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr))));
|
|
|
|
|
ptr_target_type = build_pointer_type (target_type);
|
|
|
|
|
if (want_pointer)
|
|
|
|
|
target_type = ptr_target_type;
|
|
|
|
|
|
|
|
|
|
expr = build1 (NOP_EXPR, ptr_target_type, expr);
|
builtins.c (c_strlen): Use size_diffop and return ssizetype value.
* builtins.c (c_strlen): Use size_diffop and return ssizetype value.
(expand_builtin_strcpy): Pass correct type to size_binop.
(expand_builtin_strcmp): Likewise.
Clean up conditional structure.
* c-decl.c (init_decl_processing): Don't call set_sizetype twice.
(complete_array_type): Don't use size_binop for MAXINDEX.
* c-typeck.c (c_sizeof): Use size_one_node and TYPE_SIZE_UNIT.
(c_sizeof_nowarn, c_size_in_bytes): Likewise.
(c_alignof): Use size_one_node.
(build_unary_op): Pass arg of proper type to size_binop.
(really_start_incremental_init, push_init_level): Use sizetype for
constructor{,_bit,_unfilled}_index.
(pop_init_label, output_init_element): Likewise.
(output_pending_init_elements, process_init_element): Likewise.
* calls.c (compute_argument_block_size): Field VAR is ssizetype.
* expr.c (store_expr): Use size_int.
(store_constructor): Use proper types for size_binop args.
(get_inner_reference, expand_expr, case ARRAY_REF): Likewise.
(expand_expr_unaligned): Likewise.
(string_contant): Return object of sizetype.
* expr.h (SUB_PARM_SIZE): Call size_diffop and pass proper types.
(ARGS_SIZE_RTX): Call ARGS_SIZE_TREE.
(ARGS_SIZE_TREE): Pass proper types to size_binop.
* fold-const.c (int_const_binop): Refine when size_int is called.
(fold_convert): Likewise.
(size_int_wide): Rework to take KIND as arg, only take low order
bits, handle new sizetype_tab datatype, and chain entries in
size_table.
(size_int_type_wide): New function.
(size_binop): Validate types of arguments.
(ssize_binop): Deleted.
(size_diffop): New function.
(extract_muldiv): Only fold division into multiplication for sizetypes.
* function.c (assign_parms): Use size_diffop and make sure
VAR field is of ssizetype; also pass proper type to size_binop.
(locate_and_pad_parm, pad_to_arg_alignment): Likewise.
(round_down): Deleted from here.
* store-layout.c (sizetype_tab): Now an array.
(sizetype_set, early_root_list): New variables.
(variable_size): Use size_one_node.
(round_up): Pass proper type to size_binop.
(round_down): Moved to here and corrected as above.
(layout_record): Pass proper arg types to size_binop.
(layout_type): Likewise.
If sizetype_set is zero, record the type just laid out.
(make_unsigned_type): Don't call set_sizetype;
(make_signed_type): Likewise; also, call fixup_signed_type.
(initialize_sizetypes): New function.
(set_sizetype): Make copy of types, set TYPE_IS_SIZETYPE, and
set name of bitsizetype to "bit_size_type".
Fix up type of sizes of all types made before call.
* tm.texi (ROUND_TYPE_SIZE_UNIT): New macro.
* tree.c (fix_sizetype): Deleted.
(build_common_tree_nodes): Call initialize_sizetypes.
(build_common_tree_nodes_2): Don't call fix_sizetype.
* tree.h (TYPE_IS_SIZETYPE): New macro.
(initialize_sizetype): New declaration.
(enum size_type_kind): New type.
(struct sizetype_tab): Deleted.
(sizetype_tab): Now array; adjust sizetype macros.
(size_diffop, size_int_type_wide): New functions.
(size_int_wide): Change number of args and type; access macros changed.
(ssize_int, sbitsize_int): New macros.
* config/i960/i960.h (ROUND_TYPE_SIZE): Use size_int.
(ROUND_TYPE_SIZE_UNIT): New macro.
* ch/actions.c (chill_convert_for_assignment): Don't use size_binop
for things that aren't sizes.
(expand_varying_length_assignment): Likewise.
* ch/convert.c (digest_array_tuple, convert): Likewise.
* ch/typeck.c (build_chill_slice, smash_dummy_type): Likewise.
(build_chill_slice_with_range): Likewise.
(build_chill_slice_with_length): Likewise.
(build_array_from_set): Adjust types for size_binop.
* ch/expr.c (build_concat_expr, build_chill_repetition_op): Likewise.
(build_chill_sizeof): Use TYPE_SIZE_UNIT.
* ch/tree.c (build_string_type): Pass proper type to size_binop.
* cp/class.c (dfs_build_vtable_offset_vtbl_entries): Don't use
size_binop on things that are not sizes; ssize_binop deleted.
Call size_diffop when appropriate.
(dfs_build_vcall_offset_vtbl_entries): Likewise.
(build_primary_vtable, build_secondary_vtable): Likewise.
(dfs_set_offset_for_unshared_vbases, dfs_modify_vtables): Likewise.
Variable I is HOST_WIDE_INT.
(get_vfield_offset): Pass proper types to size_binop.
(size_extra_vtbl_entries, layout_virtual_bases): Likewise.
(finish_struct_1): Likewise.
(skip_rtti_stuff): Arg N is now pointer to signed.
(layout_class_type): Use size_zero_node.
* cp/cp-tree.h (skip_rtti_stuff): Arg N is pointer to signed.
* cp/cvt.c (cp_convert_to_pointer): Pass proper types to size_binop.
* cp/decl.c (complete_arry_type): Pass proper types to size_binop.
(xref_basetypes): BINFO_OFFSET is sizetype.
* cp/error.c (dump_expr): Don't use size_binop non-sizes.
* cp/expr.c (cplus_expand_constant): Pass proper types to size_binop.
* cp/init.c (construct_virtual_bases): Fix type error.
(build_vec_delete_1): Pass proper type to size_binop and don't
fold result.
* cp/lex.c (cp_make_lang_type): BINFO_OFFSET is sizetype.
* cp/rtti.c (get_base_offset): Pass proper type to size_binop.
* cp/search.c (dfs_find_vbases): Fix type error.
(expand_upcast_fixups): Arg to skip_rtti_stuff is pointer to signed.
(dfs_get_vbase_types): BINFO_OFFSET is sizetype.
* cp/tree.c (debug_binfo): Variable N is signed.
Use HOST_WIDE_INT_PRINT_DEC.
* cp/typeck.c (comptypes): sizetype is same as equivalent integer type.
(c_sizeof, c_sizeof_nowarn, expr_sizeof): Use TYPE_SIZE_UNIT,
size_one_node and size_zero_node.
(c_alignof): Use size_one_node.
(build_component_addr): Pass proper types to size_binop.
(expand_ptrmemfunc_cst): Don't use size_binop on non-sizes.
* f/com.c (ffecom_arrayref_): Convert args to size_binop to proper
type.
(ffecom_tree_canonize_ptr_): Don't use size_binop for non-sizes.
(ffecom_tree_canonize_ref_): Likewise.
(type_for_mode): Handle TImode.
* f/ste.c (ffeste_io_dofio_, ffeste_io_douio_): Use TYPE_SIZE_UNIT.
(ffeste_io_ciclist_): Likewise.
* java/expr.c (build_java_ret): Pass proper type to size_binop.
From-SVN: r32225
2000-02-27 22:39:40 +01:00
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
if (!integer_zerop (offset))
|
|
|
|
|
expr = build (code, ptr_target_type, expr, offset);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
else
|
2001-11-25 14:21:45 +01:00
|
|
|
|
null_test = NULL;
|
|
|
|
|
|
|
|
|
|
if (!want_pointer)
|
|
|
|
|
expr = build_indirect_ref (expr, NULL);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
if (null_test)
|
|
|
|
|
expr = build (COND_EXPR, target_type, null_test,
|
|
|
|
|
build1 (NOP_EXPR, target_type, integer_zero_node),
|
|
|
|
|
expr);
|
2002-03-18 01:00:14 +01:00
|
|
|
|
|
2001-11-25 14:21:45 +01:00
|
|
|
|
return expr;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-08-08 07:48:39 +02:00
|
|
|
|
/* Convert OBJECT to the base TYPE. If CHECK_ACCESS is true, an error
|
|
|
|
|
message is emitted if TYPE is inaccessible. OBJECT is assumed to
|
|
|
|
|
be non-NULL. */
|
|
|
|
|
|
|
|
|
|
tree
|
|
|
|
|
convert_to_base (tree object, tree type, bool check_access)
|
|
|
|
|
{
|
|
|
|
|
tree binfo;
|
|
|
|
|
|
|
|
|
|
binfo = lookup_base (TREE_TYPE (object), type,
|
|
|
|
|
check_access ? ba_check : ba_ignore,
|
|
|
|
|
NULL);
|
2002-08-08 12:14:15 +02:00
|
|
|
|
if (!binfo || binfo == error_mark_node)
|
2002-08-08 07:48:39 +02:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
return build_base_path (PLUS_EXPR, object, binfo, /*nonnull=*/1);
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-16 18:38:06 +01:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* Virtual function things. */
|
|
|
|
|
|
2001-10-11 20:48:42 +02:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtable_entry_ref (tree array_ref, tree instance, tree idx)
|
2001-10-11 20:48:42 +02:00
|
|
|
|
{
|
|
|
|
|
tree i, i2, vtable, first_fn, basetype;
|
1998-08-28 18:11:35 +02:00
|
|
|
|
|
2003-07-08 03:38:44 +02:00
|
|
|
|
basetype = non_reference (TREE_TYPE (instance));
|
1998-08-28 18:11:35 +02:00
|
|
|
|
|
2001-10-11 20:48:42 +02:00
|
|
|
|
vtable = get_vtbl_decl_for_binfo (TYPE_BINFO (basetype));
|
|
|
|
|
first_fn = TYPE_BINFO_VTABLE (basetype);
|
|
|
|
|
|
|
|
|
|
i = fold (build_array_ref (first_fn, idx));
|
|
|
|
|
i = fold (build_c_cast (ptrdiff_type_node,
|
|
|
|
|
build_unary_op (ADDR_EXPR, i, 0)));
|
|
|
|
|
i2 = fold (build_array_ref (vtable, build_int_2 (0,0)));
|
|
|
|
|
i2 = fold (build_c_cast (ptrdiff_type_node,
|
|
|
|
|
build_unary_op (ADDR_EXPR, i2, 0)));
|
|
|
|
|
i = fold (cp_build_binary_op (MINUS_EXPR, i, i2));
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (i) != INTEGER_CST)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
return build (VTABLE_REF, TREE_TYPE (array_ref), array_ref, vtable, i);
|
1998-08-28 18:11:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* Given an object INSTANCE, return an expression which yields the
|
2001-09-21 18:58:22 +02:00
|
|
|
|
vtable element corresponding to INDEX. There are many special
|
|
|
|
|
cases for INSTANCE which we take care of here, mainly to avoid
|
|
|
|
|
creating extra tree nodes when we don't have to. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
2001-10-11 20:48:42 +02:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtbl_ref_1 (tree instance, tree idx)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2002-05-13 10:00:48 +02:00
|
|
|
|
tree aref;
|
|
|
|
|
tree vtbl = NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2002-05-13 10:00:48 +02:00
|
|
|
|
/* Try to figure out what a reference refers to, and
|
|
|
|
|
access its virtual function table directly. */
|
|
|
|
|
|
|
|
|
|
int cdtorp = 0;
|
|
|
|
|
tree fixed_type = fixed_type_or_null (instance, NULL, &cdtorp);
|
|
|
|
|
|
2003-07-08 03:38:44 +02:00
|
|
|
|
tree basetype = non_reference (TREE_TYPE (instance));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2002-05-13 10:00:48 +02:00
|
|
|
|
if (fixed_type && !cdtorp)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2002-05-13 10:00:48 +02:00
|
|
|
|
tree binfo = lookup_base (fixed_type, basetype,
|
|
|
|
|
ba_ignore|ba_quiet, NULL);
|
|
|
|
|
if (binfo)
|
|
|
|
|
vtbl = BINFO_VTABLE (binfo);
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2002-05-13 10:00:48 +02:00
|
|
|
|
if (!vtbl)
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
vtbl = build_vfield_ref (instance, basetype);
|
|
|
|
|
|
1995-02-18 23:06:40 +01:00
|
|
|
|
assemble_external (vtbl);
|
1998-08-28 18:11:35 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
aref = build_array_ref (vtbl, idx);
|
2002-05-13 10:00:48 +02:00
|
|
|
|
TREE_CONSTANT (aref) = 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2001-07-21 11:42:21 +02:00
|
|
|
|
return aref;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-10-11 20:48:42 +02:00
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtbl_ref (tree instance, tree idx)
|
2001-10-11 20:48:42 +02:00
|
|
|
|
{
|
|
|
|
|
tree aref = build_vtbl_ref_1 (instance, idx);
|
|
|
|
|
|
|
|
|
|
if (flag_vtable_gc)
|
|
|
|
|
aref = build_vtable_entry_ref (aref, instance, idx);
|
|
|
|
|
|
|
|
|
|
return aref;
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-21 18:58:22 +02:00
|
|
|
|
/* Given an object INSTANCE, return an expression which yields a
|
|
|
|
|
function pointer corresponding to vtable element INDEX. */
|
|
|
|
|
|
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vfn_ref (tree instance, tree idx)
|
2001-09-21 18:58:22 +02:00
|
|
|
|
{
|
2001-10-11 20:48:42 +02:00
|
|
|
|
tree aref = build_vtbl_ref_1 (instance, idx);
|
2001-09-21 18:58:22 +02:00
|
|
|
|
|
|
|
|
|
/* When using function descriptors, the address of the
|
|
|
|
|
vtable entry is treated as a function pointer. */
|
|
|
|
|
if (TARGET_VTABLE_USES_DESCRIPTORS)
|
2001-10-11 20:48:42 +02:00
|
|
|
|
aref = build1 (NOP_EXPR, TREE_TYPE (aref),
|
2001-09-21 18:58:22 +02:00
|
|
|
|
build_unary_op (ADDR_EXPR, aref, /*noconvert=*/1));
|
|
|
|
|
|
2001-10-11 20:48:42 +02:00
|
|
|
|
if (flag_vtable_gc)
|
|
|
|
|
aref = build_vtable_entry_ref (aref, instance, idx);
|
|
|
|
|
|
2001-09-21 18:58:22 +02:00
|
|
|
|
return aref;
|
|
|
|
|
}
|
|
|
|
|
|
2000-06-09 18:26:24 +02:00
|
|
|
|
/* Return the name of the virtual function table (as an IDENTIFIER_NODE)
|
|
|
|
|
for the given TYPE. */
|
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_vtable_name (tree type)
|
2000-06-09 18:26:24 +02:00
|
|
|
|
{
|
2001-02-12 10:58:18 +01:00
|
|
|
|
return mangle_vtbl_for_type (type);
|
2000-06-09 18:26:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return an IDENTIFIER_NODE for the name of the virtual table table
|
|
|
|
|
for TYPE. */
|
|
|
|
|
|
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_vtt_name (tree type)
|
2000-06-09 18:26:24 +02:00
|
|
|
|
{
|
2001-02-12 10:58:18 +01:00
|
|
|
|
return mangle_vtt_for_type (type);
|
2000-06-09 18:26:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-06-12 08:43:27 +02:00
|
|
|
|
/* Create a VAR_DECL for a primary or secondary vtable for CLASS_TYPE.
|
|
|
|
|
(For a secondary vtable for B-in-D, CLASS_TYPE should be D, not B.)
|
|
|
|
|
Use NAME for the name of the vtable, and VTABLE_TYPE for its type. */
|
2000-02-21 00:24:58 +01:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtable (tree class_type, tree name, tree vtable_type)
|
2000-02-21 00:24:58 +01:00
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
|
|
|
|
|
decl = build_lang_decl (VAR_DECL, name, vtable_type);
|
2001-05-21 17:55:40 +02:00
|
|
|
|
/* vtable names are already mangled; give them their DECL_ASSEMBLER_NAME
|
|
|
|
|
now to avoid confusion in mangle_decl. */
|
|
|
|
|
SET_DECL_ASSEMBLER_NAME (decl, name);
|
2000-02-21 00:24:58 +01:00
|
|
|
|
DECL_CONTEXT (decl) = class_type;
|
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
|
|
|
|
TREE_STATIC (decl) = 1;
|
|
|
|
|
TREE_READONLY (decl) = 1;
|
|
|
|
|
DECL_VIRTUAL_P (decl) = 1;
|
2002-06-14 02:50:34 +02:00
|
|
|
|
DECL_ALIGN (decl) = TARGET_VTABLE_ENTRY_ALIGN;
|
2003-06-24 13:54:01 +02:00
|
|
|
|
DECL_VTABLE_OR_VTT_P (decl) = 1;
|
2002-06-14 02:50:34 +02:00
|
|
|
|
|
2003-04-03 20:23:04 +02:00
|
|
|
|
/* At one time the vtable info was grabbed 2 words at a time. This
|
|
|
|
|
fails on sparc unless you have 8-byte alignment. (tiemann) */
|
|
|
|
|
DECL_ALIGN (decl) = MAX (TYPE_ALIGN (double_type_node),
|
|
|
|
|
DECL_ALIGN (decl));
|
|
|
|
|
|
2000-02-21 00:24:58 +01:00
|
|
|
|
import_export_vtable (decl, class_type, 0);
|
|
|
|
|
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-24 11:59:02 +01:00
|
|
|
|
/* Get the VAR_DECL of the vtable for TYPE. TYPE need not be polymorphic,
|
|
|
|
|
or even complete. If this does not exist, create it. If COMPLETE is
|
2002-09-21 14:51:56 +02:00
|
|
|
|
nonzero, then complete the definition of it -- that will render it
|
2000-01-24 11:59:02 +01:00
|
|
|
|
impossible to actually build the vtable, but is useful to get at those
|
|
|
|
|
which are known to exist in the runtime. */
|
|
|
|
|
|
2000-02-20 03:46:56 +01:00
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_vtable_decl (tree type, int complete)
|
2000-01-24 11:59:02 +01:00
|
|
|
|
{
|
2002-11-04 02:45:58 +01:00
|
|
|
|
tree decl;
|
|
|
|
|
|
|
|
|
|
if (CLASSTYPE_VTABLES (type))
|
|
|
|
|
return CLASSTYPE_VTABLES (type);
|
2000-01-24 11:59:02 +01:00
|
|
|
|
|
2003-03-03 22:28:23 +01:00
|
|
|
|
decl = build_vtable (type, get_vtable_name (type), vtbl_type_node);
|
2002-11-04 02:45:58 +01:00
|
|
|
|
CLASSTYPE_VTABLES (type) = decl;
|
|
|
|
|
|
2000-01-24 11:59:02 +01:00
|
|
|
|
if (complete)
|
2000-03-21 23:28:33 +01:00
|
|
|
|
{
|
|
|
|
|
DECL_EXTERNAL (decl) = 1;
|
|
|
|
|
cp_finish_decl (decl, NULL_TREE, NULL_TREE, 0);
|
|
|
|
|
}
|
2000-01-24 11:59:02 +01:00
|
|
|
|
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-17 00:44:17 +02:00
|
|
|
|
/* Returns a copy of the BINFO_VIRTUALS list in BINFO. The
|
|
|
|
|
BV_VCALL_INDEX for each entry is cleared. */
|
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
copy_virtuals (tree binfo)
|
2000-05-17 00:44:17 +02:00
|
|
|
|
{
|
|
|
|
|
tree copies;
|
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
|
|
copies = copy_list (BINFO_VIRTUALS (binfo));
|
|
|
|
|
for (t = copies; t; t = TREE_CHAIN (t))
|
2002-11-04 02:45:58 +01:00
|
|
|
|
BV_VCALL_INDEX (t) = NULL_TREE;
|
2000-05-17 00:44:17 +02:00
|
|
|
|
|
|
|
|
|
return copies;
|
|
|
|
|
}
|
2001-06-08 13:10:29 +02:00
|
|
|
|
|
2000-01-31 05:03:01 +01:00
|
|
|
|
/* Build the primary virtual function table for TYPE. If BINFO is
|
|
|
|
|
non-NULL, build the vtable starting with the initial approximation
|
|
|
|
|
that it is the same as the one which is the head of the association
|
2002-09-21 14:51:56 +02:00
|
|
|
|
list. Returns a nonzero value if a new vtable is actually
|
2000-01-31 05:03:01 +01:00
|
|
|
|
created. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
2000-01-31 05:03:01 +01:00
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_primary_vtable (tree binfo, tree type)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2000-06-23 03:14:40 +02:00
|
|
|
|
tree decl;
|
|
|
|
|
tree virtuals;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-01-24 11:59:02 +01:00
|
|
|
|
decl = get_vtable_decl (type, /*complete=*/0);
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (binfo)
|
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (BINFO_NEW_VTABLE_MARKED (binfo))
|
2000-01-02 03:13:53 +01:00
|
|
|
|
/* We have already created a vtable for this base, so there's
|
|
|
|
|
no need to do it again. */
|
2000-01-31 05:03:01 +01:00
|
|
|
|
return 0;
|
|
|
|
|
|
2000-05-17 00:44:17 +02:00
|
|
|
|
virtuals = copy_virtuals (binfo);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
TREE_TYPE (decl) = TREE_TYPE (get_vtbl_decl_for_binfo (binfo));
|
|
|
|
|
DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (decl));
|
|
|
|
|
DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (TREE_TYPE (decl));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-03-03 22:28:23 +01:00
|
|
|
|
my_friendly_assert (TREE_TYPE (decl) == vtbl_type_node, 20000118);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
virtuals = NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
|
n_vtables += 1;
|
|
|
|
|
n_vtable_elems += list_length (virtuals);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Initialize the association list for this type, based
|
|
|
|
|
on our first approximation. */
|
|
|
|
|
TYPE_BINFO_VTABLE (type) = decl;
|
|
|
|
|
TYPE_BINFO_VIRTUALS (type) = virtuals;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
SET_BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (type));
|
2000-01-31 05:03:01 +01:00
|
|
|
|
return 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* Give BINFO a new virtual function table which is initialized
|
1994-02-24 02:02:37 +01:00
|
|
|
|
with a skeleton-copy of its original initialization. The only
|
|
|
|
|
entry that changes is the `delta' entry, so we can really
|
|
|
|
|
share a lot of structure.
|
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
FOR_TYPE is the most derived type which caused this table to
|
1994-02-24 02:02:37 +01:00
|
|
|
|
be needed.
|
|
|
|
|
|
2002-09-21 14:51:56 +02:00
|
|
|
|
Returns nonzero if we haven't met BINFO before.
|
1997-10-16 09:20:46 +02:00
|
|
|
|
|
|
|
|
|
The order in which vtables are built (by calling this function) for
|
|
|
|
|
an object must remain the same, otherwise a binary incompatibility
|
|
|
|
|
can result. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
2000-01-31 05:03:01 +01:00
|
|
|
|
static int
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
build_secondary_vtable (tree binfo)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (BINFO_NEW_VTABLE_MARKED (binfo))
|
2000-01-02 03:13:53 +01:00
|
|
|
|
/* We already created a vtable for this base. There's no need to
|
|
|
|
|
do it again. */
|
2000-01-31 05:03:01 +01:00
|
|
|
|
return 0;
|
2000-01-02 03:13:53 +01:00
|
|
|
|
|
2000-02-21 05:19:12 +01:00
|
|
|
|
/* Remember that we've created a vtable for this BINFO, so that we
|
|
|
|
|
don't try to do so again. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
SET_BINFO_NEW_VTABLE_MARKED (binfo);
|
2000-02-21 05:19:12 +01:00
|
|
|
|
|
|
|
|
|
/* Make fresh virtual list, so we can smash it later. */
|
2000-05-17 00:44:17 +02:00
|
|
|
|
BINFO_VIRTUALS (binfo) = copy_virtuals (binfo);
|
2000-02-21 05:19:12 +01:00
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* Secondary vtables are laid out as part of the same structure as
|
|
|
|
|
the primary vtable. */
|
|
|
|
|
BINFO_VTABLE (binfo) = NULL_TREE;
|
2000-01-31 05:03:01 +01:00
|
|
|
|
return 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-31 05:03:01 +01:00
|
|
|
|
/* Create a new vtable for BINFO which is the hierarchy dominated by
|
2002-09-21 14:51:56 +02:00
|
|
|
|
T. Return nonzero if we actually created a new vtable. */
|
2000-01-31 05:03:01 +01:00
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
make_new_vtable (tree t, tree binfo)
|
2000-01-31 05:03:01 +01:00
|
|
|
|
{
|
|
|
|
|
if (binfo == TYPE_BINFO (t))
|
|
|
|
|
/* In this case, it is *type*'s vtable we are modifying. We start
|
2001-06-06 23:52:52 +02:00
|
|
|
|
with the approximation that its vtable is that of the
|
2000-01-31 05:03:01 +01:00
|
|
|
|
immediate base class. */
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* ??? This actually passes TYPE_BINFO (t), not the primary base binfo,
|
|
|
|
|
since we've updated DECL_CONTEXT (TYPE_VFIELD (t)) by now. */
|
|
|
|
|
return build_primary_vtable (TYPE_BINFO (DECL_CONTEXT (TYPE_VFIELD (t))),
|
2000-01-31 05:03:01 +01:00
|
|
|
|
t);
|
|
|
|
|
else
|
|
|
|
|
/* This is our very own copy of `basetype' to play with. Later,
|
|
|
|
|
we will fill in all the virtual functions that override the
|
|
|
|
|
virtual functions in these base classes which are not defined
|
|
|
|
|
by the current type. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
return build_secondary_vtable (binfo);
|
2000-01-31 05:03:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make *VIRTUALS, an entry on the BINFO_VIRTUALS list for BINFO
|
|
|
|
|
(which is in the hierarchy dominated by T) list FNDECL as its
|
2000-04-16 21:45:32 +02:00
|
|
|
|
BV_FN. DELTA is the required constant adjustment from the `this'
|
|
|
|
|
pointer where the vtable entry appears to the `this' required when
|
|
|
|
|
the function is actually called. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
modify_vtable_entry (tree t,
|
|
|
|
|
tree binfo,
|
|
|
|
|
tree fndecl,
|
|
|
|
|
tree delta,
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree *virtuals)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2000-01-31 05:03:01 +01:00
|
|
|
|
tree v;
|
2000-01-29 04:59:09 +01:00
|
|
|
|
|
2000-01-31 05:03:01 +01:00
|
|
|
|
v = *virtuals;
|
2000-01-29 04:59:09 +01:00
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
if (fndecl != BV_FN (v)
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|| !tree_int_cst_equal (delta, BV_DELTA (v)))
|
2000-01-29 04:59:09 +01:00
|
|
|
|
{
|
2000-01-31 05:03:01 +01:00
|
|
|
|
/* We need a new vtable for BINFO. */
|
|
|
|
|
if (make_new_vtable (t, binfo))
|
|
|
|
|
{
|
|
|
|
|
/* If we really did make a new vtable, we also made a copy
|
|
|
|
|
of the BINFO_VIRTUALS list. Now, we have to find the
|
|
|
|
|
corresponding entry in that list. */
|
|
|
|
|
*virtuals = BINFO_VIRTUALS (binfo);
|
2000-01-31 22:00:01 +01:00
|
|
|
|
while (BV_FN (*virtuals) != BV_FN (v))
|
2000-01-31 05:03:01 +01:00
|
|
|
|
*virtuals = TREE_CHAIN (*virtuals);
|
|
|
|
|
v = *virtuals;
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
BV_DELTA (v) = delta;
|
2000-05-17 00:44:17 +02:00
|
|
|
|
BV_VCALL_INDEX (v) = NULL_TREE;
|
2000-01-31 22:00:01 +01:00
|
|
|
|
BV_FN (v) = fndecl;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
/* Add method METHOD to class TYPE. If ERROR_P is true, we are adding
|
|
|
|
|
the method after the class has already been defined because a
|
|
|
|
|
declaration for it was seen. (Even though that is erroneous, we
|
|
|
|
|
add the method for improved error recovery.) */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
add_method (tree type, tree method, int error_p)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
int using = (DECL_CONTEXT (method) != type);
|
2000-08-04 20:41:00 +02:00
|
|
|
|
int len;
|
|
|
|
|
int slot;
|
|
|
|
|
tree method_vec;
|
2002-03-16 19:30:16 +01:00
|
|
|
|
int template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL
|
|
|
|
|
&& DECL_TEMPLATE_CONV_FN_P (method));
|
2000-08-04 20:41:00 +02:00
|
|
|
|
|
|
|
|
|
if (!CLASSTYPE_METHOD_VEC (type))
|
|
|
|
|
/* Make a new method vector. We start with 8 entries. We must
|
|
|
|
|
allocate at least two (for constructors and destructors), and
|
|
|
|
|
we're going to end up with an assignment operator at some point
|
|
|
|
|
as well.
|
|
|
|
|
|
|
|
|
|
We could use a TREE_LIST for now, and convert it to a TREE_VEC
|
|
|
|
|
in finish_struct, but we would probably waste more memory
|
|
|
|
|
making the links in the list than we would by over-allocating
|
|
|
|
|
the size of the vector here. Furthermore, we would complicate
|
|
|
|
|
all the code that expects this to be a vector. */
|
|
|
|
|
CLASSTYPE_METHOD_VEC (type) = make_tree_vec (8);
|
|
|
|
|
|
|
|
|
|
method_vec = CLASSTYPE_METHOD_VEC (type);
|
|
|
|
|
len = TREE_VEC_LENGTH (method_vec);
|
|
|
|
|
|
|
|
|
|
/* Constructors and destructors go in special slots. */
|
|
|
|
|
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (method))
|
|
|
|
|
slot = CLASSTYPE_CONSTRUCTOR_SLOT;
|
|
|
|
|
else if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (method))
|
|
|
|
|
slot = CLASSTYPE_DESTRUCTOR_SLOT;
|
|
|
|
|
else
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
2002-03-16 19:30:16 +01:00
|
|
|
|
int have_template_convs_p = 0;
|
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
/* See if we already have an entry with this name. */
|
|
|
|
|
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT; slot < len; ++slot)
|
2002-03-16 19:30:16 +01:00
|
|
|
|
{
|
|
|
|
|
tree m = TREE_VEC_ELT (method_vec, slot);
|
|
|
|
|
|
|
|
|
|
if (!m)
|
|
|
|
|
break;
|
|
|
|
|
m = OVL_CURRENT (m);
|
|
|
|
|
|
|
|
|
|
if (template_conv_p)
|
|
|
|
|
{
|
|
|
|
|
have_template_convs_p = (TREE_CODE (m) == TEMPLATE_DECL
|
|
|
|
|
&& DECL_TEMPLATE_CONV_FN_P (m));
|
|
|
|
|
|
|
|
|
|
/* If we need to move things up, see if there's
|
2002-09-13 02:22:59 +02:00
|
|
|
|
space. */
|
2002-03-16 19:30:16 +01:00
|
|
|
|
if (!have_template_convs_p)
|
|
|
|
|
{
|
|
|
|
|
slot = len - 1;
|
|
|
|
|
if (TREE_VEC_ELT (method_vec, slot))
|
|
|
|
|
slot++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (DECL_NAME (m) == DECL_NAME (method))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
if (slot == len)
|
|
|
|
|
{
|
|
|
|
|
/* We need a bigger method vector. */
|
|
|
|
|
int new_len;
|
|
|
|
|
tree new_vec;
|
|
|
|
|
|
|
|
|
|
/* In the non-error case, we are processing a class
|
|
|
|
|
definition. Double the size of the vector to give room
|
|
|
|
|
for new methods. */
|
|
|
|
|
if (!error_p)
|
|
|
|
|
new_len = 2 * len;
|
|
|
|
|
/* In the error case, the vector is already complete. We
|
|
|
|
|
don't expect many errors, and the rest of the front-end
|
|
|
|
|
will get confused if there are empty slots in the vector. */
|
|
|
|
|
else
|
|
|
|
|
new_len = len + 1;
|
|
|
|
|
|
|
|
|
|
new_vec = make_tree_vec (new_len);
|
2001-03-26 03:48:51 +02:00
|
|
|
|
memcpy (&TREE_VEC_ELT (new_vec, 0), &TREE_VEC_ELT (method_vec, 0),
|
|
|
|
|
len * sizeof (tree));
|
2000-08-04 20:41:00 +02:00
|
|
|
|
len = new_len;
|
|
|
|
|
method_vec = CLASSTYPE_METHOD_VEC (type) = new_vec;
|
|
|
|
|
}
|
1998-10-06 16:20:30 +02:00
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
if (DECL_CONV_FN_P (method) && !TREE_VEC_ELT (method_vec, slot))
|
|
|
|
|
{
|
|
|
|
|
/* Type conversion operators have to come before ordinary
|
|
|
|
|
methods; add_conversions depends on this to speed up
|
|
|
|
|
looking for conversion operators. So, if necessary, we
|
|
|
|
|
slide some of the vector elements up. In theory, this
|
|
|
|
|
makes this algorithm O(N^2) but we don't expect many
|
|
|
|
|
conversion operators. */
|
2002-03-16 19:30:16 +01:00
|
|
|
|
if (template_conv_p)
|
|
|
|
|
slot = CLASSTYPE_FIRST_CONVERSION_SLOT;
|
|
|
|
|
else
|
|
|
|
|
for (slot = CLASSTYPE_FIRST_CONVERSION_SLOT; slot < len; ++slot)
|
|
|
|
|
{
|
|
|
|
|
tree fn = TREE_VEC_ELT (method_vec, slot);
|
1999-02-21 17:38:23 +01:00
|
|
|
|
|
2002-03-16 19:30:16 +01:00
|
|
|
|
if (!fn)
|
|
|
|
|
/* There are no more entries in the vector, so we
|
|
|
|
|
can insert the new conversion operator here. */
|
|
|
|
|
break;
|
1999-02-21 17:38:23 +01:00
|
|
|
|
|
2002-03-16 19:30:16 +01:00
|
|
|
|
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
|
|
|
|
|
/* We can insert the new function right at the
|
|
|
|
|
SLOTth position. */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (template_conv_p && have_template_convs_p)
|
|
|
|
|
/*OK*/;
|
|
|
|
|
else if (!TREE_VEC_ELT (method_vec, slot))
|
2000-08-04 20:41:00 +02:00
|
|
|
|
/* There is nothing in the Ith slot, so we can avoid
|
|
|
|
|
moving anything. */
|
1998-10-06 16:20:30 +02:00
|
|
|
|
;
|
2000-08-04 20:41:00 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* We know the last slot in the vector is empty
|
|
|
|
|
because we know that at this point there's room
|
|
|
|
|
for a new function. */
|
2001-03-26 03:48:51 +02:00
|
|
|
|
memmove (&TREE_VEC_ELT (method_vec, slot + 1),
|
|
|
|
|
&TREE_VEC_ELT (method_vec, slot),
|
|
|
|
|
(len - slot - 1) * sizeof (tree));
|
2000-08-04 20:41:00 +02:00
|
|
|
|
TREE_VEC_ELT (method_vec, slot) = NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
1998-10-06 16:20:30 +02:00
|
|
|
|
}
|
2000-08-04 20:41:00 +02:00
|
|
|
|
}
|
1998-10-06 16:20:30 +02:00
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
if (template_class_depth (type))
|
|
|
|
|
/* TYPE is a template class. Don't issue any errors now; wait
|
|
|
|
|
until instantiation time to complain. */
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree fns;
|
1999-02-21 17:38:23 +01:00
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
/* Check to see if we've already got this method. */
|
|
|
|
|
for (fns = TREE_VEC_ELT (method_vec, slot);
|
|
|
|
|
fns;
|
|
|
|
|
fns = OVL_NEXT (fns))
|
|
|
|
|
{
|
|
|
|
|
tree fn = OVL_CURRENT (fns);
|
2002-07-12 00:34:58 +02:00
|
|
|
|
tree parms1;
|
|
|
|
|
tree parms2;
|
|
|
|
|
bool same = 1;
|
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
if (TREE_CODE (fn) != TREE_CODE (method))
|
|
|
|
|
continue;
|
1999-02-21 17:38:23 +01:00
|
|
|
|
|
2002-07-12 00:34:58 +02:00
|
|
|
|
/* [over.load] Member function declarations with the
|
|
|
|
|
same name and the same parameter types cannot be
|
|
|
|
|
overloaded if any of them is a static member
|
|
|
|
|
function declaration.
|
|
|
|
|
|
|
|
|
|
[namespace.udecl] When a using-declaration brings names
|
|
|
|
|
from a base class into a derived class scope, member
|
|
|
|
|
functions in the derived class override and/or hide member
|
|
|
|
|
functions with the same name and parameter types in a base
|
|
|
|
|
class (rather than conflicting). */
|
|
|
|
|
parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn));
|
|
|
|
|
parms2 = TYPE_ARG_TYPES (TREE_TYPE (method));
|
|
|
|
|
|
|
|
|
|
/* Compare the quals on the 'this' parm. Don't compare
|
|
|
|
|
the whole types, as used functions are treated as
|
|
|
|
|
coming from the using class in overload resolution. */
|
|
|
|
|
if (! DECL_STATIC_FUNCTION_P (fn)
|
|
|
|
|
&& ! DECL_STATIC_FUNCTION_P (method)
|
|
|
|
|
&& (TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms1)))
|
|
|
|
|
!= TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms2)))))
|
|
|
|
|
same = 0;
|
2002-10-18 10:09:58 +02:00
|
|
|
|
|
|
|
|
|
/* For templates, the template parms must be identical. */
|
|
|
|
|
if (TREE_CODE (fn) == TEMPLATE_DECL
|
|
|
|
|
&& !comp_template_parms (DECL_TEMPLATE_PARMS (fn),
|
|
|
|
|
DECL_TEMPLATE_PARMS (method)))
|
|
|
|
|
same = 0;
|
|
|
|
|
|
2002-07-12 00:34:58 +02:00
|
|
|
|
if (! DECL_STATIC_FUNCTION_P (fn))
|
|
|
|
|
parms1 = TREE_CHAIN (parms1);
|
|
|
|
|
if (! DECL_STATIC_FUNCTION_P (method))
|
|
|
|
|
parms2 = TREE_CHAIN (parms2);
|
|
|
|
|
|
2002-07-12 09:55:16 +02:00
|
|
|
|
if (same && compparms (parms1, parms2)
|
|
|
|
|
&& (!DECL_CONV_FN_P (fn)
|
|
|
|
|
|| same_type_p (TREE_TYPE (TREE_TYPE (fn)),
|
|
|
|
|
TREE_TYPE (TREE_TYPE (method)))))
|
2000-08-04 20:41:00 +02:00
|
|
|
|
{
|
2002-07-12 00:34:58 +02:00
|
|
|
|
if (using && DECL_CONTEXT (fn) == type)
|
|
|
|
|
/* Defer to the local function. */
|
|
|
|
|
return;
|
|
|
|
|
else
|
1999-02-21 17:38:23 +01:00
|
|
|
|
{
|
2002-07-12 00:34:58 +02:00
|
|
|
|
cp_error_at ("`%#D' and `%#D' cannot be overloaded",
|
2003-07-03 15:16:01 +02:00
|
|
|
|
method, fn);
|
2002-07-12 00:34:58 +02:00
|
|
|
|
|
|
|
|
|
/* We don't call duplicate_decls here to merge
|
|
|
|
|
the declarations because that will confuse
|
|
|
|
|
things if the methods have inline
|
|
|
|
|
definitions. In particular, we will crash
|
|
|
|
|
while processing the definitions. */
|
|
|
|
|
return;
|
1999-02-21 17:38:23 +01:00
|
|
|
|
}
|
2000-08-04 20:41:00 +02:00
|
|
|
|
}
|
1999-02-21 17:38:23 +01:00
|
|
|
|
}
|
2000-08-04 20:41:00 +02:00
|
|
|
|
}
|
1999-02-21 17:38:23 +01:00
|
|
|
|
|
2000-08-04 20:41:00 +02:00
|
|
|
|
/* Actually insert the new method. */
|
|
|
|
|
TREE_VEC_ELT (method_vec, slot)
|
|
|
|
|
= build_overload (method, TREE_VEC_ELT (method_vec, slot));
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
|
2002-03-16 19:30:16 +01:00
|
|
|
|
/* Add the new binding. */
|
2000-08-04 20:41:00 +02:00
|
|
|
|
if (!DECL_CONSTRUCTOR_P (method)
|
|
|
|
|
&& !DECL_DESTRUCTOR_P (method))
|
|
|
|
|
push_class_level_binding (DECL_NAME (method),
|
|
|
|
|
TREE_VEC_ELT (method_vec, slot));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Subroutines of finish_struct. */
|
|
|
|
|
|
|
|
|
|
/* Look through the list of fields for this struct, deleting
|
|
|
|
|
duplicates as we go. This must be recursive to handle
|
|
|
|
|
anonymous unions.
|
|
|
|
|
|
|
|
|
|
FIELD is the field which may not appear anywhere in FIELDS.
|
|
|
|
|
FIELD_PTR, if non-null, is the starting point at which
|
|
|
|
|
chained deletions may take place.
|
|
|
|
|
The value returned is the first acceptable entry found
|
|
|
|
|
in FIELDS.
|
|
|
|
|
|
|
|
|
|
Note that anonymous fields which are not of UNION_TYPE are
|
|
|
|
|
not duplicates, they are just anonymous fields. This happens
|
|
|
|
|
when we have unnamed bitfields, for example. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
delete_duplicate_fields_1 (tree field, tree fields)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
tree x;
|
1994-08-18 22:50:43 +02:00
|
|
|
|
tree prev = 0;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (DECL_NAME (field) == 0)
|
|
|
|
|
{
|
1999-05-19 12:44:22 +02:00
|
|
|
|
if (! ANON_AGGR_TYPE_P (TREE_TYPE (field)))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return fields;
|
|
|
|
|
|
|
|
|
|
for (x = TYPE_FIELDS (TREE_TYPE (field)); x; x = TREE_CHAIN (x))
|
1994-08-18 22:50:43 +02:00
|
|
|
|
fields = delete_duplicate_fields_1 (x, fields);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return fields;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (x = fields; x; prev = x, x = TREE_CHAIN (x))
|
|
|
|
|
{
|
|
|
|
|
if (DECL_NAME (x) == 0)
|
|
|
|
|
{
|
1999-05-19 12:44:22 +02:00
|
|
|
|
if (! ANON_AGGR_TYPE_P (TREE_TYPE (x)))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
continue;
|
|
|
|
|
TYPE_FIELDS (TREE_TYPE (x))
|
1994-08-18 22:50:43 +02:00
|
|
|
|
= delete_duplicate_fields_1 (field, TYPE_FIELDS (TREE_TYPE (x)));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TYPE_FIELDS (TREE_TYPE (x)) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (prev == 0)
|
|
|
|
|
fields = TREE_CHAIN (fields);
|
|
|
|
|
else
|
|
|
|
|
TREE_CHAIN (prev) = TREE_CHAIN (x);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-12-16 04:10:12 +01:00
|
|
|
|
else if (TREE_CODE (field) == USING_DECL)
|
2001-12-18 15:13:46 +01:00
|
|
|
|
/* A using declaration is allowed to appear more than
|
1999-12-16 04:10:12 +01:00
|
|
|
|
once. We'll prune these from the field list later, and
|
|
|
|
|
handle_using_decl will complain about invalid multiple
|
|
|
|
|
uses. */
|
|
|
|
|
;
|
|
|
|
|
else if (DECL_NAME (field) == DECL_NAME (x))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1999-12-16 04:10:12 +01:00
|
|
|
|
if (TREE_CODE (field) == CONST_DECL
|
|
|
|
|
&& TREE_CODE (x) == CONST_DECL)
|
|
|
|
|
cp_error_at ("duplicate enum value `%D'", x);
|
|
|
|
|
else if (TREE_CODE (field) == CONST_DECL
|
|
|
|
|
|| TREE_CODE (x) == CONST_DECL)
|
|
|
|
|
cp_error_at ("duplicate field `%D' (as enum and non-enum)",
|
|
|
|
|
x);
|
|
|
|
|
else if (DECL_DECLARES_TYPE_P (field)
|
|
|
|
|
&& DECL_DECLARES_TYPE_P (x))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1999-12-16 04:10:12 +01:00
|
|
|
|
if (same_type_p (TREE_TYPE (field), TREE_TYPE (x)))
|
|
|
|
|
continue;
|
|
|
|
|
cp_error_at ("duplicate nested type `%D'", x);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
1999-12-16 04:10:12 +01:00
|
|
|
|
else if (DECL_DECLARES_TYPE_P (field)
|
|
|
|
|
|| DECL_DECLARES_TYPE_P (x))
|
|
|
|
|
{
|
|
|
|
|
/* Hide tag decls. */
|
|
|
|
|
if ((TREE_CODE (field) == TYPE_DECL
|
|
|
|
|
&& DECL_ARTIFICIAL (field))
|
|
|
|
|
|| (TREE_CODE (x) == TYPE_DECL
|
|
|
|
|
&& DECL_ARTIFICIAL (x)))
|
|
|
|
|
continue;
|
|
|
|
|
cp_error_at ("duplicate field `%D' (as type and non-type)",
|
|
|
|
|
x);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cp_error_at ("duplicate member `%D'", x);
|
|
|
|
|
if (prev == 0)
|
|
|
|
|
fields = TREE_CHAIN (fields);
|
|
|
|
|
else
|
|
|
|
|
TREE_CHAIN (prev) = TREE_CHAIN (x);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return fields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
delete_duplicate_fields (tree fields)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
tree x;
|
|
|
|
|
for (x = fields; x && TREE_CHAIN (x); x = TREE_CHAIN (x))
|
1994-08-18 22:50:43 +02:00
|
|
|
|
TREE_CHAIN (x) = delete_duplicate_fields_1 (x, TREE_CHAIN (x));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
/* Change the access of FDECL to ACCESS in T. Return 1 if change was
|
|
|
|
|
legit, otherwise return 0. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
alter_access (tree t, tree fdecl, tree access)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2000-05-24 08:15:04 +02:00
|
|
|
|
tree elem;
|
|
|
|
|
|
|
|
|
|
if (!DECL_LANG_SPECIFIC (fdecl))
|
|
|
|
|
retrofit_lang_decl (fdecl);
|
|
|
|
|
|
2003-06-24 17:40:06 +02:00
|
|
|
|
my_friendly_assert (!DECL_DISCRIMINATOR_P (fdecl), 20030624);
|
2001-03-23 13:04:11 +01:00
|
|
|
|
|
2000-05-24 08:15:04 +02:00
|
|
|
|
elem = purpose_member (t, DECL_ACCESS (fdecl));
|
1998-03-25 17:14:49 +01:00
|
|
|
|
if (elem)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1998-03-25 17:14:49 +01:00
|
|
|
|
if (TREE_VALUE (elem) != access)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1998-03-25 17:14:49 +01:00
|
|
|
|
if (TREE_CODE (TREE_TYPE (fdecl)) == FUNCTION_DECL)
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_error_at ("conflicting access specifications for method `%D', ignored", TREE_TYPE (fdecl));
|
1998-03-25 17:14:49 +01:00
|
|
|
|
else
|
1998-09-07 16:25:35 +02:00
|
|
|
|
error ("conflicting access specifications for field `%s', ignored",
|
1998-03-25 17:14:49 +01:00
|
|
|
|
IDENTIFIER_POINTER (DECL_NAME (fdecl)));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
1998-03-29 00:49:35 +01:00
|
|
|
|
{
|
|
|
|
|
/* They're changing the access to the same thing they changed
|
|
|
|
|
it to before. That's OK. */
|
|
|
|
|
;
|
|
|
|
|
}
|
1994-11-29 01:59:16 +01:00
|
|
|
|
}
|
1998-03-25 17:14:49 +01:00
|
|
|
|
else
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2003-06-24 17:40:06 +02:00
|
|
|
|
perform_or_defer_access_check (TYPE_BINFO (t), fdecl);
|
1996-01-17 19:57:55 +01:00
|
|
|
|
DECL_ACCESS (fdecl) = tree_cons (t, access, DECL_ACCESS (fdecl));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-16 04:10:12 +01:00
|
|
|
|
/* Process the USING_DECL, which is a member of T. */
|
1998-06-14 01:48:07 +02:00
|
|
|
|
|
1999-03-03 12:24:45 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
handle_using_decl (tree using_decl, tree t)
|
1998-06-14 01:48:07 +02:00
|
|
|
|
{
|
|
|
|
|
tree ctype = DECL_INITIAL (using_decl);
|
|
|
|
|
tree name = DECL_NAME (using_decl);
|
|
|
|
|
tree access
|
|
|
|
|
= TREE_PRIVATE (using_decl) ? access_private_node
|
|
|
|
|
: TREE_PROTECTED (using_decl) ? access_protected_node
|
|
|
|
|
: access_public_node;
|
|
|
|
|
tree fdecl, binfo;
|
|
|
|
|
tree flist = NULL_TREE;
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
tree old_value;
|
1998-06-14 01:48:07 +02:00
|
|
|
|
|
2003-06-18 00:24:58 +02:00
|
|
|
|
if (ctype == error_mark_node)
|
|
|
|
|
return;
|
|
|
|
|
|
2002-10-18 00:35:49 +02:00
|
|
|
|
binfo = lookup_base (t, ctype, ba_any, NULL);
|
1998-06-14 01:48:07 +02:00
|
|
|
|
if (! binfo)
|
2002-10-18 00:35:49 +02:00
|
|
|
|
{
|
|
|
|
|
error_not_base_type (t, ctype);
|
|
|
|
|
return;
|
|
|
|
|
}
|
1998-06-14 01:48:07 +02:00
|
|
|
|
|
2002-07-10 01:31:28 +02:00
|
|
|
|
if (constructor_name_p (name, ctype))
|
1998-12-03 17:58:03 +01:00
|
|
|
|
{
|
2001-01-09 12:37:07 +01:00
|
|
|
|
cp_error_at ("`%D' names constructor", using_decl);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2002-07-10 01:31:28 +02:00
|
|
|
|
if (constructor_name_p (name, t))
|
2001-01-09 12:37:07 +01:00
|
|
|
|
{
|
|
|
|
|
cp_error_at ("`%D' invalid in `%T'", using_decl, t);
|
1998-12-03 17:58:03 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
search.c: ANSIfy function declarations and definitions.
* search.c: ANSIfy function declarations and definitions.
* cp-tree.h (lookup_field, lookup_member): Last parameter is a bool.
* call.c (build_method_call, resolve_scoped_fn_name,
build_java_interface_fn_ref): Adjust lookup_field, lookup_member
calls.
* class.c (handle_using_decl): Likewise.
* decl.c (make_typename_type, make_unmound_class_template,
start_decl, compute_array_index_type): Likewise.
* decl2.c (build_expr_from_tree, build_call_from_tree): Likewise.
* init.c (expand_member_init, build_member_call): Likewise.
* pt.c (tsubst_copy, tsubst_copy_and_build, do_decl_instantiation,
resolve_typename_type): Likewise.
* typeck.c (lookup_destructor, finish_class_member_access_exprm
build_prememfunc_access_expr): Likewise.
From-SVN: r62939
2003-02-15 19:03:22 +01:00
|
|
|
|
fdecl = lookup_member (binfo, name, 0, false);
|
1998-06-14 01:48:07 +02:00
|
|
|
|
|
|
|
|
|
if (!fdecl)
|
|
|
|
|
{
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_error_at ("no members matching `%D' in `%#T'", using_decl, ctype);
|
1998-06-14 01:48:07 +02:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
if (BASELINK_P (fdecl))
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* Ignore base type this came from. */
|
2002-06-25 17:35:27 +02:00
|
|
|
|
fdecl = BASELINK_FUNCTIONS (fdecl);
|
1998-06-14 01:48:07 +02:00
|
|
|
|
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
old_value = IDENTIFIER_CLASS_VALUE (name);
|
|
|
|
|
if (old_value)
|
1998-06-14 01:48:07 +02:00
|
|
|
|
{
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
if (is_overloaded_fn (old_value))
|
|
|
|
|
old_value = OVL_CURRENT (old_value);
|
|
|
|
|
|
|
|
|
|
if (DECL_P (old_value) && DECL_CONTEXT (old_value) == t)
|
|
|
|
|
/* OK */;
|
|
|
|
|
else
|
|
|
|
|
old_value = NULL_TREE;
|
1998-06-14 01:48:07 +02:00
|
|
|
|
}
|
1998-07-16 19:48:39 +02:00
|
|
|
|
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
if (is_overloaded_fn (fdecl))
|
|
|
|
|
flist = fdecl;
|
|
|
|
|
|
|
|
|
|
if (! old_value)
|
|
|
|
|
;
|
|
|
|
|
else if (is_overloaded_fn (old_value))
|
1998-06-14 01:48:07 +02:00
|
|
|
|
{
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
if (flist)
|
|
|
|
|
/* It's OK to use functions from a base when there are functions with
|
|
|
|
|
the same name already present in the current class. */;
|
|
|
|
|
else
|
1998-06-14 01:48:07 +02:00
|
|
|
|
{
|
2001-01-09 12:37:07 +01:00
|
|
|
|
cp_error_at ("`%D' invalid in `%#T'", using_decl, t);
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
cp_error_at (" because of local method `%#D' with same name",
|
|
|
|
|
OVL_CURRENT (old_value));
|
|
|
|
|
return;
|
1998-06-14 01:48:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-01-09 12:37:07 +01:00
|
|
|
|
else if (!DECL_ARTIFICIAL (old_value))
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
{
|
2001-01-09 12:37:07 +01:00
|
|
|
|
cp_error_at ("`%D' invalid in `%#T'", using_decl, t);
|
|
|
|
|
cp_error_at (" because of local member `%#D' with same name", old_value);
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make type T see field decl FDECL with access ACCESS.*/
|
|
|
|
|
if (flist)
|
|
|
|
|
for (; flist; flist = OVL_NEXT (flist))
|
|
|
|
|
{
|
2000-08-04 20:41:00 +02:00
|
|
|
|
add_method (t, OVL_CURRENT (flist), /*error_p=*/0);
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
alter_access (t, OVL_CURRENT (flist), access);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
alter_access (t, fdecl, access);
|
1998-06-14 01:48:07 +02:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* Run through the base clases of T, updating
|
|
|
|
|
CANT_HAVE_DEFAULT_CTOR_P, CANT_HAVE_CONST_CTOR_P, and
|
|
|
|
|
NO_CONST_ASN_REF_P. Also set flag bits in T based on properties of
|
|
|
|
|
the bases. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
check_bases (tree t,
|
|
|
|
|
int* cant_have_default_ctor_p,
|
|
|
|
|
int* cant_have_const_ctor_p,
|
|
|
|
|
int* no_const_asn_ref_p)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1999-12-16 23:18:22 +01:00
|
|
|
|
int n_baseclasses;
|
|
|
|
|
int i;
|
2001-04-12 09:44:48 +02:00
|
|
|
|
int seen_non_virtual_nearly_empty_base_p;
|
1999-12-16 23:18:22 +01:00
|
|
|
|
tree binfos;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
binfos = TYPE_BINFO_BASETYPES (t);
|
|
|
|
|
n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
|
2001-04-12 09:44:48 +02:00
|
|
|
|
seen_non_virtual_nearly_empty_base_p = 0;
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
|
|
|
|
/* An aggregate cannot have baseclasses. */
|
|
|
|
|
CLASSTYPE_NON_AGGREGATE (t) |= (n_baseclasses != 0);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_baseclasses; ++i)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1999-12-16 23:18:22 +01:00
|
|
|
|
tree base_binfo;
|
|
|
|
|
tree basetype;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* Figure out what base we're looking at. */
|
|
|
|
|
base_binfo = TREE_VEC_ELT (binfos, i);
|
|
|
|
|
basetype = TREE_TYPE (base_binfo);
|
1998-04-03 05:41:20 +02:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* If the type of basetype is incomplete, then we already
|
|
|
|
|
complained about that fact (and we should have fixed it up as
|
|
|
|
|
well). */
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (basetype))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
/* The base type is of incomplete type. It is
|
|
|
|
|
probably best to pretend that it does not
|
|
|
|
|
exist. */
|
|
|
|
|
if (i == n_baseclasses-1)
|
|
|
|
|
TREE_VEC_ELT (binfos, i) = NULL_TREE;
|
|
|
|
|
TREE_VEC_LENGTH (binfos) -= 1;
|
|
|
|
|
n_baseclasses -= 1;
|
|
|
|
|
for (j = i; j+1 < n_baseclasses; j++)
|
|
|
|
|
TREE_VEC_ELT (binfos, j) = TREE_VEC_ELT (binfos, j+1);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
continue;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-21 01:19:01 +01:00
|
|
|
|
/* Effective C++ rule 14. We only need to check TYPE_POLYMORPHIC_P
|
1999-12-16 23:18:22 +01:00
|
|
|
|
here because the case of virtual functions but non-virtual
|
|
|
|
|
dtor is handled in finish_struct_1. */
|
1999-12-21 01:19:01 +01:00
|
|
|
|
if (warn_ecpp && ! TYPE_POLYMORPHIC_P (basetype)
|
1999-12-16 23:18:22 +01:00
|
|
|
|
&& TYPE_HAS_DESTRUCTOR (basetype))
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("base class `%#T' has a non-virtual destructor",
|
1999-12-16 23:18:22 +01:00
|
|
|
|
basetype);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* If the base class doesn't have copy constructors or
|
|
|
|
|
assignment operators that take const references, then the
|
|
|
|
|
derived class cannot have such a member automatically
|
|
|
|
|
generated. */
|
|
|
|
|
if (! TYPE_HAS_CONST_INIT_REF (basetype))
|
|
|
|
|
*cant_have_const_ctor_p = 1;
|
|
|
|
|
if (TYPE_HAS_ASSIGN_REF (basetype)
|
|
|
|
|
&& !TYPE_HAS_CONST_ASSIGN_REF (basetype))
|
|
|
|
|
*no_const_asn_ref_p = 1;
|
|
|
|
|
/* Similarly, if the base class doesn't have a default
|
|
|
|
|
constructor, then the derived class won't have an
|
|
|
|
|
automatically generated default constructor. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TYPE_HAS_CONSTRUCTOR (basetype)
|
|
|
|
|
&& ! TYPE_HAS_DEFAULT_CONSTRUCTOR (basetype))
|
|
|
|
|
{
|
1999-12-16 23:18:22 +01:00
|
|
|
|
*cant_have_default_ctor_p = 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (! TYPE_HAS_CONSTRUCTOR (t))
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
pedwarn ("base `%T' with only non-default constructor in class without a constructor",
|
2000-02-21 20:51:44 +01:00
|
|
|
|
basetype);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-04-12 09:44:48 +02:00
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* A virtual base does not effect nearly emptiness. */
|
2001-04-12 09:44:48 +02:00
|
|
|
|
;
|
1999-12-29 09:28:50 +01:00
|
|
|
|
else if (CLASSTYPE_NEARLY_EMPTY_P (basetype))
|
2001-04-12 09:44:48 +02:00
|
|
|
|
{
|
|
|
|
|
if (seen_non_virtual_nearly_empty_base_p)
|
|
|
|
|
/* And if there is more than one nearly empty base, then the
|
|
|
|
|
derived class is not nearly empty either. */
|
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
|
|
|
|
else
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* Remember we've seen one. */
|
2001-04-12 09:44:48 +02:00
|
|
|
|
seen_non_virtual_nearly_empty_base_p = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (!is_empty_class (basetype))
|
|
|
|
|
/* If the base class is not empty or nearly empty, then this
|
|
|
|
|
class cannot be nearly empty. */
|
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
1999-12-29 09:28:50 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* A lot of properties from the bases also apply to the derived
|
|
|
|
|
class. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (basetype);
|
2000-03-03 03:27:15 +01:00
|
|
|
|
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|
|
|
|
|
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (basetype);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
TYPE_HAS_COMPLEX_ASSIGN_REF (t)
|
|
|
|
|
|= TYPE_HAS_COMPLEX_ASSIGN_REF (basetype);
|
1995-04-24 19:27:46 +02:00
|
|
|
|
TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (basetype);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
TYPE_OVERLOADS_CALL_EXPR (t) |= TYPE_OVERLOADS_CALL_EXPR (basetype);
|
|
|
|
|
TYPE_OVERLOADS_ARRAY_REF (t) |= TYPE_OVERLOADS_ARRAY_REF (basetype);
|
|
|
|
|
TYPE_OVERLOADS_ARROW (t) |= TYPE_OVERLOADS_ARROW (basetype);
|
1999-12-21 01:19:01 +01:00
|
|
|
|
TYPE_POLYMORPHIC_P (t) |= TYPE_POLYMORPHIC_P (basetype);
|
2002-10-21 10:40:24 +02:00
|
|
|
|
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t)
|
|
|
|
|
|= CLASSTYPE_CONTAINS_EMPTY_CLASS_P (basetype);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* Set BINFO_PRIMARY_BASE_OF for all binfos in the hierarchy
|
|
|
|
|
dominated by TYPE that are primary bases. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
mark_primary_bases (tree type)
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
tree binfo;
|
|
|
|
|
|
|
|
|
|
/* Walk the bases in inheritance graph order. */
|
|
|
|
|
for (binfo = TYPE_BINFO (type); binfo; binfo = TREE_CHAIN (binfo))
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree base_binfo = get_primary_binfo (binfo);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (!base_binfo)
|
|
|
|
|
/* Not a dynamic base. */;
|
|
|
|
|
else if (BINFO_PRIMARY_P (base_binfo))
|
2001-09-06 11:03:31 +02:00
|
|
|
|
BINFO_LOST_PRIMARY_P (binfo) = 1;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BINFO_PRIMARY_BASE_OF (base_binfo) = binfo;
|
|
|
|
|
/* A virtual binfo might have been copied from within
|
|
|
|
|
another hierarchy. As we're about to use it as a primary
|
|
|
|
|
base, make sure the offsets match. */
|
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
|
|
|
|
{
|
|
|
|
|
tree delta = size_diffop (convert (ssizetype,
|
|
|
|
|
BINFO_OFFSET (binfo)),
|
|
|
|
|
convert (ssizetype,
|
|
|
|
|
BINFO_OFFSET (base_binfo)));
|
|
|
|
|
|
|
|
|
|
propagate_binfo_offsets (base_binfo, delta);
|
|
|
|
|
}
|
|
|
|
|
}
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
/* Make the BINFO the primary base of T. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2000-01-01 04:04:27 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
set_primary_base (tree t, tree binfo)
|
2000-01-01 04:04:27 +01:00
|
|
|
|
{
|
|
|
|
|
tree basetype;
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
CLASSTYPE_PRIMARY_BINFO (t) = binfo;
|
|
|
|
|
basetype = BINFO_TYPE (binfo);
|
2000-01-01 04:04:27 +01:00
|
|
|
|
TYPE_BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (basetype);
|
|
|
|
|
TYPE_BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (basetype);
|
|
|
|
|
TYPE_VFIELD (t) = TYPE_VFIELD (basetype);
|
|
|
|
|
}
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2000-01-01 04:04:27 +01:00
|
|
|
|
/* Determine the primary class for T. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2000-01-01 04:04:27 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
determine_primary_base (tree t)
|
1999-12-16 23:18:22 +01:00
|
|
|
|
{
|
|
|
|
|
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
tree vbases;
|
|
|
|
|
tree type_binfo;
|
2000-01-03 05:05:43 +01:00
|
|
|
|
|
2000-01-03 07:56:21 +01:00
|
|
|
|
/* If there are no baseclasses, there is certainly no primary base. */
|
|
|
|
|
if (n_baseclasses == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
type_binfo = TYPE_BINFO (t);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_baseclasses; i++)
|
|
|
|
|
{
|
2000-07-31 02:24:44 +02:00
|
|
|
|
tree base_binfo = BINFO_BASETYPE (type_binfo, i);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
tree basetype = BINFO_TYPE (base_binfo);
|
1999-04-13 02:39:32 +02:00
|
|
|
|
|
2000-01-17 05:08:01 +01:00
|
|
|
|
if (TYPE_CONTAINS_VPTR_P (basetype))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* We prefer a non-virtual base, although a virtual one will
|
|
|
|
|
do. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
|
|
|
|
continue;
|
|
|
|
|
|
2000-01-01 04:04:27 +01:00
|
|
|
|
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2002-10-26 02:44:44 +02:00
|
|
|
|
set_primary_base (t, base_binfo);
|
2000-01-01 04:04:27 +01:00
|
|
|
|
CLASSTYPE_VFIELDS (t) = copy_list (CLASSTYPE_VFIELDS (basetype));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-01-01 04:04:27 +01:00
|
|
|
|
tree vfields;
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* Only add unique vfields, and flatten them out as we go. */
|
2000-01-01 04:04:27 +01:00
|
|
|
|
for (vfields = CLASSTYPE_VFIELDS (basetype);
|
|
|
|
|
vfields;
|
|
|
|
|
vfields = TREE_CHAIN (vfields))
|
|
|
|
|
if (VF_BINFO_VALUE (vfields) == NULL_TREE
|
|
|
|
|
|| ! TREE_VIA_VIRTUAL (VF_BINFO_VALUE (vfields)))
|
|
|
|
|
CLASSTYPE_VFIELDS (t)
|
|
|
|
|
= tree_cons (base_binfo,
|
|
|
|
|
VF_BASETYPE_VALUE (vfields),
|
|
|
|
|
CLASSTYPE_VFIELDS (t));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-01 04:04:27 +01:00
|
|
|
|
if (!TYPE_VFIELD (t))
|
2000-07-31 02:24:44 +02:00
|
|
|
|
CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE;
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* Find the indirect primary bases - those virtual bases which are primary
|
|
|
|
|
bases of something else in this hierarchy. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
for (vbases = CLASSTYPE_VBASECLASSES (t);
|
|
|
|
|
vbases;
|
|
|
|
|
vbases = TREE_CHAIN (vbases))
|
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
tree vbase_binfo = TREE_VALUE (vbases);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* See if this virtual base is an indirect primary base. To be so,
|
|
|
|
|
it must be a primary base within the hierarchy of one of our
|
|
|
|
|
direct bases. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
for (i = 0; i < n_baseclasses; ++i)
|
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
tree basetype = TYPE_BINFO_BASETYPE (t, i);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
tree v;
|
|
|
|
|
|
|
|
|
|
for (v = CLASSTYPE_VBASECLASSES (basetype);
|
|
|
|
|
v;
|
|
|
|
|
v = TREE_CHAIN (v))
|
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
tree base_vbase = TREE_VALUE (v);
|
|
|
|
|
|
|
|
|
|
if (BINFO_PRIMARY_P (base_vbase)
|
|
|
|
|
&& same_type_p (BINFO_TYPE (base_vbase),
|
|
|
|
|
BINFO_TYPE (vbase_binfo)))
|
2000-07-31 02:24:44 +02:00
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
BINFO_INDIRECT_PRIMARY_P (vbase_binfo) = 1;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we've discovered that this virtual base is an indirect
|
|
|
|
|
primary base, then we can move on to the next virtual
|
|
|
|
|
base. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (BINFO_INDIRECT_PRIMARY_P (vbase_binfo))
|
2000-07-31 02:24:44 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-01-03 07:56:21 +01:00
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* A "nearly-empty" virtual base class can be the primary base
|
|
|
|
|
class, if no non-virtual polymorphic base can be found. */
|
2001-02-12 10:58:18 +01:00
|
|
|
|
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
2000-06-05 22:01:47 +02:00
|
|
|
|
{
|
2000-07-31 02:24:44 +02:00
|
|
|
|
/* If not NULL, this is the best primary base candidate we have
|
|
|
|
|
found so far. */
|
|
|
|
|
tree candidate = NULL_TREE;
|
|
|
|
|
tree base_binfo;
|
2000-06-05 22:01:47 +02:00
|
|
|
|
|
|
|
|
|
/* Loop over the baseclasses. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
for (base_binfo = TYPE_BINFO (t);
|
|
|
|
|
base_binfo;
|
|
|
|
|
base_binfo = TREE_CHAIN (base_binfo))
|
2000-06-05 22:01:47 +02:00
|
|
|
|
{
|
|
|
|
|
tree basetype = BINFO_TYPE (base_binfo);
|
|
|
|
|
|
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo)
|
|
|
|
|
&& CLASSTYPE_NEARLY_EMPTY_P (basetype))
|
|
|
|
|
{
|
|
|
|
|
/* If this is not an indirect primary base, then it's
|
|
|
|
|
definitely our primary base. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
if (!BINFO_INDIRECT_PRIMARY_P (base_binfo))
|
2000-06-05 22:01:47 +02:00
|
|
|
|
{
|
2000-07-31 02:24:44 +02:00
|
|
|
|
candidate = base_binfo;
|
2000-06-05 22:01:47 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
|
|
|
|
/* If this is an indirect primary base, it still could be
|
|
|
|
|
our primary base -- unless we later find there's another
|
|
|
|
|
nearly-empty virtual base that isn't an indirect
|
|
|
|
|
primary base. */
|
|
|
|
|
if (!candidate)
|
2000-07-31 02:24:44 +02:00
|
|
|
|
candidate = base_binfo;
|
2000-06-05 22:01:47 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we've got a primary base, use it. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
if (candidate)
|
2000-06-05 22:01:47 +02:00
|
|
|
|
{
|
2002-10-26 02:44:44 +02:00
|
|
|
|
set_primary_base (t, candidate);
|
2000-06-05 22:01:47 +02:00
|
|
|
|
CLASSTYPE_VFIELDS (t)
|
2000-07-31 02:24:44 +02:00
|
|
|
|
= copy_list (CLASSTYPE_VFIELDS (BINFO_TYPE (candidate)));
|
2000-06-05 22:01:47 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-01-12 21:56:15 +01:00
|
|
|
|
|
|
|
|
|
/* Mark the primary base classes at this point. */
|
2000-01-03 07:56:21 +01:00
|
|
|
|
mark_primary_bases (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 05:05:43 +01:00
|
|
|
|
/* Set memoizing fields and bits of T (and its variants) for later
|
|
|
|
|
use. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
finish_struct_bits (tree t)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
int i, n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
|
|
|
|
|
|
|
|
|
|
/* Fix up variants (if any). */
|
|
|
|
|
tree variants = TYPE_NEXT_VARIANT (t);
|
|
|
|
|
while (variants)
|
|
|
|
|
{
|
|
|
|
|
/* These fields are in the _TYPE part of the node, not in
|
|
|
|
|
the TYPE_LANG_SPECIFIC component, so they are not shared. */
|
|
|
|
|
TYPE_HAS_CONSTRUCTOR (variants) = TYPE_HAS_CONSTRUCTOR (t);
|
|
|
|
|
TYPE_HAS_DESTRUCTOR (variants) = TYPE_HAS_DESTRUCTOR (t);
|
|
|
|
|
TYPE_NEEDS_CONSTRUCTING (variants) = TYPE_NEEDS_CONSTRUCTING (t);
|
2000-03-03 03:27:15 +01:00
|
|
|
|
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (variants)
|
|
|
|
|
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-21 01:19:01 +01:00
|
|
|
|
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (variants)
|
|
|
|
|
= TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t);
|
|
|
|
|
TYPE_POLYMORPHIC_P (variants) = TYPE_POLYMORPHIC_P (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
TYPE_USES_VIRTUAL_BASECLASSES (variants) = TYPE_USES_VIRTUAL_BASECLASSES (t);
|
|
|
|
|
/* Copy whatever these are holding today. */
|
|
|
|
|
TYPE_MIN_VALUE (variants) = TYPE_MIN_VALUE (t);
|
|
|
|
|
TYPE_MAX_VALUE (variants) = TYPE_MAX_VALUE (t);
|
1996-02-28 23:01:56 +01:00
|
|
|
|
TYPE_FIELDS (variants) = TYPE_FIELDS (t);
|
1996-07-11 03:13:25 +02:00
|
|
|
|
TYPE_SIZE (variants) = TYPE_SIZE (t);
|
1998-08-17 19:23:38 +02:00
|
|
|
|
TYPE_SIZE_UNIT (variants) = TYPE_SIZE_UNIT (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
variants = TYPE_NEXT_VARIANT (variants);
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 05:05:43 +01:00
|
|
|
|
if (n_baseclasses && TYPE_POLYMORPHIC_P (t))
|
1999-12-29 07:39:42 +01:00
|
|
|
|
/* For a class w/o baseclasses, `finish_struct' has set
|
|
|
|
|
CLASS_TYPE_ABSTRACT_VIRTUALS correctly (by
|
|
|
|
|
definition). Similarly for a class whose base classes do not
|
|
|
|
|
have vtables. When neither of these is true, we might have
|
|
|
|
|
removed abstract virtuals (by providing a definition), added
|
|
|
|
|
some (by declaring new ones), or redeclared ones from a base
|
|
|
|
|
class. We need to recalculate what's really an abstract virtual
|
|
|
|
|
at this point (by looking in the vtables). */
|
|
|
|
|
get_pure_virtuals (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
if (n_baseclasses)
|
|
|
|
|
{
|
|
|
|
|
/* Notice whether this class has type conversion functions defined. */
|
|
|
|
|
tree binfo = TYPE_BINFO (t);
|
|
|
|
|
tree binfos = BINFO_BASETYPES (binfo);
|
|
|
|
|
tree basetype;
|
|
|
|
|
|
|
|
|
|
for (i = n_baseclasses-1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
basetype = BINFO_TYPE (TREE_VEC_ELT (binfos, i));
|
|
|
|
|
|
cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
* cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
* decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise.
* class.c (duplicate_tag_error): Likewise.
(finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN.
* tree.c (layout_vbasetypes): Update from layout_record, remove
var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE.
(layout_basetypes): Likewise.
From-SVN: r18965
1998-04-02 19:05:40 +02:00
|
|
|
|
TYPE_HAS_CONVERSION (t) |= TYPE_HAS_CONVERSION (basetype);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-18 12:24:24 +01:00
|
|
|
|
/* If this type has a copy constructor or a destructor, force its mode to
|
|
|
|
|
be BLKmode, and force its TREE_ADDRESSABLE bit to be nonzero. This
|
|
|
|
|
will cause it to be passed by invisible reference and prevent it from
|
2002-04-30 23:53:53 +02:00
|
|
|
|
being returned in a register. */
|
|
|
|
|
if (! TYPE_HAS_TRIVIAL_INIT_REF (t) || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1995-04-24 19:27:46 +02:00
|
|
|
|
tree variants;
|
1996-12-18 03:46:25 +01:00
|
|
|
|
DECL_MODE (TYPE_MAIN_DECL (t)) = BLKmode;
|
1995-04-24 19:27:46 +02:00
|
|
|
|
for (variants = t; variants; variants = TYPE_NEXT_VARIANT (variants))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
TYPE_MODE (variants) = BLKmode;
|
|
|
|
|
TREE_ADDRESSABLE (variants) = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-09-15 13:43:54 +02:00
|
|
|
|
/* Issue warnings about T having private constructors, but no friends,
|
|
|
|
|
and so forth.
|
1998-09-14 13:09:07 +02:00
|
|
|
|
|
1998-09-15 13:43:54 +02:00
|
|
|
|
HAS_NONPRIVATE_METHOD is nonzero if T has any non-private methods or
|
|
|
|
|
static members. HAS_NONPRIVATE_STATIC_FN is nonzero if T has any
|
|
|
|
|
non-private static member functions. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
maybe_warn_about_overly_private_class (tree t)
|
1998-09-14 13:09:07 +02:00
|
|
|
|
{
|
1998-09-20 14:30:50 +02:00
|
|
|
|
int has_member_fn = 0;
|
|
|
|
|
int has_nonprivate_method = 0;
|
|
|
|
|
tree fn;
|
|
|
|
|
|
|
|
|
|
if (!warn_ctor_dtor_privacy
|
1998-09-15 13:43:54 +02:00
|
|
|
|
/* If the class has friends, those entities might create and
|
|
|
|
|
access instances, so we should not warn. */
|
1998-09-20 14:30:50 +02:00
|
|
|
|
|| (CLASSTYPE_FRIEND_CLASSES (t)
|
|
|
|
|
|| DECL_FRIENDLIST (TYPE_MAIN_DECL (t)))
|
1998-09-15 13:43:54 +02:00
|
|
|
|
/* We will have warned when the template was declared; there's
|
|
|
|
|
no need to warn on every instantiation. */
|
1998-09-20 14:30:50 +02:00
|
|
|
|
|| CLASSTYPE_TEMPLATE_INSTANTIATION (t))
|
|
|
|
|
/* There's no reason to even consider warning about this
|
|
|
|
|
class. */
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* We only issue one warning, if more than one applies, because
|
|
|
|
|
otherwise, on code like:
|
|
|
|
|
|
|
|
|
|
class A {
|
|
|
|
|
// Oops - forgot `public:'
|
|
|
|
|
A();
|
|
|
|
|
A(const A&);
|
|
|
|
|
~A();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
we warn several times about essentially the same problem. */
|
|
|
|
|
|
|
|
|
|
/* Check to see if all (non-constructor, non-destructor) member
|
|
|
|
|
functions are private. (Since there are no friends or
|
|
|
|
|
non-private statics, we can't ever call any of the private member
|
|
|
|
|
functions.) */
|
|
|
|
|
for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
|
|
|
|
|
/* We're not interested in compiler-generated methods; they don't
|
|
|
|
|
provide any way to call private members. */
|
|
|
|
|
if (!DECL_ARTIFICIAL (fn))
|
|
|
|
|
{
|
|
|
|
|
if (!TREE_PRIVATE (fn))
|
1998-09-15 13:43:54 +02:00
|
|
|
|
{
|
1998-09-20 14:30:50 +02:00
|
|
|
|
if (DECL_STATIC_FUNCTION_P (fn))
|
|
|
|
|
/* A non-private static member function is just like a
|
|
|
|
|
friend; it can create and invoke private member
|
|
|
|
|
functions, and be accessed without a class
|
|
|
|
|
instance. */
|
|
|
|
|
return;
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
has_nonprivate_method = 1;
|
2003-01-13 10:14:47 +01:00
|
|
|
|
/* Keep searching for a static member function. */
|
1998-09-20 14:30:50 +02:00
|
|
|
|
}
|
1998-10-15 13:36:46 +02:00
|
|
|
|
else if (!DECL_CONSTRUCTOR_P (fn) && !DECL_DESTRUCTOR_P (fn))
|
1998-09-20 14:30:50 +02:00
|
|
|
|
has_member_fn = 1;
|
|
|
|
|
}
|
1998-09-14 13:09:07 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
if (!has_nonprivate_method && has_member_fn)
|
|
|
|
|
{
|
1998-10-15 13:36:46 +02:00
|
|
|
|
/* There are no non-private methods, and there's at least one
|
|
|
|
|
private member function that isn't a constructor or
|
|
|
|
|
destructor. (If all the private members are
|
|
|
|
|
constructors/destructors we want to use the code below that
|
|
|
|
|
issues error messages specifically referring to
|
|
|
|
|
constructors/destructors.) */
|
1998-09-20 14:30:50 +02:00
|
|
|
|
int i;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree binfo = TYPE_BINFO (t);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < BINFO_N_BASETYPES (binfo); i++)
|
|
|
|
|
if (BINFO_BASEACCESS (binfo, i) != access_private_node)
|
1998-09-20 14:30:50 +02:00
|
|
|
|
{
|
|
|
|
|
has_nonprivate_method = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!has_nonprivate_method)
|
1998-09-15 13:43:54 +02:00
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("all member functions in class `%T' are private", t);
|
1998-09-20 14:30:50 +02:00
|
|
|
|
return;
|
1998-09-15 13:43:54 +02:00
|
|
|
|
}
|
1998-09-20 14:30:50 +02:00
|
|
|
|
}
|
1998-09-14 13:09:07 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
/* Even if some of the member functions are non-private, the class
|
|
|
|
|
won't be useful for much if all the constructors or destructors
|
|
|
|
|
are private: such an object can never be created or destroyed. */
|
|
|
|
|
if (TYPE_HAS_DESTRUCTOR (t))
|
|
|
|
|
{
|
|
|
|
|
tree dtor = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1);
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
if (TREE_PRIVATE (dtor))
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("`%#T' only defines a private destructor and has no friends",
|
1998-09-20 14:30:50 +02:00
|
|
|
|
t);
|
|
|
|
|
return;
|
1998-09-15 13:43:54 +02:00
|
|
|
|
}
|
1998-09-20 14:30:50 +02:00
|
|
|
|
}
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
if (TYPE_HAS_CONSTRUCTOR (t))
|
|
|
|
|
{
|
|
|
|
|
int nonprivate_ctor = 0;
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
/* If a non-template class does not define a copy
|
|
|
|
|
constructor, one is defined for it, enabling it to avoid
|
|
|
|
|
this warning. For a template class, this does not
|
|
|
|
|
happen, and so we would normally get a warning on:
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
template <class T> class C { private: C(); };
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
To avoid this asymmetry, we check TYPE_HAS_INIT_REF. All
|
|
|
|
|
complete non-template or fully instantiated classes have this
|
|
|
|
|
flag set. */
|
|
|
|
|
if (!TYPE_HAS_INIT_REF (t))
|
|
|
|
|
nonprivate_ctor = 1;
|
|
|
|
|
else
|
|
|
|
|
for (fn = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 0);
|
|
|
|
|
fn;
|
|
|
|
|
fn = OVL_NEXT (fn))
|
|
|
|
|
{
|
|
|
|
|
tree ctor = OVL_CURRENT (fn);
|
|
|
|
|
/* Ideally, we wouldn't count copy constructors (or, in
|
|
|
|
|
fact, any constructor that takes an argument of the
|
|
|
|
|
class type as a parameter) because such things cannot
|
|
|
|
|
be used to construct an instance of the class unless
|
|
|
|
|
you already have one. But, for now at least, we're
|
|
|
|
|
more generous. */
|
|
|
|
|
if (! TREE_PRIVATE (ctor))
|
1998-09-15 13:43:54 +02:00
|
|
|
|
{
|
1998-09-20 14:30:50 +02:00
|
|
|
|
nonprivate_ctor = 1;
|
|
|
|
|
break;
|
1998-09-15 13:43:54 +02:00
|
|
|
|
}
|
1998-09-20 14:30:50 +02:00
|
|
|
|
}
|
1998-09-14 13:09:07 +02:00
|
|
|
|
|
1998-09-20 14:30:50 +02:00
|
|
|
|
if (nonprivate_ctor == 0)
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("`%#T' only defines private constructors and has no friends",
|
1998-09-20 14:30:50 +02:00
|
|
|
|
t);
|
|
|
|
|
return;
|
1998-09-15 13:43:54 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-09-14 13:09:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
static struct {
|
|
|
|
|
gt_pointer_operator new_value;
|
|
|
|
|
void *cookie;
|
|
|
|
|
} resort_data;
|
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
/* Comparison function to compare two TYPE_METHOD_VEC entries by name. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
method_name_cmp (const void* m1_p, const void* m2_p)
|
1999-07-09 18:15:04 +02:00
|
|
|
|
{
|
2003-01-10 03:22:34 +01:00
|
|
|
|
const tree *const m1 = m1_p;
|
|
|
|
|
const tree *const m2 = m2_p;
|
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
if (*m1 == NULL_TREE && *m2 == NULL_TREE)
|
|
|
|
|
return 0;
|
|
|
|
|
if (*m1 == NULL_TREE)
|
|
|
|
|
return -1;
|
|
|
|
|
if (*m2 == NULL_TREE)
|
|
|
|
|
return 1;
|
|
|
|
|
if (DECL_NAME (OVL_CURRENT (*m1)) < DECL_NAME (OVL_CURRENT (*m2)))
|
|
|
|
|
return -1;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
1998-09-15 13:43:54 +02:00
|
|
|
|
|
2003-01-10 03:22:34 +01:00
|
|
|
|
/* This routine compares two fields like method_name_cmp but using the
|
|
|
|
|
pointer operator in resort_field_decl_data. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
resort_method_name_cmp (const void* m1_p, const void* m2_p)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
const tree *const m1 = m1_p;
|
|
|
|
|
const tree *const m2 = m2_p;
|
|
|
|
|
if (*m1 == NULL_TREE && *m2 == NULL_TREE)
|
|
|
|
|
return 0;
|
|
|
|
|
if (*m1 == NULL_TREE)
|
|
|
|
|
return -1;
|
|
|
|
|
if (*m2 == NULL_TREE)
|
|
|
|
|
return 1;
|
|
|
|
|
{
|
|
|
|
|
tree d1 = DECL_NAME (OVL_CURRENT (*m1));
|
|
|
|
|
tree d2 = DECL_NAME (OVL_CURRENT (*m2));
|
|
|
|
|
resort_data.new_value (&d1, resort_data.cookie);
|
|
|
|
|
resort_data.new_value (&d2, resort_data.cookie);
|
|
|
|
|
if (d1 < d2)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Resort TYPE_METHOD_VEC because pointers have been reordered. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
resort_type_method_vec (void* obj,
|
|
|
|
|
void* orig_obj ATTRIBUTE_UNUSED ,
|
|
|
|
|
gt_pointer_operator new_value,
|
|
|
|
|
void* cookie)
|
2003-01-10 03:22:34 +01:00
|
|
|
|
{
|
|
|
|
|
tree method_vec = obj;
|
|
|
|
|
int len = TREE_VEC_LENGTH (method_vec);
|
|
|
|
|
int slot;
|
|
|
|
|
|
|
|
|
|
/* The type conversion ops have to live at the front of the vec, so we
|
|
|
|
|
can't sort them. */
|
|
|
|
|
for (slot = 2; slot < len; ++slot)
|
|
|
|
|
{
|
|
|
|
|
tree fn = TREE_VEC_ELT (method_vec, slot);
|
|
|
|
|
|
|
|
|
|
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (len - slot > 1)
|
|
|
|
|
{
|
|
|
|
|
resort_data.new_value = new_value;
|
|
|
|
|
resort_data.cookie = cookie;
|
|
|
|
|
qsort (&TREE_VEC_ELT (method_vec, slot), len - slot, sizeof (tree),
|
|
|
|
|
resort_method_name_cmp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* Warn about duplicate methods in fn_fields. Also compact method
|
|
|
|
|
lists so that lookup can be made faster.
|
|
|
|
|
|
|
|
|
|
Data Structure: List of method lists. The outer list is a
|
|
|
|
|
TREE_LIST, whose TREE_PURPOSE field is the field name and the
|
1995-01-24 09:19:58 +01:00
|
|
|
|
TREE_VALUE is the DECL_CHAIN of the FUNCTION_DECLs. TREE_CHAIN
|
|
|
|
|
links the entire list of methods for TYPE_METHODS. Friends are
|
|
|
|
|
chained in the same way as member functions (? TREE_CHAIN or
|
|
|
|
|
DECL_CHAIN), but they live in the TREE_TYPE field of the outer
|
|
|
|
|
list. That allows them to be quickly deleted, and requires no
|
|
|
|
|
extra storage.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-04-11 09:39:05 +02:00
|
|
|
|
Sort methods that are not special (i.e., constructors, destructors,
|
|
|
|
|
and type conversion operators) so that we can find them faster in
|
|
|
|
|
search. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-09-15 13:43:54 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
finish_struct_methods (tree t)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1998-09-15 13:43:54 +02:00
|
|
|
|
tree fn_fields;
|
1999-12-16 04:10:12 +01:00
|
|
|
|
tree method_vec;
|
|
|
|
|
int slot, len;
|
|
|
|
|
|
|
|
|
|
if (!TYPE_METHODS (t))
|
|
|
|
|
{
|
|
|
|
|
/* Clear these for safety; perhaps some parsing error could set
|
|
|
|
|
these incorrectly. */
|
|
|
|
|
TYPE_HAS_CONSTRUCTOR (t) = 0;
|
|
|
|
|
TYPE_HAS_DESTRUCTOR (t) = 0;
|
|
|
|
|
CLASSTYPE_METHOD_VEC (t) = NULL_TREE;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
method_vec = CLASSTYPE_METHOD_VEC (t);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
my_friendly_assert (method_vec != NULL_TREE, 19991215);
|
1999-12-16 04:10:12 +01:00
|
|
|
|
len = TREE_VEC_LENGTH (method_vec);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1996-03-21 20:46:11 +01:00
|
|
|
|
/* First fill in entry 0 with the constructors, entry 1 with destructors,
|
|
|
|
|
and the next few with type conversion operators (if any). */
|
1998-09-15 13:43:54 +02:00
|
|
|
|
for (fn_fields = TYPE_METHODS (t); fn_fields;
|
|
|
|
|
fn_fields = TREE_CHAIN (fn_fields))
|
2000-04-11 09:39:05 +02:00
|
|
|
|
/* Clear out this flag. */
|
|
|
|
|
DECL_IN_AGGR_P (fn_fields) = 0;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-04-18 22:21:39 +02:00
|
|
|
|
if (TYPE_HAS_DESTRUCTOR (t) && !CLASSTYPE_DESTRUCTORS (t))
|
1998-09-15 13:43:54 +02:00
|
|
|
|
/* We thought there was a destructor, but there wasn't. Some
|
|
|
|
|
parse errors cause this anomalous situation. */
|
|
|
|
|
TYPE_HAS_DESTRUCTOR (t) = 0;
|
|
|
|
|
|
|
|
|
|
/* Issue warnings about private constructors and such. If there are
|
|
|
|
|
no methods, then some public defaults are generated. */
|
1999-07-09 18:15:04 +02:00
|
|
|
|
maybe_warn_about_overly_private_class (t);
|
|
|
|
|
|
|
|
|
|
/* Now sort the methods. */
|
|
|
|
|
while (len > 2 && TREE_VEC_ELT (method_vec, len-1) == NULL_TREE)
|
|
|
|
|
len--;
|
|
|
|
|
TREE_VEC_LENGTH (method_vec) = len;
|
|
|
|
|
|
|
|
|
|
/* The type conversion ops have to live at the front of the vec, so we
|
|
|
|
|
can't sort them. */
|
|
|
|
|
for (slot = 2; slot < len; ++slot)
|
|
|
|
|
{
|
|
|
|
|
tree fn = TREE_VEC_ELT (method_vec, slot);
|
|
|
|
|
|
|
|
|
|
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (len - slot > 1)
|
|
|
|
|
qsort (&TREE_VEC_ELT (method_vec, slot), len-slot, sizeof (tree),
|
2003-01-10 03:22:34 +01:00
|
|
|
|
method_name_cmp);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-21 17:55:40 +02:00
|
|
|
|
/* Make BINFO's vtable have N entries, including RTTI entries,
|
2000-02-21 05:19:12 +01:00
|
|
|
|
vbase and vcall offsets, etc. Set its type and call the backend
|
|
|
|
|
to lay it out. */
|
2000-01-26 00:26:21 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
layout_vtable_decl (tree binfo, int n)
|
2000-01-26 00:26:21 +01:00
|
|
|
|
{
|
|
|
|
|
tree atype;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree vtable;
|
2000-01-26 00:26:21 +01:00
|
|
|
|
|
|
|
|
|
atype = build_cplus_array_type (vtable_entry_type,
|
2001-06-05 13:53:28 +02:00
|
|
|
|
build_index_type (size_int (n - 1)));
|
2000-01-26 00:26:21 +01:00
|
|
|
|
layout_type (atype);
|
|
|
|
|
|
|
|
|
|
/* We may have to grow the vtable. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
vtable = get_vtbl_decl_for_binfo (binfo);
|
|
|
|
|
if (!same_type_p (TREE_TYPE (vtable), atype))
|
2000-01-26 00:26:21 +01:00
|
|
|
|
{
|
c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
From-SVN: r32068
2000-02-20 02:11:00 +01:00
|
|
|
|
TREE_TYPE (vtable) = atype;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
DECL_SIZE (vtable) = DECL_SIZE_UNIT (vtable) = NULL_TREE;
|
c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
From-SVN: r32068
2000-02-20 02:11:00 +01:00
|
|
|
|
layout_decl (vtable, 0);
|
2000-01-26 00:26:21 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-06-12 22:46:28 +02:00
|
|
|
|
/* True iff FNDECL and BASE_FNDECL (both non-static member functions)
|
|
|
|
|
have the same signature. */
|
1999-07-27 20:15:21 +02:00
|
|
|
|
|
2001-02-18 20:08:00 +01:00
|
|
|
|
int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
same_signature_p (tree fndecl, tree base_fndecl)
|
1999-07-27 20:15:21 +02:00
|
|
|
|
{
|
2000-05-04 16:54:18 +02:00
|
|
|
|
/* One destructor overrides another if they are the same kind of
|
|
|
|
|
destructor. */
|
|
|
|
|
if (DECL_DESTRUCTOR_P (base_fndecl) && DECL_DESTRUCTOR_P (fndecl)
|
|
|
|
|
&& special_function_p (base_fndecl) == special_function_p (fndecl))
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return 1;
|
2000-05-04 16:54:18 +02:00
|
|
|
|
/* But a non-destructor never overrides a destructor, nor vice
|
|
|
|
|
versa, nor do different kinds of destructors override
|
|
|
|
|
one-another. For example, a complete object destructor does not
|
|
|
|
|
override a deleting destructor. */
|
2000-04-18 22:21:39 +02:00
|
|
|
|
if (DECL_DESTRUCTOR_P (base_fndecl) || DECL_DESTRUCTOR_P (fndecl))
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return 0;
|
2000-05-04 16:54:18 +02:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
if (DECL_NAME (fndecl) == DECL_NAME (base_fndecl))
|
1999-07-27 20:15:21 +02:00
|
|
|
|
{
|
2000-03-29 09:36:39 +02:00
|
|
|
|
tree types, base_types;
|
|
|
|
|
types = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
|
|
|
|
|
base_types = TYPE_ARG_TYPES (TREE_TYPE (base_fndecl));
|
|
|
|
|
if ((TYPE_QUALS (TREE_TYPE (TREE_VALUE (base_types)))
|
|
|
|
|
== TYPE_QUALS (TREE_TYPE (TREE_VALUE (types))))
|
|
|
|
|
&& compparms (TREE_CHAIN (base_types), TREE_CHAIN (types)))
|
|
|
|
|
return 1;
|
1999-07-27 20:15:21 +02:00
|
|
|
|
}
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return 0;
|
1999-07-27 20:15:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-18 11:21:06 +02:00
|
|
|
|
/* Returns TRUE if DERIVED is a binfo containing the binfo BASE as a
|
|
|
|
|
subobject. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
base_derived_from (tree derived, tree base)
|
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree probe;
|
|
|
|
|
|
|
|
|
|
for (probe = base; probe; probe = BINFO_INHERITANCE_CHAIN (probe))
|
|
|
|
|
{
|
|
|
|
|
if (probe == derived)
|
|
|
|
|
return true;
|
|
|
|
|
else if (TREE_VIA_VIRTUAL (probe))
|
|
|
|
|
/* If we meet a virtual base, we can't follow the inheritance
|
|
|
|
|
any more. See if the complete type of DERIVED contains
|
|
|
|
|
such a virtual base. */
|
|
|
|
|
return purpose_member (BINFO_TYPE (probe),
|
|
|
|
|
CLASSTYPE_VBASECLASSES (BINFO_TYPE (derived)))
|
|
|
|
|
!= NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2002-10-18 11:21:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
typedef struct find_final_overrider_data_s {
|
|
|
|
|
/* The function for which we are trying to find a final overrider. */
|
|
|
|
|
tree fn;
|
|
|
|
|
/* The base class in which the function was declared. */
|
|
|
|
|
tree declaring_base;
|
|
|
|
|
/* The most derived class in the hierarchy. */
|
|
|
|
|
tree most_derived_type;
|
2002-10-18 11:21:06 +02:00
|
|
|
|
/* The candidate overriders. */
|
2001-04-10 20:06:26 +02:00
|
|
|
|
tree candidates;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
/* Binfos which inherited virtually on the currrent path. */
|
|
|
|
|
tree vpath;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
} find_final_overrider_data;
|
2000-02-21 05:19:12 +01:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
/* Called from find_final_overrider via dfs_walk. */
|
2000-02-21 05:19:12 +01:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dfs_find_final_overrider (tree binfo, void* data)
|
1994-04-22 01:30:18 +02:00
|
|
|
|
{
|
2000-03-29 09:36:39 +02:00
|
|
|
|
find_final_overrider_data *ffod = (find_final_overrider_data *) data;
|
2000-03-22 22:43:45 +01:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (binfo == ffod->declaring_base)
|
|
|
|
|
{
|
|
|
|
|
/* We've found a path to the declaring base. Walk the path from
|
|
|
|
|
derived to base, looking for an overrider for FN. */
|
|
|
|
|
tree path, probe, vpath;
|
|
|
|
|
|
|
|
|
|
/* Build the path, using the inheritance chain and record of
|
|
|
|
|
virtual inheritance. */
|
|
|
|
|
for (path = NULL_TREE, probe = binfo, vpath = ffod->vpath;;)
|
2000-02-21 05:19:12 +01:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
path = tree_cons (NULL_TREE, probe, path);
|
|
|
|
|
if (same_type_p (BINFO_TYPE (probe), ffod->most_derived_type))
|
|
|
|
|
break;
|
|
|
|
|
if (TREE_VIA_VIRTUAL (probe))
|
|
|
|
|
{
|
|
|
|
|
probe = TREE_VALUE (vpath);
|
|
|
|
|
vpath = TREE_CHAIN (vpath);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
probe = BINFO_INHERITANCE_CHAIN (probe);
|
|
|
|
|
}
|
|
|
|
|
/* Now walk path, looking for overrides. */
|
|
|
|
|
for (; path; path = TREE_CHAIN (path))
|
|
|
|
|
{
|
|
|
|
|
tree method = look_for_overrides_here
|
|
|
|
|
(BINFO_TYPE (TREE_VALUE (path)), ffod->fn);
|
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
if (method)
|
2002-10-18 11:21:06 +02:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree *candidate = &ffod->candidates;
|
2002-10-18 11:21:06 +02:00
|
|
|
|
path = TREE_VALUE (path);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
|
|
|
|
|
/* Remove any candidates overridden by this new function. */
|
|
|
|
|
while (*candidate)
|
|
|
|
|
{
|
|
|
|
|
/* If *CANDIDATE overrides METHOD, then METHOD
|
|
|
|
|
cannot override anything else on the list. */
|
|
|
|
|
if (base_derived_from (TREE_VALUE (*candidate), path))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
/* If METHOD overrides *CANDIDATE, remove *CANDIDATE. */
|
|
|
|
|
if (base_derived_from (path, TREE_VALUE (*candidate)))
|
|
|
|
|
*candidate = TREE_CHAIN (*candidate);
|
|
|
|
|
else
|
|
|
|
|
candidate = &TREE_CHAIN (*candidate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add the new function. */
|
|
|
|
|
ffod->candidates = tree_cons (method, path, ffod->candidates);
|
2002-10-18 11:21:06 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2000-01-31 22:00:01 +01:00
|
|
|
|
}
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
}
|
2000-01-31 22:00:01 +01:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
2000-06-14 18:10:14 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static tree
|
|
|
|
|
dfs_find_final_overrider_q (tree derived, int ix, void *data)
|
|
|
|
|
{
|
|
|
|
|
tree binfo = BINFO_BASETYPE (derived, ix);
|
|
|
|
|
find_final_overrider_data *ffod = (find_final_overrider_data *) data;
|
2001-04-10 20:06:26 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
ffod->vpath = tree_cons (NULL_TREE, derived, ffod->vpath);
|
|
|
|
|
|
|
|
|
|
return binfo;
|
|
|
|
|
}
|
2000-01-12 21:56:15 +01:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static tree
|
|
|
|
|
dfs_find_final_overrider_post (tree binfo, void *data)
|
|
|
|
|
{
|
|
|
|
|
find_final_overrider_data *ffod = (find_final_overrider_data *) data;
|
|
|
|
|
|
|
|
|
|
if (TREE_VIA_VIRTUAL (binfo) && TREE_CHAIN (ffod->vpath))
|
|
|
|
|
ffod->vpath = TREE_CHAIN (ffod->vpath);
|
|
|
|
|
|
2000-01-12 21:56:15 +01:00
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
/* Returns a TREE_LIST whose TREE_PURPOSE is the final overrider for
|
|
|
|
|
FN and whose TREE_VALUE is the binfo for the base where the
|
2002-11-14 17:59:23 +01:00
|
|
|
|
overriding occurs. BINFO (in the hierarchy dominated by the binfo
|
|
|
|
|
DERIVED) is the base object in which FN is declared. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-08-05 22:25:20 +02:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
find_final_overrider (tree derived, tree binfo, tree fn)
|
1994-08-05 22:25:20 +02:00
|
|
|
|
{
|
2000-01-31 22:00:01 +01:00
|
|
|
|
find_final_overrider_data ffod;
|
1994-08-05 22:25:20 +02:00
|
|
|
|
|
2002-08-09 03:16:39 +02:00
|
|
|
|
/* Getting this right is a little tricky. This is valid:
|
1994-08-05 22:25:20 +02:00
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
struct S { virtual void f (); };
|
|
|
|
|
struct T { virtual void f (); };
|
|
|
|
|
struct U : public S, public T { };
|
1994-08-05 22:25:20 +02:00
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
even though calling `f' in `U' is ambiguous. But,
|
1994-08-05 22:25:20 +02:00
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
struct R { virtual void f(); };
|
|
|
|
|
struct S : virtual public R { virtual void f (); };
|
|
|
|
|
struct T : virtual public R { virtual void f (); };
|
|
|
|
|
struct U : public S, public T { };
|
2000-01-12 21:56:15 +01:00
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
is not -- there's no way to decide whether to put `S::f' or
|
2000-01-31 22:00:01 +01:00
|
|
|
|
`T::f' in the vtable for `R'.
|
|
|
|
|
|
|
|
|
|
The solution is to look at all paths to BINFO. If we find
|
|
|
|
|
different overriders along any two, then there is a problem. */
|
2002-12-30 14:39:48 +01:00
|
|
|
|
if (DECL_THUNK_P (fn))
|
|
|
|
|
fn = THUNK_TARGET (fn);
|
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
ffod.fn = fn;
|
|
|
|
|
ffod.declaring_base = binfo;
|
2002-11-14 17:59:23 +01:00
|
|
|
|
ffod.most_derived_type = BINFO_TYPE (derived);
|
2001-04-10 20:06:26 +02:00
|
|
|
|
ffod.candidates = NULL_TREE;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
ffod.vpath = NULL_TREE;
|
2001-04-10 20:06:26 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
dfs_walk_real (derived,
|
|
|
|
|
dfs_find_final_overrider,
|
|
|
|
|
dfs_find_final_overrider_post,
|
|
|
|
|
dfs_find_final_overrider_q,
|
|
|
|
|
&ffod);
|
2000-01-31 22:00:01 +01:00
|
|
|
|
|
2001-04-10 20:06:26 +02:00
|
|
|
|
/* If there was no winner, issue an error message. */
|
2002-10-18 11:21:06 +02:00
|
|
|
|
if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
|
2001-06-06 23:52:52 +02:00
|
|
|
|
{
|
2002-11-14 17:59:23 +01:00
|
|
|
|
error ("no unique final overrider for `%D' in `%T'", fn,
|
|
|
|
|
BINFO_TYPE (derived));
|
2001-06-06 23:52:52 +02:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
2000-01-12 21:56:15 +01:00
|
|
|
|
|
2002-10-18 11:21:06 +02:00
|
|
|
|
return ffod.candidates;
|
1994-08-05 22:25:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-04 02:45:58 +01:00
|
|
|
|
/* Return the index of the vcall offset for FN when TYPE is used as a
|
|
|
|
|
virtual base. */
|
2001-06-06 23:52:52 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2002-11-04 02:45:58 +01:00
|
|
|
|
get_vcall_index (tree fn, tree type)
|
2001-06-06 23:52:52 +02:00
|
|
|
|
{
|
2002-11-04 02:45:58 +01:00
|
|
|
|
tree v;
|
2001-06-06 23:52:52 +02:00
|
|
|
|
|
2002-11-04 02:45:58 +01:00
|
|
|
|
for (v = CLASSTYPE_VCALL_INDICES (type); v; v = TREE_CHAIN (v))
|
|
|
|
|
if ((DECL_DESTRUCTOR_P (fn) && DECL_DESTRUCTOR_P (TREE_PURPOSE (v)))
|
|
|
|
|
|| same_signature_p (fn, TREE_PURPOSE (v)))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* There should always be an appropriate index. */
|
|
|
|
|
my_friendly_assert (v, 20021103);
|
|
|
|
|
|
|
|
|
|
return TREE_VALUE (v);
|
2001-06-06 23:52:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Update an entry in the vtable for BINFO, which is in the hierarchy
|
2002-12-20 17:11:41 +01:00
|
|
|
|
dominated by T. FN has been overridden in BINFO; VIRTUALS points to the
|
2001-06-06 23:52:52 +02:00
|
|
|
|
corresponding position in the BINFO_VIRTUALS list. */
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-28 00:29:50 +01:00
|
|
|
|
update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
|
|
|
|
|
unsigned ix)
|
2000-04-16 21:45:32 +02:00
|
|
|
|
{
|
|
|
|
|
tree b;
|
|
|
|
|
tree overrider;
|
|
|
|
|
tree delta;
|
2000-06-23 03:14:40 +02:00
|
|
|
|
tree virtual_base;
|
2001-06-06 23:52:52 +02:00
|
|
|
|
tree first_defn;
|
2002-12-31 20:43:16 +01:00
|
|
|
|
tree overrider_fn, overrider_target;
|
|
|
|
|
tree target_fn = DECL_THUNK_P (fn) ? THUNK_TARGET (fn) : fn;
|
|
|
|
|
tree over_return, base_return;
|
2002-01-04 15:02:14 +01:00
|
|
|
|
bool lost = false;
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* Find the nearest primary base (possibly binfo itself) which defines
|
|
|
|
|
this function; this is the class the caller will convert to when
|
|
|
|
|
calling FN through BINFO. */
|
|
|
|
|
for (b = binfo; ; b = get_primary_binfo (b))
|
2000-04-16 21:45:32 +02:00
|
|
|
|
{
|
2002-12-30 14:39:48 +01:00
|
|
|
|
my_friendly_assert (b, 20021227);
|
2002-12-31 20:43:16 +01:00
|
|
|
|
if (look_for_overrides_here (BINFO_TYPE (b), target_fn))
|
2000-06-23 03:14:40 +02:00
|
|
|
|
break;
|
2002-01-04 15:02:14 +01:00
|
|
|
|
|
|
|
|
|
/* The nearest definition is from a lost primary. */
|
|
|
|
|
if (BINFO_LOST_PRIMARY_P (b))
|
|
|
|
|
lost = true;
|
2000-04-16 21:45:32 +02:00
|
|
|
|
}
|
2001-06-06 23:52:52 +02:00
|
|
|
|
first_defn = b;
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
2000-06-23 03:14:40 +02:00
|
|
|
|
/* Find the final overrider. */
|
2002-12-31 20:43:16 +01:00
|
|
|
|
overrider = find_final_overrider (TYPE_BINFO (t), b, target_fn);
|
2000-04-16 21:45:32 +02:00
|
|
|
|
if (overrider == error_mark_node)
|
|
|
|
|
return;
|
2002-12-31 20:43:16 +01:00
|
|
|
|
overrider_target = overrider_fn = TREE_PURPOSE (overrider);
|
|
|
|
|
|
2003-07-07 01:23:46 +02:00
|
|
|
|
/* Check for adjusting covariant return types. */
|
2002-12-31 20:43:16 +01:00
|
|
|
|
over_return = TREE_TYPE (TREE_TYPE (overrider_target));
|
|
|
|
|
base_return = TREE_TYPE (TREE_TYPE (target_fn));
|
|
|
|
|
|
|
|
|
|
if (POINTER_TYPE_P (over_return)
|
|
|
|
|
&& TREE_CODE (over_return) == TREE_CODE (base_return)
|
|
|
|
|
&& CLASS_TYPE_P (TREE_TYPE (over_return))
|
|
|
|
|
&& CLASS_TYPE_P (TREE_TYPE (base_return)))
|
|
|
|
|
{
|
|
|
|
|
/* If FN is a covariant thunk, we must figure out the adjustment
|
|
|
|
|
to the final base FN was converting to. As OVERRIDER_TARGET might
|
|
|
|
|
also be converting to the return type of FN, we have to
|
|
|
|
|
combine the two conversions here. */
|
|
|
|
|
tree fixed_offset, virtual_offset;
|
|
|
|
|
|
|
|
|
|
if (DECL_THUNK_P (fn))
|
|
|
|
|
{
|
|
|
|
|
fixed_offset = ssize_int (THUNK_FIXED_OFFSET (fn));
|
|
|
|
|
virtual_offset = THUNK_VIRTUAL_OFFSET (fn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fixed_offset = virtual_offset = NULL_TREE;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
|
2002-12-31 20:43:16 +01:00
|
|
|
|
if (!virtual_offset)
|
|
|
|
|
{
|
|
|
|
|
/* There was no existing virtual thunk (which takes
|
2003-07-07 01:23:46 +02:00
|
|
|
|
precidence). */
|
2002-12-31 20:43:16 +01:00
|
|
|
|
tree thunk_binfo;
|
|
|
|
|
base_kind kind;
|
|
|
|
|
|
|
|
|
|
thunk_binfo = lookup_base (TREE_TYPE (over_return),
|
|
|
|
|
TREE_TYPE (base_return),
|
|
|
|
|
ba_check | ba_quiet, &kind);
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
2002-12-31 20:43:16 +01:00
|
|
|
|
if (thunk_binfo && (kind == bk_via_virtual
|
|
|
|
|
|| !BINFO_OFFSET_ZEROP (thunk_binfo)))
|
|
|
|
|
{
|
|
|
|
|
tree offset = BINFO_OFFSET (thunk_binfo);
|
2002-04-25 20:04:50 +02:00
|
|
|
|
|
2002-12-31 20:43:16 +01:00
|
|
|
|
if (kind == bk_via_virtual)
|
|
|
|
|
{
|
|
|
|
|
/* We convert via virtual base. Find the virtual
|
|
|
|
|
base and adjust the fixed offset to be from there. */
|
|
|
|
|
while (!TREE_VIA_VIRTUAL (thunk_binfo))
|
|
|
|
|
thunk_binfo = BINFO_INHERITANCE_CHAIN (thunk_binfo);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
|
|
|
|
|
virtual_offset = thunk_binfo;
|
2003-01-28 00:29:50 +01:00
|
|
|
|
offset = size_binop (MINUS_EXPR, offset,
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_OFFSET (virtual_offset));
|
2002-12-31 20:43:16 +01:00
|
|
|
|
}
|
|
|
|
|
if (fixed_offset)
|
|
|
|
|
/* There was an existing fixed offset, this must be
|
|
|
|
|
from the base just converted to, and the base the
|
|
|
|
|
FN was thunking to. */
|
|
|
|
|
fixed_offset = size_binop (PLUS_EXPR, fixed_offset, offset);
|
|
|
|
|
else
|
|
|
|
|
fixed_offset = offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fixed_offset || virtual_offset)
|
|
|
|
|
/* Replace the overriding function with a covariant thunk. We
|
|
|
|
|
will emit the overriding function in its own slot as
|
2003-07-07 01:23:46 +02:00
|
|
|
|
well. */
|
2002-12-31 20:43:16 +01:00
|
|
|
|
overrider_fn = make_thunk (overrider_target, /*this_adjusting=*/0,
|
|
|
|
|
fixed_offset, virtual_offset);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
my_friendly_assert (!DECL_THUNK_P (fn), 20021231);
|
|
|
|
|
|
2000-06-23 03:14:40 +02:00
|
|
|
|
/* Assume that we will produce a thunk that convert all the way to
|
|
|
|
|
the final overrider, and not to an intermediate virtual base. */
|
2000-06-28 22:41:27 +02:00
|
|
|
|
virtual_base = NULL_TREE;
|
2000-06-23 03:14:40 +02:00
|
|
|
|
|
2002-01-04 15:02:14 +01:00
|
|
|
|
/* See if we can convert to an intermediate virtual base first, and then
|
2001-07-21 02:03:21 +02:00
|
|
|
|
use the vcall offset located there to finish the conversion. */
|
2002-01-04 15:02:14 +01:00
|
|
|
|
for (; b; b = BINFO_INHERITANCE_CHAIN (b))
|
2000-04-16 21:45:32 +02:00
|
|
|
|
{
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* If we find the final overrider, then we can stop
|
|
|
|
|
walking. */
|
2001-02-12 10:58:18 +01:00
|
|
|
|
if (same_type_p (BINFO_TYPE (b),
|
|
|
|
|
BINFO_TYPE (TREE_VALUE (overrider))))
|
|
|
|
|
break;
|
2000-06-23 03:14:40 +02:00
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* If we find a virtual base, and we haven't yet found the
|
|
|
|
|
overrider, then there is a virtual base between the
|
|
|
|
|
declaring base (first_defn) and the final overrider. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (TREE_VIA_VIRTUAL (b))
|
|
|
|
|
{
|
|
|
|
|
virtual_base = b;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-04-16 21:45:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
2003-01-28 00:29:50 +01:00
|
|
|
|
if (overrider_fn != overrider_target && !virtual_base)
|
|
|
|
|
{
|
|
|
|
|
/* The ABI specifies that a covariant thunk includes a mangling
|
|
|
|
|
for a this pointer adjustment. This-adjusting thunks that
|
|
|
|
|
override a function from a virtual base have a vcall
|
|
|
|
|
adjustment. When the virtual base in question is a primary
|
|
|
|
|
virtual base, we know the adjustments are zero, (and in the
|
|
|
|
|
non-covariant case, we would not use the thunk).
|
|
|
|
|
Unfortunately we didn't notice this could happen, when
|
|
|
|
|
designing the ABI and so never mandated that such a covariant
|
|
|
|
|
thunk should be emitted. Because we must use the ABI mandated
|
|
|
|
|
name, we must continue searching from the binfo where we
|
|
|
|
|
found the most recent definition of the function, towards the
|
|
|
|
|
primary binfo which first introduced the function into the
|
|
|
|
|
vtable. If that enters a virtual base, we must use a vcall
|
|
|
|
|
this-adjusting thunk. Bleah! */
|
|
|
|
|
tree probe;
|
|
|
|
|
|
|
|
|
|
for (probe = first_defn; (probe = get_primary_binfo (probe));)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_VIA_VIRTUAL (probe))
|
|
|
|
|
virtual_base = probe;
|
|
|
|
|
if ((unsigned) list_length (BINFO_VIRTUALS (probe)) <= ix)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (virtual_base)
|
|
|
|
|
/* Even if we find a virtual base, the correct delta is
|
|
|
|
|
between the overrider and the binfo we're building a vtable
|
|
|
|
|
for. */
|
|
|
|
|
goto virtual_covariant;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* Compute the constant adjustment to the `this' pointer. The
|
|
|
|
|
`this' pointer, when this function is called, will point at BINFO
|
|
|
|
|
(or one of its primary bases, which are at the same offset). */
|
2000-06-23 03:14:40 +02:00
|
|
|
|
if (virtual_base)
|
2001-07-31 10:56:09 +02:00
|
|
|
|
/* The `this' pointer needs to be adjusted from the declaration to
|
|
|
|
|
the nearest virtual base. */
|
2001-06-06 23:52:52 +02:00
|
|
|
|
delta = size_diffop (BINFO_OFFSET (virtual_base),
|
2001-07-31 10:56:09 +02:00
|
|
|
|
BINFO_OFFSET (first_defn));
|
2002-01-04 15:02:14 +01:00
|
|
|
|
else if (lost)
|
|
|
|
|
/* If the nearest definition is in a lost primary, we don't need an
|
|
|
|
|
entry in our vtable. Except possibly in a constructor vtable,
|
|
|
|
|
if we happen to get our primary back. In that case, the offset
|
|
|
|
|
will be zero, as it will be a primary base. */
|
|
|
|
|
delta = size_zero_node;
|
2000-04-16 21:45:32 +02:00
|
|
|
|
else
|
2002-11-04 02:45:58 +01:00
|
|
|
|
/* The `this' pointer needs to be adjusted from pointing to
|
|
|
|
|
BINFO to pointing at the base where the final overrider
|
|
|
|
|
appears. */
|
2003-01-28 00:29:50 +01:00
|
|
|
|
virtual_covariant:
|
2002-11-04 02:45:58 +01:00
|
|
|
|
delta = size_diffop (BINFO_OFFSET (TREE_VALUE (overrider)),
|
|
|
|
|
BINFO_OFFSET (binfo));
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
2002-12-31 20:43:16 +01:00
|
|
|
|
modify_vtable_entry (t, binfo, overrider_fn, delta, virtuals);
|
2000-06-23 03:14:40 +02:00
|
|
|
|
|
|
|
|
|
if (virtual_base)
|
2002-11-04 02:45:58 +01:00
|
|
|
|
BV_VCALL_INDEX (*virtuals)
|
2002-12-31 20:43:16 +01:00
|
|
|
|
= get_vcall_index (overrider_target, BINFO_TYPE (virtual_base));
|
2000-04-16 21:45:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 07:56:21 +01:00
|
|
|
|
/* Called from modify_all_vtables via dfs_walk. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
2000-01-03 07:56:21 +01:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dfs_modify_vtables (tree binfo, void* data)
|
2000-01-03 07:56:21 +01:00
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (/* There's no need to modify the vtable for a non-virtual
|
2001-06-06 23:52:52 +02:00
|
|
|
|
primary base; we're not going to use that vtable anyhow.
|
|
|
|
|
We do still need to do this for virtual primary bases, as they
|
|
|
|
|
could become non-primary in a construction vtable. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
(!BINFO_PRIMARY_P (binfo) || TREE_VIA_VIRTUAL (binfo))
|
2000-01-03 07:56:21 +01:00
|
|
|
|
/* Similarly, a base without a vtable needs no modification. */
|
|
|
|
|
&& CLASSTYPE_VFIELDS (BINFO_TYPE (binfo)))
|
1994-04-22 01:30:18 +02:00
|
|
|
|
{
|
2003-01-28 00:29:50 +01:00
|
|
|
|
tree t = (tree) data;
|
2000-01-31 22:00:01 +01:00
|
|
|
|
tree virtuals;
|
|
|
|
|
tree old_virtuals;
|
2003-01-28 00:29:50 +01:00
|
|
|
|
unsigned ix;
|
|
|
|
|
|
2001-02-12 10:58:18 +01:00
|
|
|
|
make_new_vtable (t, binfo);
|
2000-01-31 22:00:01 +01:00
|
|
|
|
|
|
|
|
|
/* Now, go through each of the virtual functions in the virtual
|
|
|
|
|
function table for BINFO. Find the final overrider, and
|
|
|
|
|
update the BINFO_VIRTUALS list appropriately. */
|
2003-01-28 00:29:50 +01:00
|
|
|
|
for (ix = 0, virtuals = BINFO_VIRTUALS (binfo),
|
2000-03-28 21:27:15 +02:00
|
|
|
|
old_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
|
2000-01-31 22:00:01 +01:00
|
|
|
|
virtuals;
|
2003-01-28 00:29:50 +01:00
|
|
|
|
ix++, virtuals = TREE_CHAIN (virtuals),
|
2000-01-31 22:00:01 +01:00
|
|
|
|
old_virtuals = TREE_CHAIN (old_virtuals))
|
2000-04-16 21:45:32 +02:00
|
|
|
|
update_vtable_entry_for_fn (t,
|
|
|
|
|
binfo,
|
|
|
|
|
BV_FN (old_virtuals),
|
2003-01-28 00:29:50 +01:00
|
|
|
|
&virtuals, ix);
|
1994-04-22 01:30:18 +02:00
|
|
|
|
}
|
2000-01-03 07:56:21 +01:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_MARKED (binfo) = 1;
|
2000-01-03 07:56:21 +01:00
|
|
|
|
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-17 23:54:23 +01:00
|
|
|
|
/* Update all of the primary and secondary vtables for T. Create new
|
|
|
|
|
vtables as required, and initialize their RTTI information. Each
|
2002-08-04 15:13:56 +02:00
|
|
|
|
of the functions in VIRTUALS is declared in T and may override a
|
|
|
|
|
virtual function from a base class; find and modify the appropriate
|
|
|
|
|
entries to point to the overriding functions. Returns a list, in
|
|
|
|
|
declaration order, of the virtual functions that are declared in T,
|
|
|
|
|
but do not appear in the primary base class vtable, and which
|
|
|
|
|
should therefore be appended to the end of the vtable for T. */
|
2000-01-17 23:54:23 +01:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
modify_all_vtables (tree t, tree virtuals)
|
2000-01-03 07:56:21 +01:00
|
|
|
|
{
|
2001-07-21 02:03:21 +02:00
|
|
|
|
tree binfo = TYPE_BINFO (t);
|
|
|
|
|
tree *fnsp;
|
2000-01-17 23:54:23 +01:00
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
/* Update all of the vtables. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
dfs_walk (binfo, dfs_modify_vtables, unmarkedp, t);
|
|
|
|
|
dfs_walk (binfo, dfs_unmark, markedp, t);
|
2000-01-17 23:54:23 +01:00
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
/* Add virtual functions not already in our primary vtable. These
|
|
|
|
|
will be both those introduced by this class, and those overridden
|
|
|
|
|
from secondary bases. It does not include virtuals merely
|
|
|
|
|
inherited from secondary bases. */
|
|
|
|
|
for (fnsp = &virtuals; *fnsp; )
|
2000-01-17 23:54:23 +01:00
|
|
|
|
{
|
2001-07-21 02:03:21 +02:00
|
|
|
|
tree fn = TREE_VALUE (*fnsp);
|
2000-01-17 23:54:23 +01:00
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
if (!value_member (fn, BINFO_VIRTUALS (binfo))
|
|
|
|
|
|| DECL_VINDEX (fn) == error_mark_node)
|
2000-01-17 23:54:23 +01:00
|
|
|
|
{
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* We don't need to adjust the `this' pointer when
|
|
|
|
|
calling this function. */
|
|
|
|
|
BV_DELTA (*fnsp) = integer_zero_node;
|
|
|
|
|
BV_VCALL_INDEX (*fnsp) = NULL_TREE;
|
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
/* This is a function not already in our vtable. Keep it. */
|
2001-07-21 02:03:21 +02:00
|
|
|
|
fnsp = &TREE_CHAIN (*fnsp);
|
2000-01-17 23:54:23 +01:00
|
|
|
|
}
|
2001-07-21 02:03:21 +02:00
|
|
|
|
else
|
|
|
|
|
/* We've already got an entry for this function. Skip it. */
|
|
|
|
|
*fnsp = TREE_CHAIN (*fnsp);
|
2000-01-17 23:54:23 +01:00
|
|
|
|
}
|
2002-10-26 02:44:44 +02:00
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
return virtuals;
|
1994-04-22 01:30:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-11-29 23:01:58 +01:00
|
|
|
|
/* Get the base virtual function declarations in T that have the
|
|
|
|
|
indicated NAME. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1997-08-27 10:03:41 +02:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_basefndecls (tree name, tree t)
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
2001-11-29 23:01:58 +01:00
|
|
|
|
tree methods;
|
1996-02-01 20:32:00 +01:00
|
|
|
|
tree base_fndecls = NULL_TREE;
|
2001-11-29 23:01:58 +01:00
|
|
|
|
int n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
|
|
|
|
|
int i;
|
1996-02-01 20:32:00 +01:00
|
|
|
|
|
2003-03-06 21:06:29 +01:00
|
|
|
|
/* Find virtual functions in T with the indicated NAME. */
|
|
|
|
|
i = lookup_fnfields_1 (t, name);
|
|
|
|
|
if (i != -1)
|
|
|
|
|
for (methods = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), i);
|
|
|
|
|
methods;
|
|
|
|
|
methods = OVL_NEXT (methods))
|
|
|
|
|
{
|
|
|
|
|
tree method = OVL_CURRENT (methods);
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (method) == FUNCTION_DECL
|
|
|
|
|
&& DECL_VINDEX (method))
|
|
|
|
|
base_fndecls = tree_cons (NULL_TREE, method, base_fndecls);
|
|
|
|
|
}
|
1996-02-01 20:32:00 +01:00
|
|
|
|
|
|
|
|
|
if (base_fndecls)
|
|
|
|
|
return base_fndecls;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < n_baseclasses; i++)
|
|
|
|
|
{
|
2001-11-29 23:01:58 +01:00
|
|
|
|
tree basetype = TYPE_BINFO_BASETYPE (t, i);
|
|
|
|
|
base_fndecls = chainon (get_basefndecls (name, basetype),
|
1996-02-01 20:32:00 +01:00
|
|
|
|
base_fndecls);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base_fndecls;
|
|
|
|
|
}
|
|
|
|
|
|
1996-02-09 23:43:25 +01:00
|
|
|
|
/* If this declaration supersedes the declaration of
|
|
|
|
|
a method declared virtual in the base class, then
|
|
|
|
|
mark this field as being virtual as well. */
|
|
|
|
|
|
1997-04-02 05:58:33 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
check_for_override (tree decl, tree ctype)
|
1996-02-09 23:43:25 +01:00
|
|
|
|
{
|
2000-12-05 16:50:06 +01:00
|
|
|
|
if (TREE_CODE (decl) == TEMPLATE_DECL)
|
|
|
|
|
/* In [temp.mem] we have:
|
1996-02-09 23:43:25 +01:00
|
|
|
|
|
2000-12-05 16:50:06 +01:00
|
|
|
|
A specialization of a member function template does not
|
|
|
|
|
override a virtual function from a base class. */
|
|
|
|
|
return;
|
|
|
|
|
if ((DECL_DESTRUCTOR_P (decl)
|
|
|
|
|
|| IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)))
|
|
|
|
|
&& look_for_overrides (ctype, decl)
|
|
|
|
|
&& !DECL_STATIC_FUNCTION_P (decl))
|
2002-08-04 15:13:56 +02:00
|
|
|
|
/* Set DECL_VINDEX to a value that is neither an INTEGER_CST nor
|
|
|
|
|
the error_mark_node so that we know it is an overriding
|
|
|
|
|
function. */
|
|
|
|
|
DECL_VINDEX (decl) = decl;
|
|
|
|
|
|
2000-12-05 16:50:06 +01:00
|
|
|
|
if (DECL_VIRTUAL_P (decl))
|
1996-02-09 23:43:25 +01:00
|
|
|
|
{
|
2002-08-04 15:13:56 +02:00
|
|
|
|
if (!DECL_VINDEX (decl))
|
1996-02-09 23:43:25 +01:00
|
|
|
|
DECL_VINDEX (decl) = error_mark_node;
|
|
|
|
|
IDENTIFIER_VIRTUAL_P (DECL_NAME (decl)) = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1996-03-21 20:46:11 +01:00
|
|
|
|
/* Warn about hidden virtual functions that are not overridden in t.
|
|
|
|
|
We know that constructors and destructors don't apply. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1996-02-01 20:32:00 +01:00
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
warn_hidden (tree t)
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
|
|
|
|
tree method_vec = CLASSTYPE_METHOD_VEC (t);
|
|
|
|
|
int n_methods = method_vec ? TREE_VEC_LENGTH (method_vec) : 0;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* We go through each separately named virtual function. */
|
1998-10-06 16:20:30 +02:00
|
|
|
|
for (i = 2; i < n_methods && TREE_VEC_ELT (method_vec, i); ++i)
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
2001-11-29 23:01:58 +01:00
|
|
|
|
tree fns;
|
|
|
|
|
tree name;
|
|
|
|
|
tree fndecl;
|
|
|
|
|
tree base_fndecls;
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
/* All functions in this slot in the CLASSTYPE_METHOD_VEC will
|
|
|
|
|
have the same name. Figure out what name that is. */
|
|
|
|
|
name = DECL_NAME (OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
|
|
|
|
|
/* There are no possibly hidden functions yet. */
|
|
|
|
|
base_fndecls = NULL_TREE;
|
|
|
|
|
/* Iterate through all of the base classes looking for possibly
|
|
|
|
|
hidden functions. */
|
|
|
|
|
for (j = 0; j < CLASSTYPE_N_BASECLASSES (t); j++)
|
1999-08-03 00:59:03 +02:00
|
|
|
|
{
|
2001-11-29 23:01:58 +01:00
|
|
|
|
tree basetype = TYPE_BINFO_BASETYPE (t, j);
|
|
|
|
|
base_fndecls = chainon (get_basefndecls (name, basetype),
|
|
|
|
|
base_fndecls);
|
1999-08-03 00:59:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* If there are no functions to hide, continue. */
|
2001-11-29 23:01:58 +01:00
|
|
|
|
if (!base_fndecls)
|
1996-02-01 20:32:00 +01:00
|
|
|
|
continue;
|
|
|
|
|
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* Remove any overridden functions. */
|
2001-11-29 23:01:58 +01:00
|
|
|
|
for (fns = TREE_VEC_ELT (method_vec, i); fns; fns = OVL_NEXT (fns))
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
2001-11-29 23:01:58 +01:00
|
|
|
|
fndecl = OVL_CURRENT (fns);
|
|
|
|
|
if (DECL_VINDEX (fndecl))
|
|
|
|
|
{
|
|
|
|
|
tree *prev = &base_fndecls;
|
|
|
|
|
|
|
|
|
|
while (*prev)
|
|
|
|
|
/* If the method from the base class has the same
|
|
|
|
|
signature as the method from the derived class, it
|
|
|
|
|
has been overridden. */
|
|
|
|
|
if (same_signature_p (fndecl, TREE_VALUE (*prev)))
|
|
|
|
|
*prev = TREE_CHAIN (*prev);
|
|
|
|
|
else
|
|
|
|
|
prev = &TREE_CHAIN (*prev);
|
|
|
|
|
}
|
1996-02-01 20:32:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now give a warning for all base functions without overriders,
|
|
|
|
|
as they are hidden. */
|
2001-11-29 23:01:58 +01:00
|
|
|
|
while (base_fndecls)
|
|
|
|
|
{
|
|
|
|
|
/* Here we know it is a hider, and no overrider exists. */
|
|
|
|
|
cp_warning_at ("`%D' was hidden", TREE_VALUE (base_fndecls));
|
|
|
|
|
cp_warning_at (" by `%D'",
|
|
|
|
|
OVL_CURRENT (TREE_VEC_ELT (method_vec, i)));
|
|
|
|
|
base_fndecls = TREE_CHAIN (base_fndecls);
|
|
|
|
|
}
|
1996-02-01 20:32:00 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check for things that are invalid. There are probably plenty of other
|
|
|
|
|
things we should check for also. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1996-02-01 20:32:00 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
finish_struct_anon (tree t)
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
|
|
|
|
tree field;
|
1999-07-09 18:15:04 +02:00
|
|
|
|
|
1996-02-01 20:32:00 +01:00
|
|
|
|
for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_STATIC (field))
|
|
|
|
|
continue;
|
|
|
|
|
if (TREE_CODE (field) != FIELD_DECL)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (DECL_NAME (field) == NULL_TREE
|
1999-05-19 12:44:22 +02:00
|
|
|
|
&& ANON_AGGR_TYPE_P (TREE_TYPE (field)))
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
1999-07-09 18:15:04 +02:00
|
|
|
|
tree elt = TYPE_FIELDS (TREE_TYPE (field));
|
|
|
|
|
for (; elt; elt = TREE_CHAIN (elt))
|
1996-02-01 20:32:00 +01:00
|
|
|
|
{
|
2001-07-19 09:22:40 +02:00
|
|
|
|
/* We're generally only interested in entities the user
|
|
|
|
|
declared, but we also find nested classes by noticing
|
|
|
|
|
the TYPE_DECL that we create implicitly. You're
|
|
|
|
|
allowed to put one anonymous union inside another,
|
2001-10-11 23:33:09 +02:00
|
|
|
|
though, so we explicitly tolerate that. We use
|
|
|
|
|
TYPE_ANONYMOUS_P rather than ANON_AGGR_TYPE_P so that
|
|
|
|
|
we also allow unnamed types used for defining fields. */
|
2001-07-19 09:22:40 +02:00
|
|
|
|
if (DECL_ARTIFICIAL (elt)
|
|
|
|
|
&& (!DECL_IMPLICIT_TYPEDEF_P (elt)
|
2001-10-11 23:33:09 +02:00
|
|
|
|
|| TYPE_ANONYMOUS_P (TREE_TYPE (elt))))
|
1996-02-01 20:32:00 +01:00
|
|
|
|
continue;
|
|
|
|
|
|
2002-12-28 09:03:42 +01:00
|
|
|
|
if (constructor_name_p (DECL_NAME (elt), t))
|
2000-02-21 20:51:44 +01:00
|
|
|
|
cp_pedwarn_at ("ISO C++ forbids member `%D' with same name as enclosing class",
|
1999-07-09 18:15:04 +02:00
|
|
|
|
elt);
|
1998-11-18 03:21:54 +01:00
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
if (TREE_CODE (elt) != FIELD_DECL)
|
1998-11-18 03:21:54 +01:00
|
|
|
|
{
|
|
|
|
|
cp_pedwarn_at ("`%#D' invalid; an anonymous union can only have non-static data members",
|
1999-07-09 18:15:04 +02:00
|
|
|
|
elt);
|
1998-11-18 03:21:54 +01:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
if (TREE_PRIVATE (elt))
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_pedwarn_at ("private member `%#D' in anonymous union",
|
1999-07-09 18:15:04 +02:00
|
|
|
|
elt);
|
|
|
|
|
else if (TREE_PROTECTED (elt))
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_pedwarn_at ("protected member `%#D' in anonymous union",
|
1999-07-09 18:15:04 +02:00
|
|
|
|
elt);
|
1996-03-21 20:46:11 +01:00
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
TREE_PRIVATE (elt) = TREE_PRIVATE (field);
|
|
|
|
|
TREE_PROTECTED (elt) = TREE_PROTECTED (field);
|
1996-02-01 20:32:00 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-30 16:54:10 +01:00
|
|
|
|
/* Add T to CLASSTYPE_DECL_LIST of current_class_type which
|
|
|
|
|
will be used later during class template instantiation.
|
|
|
|
|
When FRIEND_P is zero, T can be a static member data (VAR_DECL),
|
|
|
|
|
a non-static member data (FIELD_DECL), a member function
|
|
|
|
|
(FUNCTION_DECL), a nested type (RECORD_TYPE, ENUM_TYPE),
|
|
|
|
|
a typedef (TYPE_DECL) or a member class template (TEMPLATE_DECL)
|
|
|
|
|
When FRIEND_P is nonzero, T is either a friend class
|
|
|
|
|
(RECORD_TYPE, TEMPLATE_DECL) or a friend function
|
|
|
|
|
(FUNCTION_DECL, TEMPLATE_DECL). */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
maybe_add_class_template_decl_list (tree type, tree t, int friend_p)
|
2002-10-30 16:54:10 +01:00
|
|
|
|
{
|
|
|
|
|
/* Save some memory by not creating TREE_LIST if TYPE is not template. */
|
|
|
|
|
if (CLASSTYPE_TEMPLATE_INFO (type))
|
|
|
|
|
CLASSTYPE_DECL_LIST (type)
|
|
|
|
|
= tree_cons (friend_p ? NULL_TREE : type,
|
|
|
|
|
t, CLASSTYPE_DECL_LIST (type));
|
|
|
|
|
}
|
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* Create default constructors, assignment operators, and so forth for
|
|
|
|
|
the type indicated by T, if they are needed.
|
|
|
|
|
CANT_HAVE_DEFAULT_CTOR, CANT_HAVE_CONST_CTOR, and
|
2000-04-09 08:44:20 +02:00
|
|
|
|
CANT_HAVE_CONST_ASSIGNMENT are nonzero if, for whatever reason, the
|
|
|
|
|
class cannot have a default constructor, copy constructor taking a
|
|
|
|
|
const reference argument, or an assignment operator taking a const
|
|
|
|
|
reference, respectively. If a virtual destructor is created, its
|
|
|
|
|
DECL is returned; otherwise the return value is NULL_TREE. */
|
1998-10-06 16:20:30 +02:00
|
|
|
|
|
2002-11-07 22:33:44 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
add_implicitly_declared_members (tree t,
|
|
|
|
|
int cant_have_default_ctor,
|
|
|
|
|
int cant_have_const_cctor,
|
|
|
|
|
int cant_have_const_assignment)
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
|
|
|
|
tree default_fn;
|
|
|
|
|
tree implicit_fns = NULL_TREE;
|
|
|
|
|
tree virtual_dtor = NULL_TREE;
|
|
|
|
|
tree *f;
|
|
|
|
|
|
2002-01-10 19:51:24 +01:00
|
|
|
|
++adding_implicit_members;
|
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* Destructor. */
|
2000-03-03 03:27:15 +01:00
|
|
|
|
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) && !TYPE_HAS_DESTRUCTOR (t))
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
2000-04-09 08:44:20 +02:00
|
|
|
|
default_fn = implicitly_declare_fn (sfk_destructor, t, /*const_p=*/0);
|
1998-10-06 16:20:30 +02:00
|
|
|
|
check_for_override (default_fn, t);
|
|
|
|
|
|
|
|
|
|
/* If we couldn't make it work, then pretend we didn't need it. */
|
|
|
|
|
if (default_fn == void_type_node)
|
2000-03-03 03:27:15 +01:00
|
|
|
|
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = 0;
|
1998-10-06 16:20:30 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TREE_CHAIN (default_fn) = implicit_fns;
|
|
|
|
|
implicit_fns = default_fn;
|
|
|
|
|
|
|
|
|
|
if (DECL_VINDEX (default_fn))
|
|
|
|
|
virtual_dtor = default_fn;
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-03-03 03:27:15 +01:00
|
|
|
|
else
|
|
|
|
|
/* Any non-implicit destructor is non-trivial. */
|
|
|
|
|
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) |= TYPE_HAS_DESTRUCTOR (t);
|
1998-10-06 16:20:30 +02:00
|
|
|
|
|
|
|
|
|
/* Default constructor. */
|
extend.texi (C++ Signatures): Remove node.
* extend.texi (C++ Signatures): Remove node.
* invoke.texi: Remove discussion of -fhandle-signatures,
signature, sigof, __signature__, and __sigof__.
* Make-lang.in (CXX_SRCS): Remove sig.c.
* Makefile.in (CXX_OBJS): Remove sig.o.
(sig.o): Remove.
* cp-tree.h (CPTI_OPAQUE_TYPE): Remove.
(CPTI_SIGNATURE_TYPE): Likewise.
(CPTI_SIGTABLE_ENTRY_TYPE): Likewise.
(opaque_type_node): Likewise.
(signature_type_node): Likewise.
(sigtable_entry_type): Likewise.
(flag_handle_signatures): Likewise.
(lang_type): Remove is_signature, is_signature_pointer,
is_signature_reference, has_opaque_typedecls,
sigtables_has_been_generated. Adjust dummy. Remove signature,
signature_pointer_to, signature_reference_to.
(IS_SIGNATURE): Remove.
(SET_SIGNATURE): Remove.
(CLEAR_SIGNATURE): Remove.
(IS_SIGNATURE_POINTER): Remove.
(IS_SIGNATURE_REFERENCE): Remove.
(SIGNATURE_HAS_OPAQUE_TYPEDECLS): Remove.
(SIGTABLE_HAS_BEEN_GENERATED): Remove.
(CLASSTYPE_SIGNATURE): Remove.
(SIGNATURE_TYPE): Remove.
(SIGNATURE_METHOD_VEC): Remove.
(SIGNATURE_POINTER_TO): Remove.
(SIGNATURE_REFERENCE_TO): Remove.
(lang_decl_flags): Remove is_default_implementation. Rename
memfunc_pointer_to to saved_tree.
(IS_DEFAULT_IMPLEMENTATION): Remove.
(DECL_MEMFUNC_POINTER_TO): Remove.
(DECL_MEMFUNC_POINTING_TO): Remove.
(DECL_SAVED_TREE): Adjust definition.
(tag_types): Remove signature_type_node.
(SIGNATURE_FIELD_NAME): Remove.
(SIGNATURE_FIELD_NAME_FORMAT): Likewise.
(SIGNATURE_OPTR_NAME): Likewise.
(SIGNATURE_SPTR_NAME): Likewise.
(SIGNATURE_POINTER_NAME): Likewise.
(SIGNATURE_POINTER_NAME_FORMAT): Likewise.
(SIGNATURE_REFERENCE_NAME): Likewise.
(SIGNATURE_REFERNECE_NAME_FORMAT): Likewise.
(SIGTABLE_PTR_TYPE): Likewise.
(SIGTABLE_NAME_FORMAT): Likewise.
(SIGTABLE_NAME_FORMAT_LONG): Likewise.
(SIGTABLE_TAG_NAME): Likewise.
(SIGTABLE_VB_OFF_NAME): Likewise.
(SIGTABLE_VT_OFF_NAME): Likewise.
(finish_base_specifiers): Change prototype.
(build_signature_pointer_type): Remove.
(build_signature_reference_type): Remove.
(build_signature_pointer_constructor): Remove.
(build_signature_method_call): Remove.
(build_optr_ref): Likewise.
(append_signature_fields): Likewise.
(signature_error): Likewise.
* call.c (build_this): Remove signature support.
(build_over_call): Likewise.
(build_new_method_call): Likewise.
* class.c (add_implicitly_declared_members): Likewise.
(finish_struct_1): Likewise.
(finish_struct): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_pointer_force): Likewise.
(ocp_convert): Likewise.
* decl.c (sigtable_decl_p): Remove.
(init_decl_processing): Remove support for signatures.
(cp_finish_decl): Likewise.
(grokdeclarator): Likewise.
(grokparms): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
(start_method): Likewise.
* decl2.c (finish_sigtable_vardecl): Remove.
(flag_handle_signatures): Remove.
(lang_f_options): Remove handle-signatures.
(grokfield): Remove support for signatures.
(grokbitfield): Likewise.
(finish_file): Likewise.
(reparse_absdcl_as_casts): Likewise.
* error.c (dump_type_real): Likewise.
(dump_function_decl): Likewise.
* friend.c (make_friend_class): Likewise.
* gxx.gperf: Remove __signature__, signature, __sigof__, sigof.
* hash.h: Regenerated.
* init.c (build_new_1): Remove support for signatures.
* lang-options.h: Remove -fhandle-signatures,
-fno-handle-signatures.
* lex.c (init_parse): Remove support for signatures.
(yyprint): Likewise.
* lex.h (rid): Remove RID_SIGNATURE.
* method.c (build_decl_overload_real): Remove support for
signatures.
(hack_identifier): Likewise.
* parse.y (base_class): Likewise.
(base_class.1): Likewise.
(access_specifier): Likewise.
* search.c (lookup_member): Likewise.
* semantics.c (finish_qualified_object_call_expr): Likewise.
(finish_template_type_parm): Likewise.
(begin_class_definition): Likewise.
(finish_base_specifier): Likewise.
* sig.c: Remove.
* tree.c (build_cplus_method_type): Remove support for signatures.
* typeck.c (require_complete_type): Likewise.
(c_sizeof): Likewise.
(c_alignof): Likewise.
(build_object_ref): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_for_initialization): Likewise.
* typeck2.c (signature_error): Remove.
(store_init_value): Remove support for signatures.
(digest_init): Likewise.
(build_x_arrow): Likewise.
(build_functional_cast): Likewise.
* xref.c (GNU_xref_decl): Likewise.
From-SVN: r28677
1999-08-11 22:22:41 +02:00
|
|
|
|
if (! TYPE_HAS_CONSTRUCTOR (t) && ! cant_have_default_ctor)
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
2000-04-09 08:44:20 +02:00
|
|
|
|
default_fn = implicitly_declare_fn (sfk_constructor, t, /*const_p=*/0);
|
1998-10-06 16:20:30 +02:00
|
|
|
|
TREE_CHAIN (default_fn) = implicit_fns;
|
|
|
|
|
implicit_fns = default_fn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Copy constructor. */
|
extend.texi (C++ Signatures): Remove node.
* extend.texi (C++ Signatures): Remove node.
* invoke.texi: Remove discussion of -fhandle-signatures,
signature, sigof, __signature__, and __sigof__.
* Make-lang.in (CXX_SRCS): Remove sig.c.
* Makefile.in (CXX_OBJS): Remove sig.o.
(sig.o): Remove.
* cp-tree.h (CPTI_OPAQUE_TYPE): Remove.
(CPTI_SIGNATURE_TYPE): Likewise.
(CPTI_SIGTABLE_ENTRY_TYPE): Likewise.
(opaque_type_node): Likewise.
(signature_type_node): Likewise.
(sigtable_entry_type): Likewise.
(flag_handle_signatures): Likewise.
(lang_type): Remove is_signature, is_signature_pointer,
is_signature_reference, has_opaque_typedecls,
sigtables_has_been_generated. Adjust dummy. Remove signature,
signature_pointer_to, signature_reference_to.
(IS_SIGNATURE): Remove.
(SET_SIGNATURE): Remove.
(CLEAR_SIGNATURE): Remove.
(IS_SIGNATURE_POINTER): Remove.
(IS_SIGNATURE_REFERENCE): Remove.
(SIGNATURE_HAS_OPAQUE_TYPEDECLS): Remove.
(SIGTABLE_HAS_BEEN_GENERATED): Remove.
(CLASSTYPE_SIGNATURE): Remove.
(SIGNATURE_TYPE): Remove.
(SIGNATURE_METHOD_VEC): Remove.
(SIGNATURE_POINTER_TO): Remove.
(SIGNATURE_REFERENCE_TO): Remove.
(lang_decl_flags): Remove is_default_implementation. Rename
memfunc_pointer_to to saved_tree.
(IS_DEFAULT_IMPLEMENTATION): Remove.
(DECL_MEMFUNC_POINTER_TO): Remove.
(DECL_MEMFUNC_POINTING_TO): Remove.
(DECL_SAVED_TREE): Adjust definition.
(tag_types): Remove signature_type_node.
(SIGNATURE_FIELD_NAME): Remove.
(SIGNATURE_FIELD_NAME_FORMAT): Likewise.
(SIGNATURE_OPTR_NAME): Likewise.
(SIGNATURE_SPTR_NAME): Likewise.
(SIGNATURE_POINTER_NAME): Likewise.
(SIGNATURE_POINTER_NAME_FORMAT): Likewise.
(SIGNATURE_REFERENCE_NAME): Likewise.
(SIGNATURE_REFERNECE_NAME_FORMAT): Likewise.
(SIGTABLE_PTR_TYPE): Likewise.
(SIGTABLE_NAME_FORMAT): Likewise.
(SIGTABLE_NAME_FORMAT_LONG): Likewise.
(SIGTABLE_TAG_NAME): Likewise.
(SIGTABLE_VB_OFF_NAME): Likewise.
(SIGTABLE_VT_OFF_NAME): Likewise.
(finish_base_specifiers): Change prototype.
(build_signature_pointer_type): Remove.
(build_signature_reference_type): Remove.
(build_signature_pointer_constructor): Remove.
(build_signature_method_call): Remove.
(build_optr_ref): Likewise.
(append_signature_fields): Likewise.
(signature_error): Likewise.
* call.c (build_this): Remove signature support.
(build_over_call): Likewise.
(build_new_method_call): Likewise.
* class.c (add_implicitly_declared_members): Likewise.
(finish_struct_1): Likewise.
(finish_struct): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_pointer_force): Likewise.
(ocp_convert): Likewise.
* decl.c (sigtable_decl_p): Remove.
(init_decl_processing): Remove support for signatures.
(cp_finish_decl): Likewise.
(grokdeclarator): Likewise.
(grokparms): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
(start_method): Likewise.
* decl2.c (finish_sigtable_vardecl): Remove.
(flag_handle_signatures): Remove.
(lang_f_options): Remove handle-signatures.
(grokfield): Remove support for signatures.
(grokbitfield): Likewise.
(finish_file): Likewise.
(reparse_absdcl_as_casts): Likewise.
* error.c (dump_type_real): Likewise.
(dump_function_decl): Likewise.
* friend.c (make_friend_class): Likewise.
* gxx.gperf: Remove __signature__, signature, __sigof__, sigof.
* hash.h: Regenerated.
* init.c (build_new_1): Remove support for signatures.
* lang-options.h: Remove -fhandle-signatures,
-fno-handle-signatures.
* lex.c (init_parse): Remove support for signatures.
(yyprint): Likewise.
* lex.h (rid): Remove RID_SIGNATURE.
* method.c (build_decl_overload_real): Remove support for
signatures.
(hack_identifier): Likewise.
* parse.y (base_class): Likewise.
(base_class.1): Likewise.
(access_specifier): Likewise.
* search.c (lookup_member): Likewise.
* semantics.c (finish_qualified_object_call_expr): Likewise.
(finish_template_type_parm): Likewise.
(begin_class_definition): Likewise.
(finish_base_specifier): Likewise.
* sig.c: Remove.
* tree.c (build_cplus_method_type): Remove support for signatures.
* typeck.c (require_complete_type): Likewise.
(c_sizeof): Likewise.
(c_alignof): Likewise.
(build_object_ref): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_for_initialization): Likewise.
* typeck2.c (signature_error): Remove.
(store_init_value): Remove support for signatures.
(digest_init): Likewise.
(build_x_arrow): Likewise.
(build_functional_cast): Likewise.
* xref.c (GNU_xref_decl): Likewise.
From-SVN: r28677
1999-08-11 22:22:41 +02:00
|
|
|
|
if (! TYPE_HAS_INIT_REF (t) && ! TYPE_FOR_JAVA (t))
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
|
|
|
|
/* ARM 12.18: You get either X(X&) or X(const X&), but
|
|
|
|
|
not both. --Chip */
|
2000-04-09 08:44:20 +02:00
|
|
|
|
default_fn
|
|
|
|
|
= implicitly_declare_fn (sfk_copy_constructor, t,
|
|
|
|
|
/*const_p=*/!cant_have_const_cctor);
|
1998-10-06 16:20:30 +02:00
|
|
|
|
TREE_CHAIN (default_fn) = implicit_fns;
|
|
|
|
|
implicit_fns = default_fn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Assignment operator. */
|
extend.texi (C++ Signatures): Remove node.
* extend.texi (C++ Signatures): Remove node.
* invoke.texi: Remove discussion of -fhandle-signatures,
signature, sigof, __signature__, and __sigof__.
* Make-lang.in (CXX_SRCS): Remove sig.c.
* Makefile.in (CXX_OBJS): Remove sig.o.
(sig.o): Remove.
* cp-tree.h (CPTI_OPAQUE_TYPE): Remove.
(CPTI_SIGNATURE_TYPE): Likewise.
(CPTI_SIGTABLE_ENTRY_TYPE): Likewise.
(opaque_type_node): Likewise.
(signature_type_node): Likewise.
(sigtable_entry_type): Likewise.
(flag_handle_signatures): Likewise.
(lang_type): Remove is_signature, is_signature_pointer,
is_signature_reference, has_opaque_typedecls,
sigtables_has_been_generated. Adjust dummy. Remove signature,
signature_pointer_to, signature_reference_to.
(IS_SIGNATURE): Remove.
(SET_SIGNATURE): Remove.
(CLEAR_SIGNATURE): Remove.
(IS_SIGNATURE_POINTER): Remove.
(IS_SIGNATURE_REFERENCE): Remove.
(SIGNATURE_HAS_OPAQUE_TYPEDECLS): Remove.
(SIGTABLE_HAS_BEEN_GENERATED): Remove.
(CLASSTYPE_SIGNATURE): Remove.
(SIGNATURE_TYPE): Remove.
(SIGNATURE_METHOD_VEC): Remove.
(SIGNATURE_POINTER_TO): Remove.
(SIGNATURE_REFERENCE_TO): Remove.
(lang_decl_flags): Remove is_default_implementation. Rename
memfunc_pointer_to to saved_tree.
(IS_DEFAULT_IMPLEMENTATION): Remove.
(DECL_MEMFUNC_POINTER_TO): Remove.
(DECL_MEMFUNC_POINTING_TO): Remove.
(DECL_SAVED_TREE): Adjust definition.
(tag_types): Remove signature_type_node.
(SIGNATURE_FIELD_NAME): Remove.
(SIGNATURE_FIELD_NAME_FORMAT): Likewise.
(SIGNATURE_OPTR_NAME): Likewise.
(SIGNATURE_SPTR_NAME): Likewise.
(SIGNATURE_POINTER_NAME): Likewise.
(SIGNATURE_POINTER_NAME_FORMAT): Likewise.
(SIGNATURE_REFERENCE_NAME): Likewise.
(SIGNATURE_REFERNECE_NAME_FORMAT): Likewise.
(SIGTABLE_PTR_TYPE): Likewise.
(SIGTABLE_NAME_FORMAT): Likewise.
(SIGTABLE_NAME_FORMAT_LONG): Likewise.
(SIGTABLE_TAG_NAME): Likewise.
(SIGTABLE_VB_OFF_NAME): Likewise.
(SIGTABLE_VT_OFF_NAME): Likewise.
(finish_base_specifiers): Change prototype.
(build_signature_pointer_type): Remove.
(build_signature_reference_type): Remove.
(build_signature_pointer_constructor): Remove.
(build_signature_method_call): Remove.
(build_optr_ref): Likewise.
(append_signature_fields): Likewise.
(signature_error): Likewise.
* call.c (build_this): Remove signature support.
(build_over_call): Likewise.
(build_new_method_call): Likewise.
* class.c (add_implicitly_declared_members): Likewise.
(finish_struct_1): Likewise.
(finish_struct): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_pointer_force): Likewise.
(ocp_convert): Likewise.
* decl.c (sigtable_decl_p): Remove.
(init_decl_processing): Remove support for signatures.
(cp_finish_decl): Likewise.
(grokdeclarator): Likewise.
(grokparms): Likewise.
(xref_tag): Likewise.
(start_function): Likewise.
(start_method): Likewise.
* decl2.c (finish_sigtable_vardecl): Remove.
(flag_handle_signatures): Remove.
(lang_f_options): Remove handle-signatures.
(grokfield): Remove support for signatures.
(grokbitfield): Likewise.
(finish_file): Likewise.
(reparse_absdcl_as_casts): Likewise.
* error.c (dump_type_real): Likewise.
(dump_function_decl): Likewise.
* friend.c (make_friend_class): Likewise.
* gxx.gperf: Remove __signature__, signature, __sigof__, sigof.
* hash.h: Regenerated.
* init.c (build_new_1): Remove support for signatures.
* lang-options.h: Remove -fhandle-signatures,
-fno-handle-signatures.
* lex.c (init_parse): Remove support for signatures.
(yyprint): Likewise.
* lex.h (rid): Remove RID_SIGNATURE.
* method.c (build_decl_overload_real): Remove support for
signatures.
(hack_identifier): Likewise.
* parse.y (base_class): Likewise.
(base_class.1): Likewise.
(access_specifier): Likewise.
* search.c (lookup_member): Likewise.
* semantics.c (finish_qualified_object_call_expr): Likewise.
(finish_template_type_parm): Likewise.
(begin_class_definition): Likewise.
(finish_base_specifier): Likewise.
* sig.c: Remove.
* tree.c (build_cplus_method_type): Remove support for signatures.
* typeck.c (require_complete_type): Likewise.
(c_sizeof): Likewise.
(c_alignof): Likewise.
(build_object_ref): Likewise.
(build_component_ref): Likewise.
(build_indirect_ref): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_for_initialization): Likewise.
* typeck2.c (signature_error): Remove.
(store_init_value): Remove support for signatures.
(digest_init): Likewise.
(build_x_arrow): Likewise.
(build_functional_cast): Likewise.
* xref.c (GNU_xref_decl): Likewise.
From-SVN: r28677
1999-08-11 22:22:41 +02:00
|
|
|
|
if (! TYPE_HAS_ASSIGN_REF (t) && ! TYPE_FOR_JAVA (t))
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
2000-04-09 08:44:20 +02:00
|
|
|
|
default_fn
|
|
|
|
|
= implicitly_declare_fn (sfk_assignment_operator, t,
|
|
|
|
|
/*const_p=*/!cant_have_const_assignment);
|
1998-10-06 16:20:30 +02:00
|
|
|
|
TREE_CHAIN (default_fn) = implicit_fns;
|
|
|
|
|
implicit_fns = default_fn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now, hook all of the new functions on to TYPE_METHODS,
|
|
|
|
|
and add them to the CLASSTYPE_METHOD_VEC. */
|
|
|
|
|
for (f = &implicit_fns; *f; f = &TREE_CHAIN (*f))
|
2002-10-30 16:54:10 +01:00
|
|
|
|
{
|
|
|
|
|
add_method (t, *f, /*error_p=*/0);
|
|
|
|
|
maybe_add_class_template_decl_list (current_class_type, *f, /*friend_p=*/0);
|
|
|
|
|
}
|
2002-11-07 22:33:44 +01:00
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
/* G++ 3.2 put the implicit destructor at the *beginning* of the
|
|
|
|
|
list, which cause the destructor to be emitted in an incorrect
|
|
|
|
|
location in the vtable. */
|
|
|
|
|
TYPE_METHODS (t) = chainon (TYPE_METHODS (t), implicit_fns);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (warn_abi && virtual_dtor)
|
|
|
|
|
warning ("vtable layout for class `%T' may not be ABI-compliant "
|
|
|
|
|
"and may change in a future version of GCC due to implicit "
|
|
|
|
|
"virtual destructor",
|
|
|
|
|
t);
|
|
|
|
|
*f = TYPE_METHODS (t);
|
|
|
|
|
TYPE_METHODS (t) = implicit_fns;
|
|
|
|
|
}
|
1998-10-06 16:20:30 +02:00
|
|
|
|
|
2002-01-10 19:51:24 +01:00
|
|
|
|
--adding_implicit_members;
|
1998-10-06 16:20:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
/* Subroutine of finish_struct_1. Recursively count the number of fields
|
|
|
|
|
in TYPE, including anonymous union members. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
count_fields (tree fields)
|
1999-07-09 18:15:04 +02:00
|
|
|
|
{
|
|
|
|
|
tree x;
|
|
|
|
|
int n_fields = 0;
|
|
|
|
|
for (x = fields; x; x = TREE_CHAIN (x))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
|
|
|
|
|
n_fields += count_fields (TYPE_FIELDS (TREE_TYPE (x)));
|
|
|
|
|
else
|
|
|
|
|
n_fields += 1;
|
|
|
|
|
}
|
|
|
|
|
return n_fields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Subroutine of finish_struct_1. Recursively add all the fields in the
|
2003-07-16 20:45:56 +02:00
|
|
|
|
TREE_LIST FIELDS to the SORTED_FIELDS_TYPE elts, starting at offset IDX. */
|
1999-07-09 18:15:04 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2003-07-16 20:45:56 +02:00
|
|
|
|
add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, int idx)
|
1999-07-09 18:15:04 +02:00
|
|
|
|
{
|
|
|
|
|
tree x;
|
|
|
|
|
for (x = fields; x; x = TREE_CHAIN (x))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (x) == FIELD_DECL && ANON_AGGR_TYPE_P (TREE_TYPE (x)))
|
2003-07-16 20:45:56 +02:00
|
|
|
|
idx = add_fields_to_record_type (TYPE_FIELDS (TREE_TYPE (x)), field_vec, idx);
|
1999-07-09 18:15:04 +02:00
|
|
|
|
else
|
2003-07-16 20:45:56 +02:00
|
|
|
|
field_vec->elts[idx++] = x;
|
1999-07-09 18:15:04 +02:00
|
|
|
|
}
|
|
|
|
|
return idx;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-03 22:34:04 +01:00
|
|
|
|
/* FIELD is a bit-field. We are finishing the processing for its
|
|
|
|
|
enclosing type. Issue any appropriate messages and set appropriate
|
|
|
|
|
flags. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
check_bitfield_decl (tree field)
|
1999-11-03 22:34:04 +01:00
|
|
|
|
{
|
|
|
|
|
tree type = TREE_TYPE (field);
|
2000-03-19 06:22:04 +01:00
|
|
|
|
tree w = NULL_TREE;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
|
2000-03-19 06:22:04 +01:00
|
|
|
|
/* Detect invalid bit-field type. */
|
1999-11-03 22:34:04 +01:00
|
|
|
|
if (DECL_INITIAL (field)
|
|
|
|
|
&& ! INTEGRAL_TYPE_P (TREE_TYPE (field)))
|
|
|
|
|
{
|
|
|
|
|
cp_error_at ("bit-field `%#D' with non-integral type", field);
|
2000-03-19 06:22:04 +01:00
|
|
|
|
w = error_mark_node;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Detect and ignore out of range field width. */
|
|
|
|
|
if (DECL_INITIAL (field))
|
|
|
|
|
{
|
2000-03-19 06:22:04 +01:00
|
|
|
|
w = DECL_INITIAL (field);
|
1999-11-03 22:34:04 +01:00
|
|
|
|
|
|
|
|
|
/* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */
|
|
|
|
|
STRIP_NOPS (w);
|
|
|
|
|
|
|
|
|
|
/* detect invalid field size. */
|
|
|
|
|
if (TREE_CODE (w) == CONST_DECL)
|
|
|
|
|
w = DECL_INITIAL (w);
|
2000-04-26 17:43:50 +02:00
|
|
|
|
else
|
1999-11-03 22:34:04 +01:00
|
|
|
|
w = decl_constant_value (w);
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (w) != INTEGER_CST)
|
|
|
|
|
{
|
|
|
|
|
cp_error_at ("bit-field `%D' width not an integer constant",
|
|
|
|
|
field);
|
2000-03-19 06:22:04 +01:00
|
|
|
|
w = error_mark_node;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
}
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
else if (tree_int_cst_sgn (w) < 0)
|
1999-11-03 22:34:04 +01:00
|
|
|
|
{
|
|
|
|
|
cp_error_at ("negative width in bit-field `%D'", field);
|
2000-03-19 06:22:04 +01:00
|
|
|
|
w = error_mark_node;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
}
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
else if (integer_zerop (w) && DECL_NAME (field) != 0)
|
1999-11-03 22:34:04 +01:00
|
|
|
|
{
|
|
|
|
|
cp_error_at ("zero width for bit-field `%D'", field);
|
2000-03-19 06:22:04 +01:00
|
|
|
|
w = error_mark_node;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
}
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
|
1999-11-03 22:34:04 +01:00
|
|
|
|
&& TREE_CODE (type) != ENUMERAL_TYPE
|
|
|
|
|
&& TREE_CODE (type) != BOOLEAN_TYPE)
|
|
|
|
|
cp_warning_at ("width of `%D' exceeds its type", field);
|
|
|
|
|
else if (TREE_CODE (type) == ENUMERAL_TYPE
|
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts.
(struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT.
(attribute_hash_list, type_hash_canon): hashcode is now unsigned.
(type_hash_lookup, type_hash_add, type_hash_list): Likewise.
(min_precision): Result is unsignd.
(add_double, neg_double, mul_double): Low word is unsigned.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double): Likewise.
(tree_floor_log2, compare_tree_int): New functions.
(preserve_rtl_expr_temps): New declaration.
* c-common.c (declare_hidden_char_array): Use compare_tree_int.
(decl_attributes): Use tree_log2 to find alignment.
Check for TREE_INT_CST_HIGH for format args.
(min_precision): Now unsigned.
Use tree_floor_log2.
(truthvalue_conversion): Delete long-disabled code.
* c-decl.c (finish_struct): Clean up tests on field width.
(finish_function): Use compare_tree_int.
* c-pragma.c (handle_pragma_token): Use tree_log2 for alignment.
* c-typeck.c (comptypes): Use tree_int_cst_equal.
(default_conversion, digest_init): Use compare_tree_int.
(build_binary_op): Use integer_all_onesp and compare_tree_int.
Fix type errors in forming masks.
* calls.c (initialize_argument_information): Use compare_tree_int.
* dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* except.c (expand_eh_region_start_tree): Use compare_tree_int.
* expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop.
(store_field): Use compare_tree_int.
(expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT.
(expand_expr, case ARRAY_REF): Use compare_tree_int.
(do_jump, case BIT_AND_EXPR): Use tree_floor_log2.
(do_store_flag): Use compare_tree_int.
* fold-const.c (encode, decode): Low part is always unsigned.
(force_fit_type, add_double, neg_double, mul_double): Likewise.
(lshift_double, rshift_double, lrotate_double): Likewise.
(rrotate_double, div_and_round_double, int_const_binop): Likewise.
(fold_convert): Use compare_tree_int.
(operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal.
(invert_truthvalue, case INTEGER_CST): Likewise.
(fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW.
* mkdeps.c (deps_dummy_targets): Make I unsigned.
* rtl.h (add_double, neg_double, mul_double): Low words are unsigned.
(lshift_double, rshift_double, lrotate_double, rrotate_double):
Likewise.
* stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree.
(expand_end_case): Use compare_tree_int.
(estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* stor-layout.c (mode_for_size_tree): Use compare_tree_int.
(layout_decl): Likewise.
(layout_record, layout_union): Make sizes unsigned.
(layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype.
(layout_type, case QUAL_UNION_TYPE): Use compare_tree_int.
* tree.c (struct type_hash): hashcode is unsigned.
(build_type_attribute_variant, type_hash_list): Likewise.
(type_hash_lookup, type_hash_add, type_hash_canon): Likewise.
(attribute_hash_list, build_array_type, build_method_type): Likewise.
(build_complex_type): Likewise.
(real_value_from_int_cst): Remove unneeded casts.
(integer_all_onesp): Add casts.
(tree_floor_log2, compare_tree_int): New functions.
(build_index_type): Use tree_int_cst_sgn.
* varasm.c (assemble_variable): Use compare_tree_int.
* ch/actions.c (chill_convert_for_assignment): INDEX is unsigned
HOST_WIDE_INT.
* ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH
since unsigned.
* ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned.
Use compare_tree_int.
(expand_goto_except_cleanup): Likewise.
* cp/class.c (dfs_modify_vtables): I is now unsigned.
(check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
(build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
* cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
* cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
* cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
Call integer_all_onesp.
* cp/typeck2.c (process_init_constructor): Use compare_tree_int.
* f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int.
(ffecom_sym_transform_, ffecom_transform_common_): Likewise.
(ffecom_transform_equiv_): Likewise.
* java/decl.c (emit_init_test_initialization): Mark KEY as unused.
* java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
(build_anewarray): Likewise.
* java/parse.y (patch_newarray): Likewise.
* java/parse.c: Regenerated.
From-SVN: r32383
2000-03-07 12:41:32 +01:00
|
|
|
|
&& (0 > compare_tree_int (w,
|
|
|
|
|
min_precision (TYPE_MIN_VALUE (type),
|
|
|
|
|
TREE_UNSIGNED (type)))
|
|
|
|
|
|| 0 > compare_tree_int (w,
|
|
|
|
|
min_precision
|
|
|
|
|
(TYPE_MAX_VALUE (type),
|
|
|
|
|
TREE_UNSIGNED (type)))))
|
1999-11-03 22:34:04 +01:00
|
|
|
|
cp_warning_at ("`%D' is too small to hold all values of `%#T'",
|
|
|
|
|
field, type);
|
2000-03-19 06:22:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Remove the bit-field width indicator so that the rest of the
|
|
|
|
|
compiler does not treat that value as an initializer. */
|
|
|
|
|
DECL_INITIAL (field) = NULL_TREE;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
|
2000-03-19 06:22:04 +01:00
|
|
|
|
if (w != error_mark_node)
|
|
|
|
|
{
|
|
|
|
|
DECL_SIZE (field) = convert (bitsizetype, w);
|
|
|
|
|
DECL_BIT_FIELD (field) = 1;
|
1999-11-03 22:34:04 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2000-03-19 06:22:04 +01:00
|
|
|
|
{
|
|
|
|
|
/* Non-bit-fields are aligned for their type. */
|
|
|
|
|
DECL_BIT_FIELD (field) = 0;
|
|
|
|
|
CLEAR_DECL_C_BIT_FIELD (field);
|
|
|
|
|
}
|
1999-11-03 22:34:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FIELD is a non bit-field. We are finishing the processing for its
|
|
|
|
|
enclosing type T. Issue any appropriate messages and set appropriate
|
|
|
|
|
flags. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
check_field_decl (tree field,
|
|
|
|
|
tree t,
|
|
|
|
|
int* cant_have_const_ctor,
|
|
|
|
|
int* cant_have_default_ctor,
|
|
|
|
|
int* no_const_asn_ref,
|
|
|
|
|
int* any_default_members)
|
1999-11-03 22:34:04 +01:00
|
|
|
|
{
|
|
|
|
|
tree type = strip_array_types (TREE_TYPE (field));
|
|
|
|
|
|
|
|
|
|
/* An anonymous union cannot contain any fields which would change
|
|
|
|
|
the settings of CANT_HAVE_CONST_CTOR and friends. */
|
|
|
|
|
if (ANON_UNION_TYPE_P (type))
|
|
|
|
|
;
|
|
|
|
|
/* And, we don't set TYPE_HAS_CONST_INIT_REF, etc., for anonymous
|
|
|
|
|
structs. So, we recurse through their fields here. */
|
|
|
|
|
else if (ANON_AGGR_TYPE_P (type))
|
|
|
|
|
{
|
|
|
|
|
tree fields;
|
|
|
|
|
|
|
|
|
|
for (fields = TYPE_FIELDS (type); fields; fields = TREE_CHAIN (fields))
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
if (TREE_CODE (fields) == FIELD_DECL && !DECL_C_BIT_FIELD (field))
|
1999-11-03 22:34:04 +01:00
|
|
|
|
check_field_decl (fields, t, cant_have_const_ctor,
|
|
|
|
|
cant_have_default_ctor, no_const_asn_ref,
|
|
|
|
|
any_default_members);
|
|
|
|
|
}
|
|
|
|
|
/* Check members with class type for constructors, destructors,
|
|
|
|
|
etc. */
|
|
|
|
|
else if (CLASS_TYPE_P (type))
|
|
|
|
|
{
|
|
|
|
|
/* Never let anything with uninheritable virtuals
|
|
|
|
|
make it through without complaint. */
|
|
|
|
|
abstract_virtuals_error (field, type);
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (t) == UNION_TYPE)
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_NEEDS_CONSTRUCTING (type))
|
|
|
|
|
cp_error_at ("member `%#D' with constructor not allowed in union",
|
|
|
|
|
field);
|
2000-03-03 03:27:15 +01:00
|
|
|
|
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
|
1999-11-03 22:34:04 +01:00
|
|
|
|
cp_error_at ("member `%#D' with destructor not allowed in union",
|
|
|
|
|
field);
|
|
|
|
|
if (TYPE_HAS_COMPLEX_ASSIGN_REF (type))
|
|
|
|
|
cp_error_at ("member `%#D' with copy assignment operator not allowed in union",
|
|
|
|
|
field);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TYPE_NEEDS_CONSTRUCTING (t) |= TYPE_NEEDS_CONSTRUCTING (type);
|
2000-03-03 03:27:15 +01:00
|
|
|
|
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
|
|
|
|
|
|= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type);
|
1999-11-03 22:34:04 +01:00
|
|
|
|
TYPE_HAS_COMPLEX_ASSIGN_REF (t) |= TYPE_HAS_COMPLEX_ASSIGN_REF (type);
|
|
|
|
|
TYPE_HAS_COMPLEX_INIT_REF (t) |= TYPE_HAS_COMPLEX_INIT_REF (type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!TYPE_HAS_CONST_INIT_REF (type))
|
|
|
|
|
*cant_have_const_ctor = 1;
|
|
|
|
|
|
|
|
|
|
if (!TYPE_HAS_CONST_ASSIGN_REF (type))
|
|
|
|
|
*no_const_asn_ref = 1;
|
|
|
|
|
|
|
|
|
|
if (TYPE_HAS_CONSTRUCTOR (type)
|
|
|
|
|
&& ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
|
|
|
|
|
*cant_have_default_ctor = 1;
|
|
|
|
|
}
|
|
|
|
|
if (DECL_INITIAL (field) != NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
/* `build_class_init_list' does not recognize
|
|
|
|
|
non-FIELD_DECLs. */
|
|
|
|
|
if (TREE_CODE (t) == UNION_TYPE && any_default_members != 0)
|
2003-07-03 15:16:01 +02:00
|
|
|
|
error ("multiple fields in union `%T' initialized", t);
|
1999-11-03 22:34:04 +01:00
|
|
|
|
*any_default_members = 1;
|
|
|
|
|
}
|
2000-01-13 01:35:38 +01:00
|
|
|
|
}
|
1999-11-03 22:34:04 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
/* Check the data members (both static and non-static), class-scoped
|
|
|
|
|
typedefs, etc., appearing in the declaration of T. Issue
|
|
|
|
|
appropriate diagnostics. Sets ACCESS_DECLS to a list (in
|
|
|
|
|
declaration order) of access declarations; each TREE_VALUE in this
|
|
|
|
|
list is a USING_DECL.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
In addition, set the following flags:
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
EMPTY_P
|
|
|
|
|
The class is empty, i.e., contains no non-static data members.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CANT_HAVE_DEFAULT_CTOR_P
|
|
|
|
|
This class cannot have an implicitly generated default
|
|
|
|
|
constructor.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CANT_HAVE_CONST_CTOR_P
|
|
|
|
|
This class cannot have an implicitly generated copy constructor
|
|
|
|
|
taking a const reference.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CANT_HAVE_CONST_ASN_REF
|
|
|
|
|
This class cannot have an implicitly generated assignment
|
|
|
|
|
operator taking a const reference.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
All of these flags should be initialized before calling this
|
|
|
|
|
function.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
Returns a pointer to the end of the TYPE_FIELDs chain; additional
|
|
|
|
|
fields can be added by adding to this chain. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
static void
|
2002-10-15 20:07:24 +02:00
|
|
|
|
check_field_decls (tree t, tree *access_decls,
|
|
|
|
|
int *cant_have_default_ctor_p,
|
|
|
|
|
int *cant_have_const_ctor_p,
|
|
|
|
|
int *no_const_asn_ref_p)
|
1999-12-15 01:36:57 +01:00
|
|
|
|
{
|
|
|
|
|
tree *field;
|
|
|
|
|
tree *next;
|
|
|
|
|
int has_pointers;
|
|
|
|
|
int any_default_members;
|
|
|
|
|
|
1999-12-16 04:10:12 +01:00
|
|
|
|
/* First, delete any duplicate fields. */
|
|
|
|
|
delete_duplicate_fields (TYPE_FIELDS (t));
|
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
/* Assume there are no access declarations. */
|
|
|
|
|
*access_decls = NULL_TREE;
|
|
|
|
|
/* Assume this class has no pointer members. */
|
|
|
|
|
has_pointers = 0;
|
|
|
|
|
/* Assume none of the members of this class have default
|
|
|
|
|
initializations. */
|
|
|
|
|
any_default_members = 0;
|
|
|
|
|
|
|
|
|
|
for (field = &TYPE_FIELDS (t); *field; field = next)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1999-12-15 01:36:57 +01:00
|
|
|
|
tree x = *field;
|
|
|
|
|
tree type = TREE_TYPE (x);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
next = &TREE_CHAIN (x);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1996-04-02 23:44:27 +02:00
|
|
|
|
if (TREE_CODE (x) == FIELD_DECL)
|
1996-10-31 18:08:58 +01:00
|
|
|
|
{
|
2003-07-22 11:53:34 +02:00
|
|
|
|
if (TYPE_PACKED (t))
|
|
|
|
|
{
|
|
|
|
|
if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x)))
|
|
|
|
|
cp_warning_at
|
|
|
|
|
("ignoring packed attribute on unpacked non-POD field `%#D'",
|
|
|
|
|
x);
|
|
|
|
|
else
|
|
|
|
|
DECL_PACKED (x) = 1;
|
|
|
|
|
}
|
1998-11-24 00:57:32 +01:00
|
|
|
|
|
|
|
|
|
if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))
|
1999-12-15 01:36:57 +01:00
|
|
|
|
/* We don't treat zero-width bitfields as making a class
|
|
|
|
|
non-empty. */
|
|
|
|
|
;
|
1998-11-24 00:57:32 +01:00
|
|
|
|
else
|
1999-12-29 09:28:50 +01:00
|
|
|
|
{
|
2002-10-21 10:40:24 +02:00
|
|
|
|
tree element_type;
|
|
|
|
|
|
1999-12-29 09:28:50 +01:00
|
|
|
|
/* The class is non-empty. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
CLASSTYPE_EMPTY_P (t) = 0;
|
1999-12-29 09:28:50 +01:00
|
|
|
|
/* The class is not even nearly empty. */
|
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
2002-10-21 10:40:24 +02:00
|
|
|
|
/* If one of the data members contains an empty class,
|
|
|
|
|
so does T. */
|
|
|
|
|
element_type = strip_array_types (type);
|
|
|
|
|
if (CLASS_TYPE_P (element_type)
|
|
|
|
|
&& CLASSTYPE_CONTAINS_EMPTY_CLASS_P (element_type))
|
2002-10-25 01:43:48 +02:00
|
|
|
|
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t) = 1;
|
1999-12-29 09:28:50 +01:00
|
|
|
|
}
|
1996-10-31 18:08:58 +01:00
|
|
|
|
}
|
1996-04-02 23:44:27 +02:00
|
|
|
|
|
1996-02-20 21:35:10 +01:00
|
|
|
|
if (TREE_CODE (x) == USING_DECL)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
1999-12-15 01:36:57 +01:00
|
|
|
|
/* Prune the access declaration from the list of fields. */
|
|
|
|
|
*field = TREE_CHAIN (x);
|
|
|
|
|
|
|
|
|
|
/* Save the access declarations for our caller. */
|
|
|
|
|
*access_decls = tree_cons (NULL_TREE, x, *access_decls);
|
|
|
|
|
|
|
|
|
|
/* Since we've reset *FIELD there's no reason to skip to the
|
|
|
|
|
next field. */
|
|
|
|
|
next = field;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
continue;
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-03-24 11:25:44 +01:00
|
|
|
|
if (TREE_CODE (x) == TYPE_DECL
|
|
|
|
|
|| TREE_CODE (x) == TEMPLATE_DECL)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
continue;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* If we've gotten this far, it's a data member, possibly static,
|
1996-07-11 03:13:25 +02:00
|
|
|
|
or an enumerator. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-convert.c (convert): Return if output or input type is ERROR_MARK.
* c-decl.c (duplicate_decls): Only look at DECL_BUILT_IN_NONANSI
and DECL_INLINE if FUNCTION_DECL.
(pushdecl, redeclaration_error_message): Likewise, for DECL_INLINE.
(store_parm_decls): Check for type of PARM_DECL being ERROR_MARK.
Use DECL_WEAK, not DECL_RESULT, to flag for already seen.
(combine_parm_decls): Likewise.
* ggc-common.c (gcc_mark_tree_children, case 'd'): Use DECL_RESULT_FLD.
* print-tree.c (print_node): Likewise.
Only test DECL_PACKED, DECL_INLINE, DECL_BIT_FIELD, and
DECL_TRANSPARENT_UNION on proper decl types.
Properly handly DECL_INCOMING_RTL and DECL_SAVED_INSNS.
* stor-layout.c (layout_decl): Only check DECL_PACKED and
DECL_BIT_FIELD of FIELD_DECL.
* tree.h (DECL_RESULT_FLD): New macro.
* cp/class.c (check_field_decl): Fix typo.
(build_vtbl_or_vbase_field): Don't clear DECL_SAVED_INSNS.
(check_methods): Likewise.
(check_field_decls): Likewise.
Use DECL_CONTEXT, not DECL_FIELD_CONTEXT.
* cp-tree.h (DECL_SHADOWED_FOR_VAR, DECL_TEMPLATE_RESULT):
Use DECL_RESULT_FLD, not DECL_RESULT.
* cp/decl.c (xref_tag): Use DECL_TEMPLATE_RESULT.
* cp/lex.c (identifier_type): Likewise.
* cp/pt.c (determine_specialization, lookup_template_class): Likewise.
(tsubst_friend_function, tsubst_decl, instantiate_template): Likewise.
(resolve_overloaded_unification, more_specialized): Likewise.
* cp/semantics.c (finish_member_declaration): Likewise.
* cp/typeck.c (build_x_function_call): Likewise.
From-SVN: r32759
2000-03-27 03:26:18 +02:00
|
|
|
|
DECL_CONTEXT (x) = t;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* ``A local class cannot have static data members.'' ARM 9.4 */
|
|
|
|
|
if (current_function_decl && TREE_STATIC (x))
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_error_at ("field `%D' in local class cannot be static", x);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* Perform error checking that did not get done in
|
|
|
|
|
grokdeclarator. */
|
1999-08-03 17:04:49 +02:00
|
|
|
|
if (TREE_CODE (type) == FUNCTION_TYPE)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_error_at ("field `%D' invalidly declared function type",
|
1995-10-12 03:33:51 +01:00
|
|
|
|
x);
|
1999-08-03 17:04:49 +02:00
|
|
|
|
type = build_pointer_type (type);
|
|
|
|
|
TREE_TYPE (x) = type;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
}
|
1999-08-03 17:04:49 +02:00
|
|
|
|
else if (TREE_CODE (type) == METHOD_TYPE)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_error_at ("field `%D' invalidly declared method type", x);
|
1999-08-03 17:04:49 +02:00
|
|
|
|
type = build_pointer_type (type);
|
|
|
|
|
TREE_TYPE (x) = type;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-08-03 17:04:49 +02:00
|
|
|
|
if (type == error_mark_node)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
continue;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* When this goes into scope, it will be a non-local reference. */
|
|
|
|
|
DECL_NONLOCAL (x) = 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
if (TREE_CODE (x) == CONST_DECL)
|
|
|
|
|
continue;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
if (TREE_CODE (x) == VAR_DECL)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (t) == UNION_TYPE)
|
|
|
|
|
/* Unions cannot have static members. */
|
1998-09-07 16:25:35 +02:00
|
|
|
|
cp_error_at ("field `%D' declared static in union", x);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
continue;
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* Now it can only be a FIELD_DECL. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
if (TREE_PRIVATE (x) || TREE_PROTECTED (x))
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CLASSTYPE_NON_AGGREGATE (t) = 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* If this is of reference type, check if it needs an init.
|
|
|
|
|
Also do a little ANSI jig if necessary. */
|
1999-08-03 17:04:49 +02:00
|
|
|
|
if (TREE_CODE (type) == REFERENCE_TYPE)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CLASSTYPE_NON_POD_P (t) = 1;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
if (DECL_INITIAL (x) == NULL_TREE)
|
2002-10-25 17:13:05 +02:00
|
|
|
|
SET_CLASSTYPE_REF_FIELDS_NEED_INIT (t, 1);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* ARM $12.6.2: [A member initializer list] (or, for an
|
|
|
|
|
aggregate, initialization by a brace-enclosed list) is the
|
|
|
|
|
only way to initialize nonstatic const and reference
|
|
|
|
|
members. */
|
1999-12-15 01:36:57 +01:00
|
|
|
|
*cant_have_default_ctor_p = 1;
|
1996-05-30 21:11:58 +02:00
|
|
|
|
TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
|
2002-10-02 22:02:10 +02:00
|
|
|
|
if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
|
|
|
|
|
&& extra_warnings)
|
2000-12-07 15:26:37 +01:00
|
|
|
|
cp_warning_at ("non-static reference `%#D' in class without a constructor", x);
|
1995-10-12 03:33:51 +01:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-11-03 22:34:04 +01:00
|
|
|
|
type = strip_array_types (type);
|
1999-08-03 17:04:49 +02:00
|
|
|
|
|
|
|
|
|
if (TREE_CODE (type) == POINTER_TYPE)
|
1997-02-04 03:31:49 +01:00
|
|
|
|
has_pointers = 1;
|
|
|
|
|
|
1999-08-03 17:04:49 +02:00
|
|
|
|
if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (type))
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CLASSTYPE_HAS_MUTABLE (t) = 1;
|
1999-01-16 17:31:12 +01:00
|
|
|
|
|
2001-03-02 12:44:57 +01:00
|
|
|
|
if (! pod_type_p (type))
|
|
|
|
|
/* DR 148 now allows pointers to members (which are POD themselves),
|
|
|
|
|
to be allowed in POD structs. */
|
1999-12-15 01:36:57 +01:00
|
|
|
|
CLASSTYPE_NON_POD_P (t) = 1;
|
1999-08-03 17:04:49 +02:00
|
|
|
|
|
2002-05-14 19:20:47 +02:00
|
|
|
|
if (! zero_init_p (type))
|
|
|
|
|
CLASSTYPE_NON_ZERO_INIT_P (t) = 1;
|
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* If any field is const, the structure type is pseudo-const. */
|
1999-08-03 17:04:49 +02:00
|
|
|
|
if (CP_TYPE_CONST_P (type))
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
|
|
|
|
C_TYPE_FIELDS_READONLY (t) = 1;
|
|
|
|
|
if (DECL_INITIAL (x) == NULL_TREE)
|
2002-10-25 17:13:05 +02:00
|
|
|
|
SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t, 1);
|
1995-10-12 03:33:51 +01:00
|
|
|
|
|
|
|
|
|
/* ARM $12.6.2: [A member initializer list] (or, for an
|
|
|
|
|
aggregate, initialization by a brace-enclosed list) is the
|
|
|
|
|
only way to initialize nonstatic const and reference
|
|
|
|
|
members. */
|
1999-12-15 01:36:57 +01:00
|
|
|
|
*cant_have_default_ctor_p = 1;
|
1996-05-30 21:11:58 +02:00
|
|
|
|
TYPE_HAS_COMPLEX_ASSIGN_REF (t) = 1;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
|
2002-10-02 22:02:10 +02:00
|
|
|
|
if (! TYPE_HAS_CONSTRUCTOR (t) && CLASSTYPE_NON_AGGREGATE (t)
|
|
|
|
|
&& extra_warnings)
|
2000-12-07 15:26:37 +01:00
|
|
|
|
cp_warning_at ("non-static const member `%#D' in class without a constructor", x);
|
1995-10-12 03:33:51 +01:00
|
|
|
|
}
|
1999-12-15 01:36:57 +01:00
|
|
|
|
/* A field that is pseudo-const makes the structure likewise. */
|
2003-01-30 17:02:58 +01:00
|
|
|
|
else if (CLASS_TYPE_P (type))
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
1999-12-15 01:36:57 +01:00
|
|
|
|
C_TYPE_FIELDS_READONLY (t) |= C_TYPE_FIELDS_READONLY (type);
|
2002-10-25 17:13:05 +02:00
|
|
|
|
SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT (t,
|
|
|
|
|
CLASSTYPE_READONLY_FIELDS_NEED_INIT (t)
|
|
|
|
|
| CLASSTYPE_READONLY_FIELDS_NEED_INIT (type));
|
1995-10-12 03:33:51 +01:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-05-11 21:22:53 +02:00
|
|
|
|
/* Core issue 80: A nonstatic data member is required to have a
|
|
|
|
|
different name from the class iff the class has a
|
|
|
|
|
user-defined constructor. */
|
2003-07-10 11:02:06 +02:00
|
|
|
|
if (constructor_name_p (DECL_NAME (x), t) && TYPE_HAS_CONSTRUCTOR (t))
|
2000-05-11 21:24:28 +02:00
|
|
|
|
cp_pedwarn_at ("field `%#D' with same name as class", x);
|
2000-05-11 21:22:53 +02:00
|
|
|
|
|
1998-10-16 05:37:43 +02:00
|
|
|
|
/* We set DECL_C_BIT_FIELD in grokbitfield.
|
|
|
|
|
If the type and width are valid, we'll also set DECL_BIT_FIELD. */
|
|
|
|
|
if (DECL_C_BIT_FIELD (x))
|
1999-11-03 22:34:04 +01:00
|
|
|
|
check_bitfield_decl (x);
|
1995-10-12 03:33:51 +01:00
|
|
|
|
else
|
1999-11-03 22:34:04 +01:00
|
|
|
|
check_field_decl (x, t,
|
1999-12-15 01:36:57 +01:00
|
|
|
|
cant_have_const_ctor_p,
|
|
|
|
|
cant_have_default_ctor_p,
|
|
|
|
|
no_const_asn_ref_p,
|
1999-11-03 22:34:04 +01:00
|
|
|
|
&any_default_members);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
1997-02-04 03:31:49 +01:00
|
|
|
|
/* Effective C++ rule 11. */
|
1997-07-08 02:17:49 +02:00
|
|
|
|
if (has_pointers && warn_ecpp && TYPE_HAS_CONSTRUCTOR (t)
|
1997-02-04 03:31:49 +01:00
|
|
|
|
&& ! (TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("`%#T' has pointer data members", t);
|
1997-02-04 03:31:49 +01:00
|
|
|
|
|
|
|
|
|
if (! TYPE_HAS_INIT_REF (t))
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning (" but does not override `%T(const %T&)'", t, t);
|
1997-02-04 03:31:49 +01:00
|
|
|
|
if (! TYPE_HAS_ASSIGN_REF (t))
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning (" or `operator=(const %T&)'", t);
|
1997-02-04 03:31:49 +01:00
|
|
|
|
}
|
|
|
|
|
else if (! TYPE_HAS_ASSIGN_REF (t))
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning (" but does not override `operator=(const %T&)'", t);
|
1997-02-04 03:31:49 +01:00
|
|
|
|
}
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
|
|
|
|
/* Check anonymous struct/anonymous union fields. */
|
|
|
|
|
finish_struct_anon (t);
|
|
|
|
|
|
1999-12-15 01:36:57 +01:00
|
|
|
|
/* We've built up the list of access declarations in reverse order.
|
|
|
|
|
Fix that now. */
|
|
|
|
|
*access_decls = nreverse (*access_decls);
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* If TYPE is an empty class type, records its OFFSET in the table of
|
|
|
|
|
OFFSETS. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
record_subobject_offset (tree type, tree offset, splay_tree offsets)
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2000-10-20 08:04:59 +02:00
|
|
|
|
splay_tree_node n;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
if (!is_empty_class (type))
|
|
|
|
|
return 0;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Record the location of this empty object in OFFSETS. */
|
|
|
|
|
n = splay_tree_lookup (offsets, (splay_tree_key) offset);
|
|
|
|
|
if (!n)
|
|
|
|
|
n = splay_tree_insert (offsets,
|
|
|
|
|
(splay_tree_key) offset,
|
|
|
|
|
(splay_tree_value) NULL_TREE);
|
|
|
|
|
n->value = ((splay_tree_value)
|
|
|
|
|
tree_cons (NULL_TREE,
|
|
|
|
|
type,
|
|
|
|
|
(tree) n->value));
|
|
|
|
|
|
|
|
|
|
return 0;
|
1999-12-16 23:18:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-21 14:51:56 +02:00
|
|
|
|
/* Returns nonzero if TYPE is an empty class type and there is
|
2000-10-20 08:04:59 +02:00
|
|
|
|
already an entry in OFFSETS for the same TYPE as the same OFFSET. */
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
check_subobject_offset (tree type, tree offset, splay_tree offsets)
|
2000-03-22 02:32:09 +01:00
|
|
|
|
{
|
2000-10-20 08:04:59 +02:00
|
|
|
|
splay_tree_node n;
|
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
|
|
if (!is_empty_class (type))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Record the location of this empty object in OFFSETS. */
|
|
|
|
|
n = splay_tree_lookup (offsets, (splay_tree_key) offset);
|
|
|
|
|
if (!n)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (t = (tree) n->value; t; t = TREE_CHAIN (t))
|
|
|
|
|
if (same_type_p (TREE_VALUE (t), type))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
2000-03-22 02:32:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Walk through all the subobjects of TYPE (located at OFFSET). Call
|
|
|
|
|
F for every subobject, passing it the type, offset, and table of
|
2002-11-26 08:20:13 +01:00
|
|
|
|
OFFSETS. If VBASES_P is one, then virtual non-primary bases should
|
|
|
|
|
be traversed.
|
2001-05-07 17:45:24 +02:00
|
|
|
|
|
|
|
|
|
If MAX_OFFSET is non-NULL, then subobjects with an offset greater
|
|
|
|
|
than MAX_OFFSET will not be walked.
|
|
|
|
|
|
2002-09-21 14:51:56 +02:00
|
|
|
|
If F returns a nonzero value, the traversal ceases, and that value
|
2001-05-07 17:45:24 +02:00
|
|
|
|
is returned. Otherwise, returns zero. */
|
2000-01-11 04:15:32 +01:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
walk_subobject_offsets (tree type,
|
|
|
|
|
subobject_offset_fn f,
|
|
|
|
|
tree offset,
|
|
|
|
|
splay_tree offsets,
|
|
|
|
|
tree max_offset,
|
|
|
|
|
int vbases_p)
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2000-10-20 08:04:59 +02:00
|
|
|
|
int r = 0;
|
2002-11-29 22:17:05 +01:00
|
|
|
|
tree type_binfo = NULL_TREE;
|
2000-10-20 08:04:59 +02:00
|
|
|
|
|
2001-05-07 17:45:24 +02:00
|
|
|
|
/* If this OFFSET is bigger than the MAX_OFFSET, then we should
|
|
|
|
|
stop. */
|
|
|
|
|
if (max_offset && INT_CST_LT (max_offset, offset))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (!TYPE_P (type))
|
|
|
|
|
{
|
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
type_binfo = type;
|
|
|
|
|
type = BINFO_TYPE (type);
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
if (CLASS_TYPE_P (type))
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2000-10-20 08:04:59 +02:00
|
|
|
|
tree field;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree binfo;
|
2000-10-20 08:04:59 +02:00
|
|
|
|
int i;
|
|
|
|
|
|
2002-10-21 10:40:24 +02:00
|
|
|
|
/* Avoid recursing into objects that are not interesting. */
|
|
|
|
|
if (!CLASSTYPE_CONTAINS_EMPTY_CLASS_P (type))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Record the location of TYPE. */
|
|
|
|
|
r = (*f) (type, offset, offsets);
|
|
|
|
|
if (r)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
/* Iterate through the direct base classes of TYPE. */
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (!type_binfo)
|
|
|
|
|
type_binfo = TYPE_BINFO (type);
|
|
|
|
|
for (i = 0; i < BINFO_N_BASETYPES (type_binfo); ++i)
|
2000-10-20 08:04:59 +02:00
|
|
|
|
{
|
2002-11-29 22:17:05 +01:00
|
|
|
|
tree binfo_offset;
|
|
|
|
|
|
|
|
|
|
binfo = BINFO_BASETYPE (type_binfo, i);
|
2002-09-30 18:52:19 +02:00
|
|
|
|
|
|
|
|
|
if (abi_version_at_least (2)
|
|
|
|
|
&& TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
continue;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
if (!vbases_p
|
|
|
|
|
&& TREE_VIA_VIRTUAL (binfo)
|
2001-02-05 12:45:16 +01:00
|
|
|
|
&& !BINFO_PRIMARY_P (binfo))
|
2000-10-20 08:04:59 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (!abi_version_at_least (2))
|
|
|
|
|
binfo_offset = size_binop (PLUS_EXPR,
|
|
|
|
|
offset,
|
|
|
|
|
BINFO_OFFSET (binfo));
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree orig_binfo;
|
|
|
|
|
/* We cannot rely on BINFO_OFFSET being set for the base
|
|
|
|
|
class yet, but the offsets for direct non-virtual
|
|
|
|
|
bases can be calculated by going back to the TYPE. */
|
|
|
|
|
orig_binfo = BINFO_BASETYPE (TYPE_BINFO (type), i);
|
|
|
|
|
binfo_offset = size_binop (PLUS_EXPR,
|
|
|
|
|
offset,
|
|
|
|
|
BINFO_OFFSET (orig_binfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r = walk_subobject_offsets (binfo,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
f,
|
2002-11-29 22:17:05 +01:00
|
|
|
|
binfo_offset,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
offsets,
|
2001-05-07 17:45:24 +02:00
|
|
|
|
max_offset,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
(abi_version_at_least (2)
|
|
|
|
|
? /*vbases_p=*/0 : vbases_p));
|
2000-10-20 08:04:59 +02:00
|
|
|
|
if (r)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (abi_version_at_least (2))
|
2002-09-30 18:52:19 +02:00
|
|
|
|
{
|
|
|
|
|
tree vbase;
|
|
|
|
|
|
2002-11-29 22:17:05 +01:00
|
|
|
|
/* Iterate through the virtual base classes of TYPE. In G++
|
|
|
|
|
3.2, we included virtual bases in the direct base class
|
|
|
|
|
loop above, which results in incorrect results; the
|
|
|
|
|
correct offsets for virtual bases are only known when
|
|
|
|
|
working with the most derived type. */
|
|
|
|
|
if (vbases_p)
|
|
|
|
|
for (vbase = CLASSTYPE_VBASECLASSES (type);
|
|
|
|
|
vbase;
|
|
|
|
|
vbase = TREE_CHAIN (vbase))
|
|
|
|
|
{
|
|
|
|
|
binfo = TREE_VALUE (vbase);
|
|
|
|
|
r = walk_subobject_offsets (binfo,
|
|
|
|
|
f,
|
|
|
|
|
size_binop (PLUS_EXPR,
|
|
|
|
|
offset,
|
|
|
|
|
BINFO_OFFSET (binfo)),
|
|
|
|
|
offsets,
|
|
|
|
|
max_offset,
|
|
|
|
|
/*vbases_p=*/0);
|
|
|
|
|
if (r)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-09-30 18:52:19 +02:00
|
|
|
|
{
|
2002-11-29 22:17:05 +01:00
|
|
|
|
/* We still have to walk the primary base, if it is
|
|
|
|
|
virtual. (If it is non-virtual, then it was walked
|
|
|
|
|
above.) */
|
|
|
|
|
vbase = get_primary_binfo (type_binfo);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (vbase && TREE_VIA_VIRTUAL (vbase)
|
|
|
|
|
&& BINFO_PRIMARY_BASE_OF (vbase) == type_binfo)
|
2002-11-29 22:17:05 +01:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
r = (walk_subobject_offsets
|
|
|
|
|
(vbase, f, offset,
|
|
|
|
|
offsets, max_offset, /*vbases_p=*/0));
|
|
|
|
|
if (r)
|
|
|
|
|
return r;
|
2002-11-29 22:17:05 +01:00
|
|
|
|
}
|
2002-09-30 18:52:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Iterate through the fields of TYPE. */
|
|
|
|
|
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (TREE_CODE (field) == FIELD_DECL && !DECL_ARTIFICIAL (field))
|
2000-10-20 08:04:59 +02:00
|
|
|
|
{
|
2002-09-25 21:07:35 +02:00
|
|
|
|
tree field_offset;
|
|
|
|
|
|
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
field_offset = byte_position (field);
|
|
|
|
|
else
|
|
|
|
|
/* In G++ 3.2, DECL_FIELD_OFFSET was used. */
|
|
|
|
|
field_offset = DECL_FIELD_OFFSET (field);
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
r = walk_subobject_offsets (TREE_TYPE (field),
|
|
|
|
|
f,
|
|
|
|
|
size_binop (PLUS_EXPR,
|
|
|
|
|
offset,
|
2002-09-25 21:07:35 +02:00
|
|
|
|
field_offset),
|
2000-10-20 08:04:59 +02:00
|
|
|
|
offsets,
|
2001-05-07 17:45:24 +02:00
|
|
|
|
max_offset,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/*vbases_p=*/1);
|
|
|
|
|
if (r)
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
2000-10-20 08:04:59 +02:00
|
|
|
|
else if (TREE_CODE (type) == ARRAY_TYPE)
|
|
|
|
|
{
|
2002-10-21 10:40:24 +02:00
|
|
|
|
tree element_type = strip_array_types (type);
|
2000-10-20 08:04:59 +02:00
|
|
|
|
tree domain = TYPE_DOMAIN (type);
|
|
|
|
|
tree index;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2002-10-21 10:40:24 +02:00
|
|
|
|
/* Avoid recursing into objects that are not interesting. */
|
|
|
|
|
if (!CLASS_TYPE_P (element_type)
|
|
|
|
|
|| !CLASSTYPE_CONTAINS_EMPTY_CLASS_P (element_type))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Step through each of the elements in the array. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
for (index = size_zero_node;
|
|
|
|
|
/* G++ 3.2 had an off-by-one error here. */
|
|
|
|
|
(abi_version_at_least (2)
|
|
|
|
|
? !INT_CST_LT (TYPE_MAX_VALUE (domain), index)
|
|
|
|
|
: INT_CST_LT (index, TYPE_MAX_VALUE (domain)));
|
2000-10-20 08:04:59 +02:00
|
|
|
|
index = size_binop (PLUS_EXPR, index, size_one_node))
|
|
|
|
|
{
|
|
|
|
|
r = walk_subobject_offsets (TREE_TYPE (type),
|
|
|
|
|
f,
|
|
|
|
|
offset,
|
|
|
|
|
offsets,
|
2001-05-07 17:45:24 +02:00
|
|
|
|
max_offset,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/*vbases_p=*/1);
|
|
|
|
|
if (r)
|
|
|
|
|
return r;
|
|
|
|
|
offset = size_binop (PLUS_EXPR, offset,
|
|
|
|
|
TYPE_SIZE_UNIT (TREE_TYPE (type)));
|
2001-05-07 17:45:24 +02:00
|
|
|
|
/* If this new OFFSET is bigger than the MAX_OFFSET, then
|
|
|
|
|
there's no point in iterating through the remaining
|
|
|
|
|
elements of the array. */
|
|
|
|
|
if (max_offset && INT_CST_LT (max_offset, offset))
|
|
|
|
|
break;
|
2000-10-20 08:04:59 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record all of the empty subobjects of TYPE (located at OFFSET) in
|
2002-09-21 14:51:56 +02:00
|
|
|
|
OFFSETS. If VBASES_P is nonzero, virtual bases of TYPE are
|
2000-10-20 08:04:59 +02:00
|
|
|
|
examined. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
record_subobject_offsets (tree type,
|
|
|
|
|
tree offset,
|
|
|
|
|
splay_tree offsets,
|
|
|
|
|
int vbases_p)
|
2000-10-20 08:04:59 +02:00
|
|
|
|
{
|
|
|
|
|
walk_subobject_offsets (type, record_subobject_offset, offset,
|
2001-05-07 17:45:24 +02:00
|
|
|
|
offsets, /*max_offset=*/NULL_TREE, vbases_p);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-21 14:51:56 +02:00
|
|
|
|
/* Returns nonzero if any of the empty subobjects of TYPE (located at
|
|
|
|
|
OFFSET) conflict with entries in OFFSETS. If VBASES_P is nonzero,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
virtual bases of TYPE are examined. */
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
layout_conflict_p (tree type,
|
|
|
|
|
tree offset,
|
|
|
|
|
splay_tree offsets,
|
|
|
|
|
int vbases_p)
|
2000-03-22 02:32:09 +01:00
|
|
|
|
{
|
2001-05-07 17:45:24 +02:00
|
|
|
|
splay_tree_node max_node;
|
|
|
|
|
|
|
|
|
|
/* Get the node in OFFSETS that indicates the maximum offset where
|
|
|
|
|
an empty subobject is located. */
|
|
|
|
|
max_node = splay_tree_max (offsets);
|
|
|
|
|
/* If there aren't any empty subobjects, then there's no point in
|
|
|
|
|
performing this check. */
|
|
|
|
|
if (!max_node)
|
|
|
|
|
return 0;
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
return walk_subobject_offsets (type, check_subobject_offset, offset,
|
2001-05-07 17:45:24 +02:00
|
|
|
|
offsets, (tree) (max_node->key),
|
|
|
|
|
vbases_p);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* DECL is a FIELD_DECL corresponding either to a base subobject of a
|
|
|
|
|
non-static data member of the type indicated by RLI. BINFO is the
|
2000-10-20 08:04:59 +02:00
|
|
|
|
binfo corresponding to the base subobject, OFFSETS maps offsets to
|
2002-09-30 18:52:19 +02:00
|
|
|
|
types already located at those offsets. This function determines
|
|
|
|
|
the position of the DECL. */
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2002-09-30 18:52:19 +02:00
|
|
|
|
layout_nonempty_base_or_field (record_layout_info rli,
|
|
|
|
|
tree decl,
|
|
|
|
|
tree binfo,
|
|
|
|
|
splay_tree offsets)
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2000-10-20 08:04:59 +02:00
|
|
|
|
tree offset = NULL_TREE;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
bool field_p;
|
|
|
|
|
tree type;
|
|
|
|
|
|
|
|
|
|
if (binfo)
|
|
|
|
|
{
|
|
|
|
|
/* For the purposes of determining layout conflicts, we want to
|
|
|
|
|
use the class type of BINFO; TREE_TYPE (DECL) will be the
|
|
|
|
|
CLASSTYPE_AS_BASE version, which does not contain entries for
|
|
|
|
|
zero-sized bases. */
|
|
|
|
|
type = TREE_TYPE (binfo);
|
|
|
|
|
field_p = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
type = TREE_TYPE (decl);
|
|
|
|
|
field_p = true;
|
|
|
|
|
}
|
2000-10-20 08:04:59 +02:00
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* Try to place the field. It may take more than one try if we have
|
|
|
|
|
a hard time placing the field without putting two objects of the
|
|
|
|
|
same type at the same address. */
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
2000-05-26 23:40:01 +02:00
|
|
|
|
struct record_layout_info_s old_rli = *rli;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
/* Place this field. */
|
|
|
|
|
place_field (rli, decl);
|
2000-03-28 21:27:15 +02:00
|
|
|
|
offset = byte_position (decl);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
|
|
|
|
/* We have to check to see whether or not there is already
|
|
|
|
|
something of the same type at the offset we're about to use.
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
|
|
struct S {};
|
|
|
|
|
struct T : public S { int i; };
|
|
|
|
|
struct U : public S, public T {};
|
|
|
|
|
|
|
|
|
|
Here, we put S at offset zero in U. Then, we can't put T at
|
|
|
|
|
offset zero -- its S component would be at the same address
|
|
|
|
|
as the S we already allocated. So, we have to skip ahead.
|
|
|
|
|
Since all data members, including those whose type is an
|
2002-09-21 14:51:56 +02:00
|
|
|
|
empty class, have nonzero size, any overlap can happen only
|
2000-03-15 01:16:21 +01:00
|
|
|
|
with a direct or indirect base-class -- it can't happen with
|
|
|
|
|
a data member. */
|
2002-10-22 07:04:48 +02:00
|
|
|
|
/* G++ 3.2 did not check for overlaps when placing a non-empty
|
|
|
|
|
virtual base. */
|
|
|
|
|
if (!abi_version_at_least (2) && binfo && TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
break;
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (layout_conflict_p (field_p ? type : binfo, offset,
|
|
|
|
|
offsets, field_p))
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
|
|
|
|
/* Strip off the size allocated to this field. That puts us
|
|
|
|
|
at the first place we could have put the field with
|
|
|
|
|
proper alignment. */
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
*rli = old_rli;
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Bump up by the alignment required for the type. */
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
rli->bitpos
|
2000-10-20 08:04:59 +02:00
|
|
|
|
= size_binop (PLUS_EXPR, rli->bitpos,
|
|
|
|
|
bitsize_int (binfo
|
|
|
|
|
? CLASSTYPE_ALIGN (type)
|
|
|
|
|
: TYPE_ALIGN (type)));
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
normalize_rli (rli);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
/* There was no conflict. We're done laying out this field. */
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-10-20 08:04:59 +02:00
|
|
|
|
|
2001-06-12 20:08:05 +02:00
|
|
|
|
/* Now that we know where it will be placed, update its
|
2000-10-20 08:04:59 +02:00
|
|
|
|
BINFO_OFFSET. */
|
|
|
|
|
if (binfo && CLASS_TYPE_P (BINFO_TYPE (binfo)))
|
2002-11-15 06:46:34 +01:00
|
|
|
|
/* Indirect virtual bases may have a nonzero BINFO_OFFSET at
|
2002-09-30 18:52:19 +02:00
|
|
|
|
this point because their BINFO_OFFSET is copied from another
|
|
|
|
|
hierarchy. Therefore, we may not need to add the entire
|
|
|
|
|
OFFSET. */
|
2000-10-20 08:04:59 +02:00
|
|
|
|
propagate_binfo_offsets (binfo,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
size_diffop (convert (ssizetype, offset),
|
|
|
|
|
convert (ssizetype,
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_OFFSET (binfo))));
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-15 06:46:34 +01:00
|
|
|
|
/* Returns true if TYPE is empty and OFFSET is nonzero. */
|
2002-10-22 07:04:48 +02:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
empty_base_at_nonzero_offset_p (tree type,
|
|
|
|
|
tree offset,
|
|
|
|
|
splay_tree offsets ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
return is_empty_class (type) && !integer_zerop (offset);
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-22 02:32:09 +01:00
|
|
|
|
/* Layout the empty base BINFO. EOC indicates the byte currently just
|
2000-03-26 20:57:57 +02:00
|
|
|
|
past the end of the class, and should be correctly aligned for a
|
2000-10-20 08:04:59 +02:00
|
|
|
|
class of the type indicated by BINFO; OFFSETS gives the offsets of
|
2001-06-12 20:08:05 +02:00
|
|
|
|
the empty bases allocated so far. T is the most derived
|
2002-09-21 14:51:56 +02:00
|
|
|
|
type. Return nonzero iff we added it at the end. */
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
2001-04-20 17:29:09 +02:00
|
|
|
|
static bool
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
layout_empty_base (tree binfo, tree eoc, splay_tree offsets)
|
2000-03-22 02:32:09 +01:00
|
|
|
|
{
|
2000-03-26 20:57:57 +02:00
|
|
|
|
tree alignment;
|
2000-03-22 02:32:09 +01:00
|
|
|
|
tree basetype = BINFO_TYPE (binfo);
|
2001-04-20 17:29:09 +02:00
|
|
|
|
bool atend = false;
|
2002-09-25 21:07:35 +02:00
|
|
|
|
|
2000-03-22 02:32:09 +01:00
|
|
|
|
/* This routine should only be used for empty classes. */
|
|
|
|
|
my_friendly_assert (is_empty_class (basetype), 20000321);
|
2000-05-29 17:35:06 +02:00
|
|
|
|
alignment = ssize_int (CLASSTYPE_ALIGN_UNIT (basetype));
|
2002-09-25 21:07:35 +02:00
|
|
|
|
|
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
BINFO_OFFSET (binfo) = size_zero_node;
|
|
|
|
|
if (warn_abi && !integer_zerop (BINFO_OFFSET (binfo)))
|
|
|
|
|
warning ("offset of empty base `%T' may not be ABI-compliant and may"
|
|
|
|
|
"change in a future version of GCC",
|
|
|
|
|
BINFO_TYPE (binfo));
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
|
|
|
|
/* This is an empty base class. We first try to put it at offset
|
|
|
|
|
zero. */
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (layout_conflict_p (binfo,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
BINFO_OFFSET (binfo),
|
|
|
|
|
offsets,
|
|
|
|
|
/*vbases_p=*/0))
|
2000-03-22 02:32:09 +01:00
|
|
|
|
{
|
|
|
|
|
/* That didn't work. Now, we move forward from the next
|
|
|
|
|
available spot in the class. */
|
2001-04-20 17:29:09 +02:00
|
|
|
|
atend = true;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
propagate_binfo_offsets (binfo, convert (ssizetype, eoc));
|
2000-03-22 02:32:09 +01:00
|
|
|
|
while (1)
|
|
|
|
|
{
|
2002-11-29 22:17:05 +01:00
|
|
|
|
if (!layout_conflict_p (binfo,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
BINFO_OFFSET (binfo),
|
|
|
|
|
offsets,
|
|
|
|
|
/*vbases_p=*/0))
|
2000-03-22 02:32:09 +01:00
|
|
|
|
/* We finally found a spot where there's no overlap. */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* There's overlap here, too. Bump along to the next spot. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
propagate_binfo_offsets (binfo, alignment);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-04-20 17:29:09 +02:00
|
|
|
|
return atend;
|
2000-03-22 02:32:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Layout the the base given by BINFO in the class indicated by RLI.
|
2002-10-15 20:07:24 +02:00
|
|
|
|
*BASE_ALIGN is a running maximum of the alignments of
|
2002-09-30 18:52:19 +02:00
|
|
|
|
any base class. OFFSETS gives the location of empty base
|
|
|
|
|
subobjects. T is the most derived type. Return nonzero if the new
|
|
|
|
|
object cannot be nearly-empty. A new FIELD_DECL is inserted at
|
|
|
|
|
*NEXT_FIELD, unless BINFO is for an empty base class.
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
Returns the location at which the next field should be inserted. */
|
|
|
|
|
|
|
|
|
|
static tree *
|
2002-10-15 20:07:24 +02:00
|
|
|
|
build_base_field (record_layout_info rli, tree binfo,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
splay_tree offsets, tree *next_field)
|
2000-01-11 04:15:32 +01:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree t = rli->t;
|
2000-01-11 04:15:32 +01:00
|
|
|
|
tree basetype = BINFO_TYPE (binfo);
|
|
|
|
|
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (!COMPLETE_TYPE_P (basetype))
|
2000-01-11 04:15:32 +01:00
|
|
|
|
/* This error is now reported in xref_tag, thus giving better
|
|
|
|
|
location information. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
return next_field;
|
2000-01-11 04:15:32 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Place the base class. */
|
|
|
|
|
if (!is_empty_class (basetype))
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree decl;
|
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* The containing class is non-empty because it has a non-empty
|
|
|
|
|
base class. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
CLASSTYPE_EMPTY_P (t) = 0;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
|
|
|
|
|
/* Create the FIELD_DECL. */
|
|
|
|
|
decl = build_decl (FIELD_DECL, NULL_TREE, CLASSTYPE_AS_BASE (basetype));
|
|
|
|
|
DECL_ARTIFICIAL (decl) = 1;
|
|
|
|
|
DECL_FIELD_CONTEXT (decl) = t;
|
|
|
|
|
DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
|
|
|
|
|
DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
|
|
|
|
|
DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
|
|
|
|
|
DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype);
|
2003-02-18 08:24:44 +01:00
|
|
|
|
DECL_IGNORED_P (decl) = 1;
|
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* Try to place the field. It may take more than one try if we
|
|
|
|
|
have a hard time placing the field without putting two
|
|
|
|
|
objects of the same type at the same address. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
layout_nonempty_base_or_field (rli, decl, binfo, offsets);
|
|
|
|
|
/* Add the new FIELD_DECL to the list of fields for T. */
|
|
|
|
|
TREE_CHAIN (decl) = *next_field;
|
|
|
|
|
*next_field = decl;
|
|
|
|
|
next_field = &TREE_CHAIN (decl);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
2000-03-26 20:57:57 +02:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree eoc;
|
2002-10-22 07:04:48 +02:00
|
|
|
|
bool atend;
|
2000-03-26 20:57:57 +02:00
|
|
|
|
|
|
|
|
|
/* On some platforms (ARM), even empty classes will not be
|
|
|
|
|
byte-aligned. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
eoc = round_up (rli_size_unit_so_far (rli),
|
|
|
|
|
CLASSTYPE_ALIGN_UNIT (basetype));
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
atend = layout_empty_base (binfo, eoc, offsets);
|
2002-10-22 07:04:48 +02:00
|
|
|
|
/* A nearly-empty class "has no proper base class that is empty,
|
|
|
|
|
not morally virtual, and at an offset other than zero." */
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (binfo) && CLASSTYPE_NEARLY_EMPTY_P (t))
|
|
|
|
|
{
|
|
|
|
|
if (atend)
|
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
|
|
|
|
/* The check above (used in G++ 3.2) is insufficient because
|
|
|
|
|
an empty class placed at offset zero might itself have an
|
2002-11-15 06:46:34 +01:00
|
|
|
|
empty base at a nonzero offset. */
|
2002-10-22 07:04:48 +02:00
|
|
|
|
else if (walk_subobject_offsets (basetype,
|
|
|
|
|
empty_base_at_nonzero_offset_p,
|
|
|
|
|
size_zero_node,
|
|
|
|
|
/*offsets=*/NULL,
|
|
|
|
|
/*max_offset=*/NULL_TREE,
|
|
|
|
|
/*vbases_p=*/true))
|
|
|
|
|
{
|
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
|
|
|
|
else if (warn_abi)
|
|
|
|
|
warning ("class `%T' will be considered nearly empty in a "
|
|
|
|
|
"future version of GCC", t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* We do not create a FIELD_DECL for empty base classes because
|
|
|
|
|
it might overlap some other field. We want to be able to
|
|
|
|
|
create CONSTRUCTORs for the class by iterating over the
|
|
|
|
|
FIELD_DECLs, and the back end does not handle overlapping
|
|
|
|
|
FIELD_DECLs. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
|
|
|
|
|
/* An empty virtual base causes a class to be non-empty
|
|
|
|
|
-- but in that case we do not need to clear CLASSTYPE_EMPTY_P
|
|
|
|
|
here because that was already done when the virtual table
|
|
|
|
|
pointer was created. */
|
2000-03-26 20:57:57 +02:00
|
|
|
|
}
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
|
|
|
|
/* Record the offsets of BINFO and its base subobjects. */
|
2002-11-29 22:17:05 +01:00
|
|
|
|
record_subobject_offsets (binfo,
|
2000-10-20 08:04:59 +02:00
|
|
|
|
BINFO_OFFSET (binfo),
|
|
|
|
|
offsets,
|
|
|
|
|
/*vbases_p=*/0);
|
2002-09-30 18:52:19 +02:00
|
|
|
|
|
|
|
|
|
return next_field;
|
2000-01-11 04:15:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Layout all of the non-virtual base classes. Record empty
|
2002-09-30 18:52:19 +02:00
|
|
|
|
subobjects in OFFSETS. T is the most derived type. Return nonzero
|
|
|
|
|
if the type cannot be nearly empty. The fields created
|
|
|
|
|
corresponding to the base classes will be inserted at
|
|
|
|
|
*NEXT_FIELD. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
static void
|
2002-10-15 20:07:24 +02:00
|
|
|
|
build_base_fields (record_layout_info rli,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
splay_tree offsets, tree *next_field)
|
1999-12-16 23:18:22 +01:00
|
|
|
|
{
|
|
|
|
|
/* Chain to hold all the new FIELD_DECLs which stand in for base class
|
|
|
|
|
subobjects. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree t = rli->t;
|
|
|
|
|
int n_baseclasses = CLASSTYPE_N_BASECLASSES (t);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
int i;
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* The primary base class is always allocated first. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
|
|
|
|
next_field = build_base_field (rli, CLASSTYPE_PRIMARY_BINFO (t),
|
2002-10-15 20:07:24 +02:00
|
|
|
|
offsets, next_field);
|
2000-01-11 04:15:32 +01:00
|
|
|
|
|
|
|
|
|
/* Now allocate the rest of the bases. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
for (i = 0; i < n_baseclasses; ++i)
|
|
|
|
|
{
|
2000-01-11 04:15:32 +01:00
|
|
|
|
tree base_binfo;
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
base_binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* The primary base was already allocated above, so we don't
|
|
|
|
|
need to allocate it again here. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (base_binfo == CLASSTYPE_PRIMARY_BINFO (t))
|
1999-12-16 23:18:22 +01:00
|
|
|
|
continue;
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
/* Virtual bases are added at the end (a primary virtual base
|
|
|
|
|
will have already been added). */
|
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
1999-12-16 23:18:22 +01:00
|
|
|
|
continue;
|
|
|
|
|
|
2002-10-15 20:07:24 +02:00
|
|
|
|
next_field = build_base_field (rli, base_binfo,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
offsets, next_field);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-16 04:10:12 +01:00
|
|
|
|
/* Go through the TYPE_METHODS of T issuing any appropriate
|
|
|
|
|
diagnostics, figuring out which methods override which other
|
1999-12-21 03:11:10 +01:00
|
|
|
|
methods, and so forth. */
|
1999-12-16 04:10:12 +01:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
check_methods (tree t)
|
1999-12-16 04:10:12 +01:00
|
|
|
|
{
|
|
|
|
|
tree x;
|
|
|
|
|
|
|
|
|
|
for (x = TYPE_METHODS (t); x; x = TREE_CHAIN (x))
|
|
|
|
|
{
|
|
|
|
|
/* If this was an evil function, don't keep it in class. */
|
Compute DECL_ASSEMBLER_NAME lazily.
* tree.h (DECL_ASSEMBLER_NAME): Compute it lazily.
(DECL_ASSEMBLER_NAME_SET_P): New macro.
(SET_DECL_ASSEMBLER_NAME): Likewise.
(COPY_DECL_ASSEMBLER_NAME): Likewise.
(set_decl_assembler_name): Declare.
(lang_set_decl_assembler_name): Likewise.
* tree.c (lang_set_decl_assembler_name): New variab.e
(set_decl_assembler_name): New function.
(init_obstacks): Set lang_set_decl_assembler_name.
(build_decl): Don't set DECL_ASSEMBLER_NAME.
* c-decl.c (duplicate_decls): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(builtin_function): Likewise.
(finish_decl): Likewise.
* dbxout.c (dbxout_type_methods): Likewise.
* ggc-common.c (ggc_mark_trees): Likewise.
* profile.c (output_func_start_profiler): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* class.c (get_vtable_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(add_method): Remove optimization involving comparison of
DECL_ASSEMBLER_NAME.
(build_vtbl_or_vbase_field): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(check_methods): Likewise.
(build_clone): Likewise.
(built_vtt): Likewise.
* cp-tree.h (DECL_NEEDED_P): Likewise.
* decl.c (pushtag): Likewise.
(duplicate_decls): Likewise.
(pushdecl): Likewise.
(builtin_function): Likewise.
(build_library_fn_1): Set DECL_LANGUAGE for library functions.
(build_cp_library_fn): Likewise.
(maybe_commonize_var): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(make_rtl_for_nonlocal_decl): Likewise.
(cp_finish_decl): Likewise.
(grokfndecl): Likewise.
(grokvardecl): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
(cp_missing_return_ok_p): Likewise.
* decl2.c (grokclassfn): Likewise.
(check_classfn): Likewise.
(finish_static_data_member_decl): Likewise.
(grokfield): Likewise.
* error.c (GLOBAL_IORD_P): Remove.
(dump_global_iord): Improve output.
(dump_decl): Avoid using DECL_ASSEMBLER_NAME.
* except.c (nothrow_libfn_p): Summarily reject any function not in
namespace-scope.
* init.c (build_java_class_ref): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
* mangle.c (mangle_decl_string): Handle extern "C" functions.
(mangle_decl): Set the DECL_ASSEMBLER_NAME for the decl.
* method.c (set_mangled_name_for_decl): Don't explicitly set
DECL_ASSEMBLER_NAME after calling mangle_decl.
(make_thunk): Explicitly set the DECL_ASSEMBLER_NAME and
IDENTIFIER_GLOBAL_VALUE for the thunk.
* pt.c (set_mangled_name_for_template_decl): Remove.
(check_explicit_specialization): Don't use it.
(looup_template_class): Don't set DECL_ASSEMBLER_NAME.
(tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Use COPY_DECL_ASSEMBLER_NAME.
* rtti.c (get_tinfo_decl): Use SET_DECL_ASSEMBLER_NAME,
COPY_DECL_ASSEMBLER_NAME, etc. Don't set DECL_ASSEMBLER_NAME
where it's not necessary.
(tinfo_base_init): Likewise.
(create_real_tinfo_var): Likewise.
* search.c (looup_field_1): Likewise.
* semantics.c (finish_named_return_value): Likewise.
* tree.c (init_tree): Set lang_set_decl_assembler_name.
* com.c (builtin_function): Use SET_DECL_ASSEMBLER_NAME.
* class.c (build_class_ref): Use SET_DECL_ASSEMBLER_NAME.
(layout_class): Likewise.
(layout_class_method): Likewise.
(emit_register_classes): Likewise.
* decl.c (builtin_function): Likewise.
(give_name_to_locals): Likewise.
From-SVN: r40642
2001-03-20 00:50:04 +01:00
|
|
|
|
if (DECL_ASSEMBLER_NAME_SET_P (x)
|
|
|
|
|
&& IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (x)))
|
1999-12-16 04:10:12 +01:00
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
check_for_override (x, t);
|
1999-12-29 07:39:42 +01:00
|
|
|
|
if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
|
1999-12-16 04:10:12 +01:00
|
|
|
|
cp_error_at ("initializer specified for non-virtual method `%D'", x);
|
|
|
|
|
|
|
|
|
|
/* The name of the field is the original field name
|
|
|
|
|
Save this in auxiliary field for later overloading. */
|
|
|
|
|
if (DECL_VINDEX (x))
|
|
|
|
|
{
|
1999-12-21 03:11:10 +01:00
|
|
|
|
TYPE_POLYMORPHIC_P (t) = 1;
|
1999-12-29 07:39:42 +01:00
|
|
|
|
if (DECL_PURE_VIRTUAL_P (x))
|
|
|
|
|
CLASSTYPE_PURE_VIRTUALS (t)
|
|
|
|
|
= tree_cons (NULL_TREE, x, CLASSTYPE_PURE_VIRTUALS (t));
|
1999-12-16 04:10:12 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-11 22:16:36 +02:00
|
|
|
|
/* FN is a constructor or destructor. Clone the declaration to create
|
|
|
|
|
a specialized in-charge or not-in-charge version, as indicated by
|
|
|
|
|
NAME. */
|
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_clone (tree fn, tree name)
|
2000-04-11 22:16:36 +02:00
|
|
|
|
{
|
|
|
|
|
tree parms;
|
|
|
|
|
tree clone;
|
|
|
|
|
|
|
|
|
|
/* Copy the function. */
|
|
|
|
|
clone = copy_decl (fn);
|
|
|
|
|
/* Remember where this function came from. */
|
|
|
|
|
DECL_CLONED_FUNCTION (clone) = fn;
|
2001-02-21 15:42:27 +01:00
|
|
|
|
DECL_ABSTRACT_ORIGIN (clone) = fn;
|
2000-04-11 22:16:36 +02:00
|
|
|
|
/* Reset the function name. */
|
|
|
|
|
DECL_NAME (clone) = name;
|
2001-03-21 22:12:40 +01:00
|
|
|
|
SET_DECL_ASSEMBLER_NAME (clone, NULL_TREE);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
/* There's no pending inline data for this function. */
|
|
|
|
|
DECL_PENDING_INLINE_INFO (clone) = NULL;
|
|
|
|
|
DECL_PENDING_INLINE_P (clone) = 0;
|
|
|
|
|
/* And it hasn't yet been deferred. */
|
|
|
|
|
DECL_DEFERRED_FN (clone) = 0;
|
|
|
|
|
|
2000-04-12 09:48:13 +02:00
|
|
|
|
/* The base-class destructor is not virtual. */
|
|
|
|
|
if (name == base_dtor_identifier)
|
|
|
|
|
{
|
|
|
|
|
DECL_VIRTUAL_P (clone) = 0;
|
|
|
|
|
if (TREE_CODE (clone) != TEMPLATE_DECL)
|
|
|
|
|
DECL_VINDEX (clone) = NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-16 21:45:32 +02:00
|
|
|
|
/* If there was an in-charge parameter, drop it from the function
|
2000-04-11 22:16:36 +02:00
|
|
|
|
type. */
|
|
|
|
|
if (DECL_HAS_IN_CHARGE_PARM_P (clone))
|
|
|
|
|
{
|
|
|
|
|
tree basetype;
|
|
|
|
|
tree parmtypes;
|
|
|
|
|
tree exceptions;
|
|
|
|
|
|
|
|
|
|
exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (clone));
|
|
|
|
|
basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (clone));
|
|
|
|
|
parmtypes = TYPE_ARG_TYPES (TREE_TYPE (clone));
|
|
|
|
|
/* Skip the `this' parameter. */
|
|
|
|
|
parmtypes = TREE_CHAIN (parmtypes);
|
|
|
|
|
/* Skip the in-charge parameter. */
|
|
|
|
|
parmtypes = TREE_CHAIN (parmtypes);
|
2001-02-18 20:08:00 +01:00
|
|
|
|
/* And the VTT parm, in a complete [cd]tor. */
|
|
|
|
|
if (DECL_HAS_VTT_PARM_P (fn)
|
|
|
|
|
&& ! DECL_NEEDS_VTT_PARM_P (clone))
|
|
|
|
|
parmtypes = TREE_CHAIN (parmtypes);
|
2000-05-26 01:27:18 +02:00
|
|
|
|
/* If this is subobject constructor or destructor, add the vtt
|
|
|
|
|
parameter. */
|
2000-04-11 22:16:36 +02:00
|
|
|
|
TREE_TYPE (clone)
|
|
|
|
|
= build_cplus_method_type (basetype,
|
|
|
|
|
TREE_TYPE (TREE_TYPE (clone)),
|
|
|
|
|
parmtypes);
|
|
|
|
|
if (exceptions)
|
|
|
|
|
TREE_TYPE (clone) = build_exception_variant (TREE_TYPE (clone),
|
|
|
|
|
exceptions);
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-18 20:08:00 +01:00
|
|
|
|
/* Copy the function parameters. But, DECL_ARGUMENTS on a TEMPLATE_DECL
|
|
|
|
|
aren't function parameters; those are the template parameters. */
|
2000-04-11 22:16:36 +02:00
|
|
|
|
if (TREE_CODE (clone) != TEMPLATE_DECL)
|
|
|
|
|
{
|
|
|
|
|
DECL_ARGUMENTS (clone) = copy_list (DECL_ARGUMENTS (clone));
|
|
|
|
|
/* Remove the in-charge parameter. */
|
|
|
|
|
if (DECL_HAS_IN_CHARGE_PARM_P (clone))
|
|
|
|
|
{
|
|
|
|
|
TREE_CHAIN (DECL_ARGUMENTS (clone))
|
|
|
|
|
= TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (clone)));
|
|
|
|
|
DECL_HAS_IN_CHARGE_PARM_P (clone) = 0;
|
|
|
|
|
}
|
2001-02-18 20:08:00 +01:00
|
|
|
|
/* And the VTT parm, in a complete [cd]tor. */
|
|
|
|
|
if (DECL_HAS_VTT_PARM_P (fn))
|
2000-05-26 01:27:18 +02:00
|
|
|
|
{
|
2001-02-18 20:08:00 +01:00
|
|
|
|
if (DECL_NEEDS_VTT_PARM_P (clone))
|
|
|
|
|
DECL_HAS_VTT_PARM_P (clone) = 1;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TREE_CHAIN (DECL_ARGUMENTS (clone))
|
|
|
|
|
= TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (clone)));
|
|
|
|
|
DECL_HAS_VTT_PARM_P (clone) = 0;
|
|
|
|
|
}
|
2000-05-26 01:27:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-11 22:16:36 +02:00
|
|
|
|
for (parms = DECL_ARGUMENTS (clone); parms; parms = TREE_CHAIN (parms))
|
|
|
|
|
{
|
|
|
|
|
DECL_CONTEXT (parms) = clone;
|
2002-02-28 08:39:44 +01:00
|
|
|
|
cxx_dup_lang_specific_decl (parms);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create the RTL for this function. */
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
SET_DECL_RTL (clone, NULL_RTX);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
rest_of_decl_compilation (clone, NULL, /*top_level=*/1, at_eof);
|
|
|
|
|
|
|
|
|
|
/* Make it easy to find the CLONE given the FN. */
|
|
|
|
|
TREE_CHAIN (clone) = TREE_CHAIN (fn);
|
|
|
|
|
TREE_CHAIN (fn) = clone;
|
|
|
|
|
|
|
|
|
|
/* If this is a template, handle the DECL_TEMPLATE_RESULT as well. */
|
|
|
|
|
if (TREE_CODE (clone) == TEMPLATE_DECL)
|
|
|
|
|
{
|
|
|
|
|
tree result;
|
|
|
|
|
|
|
|
|
|
DECL_TEMPLATE_RESULT (clone)
|
|
|
|
|
= build_clone (DECL_TEMPLATE_RESULT (clone), name);
|
|
|
|
|
result = DECL_TEMPLATE_RESULT (clone);
|
|
|
|
|
DECL_TEMPLATE_INFO (result) = copy_node (DECL_TEMPLATE_INFO (result));
|
|
|
|
|
DECL_TI_TEMPLATE (result) = clone;
|
|
|
|
|
}
|
2000-04-12 09:48:13 +02:00
|
|
|
|
else if (DECL_DEFERRED_FN (fn))
|
|
|
|
|
defer_fn (clone);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
|
|
|
|
|
return clone;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Produce declarations for all appropriate clones of FN. If
|
2002-09-21 14:51:56 +02:00
|
|
|
|
UPDATE_METHOD_VEC_P is nonzero, the clones are added to the
|
2000-04-11 22:16:36 +02:00
|
|
|
|
CLASTYPE_METHOD_VEC as well. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
clone_function_decl (tree fn, int update_method_vec_p)
|
2000-04-11 22:16:36 +02:00
|
|
|
|
{
|
|
|
|
|
tree clone;
|
|
|
|
|
|
2000-12-04 18:00:04 +01:00
|
|
|
|
/* Avoid inappropriate cloning. */
|
2001-02-12 10:58:18 +01:00
|
|
|
|
if (TREE_CHAIN (fn)
|
|
|
|
|
&& DECL_CLONED_FUNCTION (TREE_CHAIN (fn)))
|
2000-12-04 18:00:04 +01:00
|
|
|
|
return;
|
|
|
|
|
|
2000-04-12 09:48:13 +02:00
|
|
|
|
if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
|
2000-04-11 22:16:36 +02:00
|
|
|
|
{
|
2000-04-12 09:48:13 +02:00
|
|
|
|
/* For each constructor, we need two variants: an in-charge version
|
|
|
|
|
and a not-in-charge version. */
|
2000-04-11 22:16:36 +02:00
|
|
|
|
clone = build_clone (fn, complete_ctor_identifier);
|
|
|
|
|
if (update_method_vec_p)
|
2000-08-04 20:41:00 +02:00
|
|
|
|
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
clone = build_clone (fn, base_ctor_identifier);
|
|
|
|
|
if (update_method_vec_p)
|
2000-08-04 20:41:00 +02:00
|
|
|
|
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2000-04-12 09:48:13 +02:00
|
|
|
|
{
|
|
|
|
|
my_friendly_assert (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn), 20000411);
|
|
|
|
|
|
2000-05-26 01:27:18 +02:00
|
|
|
|
/* For each destructor, we need three variants: an in-charge
|
2000-04-12 09:48:13 +02:00
|
|
|
|
version, a not-in-charge version, and an in-charge deleting
|
2000-04-16 21:45:32 +02:00
|
|
|
|
version. We clone the deleting version first because that
|
|
|
|
|
means it will go second on the TYPE_METHODS list -- and that
|
|
|
|
|
corresponds to the correct layout order in the virtual
|
2001-02-14 07:32:15 +01:00
|
|
|
|
function table.
|
|
|
|
|
|
|
|
|
|
For a non-virtual destructor, we do not build a deleting
|
|
|
|
|
destructor. */
|
|
|
|
|
if (DECL_VIRTUAL_P (fn))
|
|
|
|
|
{
|
|
|
|
|
clone = build_clone (fn, deleting_dtor_identifier);
|
|
|
|
|
if (update_method_vec_p)
|
|
|
|
|
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
|
|
|
|
|
}
|
2000-04-16 21:45:32 +02:00
|
|
|
|
clone = build_clone (fn, complete_dtor_identifier);
|
2000-04-12 09:48:13 +02:00
|
|
|
|
if (update_method_vec_p)
|
2000-08-04 20:41:00 +02:00
|
|
|
|
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
|
2000-04-12 09:48:13 +02:00
|
|
|
|
clone = build_clone (fn, base_dtor_identifier);
|
|
|
|
|
if (update_method_vec_p)
|
2000-08-04 20:41:00 +02:00
|
|
|
|
add_method (DECL_CONTEXT (clone), clone, /*error_p=*/0);
|
2000-04-12 09:48:13 +02:00
|
|
|
|
}
|
2001-02-21 15:42:27 +01:00
|
|
|
|
|
|
|
|
|
/* Note that this is an abstract function that is never emitted. */
|
|
|
|
|
DECL_ABSTRACT (fn) = 1;
|
2000-04-11 22:16:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-04-27 12:47:36 +02:00
|
|
|
|
/* DECL is an in charge constructor, which is being defined. This will
|
|
|
|
|
have had an in class declaration, from whence clones were
|
|
|
|
|
declared. An out-of-class definition can specify additional default
|
|
|
|
|
arguments. As it is the clones that are involved in overload
|
|
|
|
|
resolution, we must propagate the information from the DECL to its
|
2002-09-13 02:22:59 +02:00
|
|
|
|
clones. */
|
2001-04-27 12:47:36 +02:00
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
adjust_clone_args (tree decl)
|
2001-04-27 12:47:36 +02:00
|
|
|
|
{
|
|
|
|
|
tree clone;
|
|
|
|
|
|
|
|
|
|
for (clone = TREE_CHAIN (decl); clone && DECL_CLONED_FUNCTION (clone);
|
|
|
|
|
clone = TREE_CHAIN (clone))
|
|
|
|
|
{
|
|
|
|
|
tree orig_clone_parms = TYPE_ARG_TYPES (TREE_TYPE (clone));
|
|
|
|
|
tree orig_decl_parms = TYPE_ARG_TYPES (TREE_TYPE (decl));
|
|
|
|
|
tree decl_parms, clone_parms;
|
|
|
|
|
|
|
|
|
|
clone_parms = orig_clone_parms;
|
|
|
|
|
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* Skip the 'this' parameter. */
|
2001-04-27 12:47:36 +02:00
|
|
|
|
orig_clone_parms = TREE_CHAIN (orig_clone_parms);
|
|
|
|
|
orig_decl_parms = TREE_CHAIN (orig_decl_parms);
|
|
|
|
|
|
|
|
|
|
if (DECL_HAS_IN_CHARGE_PARM_P (decl))
|
|
|
|
|
orig_decl_parms = TREE_CHAIN (orig_decl_parms);
|
|
|
|
|
if (DECL_HAS_VTT_PARM_P (decl))
|
|
|
|
|
orig_decl_parms = TREE_CHAIN (orig_decl_parms);
|
|
|
|
|
|
|
|
|
|
clone_parms = orig_clone_parms;
|
|
|
|
|
if (DECL_HAS_VTT_PARM_P (clone))
|
|
|
|
|
clone_parms = TREE_CHAIN (clone_parms);
|
|
|
|
|
|
|
|
|
|
for (decl_parms = orig_decl_parms; decl_parms;
|
|
|
|
|
decl_parms = TREE_CHAIN (decl_parms),
|
|
|
|
|
clone_parms = TREE_CHAIN (clone_parms))
|
|
|
|
|
{
|
|
|
|
|
my_friendly_assert (same_type_p (TREE_TYPE (decl_parms),
|
|
|
|
|
TREE_TYPE (clone_parms)), 20010424);
|
|
|
|
|
|
|
|
|
|
if (TREE_PURPOSE (decl_parms) && !TREE_PURPOSE (clone_parms))
|
|
|
|
|
{
|
|
|
|
|
/* A default parameter has been added. Adjust the
|
2002-09-13 02:22:59 +02:00
|
|
|
|
clone's parameters. */
|
2001-04-27 12:47:36 +02:00
|
|
|
|
tree exceptions = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (clone));
|
|
|
|
|
tree basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (clone));
|
|
|
|
|
tree type;
|
|
|
|
|
|
|
|
|
|
clone_parms = orig_decl_parms;
|
|
|
|
|
|
|
|
|
|
if (DECL_HAS_VTT_PARM_P (clone))
|
|
|
|
|
{
|
|
|
|
|
clone_parms = tree_cons (TREE_PURPOSE (orig_clone_parms),
|
|
|
|
|
TREE_VALUE (orig_clone_parms),
|
|
|
|
|
clone_parms);
|
|
|
|
|
TREE_TYPE (clone_parms) = TREE_TYPE (orig_clone_parms);
|
|
|
|
|
}
|
|
|
|
|
type = build_cplus_method_type (basetype,
|
|
|
|
|
TREE_TYPE (TREE_TYPE (clone)),
|
|
|
|
|
clone_parms);
|
|
|
|
|
if (exceptions)
|
|
|
|
|
type = build_exception_variant (type, exceptions);
|
|
|
|
|
TREE_TYPE (clone) = type;
|
|
|
|
|
|
|
|
|
|
clone_parms = NULL_TREE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
my_friendly_assert (!clone_parms, 20010424);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-11 22:16:36 +02:00
|
|
|
|
/* For each of the constructors and destructors in T, create an
|
|
|
|
|
in-charge and not-in-charge variant. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
clone_constructors_and_destructors (tree t)
|
2000-04-11 22:16:36 +02:00
|
|
|
|
{
|
|
|
|
|
tree fns;
|
|
|
|
|
|
|
|
|
|
/* If for some reason we don't have a CLASSTYPE_METHOD_VEC, we bail
|
|
|
|
|
out now. */
|
|
|
|
|
if (!CLASSTYPE_METHOD_VEC (t))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (fns = CLASSTYPE_CONSTRUCTORS (t); fns; fns = OVL_NEXT (fns))
|
|
|
|
|
clone_function_decl (OVL_CURRENT (fns), /*update_method_vec_p=*/1);
|
2000-04-12 09:48:13 +02:00
|
|
|
|
for (fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
|
|
|
|
|
clone_function_decl (OVL_CURRENT (fns), /*update_method_vec_p=*/1);
|
2000-04-11 22:16:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-16 04:10:12 +01:00
|
|
|
|
/* Remove all zero-width bit-fields from T. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
remove_zero_width_bit_fields (tree t)
|
1999-12-16 04:10:12 +01:00
|
|
|
|
{
|
|
|
|
|
tree *fieldsp;
|
|
|
|
|
|
|
|
|
|
fieldsp = &TYPE_FIELDS (t);
|
|
|
|
|
while (*fieldsp)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (*fieldsp) == FIELD_DECL
|
|
|
|
|
&& DECL_C_BIT_FIELD (*fieldsp)
|
|
|
|
|
&& DECL_INITIAL (*fieldsp))
|
|
|
|
|
*fieldsp = TREE_CHAIN (*fieldsp);
|
|
|
|
|
else
|
|
|
|
|
fieldsp = &TREE_CHAIN (*fieldsp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-19 06:27:16 +02:00
|
|
|
|
/* Returns TRUE iff we need a cookie when dynamically allocating an
|
|
|
|
|
array whose elements have the indicated class TYPE. */
|
|
|
|
|
|
|
|
|
|
static bool
|
2003-01-23 03:47:51 +01:00
|
|
|
|
type_requires_array_cookie (tree type)
|
2001-07-19 06:27:16 +02:00
|
|
|
|
{
|
|
|
|
|
tree fns;
|
2001-07-23 08:34:51 +02:00
|
|
|
|
bool has_two_argument_delete_p = false;
|
2001-07-19 06:27:16 +02:00
|
|
|
|
|
|
|
|
|
my_friendly_assert (CLASS_TYPE_P (type), 20010712);
|
|
|
|
|
|
|
|
|
|
/* If there's a non-trivial destructor, we need a cookie. In order
|
|
|
|
|
to iterate through the array calling the destructor for each
|
|
|
|
|
element, we'll have to know how many elements there are. */
|
|
|
|
|
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
/* If the usual deallocation function is a two-argument whose second
|
|
|
|
|
argument is of type `size_t', then we have to pass the size of
|
|
|
|
|
the array to the deallocation function, so we will need to store
|
|
|
|
|
a cookie. */
|
|
|
|
|
fns = lookup_fnfields (TYPE_BINFO (type),
|
|
|
|
|
ansi_opname (VEC_DELETE_EXPR),
|
|
|
|
|
/*protect=*/0);
|
|
|
|
|
/* If there are no `operator []' members, or the lookup is
|
|
|
|
|
ambiguous, then we don't need a cookie. */
|
|
|
|
|
if (!fns || fns == error_mark_node)
|
|
|
|
|
return false;
|
|
|
|
|
/* Loop through all of the functions. */
|
2002-08-08 07:48:39 +02:00
|
|
|
|
for (fns = BASELINK_FUNCTIONS (fns); fns; fns = OVL_NEXT (fns))
|
2001-07-19 06:27:16 +02:00
|
|
|
|
{
|
|
|
|
|
tree fn;
|
|
|
|
|
tree second_parm;
|
|
|
|
|
|
|
|
|
|
/* Select the current function. */
|
|
|
|
|
fn = OVL_CURRENT (fns);
|
|
|
|
|
/* See if this function is a one-argument delete function. If
|
|
|
|
|
it is, then it will be the usual deallocation function. */
|
|
|
|
|
second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
|
|
|
|
|
if (second_parm == void_list_node)
|
|
|
|
|
return false;
|
|
|
|
|
/* Otherwise, if we have a two-argument function and the second
|
|
|
|
|
argument is `size_t', it will be the usual deallocation
|
|
|
|
|
function -- unless there is one-argument function, too. */
|
|
|
|
|
if (TREE_CHAIN (second_parm) == void_list_node
|
|
|
|
|
&& same_type_p (TREE_VALUE (second_parm), sizetype))
|
|
|
|
|
has_two_argument_delete_p = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return has_two_argument_delete_p;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* Check the validity of the bases and members declared in T. Add any
|
|
|
|
|
implicitly-generated functions (like copy-constructors and
|
|
|
|
|
assignment operators). Compute various flag bits (like
|
|
|
|
|
CLASSTYPE_NON_POD_T) for T. This routine works purely at the C++
|
|
|
|
|
level: i.e., independently of the ABI in use. */
|
|
|
|
|
|
|
|
|
|
static void
|
2002-10-15 20:07:24 +02:00
|
|
|
|
check_bases_and_members (tree t)
|
1999-12-16 23:18:22 +01:00
|
|
|
|
{
|
|
|
|
|
/* Nonzero if we are not allowed to generate a default constructor
|
|
|
|
|
for this case. */
|
|
|
|
|
int cant_have_default_ctor;
|
|
|
|
|
/* Nonzero if the implicitly generated copy constructor should take
|
|
|
|
|
a non-const reference argument. */
|
|
|
|
|
int cant_have_const_ctor;
|
|
|
|
|
/* Nonzero if the the implicitly generated assignment operator
|
|
|
|
|
should take a non-const reference argument. */
|
|
|
|
|
int no_const_asn_ref;
|
|
|
|
|
tree access_decls;
|
|
|
|
|
|
|
|
|
|
/* By default, we use const reference arguments and generate default
|
|
|
|
|
constructors. */
|
|
|
|
|
cant_have_default_ctor = 0;
|
|
|
|
|
cant_have_const_ctor = 0;
|
|
|
|
|
no_const_asn_ref = 0;
|
|
|
|
|
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* Check all the base-classes. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
check_bases (t, &cant_have_default_ctor, &cant_have_const_ctor,
|
|
|
|
|
&no_const_asn_ref);
|
|
|
|
|
|
|
|
|
|
/* Check all the data member declarations. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
check_field_decls (t, &access_decls,
|
1999-12-16 23:18:22 +01:00
|
|
|
|
&cant_have_default_ctor,
|
|
|
|
|
&cant_have_const_ctor,
|
|
|
|
|
&no_const_asn_ref);
|
|
|
|
|
|
|
|
|
|
/* Check all the method declarations. */
|
|
|
|
|
check_methods (t);
|
|
|
|
|
|
2000-01-17 05:08:01 +01:00
|
|
|
|
/* A nearly-empty class has to be vptr-containing; a nearly empty
|
|
|
|
|
class contains just a vptr. */
|
|
|
|
|
if (!TYPE_CONTAINS_VPTR_P (t))
|
1999-12-29 09:28:50 +01:00
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 0;
|
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* Do some bookkeeping that will guide the generation of implicitly
|
|
|
|
|
declared member functions. */
|
|
|
|
|
TYPE_HAS_COMPLEX_INIT_REF (t)
|
1999-12-21 03:11:10 +01:00
|
|
|
|
|= (TYPE_HAS_INIT_REF (t)
|
|
|
|
|
|| TYPE_USES_VIRTUAL_BASECLASSES (t)
|
|
|
|
|
|| TYPE_POLYMORPHIC_P (t));
|
1999-12-16 23:18:22 +01:00
|
|
|
|
TYPE_NEEDS_CONSTRUCTING (t)
|
1999-12-21 03:11:10 +01:00
|
|
|
|
|= (TYPE_HAS_CONSTRUCTOR (t)
|
|
|
|
|
|| TYPE_USES_VIRTUAL_BASECLASSES (t)
|
|
|
|
|
|| TYPE_POLYMORPHIC_P (t));
|
|
|
|
|
CLASSTYPE_NON_AGGREGATE (t) |= (TYPE_HAS_CONSTRUCTOR (t)
|
|
|
|
|
|| TYPE_POLYMORPHIC_P (t));
|
1999-12-16 23:18:22 +01:00
|
|
|
|
CLASSTYPE_NON_POD_P (t)
|
|
|
|
|
|= (CLASSTYPE_NON_AGGREGATE (t) || TYPE_HAS_DESTRUCTOR (t)
|
|
|
|
|
|| TYPE_HAS_ASSIGN_REF (t));
|
|
|
|
|
TYPE_HAS_REAL_ASSIGN_REF (t) |= TYPE_HAS_ASSIGN_REF (t);
|
|
|
|
|
TYPE_HAS_COMPLEX_ASSIGN_REF (t)
|
2001-08-07 15:57:06 +02:00
|
|
|
|
|= TYPE_HAS_ASSIGN_REF (t) || TYPE_CONTAINS_VPTR_P (t);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
|
|
|
|
/* Synthesize any needed methods. Note that methods will be synthesized
|
|
|
|
|
for anonymous unions; grok_x_components undoes that. */
|
|
|
|
|
add_implicitly_declared_members (t, cant_have_default_ctor,
|
|
|
|
|
cant_have_const_ctor,
|
|
|
|
|
no_const_asn_ref);
|
|
|
|
|
|
2000-04-11 22:16:36 +02:00
|
|
|
|
/* Create the in-charge and not-in-charge variants of constructors
|
|
|
|
|
and destructors. */
|
|
|
|
|
clone_constructors_and_destructors (t);
|
|
|
|
|
|
Implement class scope using-declarations for functions.
* class.c (handle_using_decl): Call add_method for used functions.
Use IDENTIFIER_CLASS_VALUE to check for conflicts.
(add_method): Used functions are hidden by local functions.
(check_bases_and_members): Handle using-decls before finalizing
CLASSTYPE_METHOD_VEC.
* call.c (add_function_candidate): Add ctype parm; if non-zero,
override the type of 'this' accordingly.
(add_template_candidate, add_template_candidate_real): Add ctype parm.
(convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call): Pass ctype parm.
* search.c (lookup_member): Put rval_binfo, not basetype_path, in
the baselink.
* call.c (convert_class_to_reference, build_user_type_conversion_1,
build_new_function_call, build_object_call, build_new_op,
build_new_method_call, build_op_delete_call): Don't get basetype_path
from a baselink.
* typeck.c (build_component_ref): Likewise.
* init.c (build_offset_ref): Likewise.
(resolve_offset_ref): Don't call enforce_access.
Call build_scoped_ref.
* typeck2.c (build_scoped_ref): Simplify. Do nothing if it
would cause an error or if -pedantic.
* class.c (alter_access): Lose binfo parm.
From-SVN: r32212
2000-02-27 07:54:04 +01:00
|
|
|
|
/* Process the using-declarations. */
|
|
|
|
|
for (; access_decls; access_decls = TREE_CHAIN (access_decls))
|
|
|
|
|
handle_using_decl (TREE_VALUE (access_decls), t);
|
|
|
|
|
|
1999-12-16 23:18:22 +01:00
|
|
|
|
/* Build and sort the CLASSTYPE_METHOD_VEC. */
|
|
|
|
|
finish_struct_methods (t);
|
2001-07-19 06:27:16 +02:00
|
|
|
|
|
|
|
|
|
/* Figure out whether or not we will need a cookie when dynamically
|
|
|
|
|
allocating an array of this type. */
|
2002-06-04 09:11:05 +02:00
|
|
|
|
TYPE_LANG_SPECIFIC (t)->u.c.vec_new_uses_cookie
|
2001-07-19 06:27:16 +02:00
|
|
|
|
= type_requires_array_cookie (t);
|
1999-12-16 23:18:22 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-21 03:11:10 +01:00
|
|
|
|
/* If T needs a pointer to its virtual function table, set TYPE_VFIELD
|
2000-03-15 01:16:21 +01:00
|
|
|
|
accordingly. If a new vfield was created (because T doesn't have a
|
|
|
|
|
primary base class), then the newly created field is returned. It
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
is not added to the TYPE_FIELDS list; it is the caller's
|
2002-08-04 15:13:56 +02:00
|
|
|
|
responsibility to do that. Accumulate declared virtual functions
|
|
|
|
|
on VIRTUALS_P. */
|
1999-12-21 03:11:10 +01:00
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
create_vtable_ptr (tree t, tree* virtuals_p)
|
1999-12-21 03:11:10 +01:00
|
|
|
|
{
|
|
|
|
|
tree fn;
|
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
/* Collect the virtual functions declared in T. */
|
1999-12-21 03:11:10 +01:00
|
|
|
|
for (fn = TYPE_METHODS (t); fn; fn = TREE_CHAIN (fn))
|
2002-08-04 15:13:56 +02:00
|
|
|
|
if (DECL_VINDEX (fn) && !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fn)
|
|
|
|
|
&& TREE_CODE (DECL_VINDEX (fn)) != INTEGER_CST)
|
|
|
|
|
{
|
|
|
|
|
tree new_virtual = make_node (TREE_LIST);
|
|
|
|
|
|
|
|
|
|
BV_FN (new_virtual) = fn;
|
|
|
|
|
BV_DELTA (new_virtual) = integer_zero_node;
|
1999-12-21 03:11:10 +01:00
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
TREE_CHAIN (new_virtual) = *virtuals_p;
|
|
|
|
|
*virtuals_p = new_virtual;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-28 21:27:15 +02:00
|
|
|
|
/* If we couldn't find an appropriate base class, create a new field
|
|
|
|
|
here. Even if there weren't any new virtual functions, we might need a
|
2000-01-17 05:08:01 +01:00
|
|
|
|
new virtual function table if we're supposed to include vptrs in
|
|
|
|
|
all classes that need them. */
|
2002-08-04 15:13:56 +02:00
|
|
|
|
if (!TYPE_VFIELD (t) && (*virtuals_p || TYPE_CONTAINS_VPTR_P (t)))
|
1999-12-21 03:11:10 +01:00
|
|
|
|
{
|
|
|
|
|
/* We build this decl with vtbl_ptr_type_node, which is a
|
|
|
|
|
`vtable_entry_type*'. It might seem more precise to use
|
|
|
|
|
`vtable_entry_type (*)[N]' where N is the number of firtual
|
|
|
|
|
functions. However, that would require the vtable pointer in
|
|
|
|
|
base classes to have a different type than the vtable pointer
|
|
|
|
|
in derived classes. We could make that happen, but that
|
|
|
|
|
still wouldn't solve all the problems. In particular, the
|
|
|
|
|
type-based alias analysis code would decide that assignments
|
|
|
|
|
to the base class vtable pointer can't alias assignments to
|
|
|
|
|
the derived class vtable pointer, since they have different
|
2002-12-20 17:11:41 +01:00
|
|
|
|
types. Thus, in a derived class destructor, where the base
|
1999-12-21 03:11:10 +01:00
|
|
|
|
class constructor was inlined, we could generate bad code for
|
|
|
|
|
setting up the vtable pointer.
|
|
|
|
|
|
|
|
|
|
Therefore, we use one type for all vtable pointers. We still
|
|
|
|
|
use a type-correct type; it's just doesn't indicate the array
|
|
|
|
|
bounds. That's better than using `void*' or some such; it's
|
|
|
|
|
cleaner, and it let's the alias analysis code know that these
|
|
|
|
|
stores cannot alias stores to void*! */
|
2001-07-25 10:54:06 +02:00
|
|
|
|
tree field;
|
|
|
|
|
|
|
|
|
|
field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
|
|
|
|
|
SET_DECL_ASSEMBLER_NAME (field, get_identifier (VFIELD_BASE));
|
|
|
|
|
DECL_VIRTUAL_P (field) = 1;
|
|
|
|
|
DECL_ARTIFICIAL (field) = 1;
|
|
|
|
|
DECL_FIELD_CONTEXT (field) = t;
|
|
|
|
|
DECL_FCONTEXT (field) = t;
|
|
|
|
|
|
|
|
|
|
TYPE_VFIELD (t) = field;
|
|
|
|
|
|
|
|
|
|
/* This class is non-empty. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
CLASSTYPE_EMPTY_P (t) = 0;
|
1999-12-21 03:11:10 +01:00
|
|
|
|
|
2001-02-12 10:58:18 +01:00
|
|
|
|
if (CLASSTYPE_N_BASECLASSES (t))
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* If there were any baseclasses, they can't possibly be at
|
|
|
|
|
offset zero any more, because that's where the vtable
|
|
|
|
|
pointer is. So, converting to a base class is going to
|
|
|
|
|
take work. */
|
|
|
|
|
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t) = 1;
|
1999-12-21 03:11:10 +01:00
|
|
|
|
|
2001-07-25 10:54:06 +02:00
|
|
|
|
return field;
|
1999-12-21 03:11:10 +01:00
|
|
|
|
}
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
|
|
|
|
return NULL_TREE;
|
1999-12-21 03:11:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Fixup the inline function given by INFO now that the class is
|
|
|
|
|
complete. */
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
fixup_pending_inline (tree fn)
|
1999-12-29 08:31:51 +01:00
|
|
|
|
{
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
if (DECL_PENDING_INLINE_INFO (fn))
|
1999-12-29 08:31:51 +01:00
|
|
|
|
{
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
tree args = DECL_ARGUMENTS (fn);
|
1999-12-29 08:31:51 +01:00
|
|
|
|
while (args)
|
|
|
|
|
{
|
|
|
|
|
DECL_CONTEXT (args) = fn;
|
|
|
|
|
args = TREE_CHAIN (args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Fixup the inline methods and friends in TYPE now that TYPE is
|
|
|
|
|
complete. */
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
fixup_inline_methods (tree type)
|
1999-12-15 01:36:57 +01:00
|
|
|
|
{
|
1999-12-29 08:31:51 +01:00
|
|
|
|
tree method = TYPE_METHODS (type);
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
if (method && TREE_CODE (method) == TREE_VEC)
|
1999-12-15 01:36:57 +01:00
|
|
|
|
{
|
1999-12-29 08:31:51 +01:00
|
|
|
|
if (TREE_VEC_ELT (method, 1))
|
|
|
|
|
method = TREE_VEC_ELT (method, 1);
|
|
|
|
|
else if (TREE_VEC_ELT (method, 0))
|
|
|
|
|
method = TREE_VEC_ELT (method, 0);
|
1999-12-15 01:36:57 +01:00
|
|
|
|
else
|
1999-12-29 08:31:51 +01:00
|
|
|
|
method = TREE_VEC_ELT (method, 2);
|
1999-12-15 01:36:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Do inline member functions. */
|
|
|
|
|
for (; method; method = TREE_CHAIN (method))
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
fixup_pending_inline (method);
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Do friends. */
|
|
|
|
|
for (method = CLASSTYPE_INLINE_FRIENDS (type);
|
|
|
|
|
method;
|
|
|
|
|
method = TREE_CHAIN (method))
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
fixup_pending_inline (TREE_VALUE (method));
|
1999-12-30 18:23:24 +01:00
|
|
|
|
CLASSTYPE_INLINE_FRIENDS (type) = NULL_TREE;
|
1999-12-29 08:31:51 +01:00
|
|
|
|
}
|
1999-12-15 01:36:57 +01:00
|
|
|
|
|
2000-01-11 05:13:27 +01:00
|
|
|
|
/* Add OFFSET to all base types of BINFO which is a base in the
|
|
|
|
|
hierarchy dominated by T.
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
OFFSET, which is a type offset, is number of bytes. */
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
|
|
|
|
static void
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
propagate_binfo_offsets (tree binfo, tree offset)
|
2000-01-02 20:41:09 +01:00
|
|
|
|
{
|
2000-07-31 02:24:44 +02:00
|
|
|
|
int i;
|
|
|
|
|
tree primary_binfo;
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
/* Update BINFO's offset. */
|
|
|
|
|
BINFO_OFFSET (binfo)
|
|
|
|
|
= convert (sizetype,
|
|
|
|
|
size_binop (PLUS_EXPR,
|
|
|
|
|
convert (ssizetype, BINFO_OFFSET (binfo)),
|
|
|
|
|
offset));
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
/* Find the primary base class. */
|
|
|
|
|
primary_binfo = get_primary_binfo (binfo);
|
|
|
|
|
|
|
|
|
|
/* Scan all of the bases, pushing the BINFO_OFFSET adjust
|
|
|
|
|
downwards. */
|
|
|
|
|
for (i = -1; i < BINFO_N_BASETYPES (binfo); ++i)
|
2000-01-02 20:41:09 +01:00
|
|
|
|
{
|
2000-07-31 02:24:44 +02:00
|
|
|
|
tree base_binfo;
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2001-06-12 20:08:05 +02:00
|
|
|
|
/* On the first time through the loop, do the primary base.
|
|
|
|
|
Because the primary base need not be an immediate base, we
|
|
|
|
|
must handle the primary base specially. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
if (i == -1)
|
|
|
|
|
{
|
|
|
|
|
if (!primary_binfo)
|
|
|
|
|
continue;
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
base_binfo = primary_binfo;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
base_binfo = BINFO_BASETYPE (binfo, i);
|
|
|
|
|
/* Don't do the primary base twice. */
|
|
|
|
|
if (base_binfo == primary_binfo)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-12 20:08:05 +02:00
|
|
|
|
/* Skip virtual bases that aren't our canonical primary base. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo)
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
&& BINFO_PRIMARY_BASE_OF (base_binfo) != binfo)
|
2000-07-31 02:24:44 +02:00
|
|
|
|
continue;
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
propagate_binfo_offsets (base_binfo, offset);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
}
|
2000-01-11 05:13:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Set BINFO_OFFSET for all of the virtual bases for RLI->T. Update
|
2000-10-20 08:04:59 +02:00
|
|
|
|
TYPE_ALIGN and TYPE_SIZE for T. OFFSETS gives the location of
|
|
|
|
|
empty subobjects of T. */
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-01-03 05:05:43 +01:00
|
|
|
|
static void
|
2002-09-30 18:52:19 +02:00
|
|
|
|
layout_virtual_bases (record_layout_info rli, splay_tree offsets)
|
2000-01-02 20:41:09 +01:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree vbase;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree t = rli->t;
|
2002-08-28 00:14:51 +02:00
|
|
|
|
bool first_vbase = true;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree *next_field;
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
|
|
|
|
if (CLASSTYPE_N_BASECLASSES (t) == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (!abi_version_at_least(2))
|
|
|
|
|
{
|
|
|
|
|
/* In G++ 3.2, we incorrectly rounded the size before laying out
|
|
|
|
|
the virtual bases. */
|
|
|
|
|
finish_record_layout (rli, /*free_p=*/false);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
#ifdef STRUCTURE_SIZE_BOUNDARY
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Packed structures don't need to have minimum size. */
|
|
|
|
|
if (! TYPE_PACKED (t))
|
2003-01-16 16:13:33 +01:00
|
|
|
|
TYPE_ALIGN (t) = MAX (TYPE_ALIGN (t), (unsigned) STRUCTURE_SIZE_BOUNDARY);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
#endif
|
2002-09-30 18:52:19 +02:00
|
|
|
|
rli->offset = TYPE_SIZE_UNIT (t);
|
|
|
|
|
rli->bitpos = bitsize_zero_node;
|
|
|
|
|
rli->record_align = TYPE_ALIGN (t);
|
|
|
|
|
}
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Find the last field. The artificial fields created for virtual
|
|
|
|
|
bases will go after the last extant field to date. */
|
|
|
|
|
next_field = &TYPE_FIELDS (t);
|
|
|
|
|
while (*next_field)
|
|
|
|
|
next_field = &TREE_CHAIN (*next_field);
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-01-11 05:13:27 +01:00
|
|
|
|
/* Go through the virtual bases, allocating space for each virtual
|
2001-07-21 02:03:21 +02:00
|
|
|
|
base that is not already a primary base class. These are
|
|
|
|
|
allocated in inheritance graph order. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (!TREE_VIA_VIRTUAL (vbase))
|
2001-02-12 10:58:18 +01:00
|
|
|
|
continue;
|
2002-08-28 00:14:51 +02:00
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (!BINFO_PRIMARY_P (vbase))
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree basetype = TREE_TYPE (vbase);
|
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* This virtual base is not a primary base of any class in the
|
|
|
|
|
hierarchy, so we have to add space for it. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
next_field = build_base_field (rli, vbase,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
offsets, next_field);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
2002-08-28 00:14:51 +02:00
|
|
|
|
/* If the first virtual base might have been placed at a
|
|
|
|
|
lower address, had we started from CLASSTYPE_SIZE, rather
|
|
|
|
|
than TYPE_SIZE, issue a warning. There can be both false
|
|
|
|
|
positives and false negatives from this warning in rare
|
|
|
|
|
cases; to deal with all the possibilities would probably
|
|
|
|
|
require performing both layout algorithms and comparing
|
|
|
|
|
the results which is not particularly tractable. */
|
|
|
|
|
if (warn_abi
|
|
|
|
|
&& first_vbase
|
2002-09-30 18:52:19 +02:00
|
|
|
|
&& (tree_int_cst_lt
|
|
|
|
|
(size_binop (CEIL_DIV_EXPR,
|
|
|
|
|
round_up (CLASSTYPE_SIZE (t),
|
|
|
|
|
CLASSTYPE_ALIGN (basetype)),
|
|
|
|
|
bitsize_unit_node),
|
|
|
|
|
BINFO_OFFSET (vbase))))
|
2002-08-28 00:14:51 +02:00
|
|
|
|
warning ("offset of virtual base `%T' is not ABI-compliant and may change in a future version of GCC",
|
|
|
|
|
basetype);
|
|
|
|
|
|
|
|
|
|
first_vbase = false;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-01-02 20:41:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-25 08:01:55 +02:00
|
|
|
|
/* Returns the offset of the byte just past the end of the base class
|
|
|
|
|
BINFO. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
end_of_base (tree binfo)
|
|
|
|
|
{
|
|
|
|
|
tree size;
|
|
|
|
|
|
|
|
|
|
if (is_empty_class (BINFO_TYPE (binfo)))
|
|
|
|
|
/* An empty class has zero CLASSTYPE_SIZE_UNIT, but we need to
|
|
|
|
|
allocate some space for it. It cannot have virtual bases, so
|
|
|
|
|
TYPE_SIZE_UNIT is fine. */
|
|
|
|
|
size = TYPE_SIZE_UNIT (BINFO_TYPE (binfo));
|
|
|
|
|
else
|
|
|
|
|
size = CLASSTYPE_SIZE_UNIT (BINFO_TYPE (binfo));
|
|
|
|
|
|
|
|
|
|
return size_binop (PLUS_EXPR, BINFO_OFFSET (binfo), size);
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-22 02:32:09 +01:00
|
|
|
|
/* Returns the offset of the byte just past the end of the base class
|
|
|
|
|
with the highest offset in T. If INCLUDE_VIRTUALS_P is zero, then
|
|
|
|
|
only non-virtual bases are included. */
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
end_of_class (tree t, int include_virtuals_p)
|
2000-01-02 20:41:09 +01:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree result = size_zero_node;
|
2002-10-25 08:01:55 +02:00
|
|
|
|
tree binfo;
|
|
|
|
|
tree offset;
|
2000-03-22 02:32:09 +01:00
|
|
|
|
int i;
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2000-03-22 02:32:09 +01:00
|
|
|
|
for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
|
|
|
|
|
{
|
2002-10-25 08:01:55 +02:00
|
|
|
|
binfo = BINFO_BASETYPE (TYPE_BINFO (t), i);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
|
|
|
|
if (!include_virtuals_p
|
2002-10-25 08:01:55 +02:00
|
|
|
|
&& TREE_VIA_VIRTUAL (binfo)
|
2003-03-05 09:27:42 +01:00
|
|
|
|
&& BINFO_PRIMARY_BASE_OF (binfo) != TYPE_BINFO (t))
|
2000-03-22 02:32:09 +01:00
|
|
|
|
continue;
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2002-10-25 08:01:55 +02:00
|
|
|
|
offset = end_of_base (binfo);
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (INT_CST_LT_UNSIGNED (result, offset))
|
|
|
|
|
result = offset;
|
2000-03-22 02:32:09 +01:00
|
|
|
|
}
|
2000-01-02 20:41:09 +01:00
|
|
|
|
|
2002-10-25 08:01:55 +02:00
|
|
|
|
/* G++ 3.2 did not check indirect virtual bases. */
|
|
|
|
|
if (abi_version_at_least (2) && include_virtuals_p)
|
|
|
|
|
for (binfo = CLASSTYPE_VBASECLASSES (t);
|
|
|
|
|
binfo;
|
|
|
|
|
binfo = TREE_CHAIN (binfo))
|
|
|
|
|
{
|
|
|
|
|
offset = end_of_base (TREE_VALUE (binfo));
|
|
|
|
|
if (INT_CST_LT_UNSIGNED (result, offset))
|
|
|
|
|
result = offset;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-22 02:32:09 +01:00
|
|
|
|
return result;
|
2000-01-02 20:41:09 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Warn about bases of T that are inaccessible because they are
|
2001-04-10 20:06:26 +02:00
|
|
|
|
ambiguous. For example:
|
|
|
|
|
|
|
|
|
|
struct S {};
|
|
|
|
|
struct T : public S {};
|
|
|
|
|
struct U : public S, public T {};
|
|
|
|
|
|
|
|
|
|
Here, `(S*) new U' is not allowed because there are two `S'
|
|
|
|
|
subobjects of U. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
warn_about_ambiguous_bases (tree t)
|
2001-04-10 20:06:26 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
tree vbases;
|
|
|
|
|
tree basetype;
|
2001-04-10 20:06:26 +02:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Check direct bases. */
|
2001-04-10 20:06:26 +02:00
|
|
|
|
for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); ++i)
|
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
basetype = TYPE_BINFO_BASETYPE (t, i);
|
2001-04-10 20:06:26 +02:00
|
|
|
|
|
2001-11-29 18:15:56 +01:00
|
|
|
|
if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("direct base `%T' inaccessible in `%T' due to ambiguity",
|
2002-09-30 18:52:19 +02:00
|
|
|
|
basetype, t);
|
2001-04-10 20:06:26 +02:00
|
|
|
|
}
|
2002-09-30 18:52:19 +02:00
|
|
|
|
|
|
|
|
|
/* Check for ambiguous virtual bases. */
|
|
|
|
|
if (extra_warnings)
|
|
|
|
|
for (vbases = CLASSTYPE_VBASECLASSES (t);
|
|
|
|
|
vbases;
|
|
|
|
|
vbases = TREE_CHAIN (vbases))
|
|
|
|
|
{
|
|
|
|
|
basetype = BINFO_TYPE (TREE_VALUE (vbases));
|
|
|
|
|
|
|
|
|
|
if (!lookup_base (t, basetype, ba_ignore | ba_quiet, NULL))
|
|
|
|
|
warning ("virtual base `%T' inaccessible in `%T' due to ambiguity",
|
|
|
|
|
basetype, t);
|
|
|
|
|
}
|
2001-04-10 20:06:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Compare two INTEGER_CSTs K1 and K2. */
|
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
splay_tree_compare_integer_csts (splay_tree_key k1, splay_tree_key k2)
|
2000-10-20 08:04:59 +02:00
|
|
|
|
{
|
|
|
|
|
return tree_int_cst_compare ((tree) k1, (tree) k2);
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Increase the size indicated in RLI to account for empty classes
|
|
|
|
|
that are "off the end" of the class. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
include_empty_classes (record_layout_info rli)
|
|
|
|
|
{
|
|
|
|
|
tree eoc;
|
2002-10-21 23:47:44 +02:00
|
|
|
|
tree rli_size;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
|
|
|
|
|
/* It might be the case that we grew the class to allocate a
|
|
|
|
|
zero-sized base class. That won't be reflected in RLI, yet,
|
|
|
|
|
because we are willing to overlay multiple bases at the same
|
|
|
|
|
offset. However, now we need to make sure that RLI is big enough
|
|
|
|
|
to reflect the entire class. */
|
|
|
|
|
eoc = end_of_class (rli->t,
|
|
|
|
|
CLASSTYPE_AS_BASE (rli->t) != NULL_TREE);
|
2002-10-21 23:47:44 +02:00
|
|
|
|
rli_size = rli_size_unit_so_far (rli);
|
|
|
|
|
if (TREE_CODE (rli_size) == INTEGER_CST
|
|
|
|
|
&& INT_CST_LT_UNSIGNED (rli_size, eoc))
|
2002-09-30 18:52:19 +02:00
|
|
|
|
{
|
2002-10-21 23:47:44 +02:00
|
|
|
|
rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
|
|
|
|
|
rli->bitpos
|
|
|
|
|
= size_binop (PLUS_EXPR,
|
|
|
|
|
rli->bitpos,
|
|
|
|
|
size_binop (MULT_EXPR,
|
|
|
|
|
convert (bitsizetype,
|
|
|
|
|
size_binop (MINUS_EXPR,
|
|
|
|
|
eoc, rli_size)),
|
|
|
|
|
bitsize_int (BITS_PER_UNIT)));
|
|
|
|
|
normalize_rli (rli);
|
2002-09-30 18:52:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Calculate the TYPE_SIZE, TYPE_ALIGN, etc for T. Calculate
|
|
|
|
|
BINFO_OFFSETs for all of the base-classes. Position the vtable
|
2002-09-13 02:22:59 +02:00
|
|
|
|
pointer. Accumulate declared virtual functions on VIRTUALS_P. */
|
1999-12-16 23:18:22 +01:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
static void
|
2002-10-26 02:44:44 +02:00
|
|
|
|
layout_class_type (tree t, tree *virtuals_p)
|
1999-12-29 08:31:51 +01:00
|
|
|
|
{
|
2000-03-15 01:16:21 +01:00
|
|
|
|
tree non_static_data_members;
|
|
|
|
|
tree field;
|
|
|
|
|
tree vptr;
|
|
|
|
|
record_layout_info rli;
|
2000-10-20 08:04:59 +02:00
|
|
|
|
/* Maps offsets (represented as INTEGER_CSTs) to a TREE_LIST of
|
|
|
|
|
types that appear at that offset. */
|
|
|
|
|
splay_tree empty_base_offsets;
|
2002-08-28 00:14:51 +02:00
|
|
|
|
/* True if the last field layed out was a bit-field. */
|
|
|
|
|
bool last_field_was_bitfield = false;
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* The location at which the next field should be inserted. */
|
|
|
|
|
tree *next_field;
|
|
|
|
|
/* T, as a base class. */
|
|
|
|
|
tree base_t;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
|
|
|
|
/* Keep track of the first non-static data member. */
|
|
|
|
|
non_static_data_members = TYPE_FIELDS (t);
|
|
|
|
|
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
/* Start laying out the record. */
|
|
|
|
|
rli = start_record_layout (t);
|
2000-01-25 07:33:06 +01:00
|
|
|
|
|
2000-01-03 07:56:21 +01:00
|
|
|
|
/* If possible, we reuse the virtual function table pointer from one
|
|
|
|
|
of our base classes. */
|
2002-10-26 02:44:44 +02:00
|
|
|
|
determine_primary_base (t);
|
2000-01-03 07:56:21 +01:00
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* Create a pointer to our virtual function table. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
vptr = create_vtable_ptr (t, virtuals_p);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* The vptr is always the first thing in the class. */
|
2001-02-12 10:58:18 +01:00
|
|
|
|
if (vptr)
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
TREE_CHAIN (vptr) = TYPE_FIELDS (t);
|
|
|
|
|
TYPE_FIELDS (t) = vptr;
|
|
|
|
|
next_field = &TREE_CHAIN (vptr);
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
place_field (rli, vptr);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
2002-09-30 18:52:19 +02:00
|
|
|
|
else
|
|
|
|
|
next_field = &TYPE_FIELDS (t);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
2000-07-11 19:31:21 +02:00
|
|
|
|
/* Build FIELD_DECLs for all of the non-virtual base-types. */
|
2000-10-20 08:04:59 +02:00
|
|
|
|
empty_base_offsets = splay_tree_new (splay_tree_compare_integer_csts,
|
|
|
|
|
NULL, NULL);
|
2002-10-15 20:07:24 +02:00
|
|
|
|
build_base_fields (rli, empty_base_offsets, next_field);
|
2001-04-20 17:29:09 +02:00
|
|
|
|
|
2000-03-15 01:16:21 +01:00
|
|
|
|
/* Layout the non-static data members. */
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
for (field = non_static_data_members; field; field = TREE_CHAIN (field))
|
2000-03-15 01:16:21 +01:00
|
|
|
|
{
|
2000-03-19 01:59:51 +01:00
|
|
|
|
tree type;
|
|
|
|
|
tree padding;
|
2000-03-15 01:16:21 +01:00
|
|
|
|
|
|
|
|
|
/* We still pass things that aren't non-static data members to
|
|
|
|
|
the back-end, in case it wants to do something with them. */
|
|
|
|
|
if (TREE_CODE (field) != FIELD_DECL)
|
|
|
|
|
{
|
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
2000-03-25 19:34:13 +01:00
|
|
|
|
place_field (rli, field);
|
2002-04-07 08:09:27 +02:00
|
|
|
|
/* If the static data member has incomplete type, keep track
|
|
|
|
|
of it so that it can be completed later. (The handling
|
|
|
|
|
of pending statics in finish_record_layout is
|
|
|
|
|
insufficient; consider:
|
|
|
|
|
|
|
|
|
|
struct S1;
|
|
|
|
|
struct S2 { static S1 s1; };
|
|
|
|
|
|
|
|
|
|
At this point, finish_record_layout will be called, but
|
|
|
|
|
S1 is still incomplete.) */
|
|
|
|
|
if (TREE_CODE (field) == VAR_DECL)
|
|
|
|
|
maybe_register_incomplete_var (field);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-19 01:59:51 +01:00
|
|
|
|
type = TREE_TYPE (field);
|
2003-04-10 21:28:46 +02:00
|
|
|
|
|
|
|
|
|
padding = NULL_TREE;
|
2000-03-19 01:59:51 +01:00
|
|
|
|
|
|
|
|
|
/* If this field is a bit-field whose width is greater than its
|
2001-07-21 02:03:21 +02:00
|
|
|
|
type, then there are some special rules for allocating
|
|
|
|
|
it. */
|
2000-03-19 01:59:51 +01:00
|
|
|
|
if (DECL_C_BIT_FIELD (field)
|
2001-02-12 10:58:18 +01:00
|
|
|
|
&& INT_CST_LT (TYPE_SIZE (type), DECL_SIZE (field)))
|
2000-03-19 01:59:51 +01:00
|
|
|
|
{
|
|
|
|
|
integer_type_kind itk;
|
|
|
|
|
tree integer_type;
|
2003-04-29 23:28:41 +02:00
|
|
|
|
bool was_unnamed_p = false;
|
2000-03-19 01:59:51 +01:00
|
|
|
|
/* We must allocate the bits as if suitably aligned for the
|
|
|
|
|
longest integer type that fits in this many bits. type
|
|
|
|
|
of the field. Then, we are supposed to use the left over
|
|
|
|
|
bits as additional padding. */
|
|
|
|
|
for (itk = itk_char; itk != itk_none; ++itk)
|
|
|
|
|
if (INT_CST_LT (DECL_SIZE (field),
|
|
|
|
|
TYPE_SIZE (integer_types[itk])))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* ITK now indicates a type that is too large for the
|
|
|
|
|
field. We have to back up by one to find the largest
|
|
|
|
|
type that fits. */
|
|
|
|
|
integer_type = integer_types[itk - 1];
|
2002-09-23 11:22:17 +02:00
|
|
|
|
|
2003-04-10 21:28:46 +02:00
|
|
|
|
/* Figure out how much additional padding is required. GCC
|
|
|
|
|
3.2 always created a padding field, even if it had zero
|
|
|
|
|
width. */
|
|
|
|
|
if (!abi_version_at_least (2)
|
|
|
|
|
|| INT_CST_LT (TYPE_SIZE (integer_type), DECL_SIZE (field)))
|
2002-09-23 11:22:17 +02:00
|
|
|
|
{
|
2003-04-10 21:28:46 +02:00
|
|
|
|
if (abi_version_at_least (2) && TREE_CODE (t) == UNION_TYPE)
|
|
|
|
|
/* In a union, the padding field must have the full width
|
|
|
|
|
of the bit-field; all fields start at offset zero. */
|
|
|
|
|
padding = DECL_SIZE (field);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (warn_abi && TREE_CODE (t) == UNION_TYPE)
|
|
|
|
|
warning ("size assigned to `%T' may not be "
|
|
|
|
|
"ABI-compliant and may change in a future "
|
|
|
|
|
"version of GCC",
|
|
|
|
|
t);
|
|
|
|
|
padding = size_binop (MINUS_EXPR, DECL_SIZE (field),
|
|
|
|
|
TYPE_SIZE (integer_type));
|
|
|
|
|
}
|
2002-09-23 11:22:17 +02:00
|
|
|
|
}
|
2003-01-07 16:41:30 +01:00
|
|
|
|
#ifdef PCC_BITFIELD_TYPE_MATTERS
|
2003-01-07 02:33:54 +01:00
|
|
|
|
/* An unnamed bitfield does not normally affect the
|
|
|
|
|
alignment of the containing class on a target where
|
|
|
|
|
PCC_BITFIELD_TYPE_MATTERS. But, the C++ ABI does not
|
|
|
|
|
make any exceptions for unnamed bitfields when the
|
|
|
|
|
bitfields are longer than their types. Therefore, we
|
|
|
|
|
temporarily give the field a name. */
|
|
|
|
|
if (PCC_BITFIELD_TYPE_MATTERS && !DECL_NAME (field))
|
|
|
|
|
{
|
|
|
|
|
was_unnamed_p = true;
|
|
|
|
|
DECL_NAME (field) = make_anon_name ();
|
|
|
|
|
}
|
2003-01-07 16:41:30 +01:00
|
|
|
|
#endif
|
2000-03-19 01:59:51 +01:00
|
|
|
|
DECL_SIZE (field) = TYPE_SIZE (integer_type);
|
|
|
|
|
DECL_ALIGN (field) = TYPE_ALIGN (integer_type);
|
2000-06-14 07:30:09 +02:00
|
|
|
|
DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type);
|
2003-04-29 23:28:41 +02:00
|
|
|
|
layout_nonempty_base_or_field (rli, field, NULL_TREE,
|
|
|
|
|
empty_base_offsets);
|
|
|
|
|
if (was_unnamed_p)
|
|
|
|
|
DECL_NAME (field) = NULL_TREE;
|
|
|
|
|
/* Now that layout has been performed, set the size of the
|
|
|
|
|
field to the size of its declared type; the rest of the
|
|
|
|
|
field is effectively invisible. */
|
|
|
|
|
DECL_SIZE (field) = TYPE_SIZE (type);
|
2000-03-19 01:59:51 +01:00
|
|
|
|
}
|
2003-04-29 23:28:41 +02:00
|
|
|
|
else
|
|
|
|
|
layout_nonempty_base_or_field (rli, field, NULL_TREE,
|
|
|
|
|
empty_base_offsets);
|
2000-03-19 01:59:51 +01:00
|
|
|
|
|
2002-11-26 08:20:13 +01:00
|
|
|
|
/* Remember the location of any empty classes in FIELD. */
|
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
record_subobject_offsets (TREE_TYPE (field),
|
|
|
|
|
byte_position(field),
|
|
|
|
|
empty_base_offsets,
|
|
|
|
|
/*vbases_p=*/1);
|
|
|
|
|
|
2002-08-28 00:14:51 +02:00
|
|
|
|
/* If a bit-field does not immediately follow another bit-field,
|
|
|
|
|
and yet it starts in the middle of a byte, we have failed to
|
|
|
|
|
comply with the ABI. */
|
|
|
|
|
if (warn_abi
|
|
|
|
|
&& DECL_C_BIT_FIELD (field)
|
|
|
|
|
&& !last_field_was_bitfield
|
|
|
|
|
&& !integer_zerop (size_binop (TRUNC_MOD_EXPR,
|
|
|
|
|
DECL_FIELD_BIT_OFFSET (field),
|
|
|
|
|
bitsize_unit_node)))
|
|
|
|
|
cp_warning_at ("offset of `%D' is not ABI-compliant and may change in a future version of GCC",
|
|
|
|
|
field);
|
|
|
|
|
|
2002-09-25 21:07:35 +02:00
|
|
|
|
/* G++ used to use DECL_FIELD_OFFSET as if it were the byte
|
|
|
|
|
offset of the field. */
|
|
|
|
|
if (warn_abi
|
|
|
|
|
&& !tree_int_cst_equal (DECL_FIELD_OFFSET (field),
|
|
|
|
|
byte_position (field))
|
|
|
|
|
&& contains_empty_class_p (TREE_TYPE (field)))
|
|
|
|
|
cp_warning_at ("`%D' contains empty classes which may cause base "
|
|
|
|
|
"classes to be placed at different locations in a "
|
|
|
|
|
"future version of GCC",
|
|
|
|
|
field);
|
|
|
|
|
|
2000-03-19 01:59:51 +01:00
|
|
|
|
/* If we needed additional padding after this field, add it
|
|
|
|
|
now. */
|
|
|
|
|
if (padding)
|
|
|
|
|
{
|
|
|
|
|
tree padding_field;
|
|
|
|
|
|
|
|
|
|
padding_field = build_decl (FIELD_DECL,
|
|
|
|
|
NULL_TREE,
|
|
|
|
|
char_type_node);
|
|
|
|
|
DECL_BIT_FIELD (padding_field) = 1;
|
|
|
|
|
DECL_SIZE (padding_field) = padding;
|
2003-04-10 21:28:46 +02:00
|
|
|
|
DECL_CONTEXT (padding_field) = t;
|
2000-10-20 08:04:59 +02:00
|
|
|
|
layout_nonempty_base_or_field (rli, padding_field,
|
|
|
|
|
NULL_TREE,
|
2002-09-30 18:52:19 +02:00
|
|
|
|
empty_base_offsets);
|
2000-03-19 01:59:51 +01:00
|
|
|
|
}
|
2002-08-28 00:14:51 +02:00
|
|
|
|
|
|
|
|
|
last_field_was_bitfield = DECL_C_BIT_FIELD (field);
|
2000-03-15 01:16:21 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (abi_version_at_least (2) && !integer_zerop (rli->bitpos))
|
2002-10-21 23:47:44 +02:00
|
|
|
|
{
|
|
|
|
|
/* Make sure that we are on a byte boundary so that the size of
|
|
|
|
|
the class without virtual bases will always be a round number
|
|
|
|
|
of bytes. */
|
|
|
|
|
rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
|
|
|
|
|
normalize_rli (rli);
|
|
|
|
|
}
|
2002-09-30 18:52:19 +02:00
|
|
|
|
|
2002-11-25 00:26:13 +01:00
|
|
|
|
/* G++ 3.2 does not allow virtual bases to be overlaid with tail
|
|
|
|
|
padding. */
|
|
|
|
|
if (!abi_version_at_least (2))
|
|
|
|
|
include_empty_classes(rli);
|
1999-12-16 04:10:12 +01:00
|
|
|
|
|
1999-12-21 03:11:10 +01:00
|
|
|
|
/* Delete all zero-width bit-fields from the list of fields. Now
|
|
|
|
|
that the type is laid out they are no longer important. */
|
|
|
|
|
remove_zero_width_bit_fields (t);
|
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Create the version of T used for virtual bases. We do not use
|
|
|
|
|
make_aggr_type for this version; this is an artificial type. For
|
|
|
|
|
a POD type, we just reuse T. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
if (CLASSTYPE_NON_POD_P (t) || CLASSTYPE_EMPTY_P (t))
|
c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
From-SVN: r32068
2000-02-20 02:11:00 +01:00
|
|
|
|
{
|
2002-09-30 18:52:19 +02:00
|
|
|
|
base_t = make_node (TREE_CODE (t));
|
|
|
|
|
|
2002-10-15 20:07:24 +02:00
|
|
|
|
/* Set the size and alignment for the new type. In G++ 3.2, all
|
|
|
|
|
empty classes were considered to have size zero when used as
|
|
|
|
|
base classes. */
|
|
|
|
|
if (!abi_version_at_least (2) && CLASSTYPE_EMPTY_P (t))
|
|
|
|
|
{
|
|
|
|
|
TYPE_SIZE (base_t) = bitsize_zero_node;
|
|
|
|
|
TYPE_SIZE_UNIT (base_t) = size_zero_node;
|
|
|
|
|
if (warn_abi && !integer_zerop (rli_size_unit_so_far (rli)))
|
|
|
|
|
warning ("layout of classes derived from empty class `%T' "
|
|
|
|
|
"may change in a future version of GCC",
|
|
|
|
|
t);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-02-18 20:17:29 +01:00
|
|
|
|
tree eoc;
|
|
|
|
|
|
|
|
|
|
/* If the ABI version is not at least two, and the last
|
|
|
|
|
field was a bit-field, RLI may not be on a byte
|
|
|
|
|
boundary. In particular, rli_size_unit_so_far might
|
|
|
|
|
indicate the last complete byte, while rli_size_so_far
|
|
|
|
|
indicates the total number of bits used. Therefore,
|
|
|
|
|
rli_size_so_far, rather than rli_size_unit_so_far, is
|
|
|
|
|
used to compute TYPE_SIZE_UNIT. */
|
|
|
|
|
eoc = end_of_class (t, /*include_virtuals_p=*/0);
|
2002-11-25 00:26:13 +01:00
|
|
|
|
TYPE_SIZE_UNIT (base_t)
|
|
|
|
|
= size_binop (MAX_EXPR,
|
2003-02-18 20:17:29 +01:00
|
|
|
|
convert (sizetype,
|
|
|
|
|
size_binop (CEIL_DIV_EXPR,
|
|
|
|
|
rli_size_so_far (rli),
|
|
|
|
|
bitsize_int (BITS_PER_UNIT))),
|
|
|
|
|
eoc);
|
2002-11-25 00:26:13 +01:00
|
|
|
|
TYPE_SIZE (base_t)
|
|
|
|
|
= size_binop (MAX_EXPR,
|
|
|
|
|
rli_size_so_far (rli),
|
|
|
|
|
size_binop (MULT_EXPR,
|
2003-02-18 20:17:29 +01:00
|
|
|
|
convert (bitsizetype, eoc),
|
2002-11-25 00:26:13 +01:00
|
|
|
|
bitsize_int (BITS_PER_UNIT)));
|
2002-10-15 20:07:24 +02:00
|
|
|
|
}
|
2002-09-30 18:52:19 +02:00
|
|
|
|
TYPE_ALIGN (base_t) = rli->record_align;
|
|
|
|
|
TYPE_USER_ALIGN (base_t) = TYPE_USER_ALIGN (t);
|
|
|
|
|
|
|
|
|
|
/* Copy the fields from T. */
|
|
|
|
|
next_field = &TYPE_FIELDS (base_t);
|
|
|
|
|
for (field = TYPE_FIELDS (t); field; field = TREE_CHAIN (field))
|
|
|
|
|
if (TREE_CODE (field) == FIELD_DECL)
|
|
|
|
|
{
|
|
|
|
|
*next_field = build_decl (FIELD_DECL,
|
|
|
|
|
DECL_NAME (field),
|
|
|
|
|
TREE_TYPE (field));
|
|
|
|
|
DECL_CONTEXT (*next_field) = base_t;
|
|
|
|
|
DECL_FIELD_OFFSET (*next_field) = DECL_FIELD_OFFSET (field);
|
|
|
|
|
DECL_FIELD_BIT_OFFSET (*next_field)
|
|
|
|
|
= DECL_FIELD_BIT_OFFSET (field);
|
|
|
|
|
next_field = &TREE_CHAIN (*next_field);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Record the base version of the type. */
|
|
|
|
|
CLASSTYPE_AS_BASE (t) = base_t;
|
2002-12-30 13:46:13 +01:00
|
|
|
|
TYPE_CONTEXT (base_t) = t;
|
2002-06-18 18:05:31 +02:00
|
|
|
|
}
|
2001-02-12 10:58:18 +01:00
|
|
|
|
else
|
2002-09-30 18:52:19 +02:00
|
|
|
|
CLASSTYPE_AS_BASE (t) = t;
|
cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
* cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
* decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise.
* class.c (duplicate_tag_error): Likewise.
(finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN.
* tree.c (layout_vbasetypes): Update from layout_record, remove
var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE.
(layout_basetypes): Likewise.
From-SVN: r18965
1998-04-02 19:05:40 +02:00
|
|
|
|
|
2002-10-21 10:40:24 +02:00
|
|
|
|
/* Every empty class contains an empty class. */
|
|
|
|
|
if (CLASSTYPE_EMPTY_P (t))
|
|
|
|
|
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t) = 1;
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* Set the TYPE_DECL for this type to contain the right
|
|
|
|
|
value for DECL_OFFSET, so that we can use it as part
|
|
|
|
|
of a COMPONENT_REF for multiple inheritance. */
|
1996-12-18 03:46:25 +01:00
|
|
|
|
layout_decl (TYPE_MAIN_DECL (t), 0);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1994-04-22 01:30:18 +02:00
|
|
|
|
/* Now fix up any virtual base class types that we left lying
|
|
|
|
|
around. We must get these done before we try to lay out the
|
2000-03-15 01:16:21 +01:00
|
|
|
|
virtual function table. As a side-effect, this will remove the
|
|
|
|
|
base subobject fields. */
|
2002-09-30 18:52:19 +02:00
|
|
|
|
layout_virtual_bases (rli, empty_base_offsets);
|
|
|
|
|
|
|
|
|
|
/* Make sure that empty classes are reflected in RLI at this
|
|
|
|
|
point. */
|
|
|
|
|
include_empty_classes(rli);
|
|
|
|
|
|
|
|
|
|
/* Make sure not to create any structures with zero size. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
if (integer_zerop (rli_size_unit_so_far (rli)) && CLASSTYPE_EMPTY_P (t))
|
2002-09-30 18:52:19 +02:00
|
|
|
|
place_field (rli,
|
|
|
|
|
build_decl (FIELD_DECL, NULL_TREE, char_type_node));
|
|
|
|
|
|
|
|
|
|
/* Let the back-end lay out the type. */
|
|
|
|
|
finish_record_layout (rli, /*free_p=*/true);
|
2000-03-22 02:32:09 +01:00
|
|
|
|
|
2002-09-30 18:52:19 +02:00
|
|
|
|
/* Warn about bases that can't be talked about due to ambiguity. */
|
|
|
|
|
warn_about_ambiguous_bases (t);
|
2001-04-10 20:06:26 +02:00
|
|
|
|
|
2000-03-22 02:32:09 +01:00
|
|
|
|
/* Clean up. */
|
2000-10-20 08:04:59 +02:00
|
|
|
|
splay_tree_delete (empty_base_offsets);
|
1999-12-29 08:31:51 +01:00
|
|
|
|
}
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
2003-01-03 20:48:55 +01:00
|
|
|
|
/* Returns the virtual function with which the vtable for TYPE is
|
|
|
|
|
emitted, or NULL_TREE if that heuristic is not applicable to TYPE. */
|
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
key_method (tree type)
|
|
|
|
|
{
|
|
|
|
|
tree method;
|
|
|
|
|
|
|
|
|
|
if (TYPE_FOR_JAVA (type)
|
|
|
|
|
|| processing_template_decl
|
|
|
|
|
|| CLASSTYPE_TEMPLATE_INSTANTIATION (type)
|
|
|
|
|
|| CLASSTYPE_INTERFACE_KNOWN (type))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
|
|
|
|
for (method = TYPE_METHODS (type); method != NULL_TREE;
|
|
|
|
|
method = TREE_CHAIN (method))
|
|
|
|
|
if (DECL_VINDEX (method) != NULL_TREE
|
|
|
|
|
&& ! DECL_DECLARED_INLINE_P (method)
|
|
|
|
|
&& ! DECL_PURE_VIRTUAL_P (method))
|
|
|
|
|
return method;
|
|
|
|
|
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-04 02:45:58 +01:00
|
|
|
|
/* Perform processing required when the definition of T (a class type)
|
|
|
|
|
is complete. */
|
1999-12-29 08:31:51 +01:00
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
finish_struct_1 (tree t)
|
1999-12-29 08:31:51 +01:00
|
|
|
|
{
|
|
|
|
|
tree x;
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* A TREE_LIST. The TREE_VALUE of each node is a FUNCTION_DECL. */
|
2002-08-04 15:13:56 +02:00
|
|
|
|
tree virtuals = NULL_TREE;
|
1999-12-29 08:31:51 +01:00
|
|
|
|
int n_fields = 0;
|
|
|
|
|
tree vfield;
|
|
|
|
|
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
if (COMPLETE_TYPE_P (t))
|
1999-12-29 08:31:51 +01:00
|
|
|
|
{
|
|
|
|
|
if (IS_AGGR_TYPE (t))
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
error ("redefinition of `%#T'", t);
|
1999-12-29 08:31:51 +01:00
|
|
|
|
else
|
call.c, [...]: Change my_fancy_abort() to abort().
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
Change my_fancy_abort() to abort().
From-SVN: r49139
2002-01-23 15:26:07 +01:00
|
|
|
|
abort ();
|
1999-12-29 08:31:51 +01:00
|
|
|
|
popclass ();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If this type was previously laid out as a forward reference,
|
|
|
|
|
make sure we lay it out again. */
|
|
|
|
|
TYPE_SIZE (t) = NULL_TREE;
|
|
|
|
|
CLASSTYPE_GOT_SEMICOLON (t) = 0;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
CLASSTYPE_PRIMARY_BINFO (t) = NULL_TREE;
|
1999-12-29 08:31:51 +01:00
|
|
|
|
|
2001-09-06 10:59:39 +02:00
|
|
|
|
fixup_inline_methods (t);
|
|
|
|
|
|
2002-10-21 10:40:24 +02:00
|
|
|
|
/* Make assumptions about the class; we'll reset the flags if
|
|
|
|
|
necessary. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
CLASSTYPE_EMPTY_P (t) = 1;
|
|
|
|
|
CLASSTYPE_NEARLY_EMPTY_P (t) = 1;
|
2002-10-21 10:40:24 +02:00
|
|
|
|
CLASSTYPE_CONTAINS_EMPTY_CLASS_P (t) = 0;
|
2002-10-15 20:07:24 +02:00
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Do end-of-class semantic processing: checking the validity of the
|
2000-01-01 04:04:27 +01:00
|
|
|
|
bases and members and add implicitly generated methods. */
|
2002-10-15 20:07:24 +02:00
|
|
|
|
check_bases_and_members (t);
|
1999-12-29 08:31:51 +01:00
|
|
|
|
|
2003-01-03 20:48:55 +01:00
|
|
|
|
/* Find the key method */
|
2003-05-20 22:52:33 +02:00
|
|
|
|
if (TYPE_CONTAINS_VPTR_P (t))
|
2003-01-03 20:48:55 +01:00
|
|
|
|
{
|
|
|
|
|
CLASSTYPE_KEY_METHOD (t) = key_method (t);
|
|
|
|
|
|
|
|
|
|
/* If a polymorphic class has no key method, we may emit the vtable
|
2003-07-07 01:23:46 +02:00
|
|
|
|
in every translation unit where the class definition appears. */
|
2003-01-03 20:48:55 +01:00
|
|
|
|
if (CLASSTYPE_KEY_METHOD (t) == NULL_TREE)
|
|
|
|
|
keyed_classes = tree_cons (NULL_TREE, t, keyed_classes);
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-29 08:31:51 +01:00
|
|
|
|
/* Layout the class itself. */
|
2002-10-26 02:44:44 +02:00
|
|
|
|
layout_class_type (t, &virtuals);
|
1998-11-18 03:21:54 +01:00
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* Make sure that we get our own copy of the vfield FIELD_DECL. */
|
1999-12-21 03:11:10 +01:00
|
|
|
|
vfield = TYPE_VFIELD (t);
|
2001-07-27 17:07:40 +02:00
|
|
|
|
if (vfield && CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
1994-05-19 22:19:03 +02:00
|
|
|
|
{
|
2001-07-27 17:07:40 +02:00
|
|
|
|
tree primary = CLASSTYPE_PRIMARY_BINFO (t);
|
|
|
|
|
|
|
|
|
|
my_friendly_assert (same_type_p (DECL_FIELD_CONTEXT (vfield),
|
|
|
|
|
BINFO_TYPE (primary)),
|
|
|
|
|
20010726);
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* The vtable better be at the start. */
|
2001-07-27 17:07:40 +02:00
|
|
|
|
my_friendly_assert (integer_zerop (DECL_FIELD_OFFSET (vfield)),
|
|
|
|
|
20010726);
|
|
|
|
|
my_friendly_assert (integer_zerop (BINFO_OFFSET (primary)),
|
|
|
|
|
20010726);
|
|
|
|
|
|
2000-04-11 18:27:42 +02:00
|
|
|
|
vfield = copy_decl (vfield);
|
1994-05-19 22:19:03 +02:00
|
|
|
|
DECL_FIELD_CONTEXT (vfield) = t;
|
1999-10-06 21:01:44 +02:00
|
|
|
|
TYPE_VFIELD (t) = vfield;
|
1994-05-19 22:19:03 +02:00
|
|
|
|
}
|
2001-07-27 17:07:40 +02:00
|
|
|
|
else
|
|
|
|
|
my_friendly_assert (!vfield || DECL_FIELD_CONTEXT (vfield) == t, 20010726);
|
1999-12-21 01:19:01 +01:00
|
|
|
|
|
2002-10-26 02:44:44 +02:00
|
|
|
|
virtuals = modify_all_vtables (t, nreverse (virtuals));
|
1994-11-29 01:59:16 +01:00
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* If we created a new vtbl pointer for this class, add it to the
|
|
|
|
|
list. */
|
|
|
|
|
if (TYPE_VFIELD (t) && !CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
|
|
|
|
CLASSTYPE_VFIELDS (t)
|
|
|
|
|
= chainon (CLASSTYPE_VFIELDS (t), build_tree_list (NULL_TREE, t));
|
|
|
|
|
|
2000-01-31 22:00:01 +01:00
|
|
|
|
/* If necessary, create the primary vtable for this class. */
|
2002-08-04 15:13:56 +02:00
|
|
|
|
if (virtuals || TYPE_CONTAINS_VPTR_P (t))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
/* We must enter these virtuals into the table. */
|
1999-12-21 03:11:10 +01:00
|
|
|
|
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
2000-03-28 21:27:15 +02:00
|
|
|
|
build_primary_vtable (NULL_TREE, t);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
else if (! BINFO_NEW_VTABLE_MARKED (TYPE_BINFO (t)))
|
2000-01-02 03:13:53 +01:00
|
|
|
|
/* Here we know enough to change the type of our virtual
|
|
|
|
|
function table, but we will wait until later this function. */
|
2000-01-31 05:03:01 +01:00
|
|
|
|
build_primary_vtable (CLASSTYPE_PRIMARY_BINFO (t), t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-17 05:08:01 +01:00
|
|
|
|
if (TYPE_CONTAINS_VPTR_P (t))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2002-10-26 02:44:44 +02:00
|
|
|
|
int vindex;
|
|
|
|
|
tree fn;
|
|
|
|
|
|
2000-01-17 06:12:39 +01:00
|
|
|
|
if (TYPE_BINFO_VTABLE (t))
|
|
|
|
|
my_friendly_assert (DECL_VIRTUAL_P (TYPE_BINFO_VTABLE (t)),
|
|
|
|
|
20000116);
|
|
|
|
|
if (!CLASSTYPE_HAS_PRIMARY_BASE_P (t))
|
|
|
|
|
my_friendly_assert (TYPE_BINFO_VIRTUALS (t) == NULL_TREE,
|
|
|
|
|
20000116);
|
|
|
|
|
|
2002-08-04 15:13:56 +02:00
|
|
|
|
/* Add entries for virtual functions introduced by this class. */
|
|
|
|
|
TYPE_BINFO_VIRTUALS (t) = chainon (TYPE_BINFO_VIRTUALS (t), virtuals);
|
2002-10-26 02:44:44 +02:00
|
|
|
|
|
|
|
|
|
/* Set DECL_VINDEX for all functions declared in this class. */
|
|
|
|
|
for (vindex = 0, fn = BINFO_VIRTUALS (TYPE_BINFO (t));
|
|
|
|
|
fn;
|
|
|
|
|
fn = TREE_CHAIN (fn),
|
|
|
|
|
vindex += (TARGET_VTABLE_USES_DESCRIPTORS
|
|
|
|
|
? TARGET_VTABLE_USES_DESCRIPTORS : 1))
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
tree fndecl = BV_FN (fn);
|
|
|
|
|
|
|
|
|
|
if (DECL_THUNK_P (fndecl))
|
|
|
|
|
/* A thunk. We should never be calling this entry directly
|
|
|
|
|
from this vtable -- we'd use the entry for the non
|
|
|
|
|
thunk base function. */
|
|
|
|
|
DECL_VINDEX (fndecl) = NULL_TREE;
|
|
|
|
|
else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
|
|
|
|
|
DECL_VINDEX (fndecl) = build_shared_int_cst (vindex);
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 05:05:43 +01:00
|
|
|
|
finish_struct_bits (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
/* Complete the rtl for any static member objects of the type we're
|
|
|
|
|
working on. */
|
1999-12-16 04:10:12 +01:00
|
|
|
|
for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x))
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x)
|
2002-03-29 08:47:06 +01:00
|
|
|
|
&& same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t))
|
varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME...
* varasm.c (assemble_alias): Use DECL_ASSEMBLER_NAME, not the
contents of the RTL, to determine the name of the object.
* tree.h (DECL_RTL): Allocate RTL lazily.
(SET_DECL_RTL): New macro.
(DECL_RTL_SET_P): Likewise.
(COPY_DECL_RTL): Likewise.
(DECL_RTL_IF_SET): Likewise.
* varasm.c (make_decl_rtl): Add assertions about the kind of
declaration we are processing.
* c-decl.c (duplicate_decls): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
(start_decl): Likewise.
(finish_decl): Likewise.
* c-semantics.c (emit_local_var): Likewise.
* calls.c (expand_call): Likewise.
* dbxout.c (dbxout_symbol): Likewise.
* emit-rtl.c (unshare_all_rtl): Likewise.
(unshare_all_decls): Likewise.
(reset_used_decls): Likewise.
* expr.c (store_constructor): Likewise.
(safe_from_p): Likewise.
(expand_expr): Likewise.
* function.c (put_var_into_stack): Likewise.
(instantiate_decls_1): Likewise.
(assign_parms): Likewise.
(expand_function_start): Likewise.
(expand_function_end): Likewise.
* ggc-common.c (gcc_mark_trees): Likewise.
* integrate.c (function_cannot_inline_p): Likewise.
(copy_decl_for_inlining): Likewise.
(expand_inline_function): Likewise.
(integrate_parm_decls): Likewise.
(integrate_decl_tree): Likewise.
* print-tree.c (print_node): Likewise.
* reg-stack.c (stack_result): Likewise.
* stmt.c (label_rtx): Likewise.
(expand_return): Likewise.
(expand_decl): Likewise.
(expand_decl_cleanup): Likewise.
(expand_anon_union_decl): Likewise.
* toplev.c (check_global_declarations): Likewise.
(rest_of_decl_compilation): Likewise.
* tree.c (simple_cst_equal): Likewise.
* objc/objc-act.c (generate_static_references): Likewise.
* class.c (build_clone): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* cp-tree.h (DECL_IN_MEMORY_P): Likewise.
* decl.c (duplicate_decls): Likewise.
(builtin_function): Likewise.
(build_library_fn): Likewise.
(build_cp_library_fn): Likewise.
(check_initializer): Likewise.
(cp_finish_decl): Likewise.
* decl2.c (grokfield): Likewise.
(grok_function_init): Remove #if 0'd code.
(finish_anon_union): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
* friend.c (do_friend): Likewise.
* init.c (get_temp_regvar): Likewise.
* method.c (make_thunk): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(tsubst_decl): Likewise.
(regenerate_decl_from_template): Likewise.
* semantics.c (genrtl_named_return_value): Likewise.
(expand_body): Likewise.
(genrtl_finish_function): Likewise.
* tree.c (cp_tree_equal): Likewise.
* com.c (ffecom_member_phase_2): Use COPY_DECL_RTL,
DECL_RTL_SET_P, etc.
(duplicate_decls): Likewise.
(start_decl): Likewise.
* class.c (build_static_field_ref): Likewise.
(make_method_value): Likewise.
(get_dispatch_table): Likewise.
* decl.c (push_jvm_slot): Use COPY_DECL_RTL, DECL_RTL_SET_P, etc.
From-SVN: r40482
2001-03-15 03:51:03 +01:00
|
|
|
|
DECL_MODE (x) = TYPE_MODE (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-07-09 18:15:04 +02:00
|
|
|
|
/* Done with FIELDS...now decide whether to sort these for
|
1999-12-16 04:10:12 +01:00
|
|
|
|
faster lookups later.
|
1999-07-09 18:15:04 +02:00
|
|
|
|
|
2002-12-04 21:17:49 +01:00
|
|
|
|
We use a small number because most searches fail (succeeding
|
1999-07-09 18:15:04 +02:00
|
|
|
|
ultimately as the search bores through the inheritance
|
|
|
|
|
hierarchy), and we want this failure to occur quickly. */
|
|
|
|
|
|
1999-12-16 04:10:12 +01:00
|
|
|
|
n_fields = count_fields (TYPE_FIELDS (t));
|
|
|
|
|
if (n_fields > 7)
|
1999-07-09 18:15:04 +02:00
|
|
|
|
{
|
2003-07-16 20:45:56 +02:00
|
|
|
|
struct sorted_fields_type *field_vec = ggc_alloc (sizeof (struct sorted_fields_type)
|
|
|
|
|
+ n_fields * sizeof (tree));
|
|
|
|
|
field_vec->len = n_fields;
|
|
|
|
|
add_fields_to_record_type (TYPE_FIELDS (t), field_vec, 0);
|
|
|
|
|
qsort (field_vec->elts, n_fields, sizeof (tree),
|
2003-01-10 03:22:34 +01:00
|
|
|
|
field_decl_cmp);
|
1999-07-09 18:15:04 +02:00
|
|
|
|
if (! DECL_LANG_SPECIFIC (TYPE_MAIN_DECL (t)))
|
|
|
|
|
retrofit_lang_decl (TYPE_MAIN_DECL (t));
|
|
|
|
|
DECL_SORTED_FIELDS (TYPE_MAIN_DECL (t)) = field_vec;
|
|
|
|
|
}
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TYPE_HAS_CONSTRUCTOR (t))
|
|
|
|
|
{
|
|
|
|
|
tree vfields = CLASSTYPE_VFIELDS (t);
|
|
|
|
|
|
2002-08-04 16:43:46 +02:00
|
|
|
|
for (vfields = CLASSTYPE_VFIELDS (t);
|
|
|
|
|
vfields; vfields = TREE_CHAIN (vfields))
|
|
|
|
|
/* Mark the fact that constructor for T could affect anybody
|
|
|
|
|
inheriting from T who wants to initialize vtables for
|
|
|
|
|
VFIELDS's type. */
|
|
|
|
|
if (VF_BINFO_VALUE (vfields))
|
|
|
|
|
TREE_ADDRESSABLE (vfields) = 1;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-02-21 05:19:12 +01:00
|
|
|
|
/* Make the rtl for any new vtables we have created, and unmark
|
|
|
|
|
the base types we marked. */
|
|
|
|
|
finish_vtbls (t);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Build the VTT for T. */
|
|
|
|
|
build_vtt (t);
|
2000-02-21 05:19:12 +01:00
|
|
|
|
|
2001-08-07 15:57:06 +02:00
|
|
|
|
if (warn_nonvdtor && TYPE_POLYMORPHIC_P (t) && TYPE_HAS_DESTRUCTOR (t)
|
|
|
|
|
&& DECL_VINDEX (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 1)) == NULL_TREE)
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
warning ("`%#T' has virtual functions but non-virtual destructor", t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2002-04-07 08:09:27 +02:00
|
|
|
|
complete_vars (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1996-02-01 20:32:00 +01:00
|
|
|
|
if (warn_overloaded_virtual)
|
|
|
|
|
warn_hidden (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-11-16 02:37:39 +01:00
|
|
|
|
maybe_suppress_debug_info (t);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
dump_class_hierarchy (t);
|
|
|
|
|
|
1996-12-18 03:46:25 +01:00
|
|
|
|
/* Finish debugging output for this type. */
|
[multiple changes]
2000-08-28 Daniel Berlin <dberlin@redhat.com>
* dwarf2out.c (DIE_LABEL_PREFIX): Remove leading "__".
(print_die): If we don't know the offset of the
target die, try the symbol. Add a trailing newline.
(reverse_all_dies): New fn.
(dwarf2out_finish): Call it.
(break_out_includes): Reorganize for clarity.
(add_sibling_attributes): Don't call reverse_die_lists.
(output_comp_unit): Rename from output_comdat_comp_unit. Use for
primary CU, too.
* flags.h: Add flag_eliminate_dwarf2_dups.
* toplev.c (f_options): Support -feliminate-dwarf2-dups.
2000-08-28 Jason Merrill <jason@redhat.com>
* dwarf2.h (DW_TAG_GNU_BINCL, DW_TAG_GNU_EINCL): New tags.
* dwarf2out.c: #include "md5.h".
(DIE_LABEL_PREFIX): New macro.
(dw_val_struct): Add 'external' flag to val_die_ref.
(add_AT_die_ref, AT_ref): Adjust.
(AT_ref_external, set_AT_ref_external): New fns.
(build_abbrev_table): Call set_AT_ref_external.
(value_format): Call AT_ref_external.
(die_struct): Add die_symbol field.
(new_die): Clear it.
(dwarf_tag_name): Handle BINCL/EINCL.
(dwarf2out_start_source_file): Add BINCL DIE.
(dwarf2out_end_source_file): Add EINCL DIE.
(push_new_compile_unit, pop_compile_unit, clear_die_sizes): New fns.
(loc_checksum, attr_checksum, die_checksum): New fns.
(is_type_die, is_comdat_die, is_symbol_die): New fns.
(compute_section_prefix, assign_symbol_names): New fns.
(gen_internal_sym, output_die_symbol, output_symbolic_ref): New fns.
(output_die): Call output_die_symbol and AT_ref_external.
(output_comdat_comp_unit): New fn, split out from...
(dwarf2out_finish): ...here. Also call add_sibling_attributes for
secondary CUs.
(output_pubnames, output_aranges): Abort if we see entries from
secondary CUs.
* toplev.h: Declare file_name_nondirectory.
* toplev.c (file_name_nondirectory): New fn, moved from C++ frontend.
(rest_of_type_compilation): Call dwarf2out_decl if at toplevel.
(debug_start_source_file): Call dwarf2out_start_source_file
regardless of debug verbosity.
(debug_end_source_file): Similarly.
* tree.h: Declare clean_symbol_name.
* tree.c (clean_symbol_name): Split out from...
(get_file_function_name_long): ...here.
* dwarf2out.c (new_loc_descr): Use calloc.
(splice_child_die): Remove the die from the right parent.
(gen_struct_or_union_die): Don't add AT_name to a specification DIE.
gcc/cp:
2000-08-28 Jason Merrill <jason@redhat.com>
* lex.c (file_name_nondirectory): Move to toplev.c.
libiberty:
2000-08-28 Jason Merrill <jason@redhat.com>
* Makefile.in (REQUIRED_OFILES): Add md5.o.
(CFILES): Add md5.c.
* md5.c: New file.
include:
2000-08-28 Jason Merrill <jason@redhat.com>
* md5.h: New file.
gcc/cp:
2000-08-28 Jason Merrill <jason@redhat.com>
* cp-tree.h (LOCAL_CLASS_P): New macro.
* class.c (finish_struct_1): Use it.
From-SVN: r36022
2000-08-29 02:29:29 +02:00
|
|
|
|
rest_of_type_compilation (t, ! LOCAL_CLASS_P (t));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
1995-10-12 03:33:51 +01:00
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* When T was built up, the member declarations were added in reverse
|
|
|
|
|
order. Rearrange them to declaration order. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
unreverse_member_declarations (tree t)
|
1998-10-06 16:20:30 +02:00
|
|
|
|
{
|
|
|
|
|
tree next;
|
|
|
|
|
tree prev;
|
|
|
|
|
tree x;
|
|
|
|
|
|
2002-10-30 16:54:10 +01:00
|
|
|
|
/* The following lists are all in reverse order. Put them in
|
|
|
|
|
declaration order now. */
|
1998-10-06 16:20:30 +02:00
|
|
|
|
TYPE_METHODS (t) = nreverse (TYPE_METHODS (t));
|
2002-10-30 16:54:10 +01:00
|
|
|
|
CLASSTYPE_DECL_LIST (t) = nreverse (CLASSTYPE_DECL_LIST (t));
|
1998-10-06 16:20:30 +02:00
|
|
|
|
|
|
|
|
|
/* Actually, for the TYPE_FIELDS, only the non TYPE_DECLs are in
|
|
|
|
|
reverse order, so we can't just use nreverse. */
|
|
|
|
|
prev = NULL_TREE;
|
|
|
|
|
for (x = TYPE_FIELDS (t);
|
|
|
|
|
x && TREE_CODE (x) != TYPE_DECL;
|
|
|
|
|
x = next)
|
|
|
|
|
{
|
|
|
|
|
next = TREE_CHAIN (x);
|
|
|
|
|
TREE_CHAIN (x) = prev;
|
|
|
|
|
prev = x;
|
|
|
|
|
}
|
|
|
|
|
if (prev)
|
|
|
|
|
{
|
|
|
|
|
TREE_CHAIN (TYPE_FIELDS (t)) = x;
|
|
|
|
|
if (prev)
|
|
|
|
|
TYPE_FIELDS (t) = prev;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1995-10-12 03:33:51 +01:00
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
finish_struct (tree t, tree attributes)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
2003-05-03 13:37:22 +02:00
|
|
|
|
location_t saved_loc = input_location;
|
2001-01-08 12:45:22 +01:00
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* Now that we've got all the field declarations, reverse everything
|
|
|
|
|
as necessary. */
|
|
|
|
|
unreverse_member_declarations (t);
|
1995-10-12 03:33:51 +01:00
|
|
|
|
|
Table-driven attributes.
* c-decl.c, config/alpha/alpha.c, config/arc/arc.c,
config/arm/arm.c, config/arm/pe.c, config/avr/avr.c,
config/avr/avr.h, config/d30v/d30v.h, config/fr30/fr30.h,
config/h8300/h8300.c, config/i386/cygwin.h, config/i386/winnt.c,
config/m32r/m32r.c, config/mcore/mcore.c, config/sh/sh.c,
config/stormy16/stormy16.h, config/v850/v850.c, doc/c-tree.texi,
doc/tm.texi, ggc-common.c, integrate.c, print-tree.c, tree.c,
tree.h: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* tree.h (struct tree_decl): Change machine_attributes to
attributes.
* doc/c-tree.texi: Document that all attributes are now attached
to decls and types.
* c-common.c (add_attribute, attrtab, attrtab_idx,
default_valid_lang_attribute, valid_lang_attribute): Remove.
(attribute_tables, attributes_initialized,
c_common_attribute_table, default_lang_attribute_table): New
variables.
(handle_packed_attribute, handle_nocommon_attribute,
handle_common_attribute, handle_noreturn_attribute,
handle_unused_attribute, handle_const_attribute,
handle_transparent_union_attribute, handle_constructor_attribute,
handle_destructor_attribute, handle_mode_attribute,
handle_section_attribute, handle_aligned_attribute,
handle_weak_attribute, handle_alias_attribute,
handle_no_instrument_function_attribute,
handle_no_check_memory_usage_attribute, handle_malloc_attribute,
handle_no_limit_stack_attribute, handle_pure_attribute): New
functions.
(init_attributes, decl_attributes): Rewrite to implement
table-driven attributes.
* c-common.h (enum attribute_flags): Move to tree.h.
* c-format.c (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Rename to
handle_format_attribute and handle_format_arg_attribute. Update
for table-driven attributes.
* c-common.h (decl_handle_format_attribute,
decl_handle_format_arg_attribute): Remove prototypes.
(handle_format_attribute, handle_format_arg_attribute): Add
prototypes.
* c-decl.c (grokdeclarator): Handle attributes nested inside
declarators.
* c-parse.in (setattrs, maybe_setattrs): Remove.
(maybe_type_quals_setattrs): Rename to maybe_type_quals_attrs.
Update to handle nested attributes properly.
(maybe_resetattrs, after_type_declarator,
parm_declarator_nostarttypename, notype_declarator, absdcl1_noea,
absdcl1_ea, direct_absdcl1): Update to handle nested attributes
properly.
(make_pointer_declarator): Update to handle nested attributes
properly.
* doc/extend.texi: Update documentation of limits of attributes
syntax. Warn about problems with attribute semantics in C++.
* target.h (struct target): Remove valid_decl_attribute and
valid_type_attribute. Add attribute_table and
function_attribute_inlinable_p.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Remove.
(TARGET_ATTRIBUTE_TABLE, TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P):
Add.
(TARGET_INITIALIZER): Update.
* integrate.c (FUNCTION_ATTRIBUTE_INLINABLE_P): Remove default
definition.
(function_attribute_inlinable_p): New function. Check for the
presence of any machine attributes before using
targetm.function_attribute_inlinable_p.
(function_cannot_inline_p): Update.
* Makefile.in (integrate.o): Update dependencies.
* doc/tm.texi: Update documentation of target attributes and
example definition of TARGET_VALID_TYPE_ATTRIBUTE.
* tree.c (default_valid_attribute_p, valid_machine_attribute):
Remove.
(default_target_attribute_table,
default_function_attribute_inlinable_p): New.
(lookup_attribute): Update comment to clarify handling of multiple
attributes with the same name.
(merge_attributes, attribute_list_contained): Allow multiple
attributes with the same name but different arguments to appear in
the same attribute list.
* tree.h (default_valid_attribute_p): Remove prototype.
(struct attribute_spec): New.
(default_target_attribute_table): Declare.
(enum attribute_flags): Move from c-common.h. Add
ATTR_FLAG_TYPE_IN_PLACE.
(default_function_attribute_inlinable_p): Declare.
* config/alpha/alpha.c (vms_valid_decl_attribute_p): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(vms_attribute_table): New.
* config/arc/arc.c (arc_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arc_attribute_table, arc_handle_interrupt_attribute): New.
* config/arm/arm.c (arm_valid_type_attribute_p,
arm_valid_decl_attribute_p, arm_pe_valid_decl_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(arm_attribute_table, arm_handle_fndecl_attribute,
arm_handle_isr_attribute): New.
* config/avr/avr.c (avr_valid_type_attribute,
avr_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE, TARGET_VALID_TYPE_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(avr_attribute_table, avr_handle_progmem_attribute,
avr_handle_fndecl_attribute): New.
* config/c4x/c4x.c (c4x_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(c4x_attribute_table, c4x_handle_fntype_attribute): New.
* config/h8300/h8300.c (h8300_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(h8300_attribute_table, h8300_handle_fndecl_attribute,
h8300_handle_eightbit_data_attribute,
h8300_handle_tiny_data_attribute): New.
* config/i386/i386-protos.h (ix86_valid_type_attribute_p,
i386_pe_valid_decl_attribute_p, i386_pe_valid_type_attribute_p):
Remove prototypes.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New
declarations.
* config/i386/i386.c (ix86_valid_type_attribute_p: Remove.
(TARGET_VALID_TYPE_ATTRIBUTE, TARGET_VALID_DECL_ATTRIBUTE): Don't
define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ix86_attribute_table, ix86_handle_cdecl_attribute,
ix86_handle_regparm_attribute): New.
* config/i386/winnt.c (i386_pe_valid_decl_attribute_p,
i386_pe_valid_type_attribute_p): Remove.
(ix86_handle_dll_attribute, ix86_handle_shared_attribute): New.
* config/ia64/ia64.c (ia64_valid_type_attribute): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ia64_attribute_table): New.
* config/m32r/m32r.c (m32r_valid_decl_attribute, interrupt_ident1,
interrupt_ident2, model_ident1, model_ident2): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(init_idents): Update.
(m32r_attribute_table, m32r_handle_model_attribute): New.
* config/m68hc11/m68hc11.c (m68hc11_valid_type_attribute_p):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(m68hc11_attribute_table, m68hc11_handle_fntype_attribute): New.
* config/mcore/mcore.c (mcore_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(mcore_attribute_table, mcore_handle_naked_attribute): New.
* config/ns32k/ns32k.c (ns32k_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(ns32k_attribute_table, ns32k_handle_fntype_attribute): New.
* config/rs6000/rs6000.c (rs6000_valid_type_attribute_p): Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(rs6000_attribute_table, rs6000_handle_longcall_attribute): New.
* config/sh/sh.c (sh_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(sh_attribute_table, sh_handle_interrupt_handler_attribute,
sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute):
New.
* config/stormy16/stormy16.c (stormy16_valid_type_attribute):
Remove.
(TARGET_VALID_TYPE_ATTRIBUTE): Don't define
(TARGET_ATTRIBUTE_TABLE): Define.
(stormy16_attribute_table, stormy16_handle_interrupt_attribute):
New.
* config/v850/v850.c (v850_valid_decl_attribute): Remove.
(TARGET_VALID_DECL_ATTRIBUTE): Don't define.
(TARGET_ATTRIBUTE_TABLE): Define.
(v850_attribute_table, v850_handle_interrupt_attribute,
v850_handle_data_area_attribute): New.
* config/v850/v850-c.c (mark_current_function_as_interrupt):
Return void. Call decl_attributes instead of
valid_machine_attribute.
cp:
Table-driven attributes.
* decl.c: Rename DECL_MACHINE_ATTRIBUTES to DECL_ATTRIBUTES.
* decl2.c (cplus_decl_attributes): Only take one attributes
parameter.
* cp-tree.c (cplus_decl_attributes): Update prototype.
* class.c (finish_struct), decl.c (start_decl, start_function),
decl2.c (grokfield), friend.c (do_friend), parse.y
(parse_bitfield): Update calls to cplus_decl_attributes.
* decl.c (grokdeclarator): Take a pointer to a single ordinary
attribute list.
* decl.h (grokdeclarator): Update prototype.
* decl2.c (grokfield): Take a single ordinary attribute list.
* friend.c (do_friend): Likewise.
* decl.c (shadow_tag, groktypename, start_decl,
start_handler_parms, grokdeclarator, grokparms, start_function,
start_method), decl2.c (grokfield, grokbitfield, grokoptypename),
parse.y (parse_field, parse_bitfield, component_decl_1), pt.c
(process_template_parm, do_decl_instantiation): Pass single
ordinary attribute lists around.
* decl.c (grokdeclarator): Correct handling of nested attributes.
Revert the patch
1998-10-18 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Embedded attrs bind to the right,
not the left.
.
* cp-tree.h (cp_valid_lang_attribute): Remove declaration
(cp_attribute_table): Declare.
* decl.c (valid_lang_attribute): Don't define.
(lang_attribute_table): Define.
(init_decl_processing): Initialize lang_attribute_table instead of
valid_lang_attribute.
* tree.c (cp_valid_lang_attribute): Remove.
(handle_java_interface_attribute, handle_com_interface_attribute,
handle_init_priority_attribute): New functions.
(cp_attribute_table): New array.
* decl2.c (import_export_class): Don't use
targetm.valid_type_attribute.
testsuite:
Table-driven attributes.
* g++.dg/ext/attrib1.C: New test.
From-SVN: r45718
2001-09-21 03:27:06 +02:00
|
|
|
|
cplus_decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE);
|
1996-08-09 00:08:30 +02:00
|
|
|
|
|
2001-01-08 12:45:22 +01:00
|
|
|
|
/* Nadger the current location so that diagnostics point to the start of
|
|
|
|
|
the struct, not the end. */
|
2003-05-03 13:37:22 +02:00
|
|
|
|
input_location = DECL_SOURCE_LOCATION (TYPE_NAME (t));
|
2001-01-08 12:45:22 +01:00
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
|
if (processing_template_decl)
|
1995-10-12 03:33:51 +01:00
|
|
|
|
{
|
1998-09-15 13:43:54 +02:00
|
|
|
|
finish_struct_methods (t);
|
2000-03-29 02:58:46 +02:00
|
|
|
|
TYPE_SIZE (t) = bitsize_zero_node;
|
1999-07-09 13:05:23 +02:00
|
|
|
|
}
|
1995-10-12 03:33:51 +01:00
|
|
|
|
else
|
1999-07-21 10:52:14 +02:00
|
|
|
|
finish_struct_1 (t);
|
1996-02-28 23:01:56 +01:00
|
|
|
|
|
2003-05-03 13:37:22 +02:00
|
|
|
|
input_location = saved_loc;
|
2001-01-08 12:45:22 +01:00
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
|
TYPE_BEING_DEFINED (t) = 0;
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
|
if (current_class_type)
|
1999-04-14 15:20:19 +02:00
|
|
|
|
popclass ();
|
1996-02-28 23:01:56 +01:00
|
|
|
|
else
|
2001-12-01 19:42:49 +01:00
|
|
|
|
error ("trying to finish struct, but kicked out due to previous parse errors");
|
1996-02-28 23:01:56 +01:00
|
|
|
|
|
2002-06-24 21:18:43 +02:00
|
|
|
|
if (processing_template_decl && at_function_scope_p ())
|
|
|
|
|
add_stmt (build_min (TAG_DEFN, t));
|
1999-11-16 02:37:39 +01:00
|
|
|
|
|
1996-02-28 23:01:56 +01:00
|
|
|
|
return t;
|
1995-10-12 03:33:51 +01:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-08-25 03:48:47 +02:00
|
|
|
|
/* Return the dynamic type of INSTANCE, if known.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
Used to determine whether the virtual function table is needed
|
|
|
|
|
or not.
|
|
|
|
|
|
|
|
|
|
*NONNULL is set iff INSTANCE can be known to be nonnull, regardless
|
2000-01-18 05:52:50 +01:00
|
|
|
|
of our knowledge of its type. *NONNULL should be initialized
|
|
|
|
|
before this function is called. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
Warning fixes:
* call.c (op_error): Const-ify a char*.
(add_candidate, source_type, add_warning): Add static prototype.
(print_z_candidates): Const-ify a char*.
* class.c (resolve_address_of_overloaded_function,
fixed_type_or_null, build_vtable_entry_ref): Add static prototype.
(get_vtable_name, finish_struct_1): Const-ify a char*.
* cvt.c (convert_to_reference): Likewise.
* decl.c (redeclaration_error_message, record_builtin_type,
record_unknown_type, member_function_or_else, bad_specifiers):
Likewise.
(find_binding, select_decl, unqualified_namespace_lookup,
lookup_flags, qualify_lookup, record_builtin_java_type, tag_name):
Add static prototype.
(warn_extern_redeclared_static, duplicate_decls, pushdecl,
implicitly_declare, record_builtin_java_type, define_function,
grok_op_properties, tag_name): Const-ify a char*.
* cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const.
(define_function, finish_builtin_type): Const-ify a char*.
(cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn,
cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args.
(file_name_nondirectory): Const-ify a char*.
(init_filename_times): Don't prototype.
(compiler_error): Prototype.
(yyerror, init_repo): Const-ify a char*.
(build_srcloc): Don't prototype.
(build_x_indirect_ref, build_indirect_ref, build_component_addr):
Const-ify a char*.
(warn_for_assignment): Don't prototype.
(convert_for_initialization, readonly_error, check_for_new_type,
GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call):
Const-ify a char*.
* decl2.c (acceptable_java_type, output_vtable_inherit,
setup_initp, start_objects, finish_objects, do_dtors, do_ctors,
merge_functions, decl_namespace, validate_nonmember_using_decl,
do_nonmember_using_decl): Add static prototype.
(lang_f_options): Const-ify a char*.
(finish_builtin_type): Likewise.
(add_function, arg_assoc_namespace, arg_assoc_class): Add static
prototype.
* errfn.c: Include cp-tree.h.
(cp_thing): Add static prototype.
(compiler_error): Don't protoptype.
(cp_compiler_error): Cast `compiler_error' to `errorfn' before
passing it to `cp_thing'.
* error.c (interesting_scope_p): Add static prototype.
* except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify
a char*.
* init.c (compiler_error): Don't prototype.
(member_init_ok_or_else): Const-ify a char*.
(build_java_class_ref): Add static prototype.
* lex.c (compiler_error): Don't prototype.
(get_time_identifier, interface_strcmp, extend_token_buffer,
handle_cp_pragma): Const-ify a char*.
(is_global, init_filename_times): Add static prototype.
(file_name_nondirectory, cplus_tree_code_name): Const-ify a char*.
(compiler_error): Change from fixed args to variable args.
(yyerror): Const-ify a char*.
* parse.y (cond_stmt_keyword): Const-ify a char*.
(parse_decl): Add static prototype.
* pt.c (template_args_equal, print_template_context): Likewise.
(print_candidates, check_default_tmpl_args): Const-ify a char*.
(instantiate_class_template): Likewise.
* repo.c (get_base_filename, open_repo_file, init_repo): Likewise.
* rtti.c (call_void_fn, expand_generic_desc, expand_si_desc,
expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise.
* search.c (lookup_field_info, lookup_member): Likewise.
(lookup_member): Cast the first argument of `bzero' to a PTR.
* sig.c (compiler_error): Don't prototype.
(build_signature_pointer_or_reference_nam): Const-ify a char*.
(get_sigtable_name, build_member_function_pointer): Likewise.
* tree.c (compiler_error): Don't prototype.
(no_linkage_helper, build_srcloc): Add static prototype.
(build_vbase_pointer_fields): Const-ify a char*.
(__eprintf): Don't unnecessarily handle `const' when !__STDC__.
* typeck.c (compiler_error): Don't prototype.
(convert_for_assignment): Const-ify a char*.
(comp_cv_target_types): Add static prototype.
(build_x_indirect_ref, build_indirect_ref, convert_arguments,
build_component_addr, build_unary_op, convert_for_initialization):
Const-ify a char*.
* typeck2.c (ack): Add static prototype and change from fixed args
to variable args.
(readonly_error, check_for_new_type): Const-ify a char*.
* xref.c (_XREF_FILE, find_file, filename, fctname, declname,
fixname, open_xref_file, classname, GNU_xref_begin): Likewise.
(GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'.
(GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call,
gen_assign, GNU_xref_member): Const-ify a char*.
From-SVN: r25994
1999-03-26 08:45:00 +01:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
fixed_type_or_null (tree instance, int* nonnull, int* cdtorp)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
switch (TREE_CODE (instance))
|
|
|
|
|
{
|
|
|
|
|
case INDIRECT_REF:
|
2002-01-23 13:45:30 +01:00
|
|
|
|
if (POINTER_TYPE_P (TREE_TYPE (instance)))
|
2001-12-13 02:37:52 +01:00
|
|
|
|
return NULL_TREE;
|
|
|
|
|
else
|
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 0),
|
|
|
|
|
nonnull, cdtorp);
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
case CALL_EXPR:
|
|
|
|
|
/* This is a call to a constructor, hence it's never zero. */
|
|
|
|
|
if (TREE_HAS_CONSTRUCTOR (instance))
|
|
|
|
|
{
|
|
|
|
|
if (nonnull)
|
|
|
|
|
*nonnull = 1;
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return TREE_TYPE (instance);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case SAVE_EXPR:
|
|
|
|
|
/* This is a call to a constructor, hence it's never zero. */
|
|
|
|
|
if (TREE_HAS_CONSTRUCTOR (instance))
|
|
|
|
|
{
|
|
|
|
|
if (nonnull)
|
|
|
|
|
*nonnull = 1;
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return TREE_TYPE (instance);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
2001-02-14 11:49:27 +01:00
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case RTL_EXPR:
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case PLUS_EXPR:
|
|
|
|
|
case MINUS_EXPR:
|
2001-02-14 11:49:27 +01:00
|
|
|
|
if (TREE_CODE (TREE_OPERAND (instance, 0)) == ADDR_EXPR)
|
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TREE_CODE (TREE_OPERAND (instance, 1)) == INTEGER_CST)
|
|
|
|
|
/* Propagate nonnull. */
|
2002-05-13 10:00:48 +02:00
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case NOP_EXPR:
|
|
|
|
|
case CONVERT_EXPR:
|
2001-02-14 11:49:27 +01:00
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case ADDR_EXPR:
|
|
|
|
|
if (nonnull)
|
|
|
|
|
*nonnull = 1;
|
2001-02-14 11:49:27 +01:00
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 0), nonnull, cdtorp);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case COMPONENT_REF:
|
2001-02-14 11:49:27 +01:00
|
|
|
|
return fixed_type_or_null (TREE_OPERAND (instance, 1), nonnull, cdtorp);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case VAR_DECL:
|
|
|
|
|
case FIELD_DECL:
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (instance)) == ARRAY_TYPE
|
|
|
|
|
&& IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (instance))))
|
|
|
|
|
{
|
|
|
|
|
if (nonnull)
|
|
|
|
|
*nonnull = 1;
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return TREE_TYPE (TREE_TYPE (instance));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
1996-07-11 03:13:25 +02:00
|
|
|
|
/* fall through... */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
case TARGET_EXPR:
|
|
|
|
|
case PARM_DECL:
|
2002-05-13 10:00:48 +02:00
|
|
|
|
case RESULT_DECL:
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (IS_AGGR_TYPE (TREE_TYPE (instance)))
|
|
|
|
|
{
|
|
|
|
|
if (nonnull)
|
|
|
|
|
*nonnull = 1;
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return TREE_TYPE (instance);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
2001-02-14 11:49:27 +01:00
|
|
|
|
else if (instance == current_class_ptr)
|
|
|
|
|
{
|
|
|
|
|
if (nonnull)
|
|
|
|
|
*nonnull = 1;
|
|
|
|
|
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* if we're in a ctor or dtor, we know our type. */
|
2001-02-14 11:49:27 +01:00
|
|
|
|
if (DECL_LANG_SPECIFIC (current_function_decl)
|
|
|
|
|
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|
|
|
|
|
|| DECL_DESTRUCTOR_P (current_function_decl)))
|
|
|
|
|
{
|
|
|
|
|
if (cdtorp)
|
|
|
|
|
*cdtorp = 1;
|
|
|
|
|
return TREE_TYPE (TREE_TYPE (instance));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE)
|
|
|
|
|
{
|
|
|
|
|
/* Reference variables should be references to objects. */
|
|
|
|
|
if (nonnull)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
*nonnull = 1;
|
2003-04-28 08:06:59 +02:00
|
|
|
|
|
|
|
|
|
/* DECL_VAR_MARKED_P is used to prevent recursion; a
|
|
|
|
|
variable's initializer may refer to the variable
|
|
|
|
|
itself. */
|
|
|
|
|
if (TREE_CODE (instance) == VAR_DECL
|
|
|
|
|
&& DECL_INITIAL (instance)
|
|
|
|
|
&& !DECL_VAR_MARKED_P (instance))
|
|
|
|
|
{
|
|
|
|
|
tree type;
|
|
|
|
|
DECL_VAR_MARKED_P (instance) = 1;
|
|
|
|
|
type = fixed_type_or_null (DECL_INITIAL (instance),
|
|
|
|
|
nonnull, cdtorp);
|
|
|
|
|
DECL_VAR_MARKED_P (instance) = 0;
|
|
|
|
|
return type;
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
default:
|
1998-08-25 03:48:47 +02:00
|
|
|
|
return NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
1998-08-25 03:48:47 +02:00
|
|
|
|
|
2002-09-21 14:51:56 +02:00
|
|
|
|
/* Return nonzero if the dynamic type of INSTANCE is known, and
|
2001-11-25 14:21:45 +01:00
|
|
|
|
equivalent to the static type. We also handle the case where
|
|
|
|
|
INSTANCE is really a pointer. Return negative if this is a
|
|
|
|
|
ctor/dtor. There the dynamic type is known, but this might not be
|
|
|
|
|
the most derived base of the original object, and hence virtual
|
|
|
|
|
bases may not be layed out according to this type.
|
1998-08-25 03:48:47 +02:00
|
|
|
|
|
|
|
|
|
Used to determine whether the virtual function table is needed
|
|
|
|
|
or not.
|
|
|
|
|
|
|
|
|
|
*NONNULL is set iff INSTANCE can be known to be nonnull, regardless
|
2000-01-18 05:52:50 +01:00
|
|
|
|
of our knowledge of its type. *NONNULL should be initialized
|
|
|
|
|
before this function is called. */
|
1998-08-25 03:48:47 +02:00
|
|
|
|
|
|
|
|
|
int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
resolves_to_fixed_type_p (tree instance, int* nonnull)
|
1998-08-25 03:48:47 +02:00
|
|
|
|
{
|
|
|
|
|
tree t = TREE_TYPE (instance);
|
2001-02-14 11:49:27 +01:00
|
|
|
|
int cdtorp = 0;
|
|
|
|
|
|
|
|
|
|
tree fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
|
1998-08-25 03:48:47 +02:00
|
|
|
|
if (fixed == NULL_TREE)
|
|
|
|
|
return 0;
|
|
|
|
|
if (POINTER_TYPE_P (t))
|
|
|
|
|
t = TREE_TYPE (t);
|
2001-02-14 11:49:27 +01:00
|
|
|
|
if (!same_type_ignoring_top_level_qualifiers_p (t, fixed))
|
|
|
|
|
return 0;
|
|
|
|
|
return cdtorp ? -1 : 1;
|
1998-08-25 03:48:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
init_class_processing (void)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
current_class_depth = 0;
|
1998-10-06 16:20:30 +02:00
|
|
|
|
current_class_stack_size = 10;
|
|
|
|
|
current_class_stack
|
2003-07-19 18:09:51 +02:00
|
|
|
|
= xmalloc (current_class_stack_size * sizeof (struct class_stack_node));
|
2000-06-04 23:12:27 +02:00
|
|
|
|
VARRAY_TREE_INIT (local_classes, 8, "local_classes");
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
Integrated preprocessor.
top level:
* Makefile.in: Remove all references to c-parse.gperf,
c-gperf.h, and c-parse.h. Remove -d from yacc command line
generating c-parse.c. Update dependencies.
* c-parse.gperf, c-gperf.h: Delete.
* c-common.c: Don't define parse_options, cpp_token, yy_cur,
yy_lim, or yy_get_token. Don't define get_directive_line if
USE_CPPLIB.
* c-common.h: Add multiple include guard. Define RID values
for every keyword in C, C++, and Objective C. Put all the
modifiers first.
(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
* c-decl.c (c_decode_option): Handle -lang-objc here.
(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
(grokdeclarator): Adjust for new RID scheme.
(extract_interface_info): New stub.
* c-lang.c: Don't declare yy_cur or parse_options.
(lang_init_options): Call cpp_init. Don't call
cpp_options_init.
(lang_init): Don't call check_newline if USE_CPPLIB.
* c-lex.c: Don't include c-parse.h. Do include timevar.h.
Elide lots of unnecessary code if USE_CPPLIB. Delete code
rendered unnecessary by new architecture. Move routines not
shared with C++ to c-parse.in. Maintain a local idea of the
line number. Handle C++ as well as C.
[USE_CPPLIB]: Declare and register callbacks for #ident and
for entering/leaving files.
(init_c_lex, c_lex): Are now the entry points to this file.
(check_newline): Break out directive handling to
process_directive.
(read_ucs, is_extended_char, utf8_extend_token): Moved here
from C++ front end.
(readescape, parse_float): Overhaul.
(lex_number, lex_string, lex_charconst): Break out of c_lex
(n'ee yylex).
(get_fileinfo, update_header_times, dump_one_header,
dump_time_statistics): New and/or moved here from C++.
Support per-file data needed by C++ and per-header timing
statistics (C++ only, at the moment).
* c-lex.h: Update prototypes. Add multiple include guard.
* c-tree.h (struct lang_identifier): Add rid_code field.
(C_IS_RESERVED_WORD, C_RID_CODE): New.
* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
reinit_parse_for_function and/or position_after_white_space.
(save_filename, save_lineno): Look ahead before saving.
(label -> identifier ':'): Save file and line before shifting ':'.
(reservedwords): No need to call get_identifier.
(init_parse, finish_parse, yyerror, yylex, yyprint,
make_pointer_declarator): Are now here for C/ObjC.
(rid_to_yy): Conversion table from RID constants to Yacc codes.
* c-pragma.c: Rewrite parsing logic to fit with cpplib's
#pragma registry. Provide dummy implementation of that
interface if !USE_CPPLIB.
* c-pragma.h: Update to match.
* flags.h: Add multiple include guard.
(flag_detailed_statistics): Moved here from C++.
* toplev.c: Define flag_detailed_statistics.
* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* timevar.def (TV_CPP, TV_LEX): New.
* timevar.h: Add multiple include guard.
* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
#if USE_CPPLIB.
* objc/objc-act.c: Don't mention yy_cur or parse_options.
Initialize cpplib properly. Force lineno to 0 after first
call to check_newline. Don't handle -lang-objc here.
Move forget_protocol_qualifiers and remember_protocol_qualifiers here.
cp:
* Make-lang.in, Makefile.in: Remove all references to input.c,
gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS.
* gxx.gperf, hash.h, input.c: Delete.
* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
initialized properly.
* class.c (fixup_pending_inline): Take a tree, not a
struct pending_inline *. All callers changed.
(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
RID_PROTECTED entries in ridpointers[] array here.
* decl.c (duplicate_decls): Do not refer to struct
pending_inline.
(record_builtin_type, init_decl_processing): Use RID_MAX not
CP_RID_MAX.
(grokdeclarator): Use C_IS_RESERVED_WORD.
* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
cpplib.
(grok_x_components): Do not inspect pending_inlines chain.
* cp-tree.h (struct lang_identifier): Add rid_code entry.
(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
TIME_IDENTIFIER_FILEINFO): Kill.
Update prototypes.
* lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a
single 32-bit word.
* parse.y: Call do_pending_inlines unconditionally.
reinit_parse_for_method is now snarf_method. fn.defpen is no
longer necessary. Remove unnecessary <itype> annotation on
SCOPE. Do not refer to end_of_file or struct pending_inline.
* semantics.c (begin_inline_definitions): Call
do_pending_inlines unconditionally.
* lex.c: Remove all code now shared with C front end.
Initialize cpplib properly if USE_CPPLIB. Put reserved words
into the get_identifier table. Rewrite pragma handling to
work with the registry. Move code to save tokens for later
processing to spew.c.
* spew.c: Rewrite everything in terms of token streams instead
of text. Move routines here from lex.c / input.c as
appropriate. GC-mark trees hanging off the pending inlines
chain.
testsuite:
* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
ERROR markers.
* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
* gcc.dg/wtr-suffix-1.c: Correct error regexps.
* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
Preprocess only.
* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.
From-SVN: r36216
2000-09-07 02:37:14 +02:00
|
|
|
|
ridpointers[(int) RID_PUBLIC] = access_public_node;
|
|
|
|
|
ridpointers[(int) RID_PRIVATE] = access_private_node;
|
|
|
|
|
ridpointers[(int) RID_PROTECTED] = access_protected_node;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-28 09:03:42 +01:00
|
|
|
|
/* Set global variables CURRENT_CLASS_NAME and CURRENT_CLASS_TYPE as
|
|
|
|
|
appropriate for TYPE.
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
If MODIFY is 1, we set IDENTIFIER_CLASS_VALUE's of names
|
|
|
|
|
which can be seen locally to the class. They are shadowed by
|
|
|
|
|
any subsequent local declaration (including parameter names).
|
|
|
|
|
|
|
|
|
|
If MODIFY is 2, we set IDENTIFIER_CLASS_VALUE's of names
|
|
|
|
|
which have static meaning (i.e., static members, static
|
|
|
|
|
member functions, enum declarations, etc).
|
|
|
|
|
|
|
|
|
|
If MODIFY is 3, we set IDENTIFIER_CLASS_VALUE of names
|
|
|
|
|
which can be seen locally to the class (as in 1), but
|
|
|
|
|
know that we are doing this for declaration purposes
|
|
|
|
|
(i.e. friend foo::bar (int)).
|
|
|
|
|
|
|
|
|
|
So that we may avoid calls to lookup_name, we cache the _TYPE
|
|
|
|
|
nodes of local TYPE_DECLs in the TREE_TYPE field of the name.
|
|
|
|
|
|
|
|
|
|
For multiple inheritance, we perform a two-pass depth-first search
|
|
|
|
|
of the type lattice. The first pass performs a pre-order search,
|
|
|
|
|
marking types after the type has had its fields installed in
|
|
|
|
|
the appropriate IDENTIFIER_CLASS_VALUE slot. The second pass merely
|
|
|
|
|
unmarks the marked types. If a field or member function name
|
|
|
|
|
appears in an ambiguous way, the IDENTIFIER_CLASS_VALUE of
|
|
|
|
|
that name becomes `error_mark_node'. */
|
|
|
|
|
|
|
|
|
|
void
|
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* call.c (build_field_call): Use build_new_op, not build_opfncall.
(prep_operand): New function.
(build_new_op): Use it. Remove dead code.
* class.c (pushclass): Change "modify" parameter type from int to
bool.
(currently_open_class): Use same_type_p, not pointer equality.
(push_nested_class): Adjust calls to pushclass, remove modify
parameter.
* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
(pushclass): Change prototype.
(push_nested_class): Likewise.
(grokoptypename): Remove.
(build_opfncall): Remove.
(value_dependent_expression_p): Declare.
(resolve_typename_type): Likewise.
(resolve_typename_type_in_current_instantiation): Likewise.
(enter_scope_of): Remove.
(tsubst): Remove.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
* decl.c (warn_about_implicit_typename_lookup): Remove.
(finish_case_label): Return error_mark_node for erroneous labels.
(start_decl): Adjust calls to push_nested_class.
(grokfndecl): Call push_scope/pop_scope around call to
duplicate_decls.
(grokdeclarator): Do not call tsubst.
(start_function): Adjust calls to push_nested_class.
* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
(check_classfn): Use push_scope/pop_scope around type comparisions.
(grokoptypename): Remove.
(push_sscope): Adjust call to push_nested_class.
* error.c (dump_type): Show cv-qualification of typename types.
* init.c (build_member_call): Use build_new_op, not
build_opfncall.
* method.c (build_opfncall): Remove.
* parser.c (cp_parser): Add allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_constant_expression): Adjust prototype.
(cp_parser_resolve_typename_type): Remove.
(cp_parser_non_constant_expression): New function.
(cp_parser_non_constant_id_expression): Likewise.
(cp_parser_new): Set allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_primary_expression): Reject `this' and `va_arg' in
constant-expressions. Note that dependent names aren't really
constant.
(cp_parser_postfix_expression): Reject conversions to non-integral
types in constant-expressions. Neither are increments or
decrements.
(cp_parser_unary_expression): Reject increments and decrements in
constant-expressions.
(cp_parser_direct_new_declarator): Adjust call to
cp_parser_constant_expression.
(cp_parser_cast_expression): Reject conversions to non-integral
types in constant-expressions.
(cp_parser_assignment_expression): Rejects assignments in
constant-expressions.
(cp_parser_expression): Reject commas in constant-expressions.
(cp_parser_labeled_statement): Adjust call to
cp_parser_constant_expression.
(cp_parser_direct_declarator): Simplify array bounds, even in
templates, when they are non-dependent. Use
resolve_typename_type, not cp_parser_resolve_typename_type.
(cp_parser_class_head): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_member_declaration): Adjust call to
cp_parser_constant_expression.
(cp_parser_constant_initializer): Likewise.
(cp_parser_constructor_declarator): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_late_parsing_default_args): Adjust call to
push_nested_class.
* pt.c (tsubst): Give it internal linkage.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
(push_access_scope_real): Likewise.
(tsubst_friend_class): Likewise.
(instantiate_class_template): Adjust call to pushclass.
(value_dependent_expression_p): Give it external linkage.
Robustify.
(resolve_typename_type): New function.
* semantics.c (finish_call_expr): Use build_new_op, not
build_opfncall.
(begin_constructor_declarator): Remove.
(begin_class_definition): Adjust call to pushclass.
(enter_scope_of): Remove.
* typeck.c (comptypes): Resolve typename types as appropriate.
(build_x_indirect_ref): Use build_new_op, not build_opfncall.
(build_x_compound_expr): Likewise.
(build_modify_expr): Likewise.
(build_x_modify_expr): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* g++.dg/parser/constant1.C: New test.
* include/std/std_limits.h (numeric_limits<float>::has_infinity):
Use __FLT_HAS_INIFINITY__ to initialize.
(numeric_limits<float>::has_quiet_NaN): Likewise.
(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
to initialize.
(numeric_limits<double>::has_quiet_NaN): Likewise.
(numeric_limits<long double>::has_infinity): Use
__LDBL_HAS_INIFINITY__ to initialize.
(numeric_limits<long_double>::has_quiet_NaN): Likewise.
From-SVN: r62130
2003-01-30 08:24:02 +01:00
|
|
|
|
pushclass (tree type, bool modify)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1998-05-26 13:43:52 +02:00
|
|
|
|
type = TYPE_MAIN_VARIANT (type);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* Make sure there is enough room for the new entry on the stack. */
|
|
|
|
|
if (current_class_depth + 1 >= current_class_stack_size)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1998-10-06 16:20:30 +02:00
|
|
|
|
current_class_stack_size *= 2;
|
|
|
|
|
current_class_stack
|
2003-07-19 18:09:51 +02:00
|
|
|
|
= xrealloc (current_class_stack,
|
|
|
|
|
current_class_stack_size
|
|
|
|
|
* sizeof (struct class_stack_node));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* Insert a new entry on the class stack. */
|
|
|
|
|
current_class_stack[current_class_depth].name = current_class_name;
|
|
|
|
|
current_class_stack[current_class_depth].type = current_class_type;
|
|
|
|
|
current_class_stack[current_class_depth].access = current_access_specifier;
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
current_class_stack[current_class_depth].names_used = 0;
|
1998-10-06 16:20:30 +02:00
|
|
|
|
current_class_depth++;
|
|
|
|
|
|
|
|
|
|
/* Now set up the new type. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
current_class_name = TYPE_NAME (type);
|
|
|
|
|
if (TREE_CODE (current_class_name) == TYPE_DECL)
|
|
|
|
|
current_class_name = DECL_NAME (current_class_name);
|
|
|
|
|
current_class_type = type;
|
|
|
|
|
|
1998-10-06 16:20:30 +02:00
|
|
|
|
/* By default, things in classes are private, while things in
|
|
|
|
|
structures or unions are public. */
|
|
|
|
|
current_access_specifier = (CLASSTYPE_DECLARED_CLASS (type)
|
|
|
|
|
? access_private_node
|
|
|
|
|
: access_public_node);
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (previous_class_type != NULL_TREE
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
&& (type != previous_class_type
|
tree.h (COMPLETE_TYPE_P): New macro.
gcc
* tree.h (COMPLETE_TYPE_P): New macro.
(COMPLETE_OR_VOID_TYPE_P): New macro.
(COMPLETE_OR_UNBOUND_ARRAY_TYPE_P): New macro.
* stor-layout.c (layout_type, case VOID_TYPE): Don't set TYPE_SIZE.
* c-aux-info.c (gen_type): Use them.
* c-common.c (c_expand_expr_stmt): Likewise.
* c-decl.c (poplevel, pushdecl, start_decl, finish_decl,
grokdeclarator, grokparms, finish_struct, start_function,
store_parm_decls, combine_parm_decls): Likewise.
* c-parse.y (cast_expr): Likewise.
* c-typeck.c (require_complete_type, c_sizeof, c_sizeof_nowarn,
c_size_in_bytes, c_alignof, build_component_ref,
build_indirect_ref, build_array_ref, convert_arguments,
build_binary_op, pointer_diff, build_unary_op, digest_init: Likewise.
* calls.c (initialize_argument_information): Likewise.
* convert.c (convert_to_integer): Likewise.
* dbxout.c (dbxout_typedefs, dbxout_type, dbxout_symbol): Likewise.
* dwarfout.c (location_or_const_value_attribute,
output_enumeration_type_die, output_structure_type_die,
output_union_type_die, output_type): Likewise.
* expr.c (safe_from_p, expand_expr): Likewise.
* function.c (assign_parms): Likewise.
* sdbout.c (sdbout_symbol, sdbout_one_type): Likewise.
* tree.c (build_array_type, build_function_type,
build_method_type, build_offset_type, build_complex_type): Likewise.
* c-parse.c, c-parse.h: Regenerated.
gcc/cp
* typeck.c (require_complete_type, complete_type,
complete_type_or_else, c_sizeof, c_sizeof_nowarn,
build_array_ref, convert_arguments, pointer_diff,
build_x_unary_op, build_unary_op, build_c_cast,
build_modify_expr): Use COMPLETE_TYPE_P etc.
* call.c (is_complete, convert_like_real,
build_new_method_call): Likewise.
* class.c (build_vbase_pointer_fields, check_bases,
build_base_field, finish_struct_1, pushclass): Likewise.
* cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
* decl.c (maybe_process_template_type_declaration, pushtag,
pushdecl, redeclaration_error_message, start_decl, start_decl_1,
layout_var_decl, check_initializer, cp_finish_decl,
grokdeclarator, require_complete_types_for_parms,
grok_op_properties, xref_tag, xref_basetypes,
check_function_type): Likewise.
* decl2.c (check_classfn, reparse_absdcl_as_casts): Likewise.
* friend.c (do_friend): Likewise.
* init.c (build_offset_ref): Likewise.
* parse.y (structsp): Likewise.
* pt.c (maybe_process_partial_specialization,
tsubst_friend_function, instantiate_class_template, tsubst,
do_type_instantiation, instantiate_pending_templates): Likewise.
* repo.c (repo_get_id): Likewise.
* rtti.c (build_typeid, get_typeid, build_dynamic_cast_1,
synthesize_tinfo_var, emit_support_tinfos): Likewise.
* search.c (lookup_fnfields_1, lookup_conversions): Likewise.
* semantics.c (begin_class_definition): Likewise.
* tree.c (build_cplus_method_type): Likewise.
* typeck2.c (digest_init, build_functional_cast,
add_exception_specifier): Likewise.
* parse.h, parse.c: Regenerated.
From-SVN: r32671
2000-03-21 19:10:48 +01:00
|
|
|
|
|| !COMPLETE_TYPE_P (previous_class_type))
|
1994-02-24 02:02:37 +01:00
|
|
|
|
&& current_class_depth == 1)
|
|
|
|
|
{
|
|
|
|
|
/* Forcibly remove any old class remnants. */
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
invalidate_class_lookup_cache ();
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
/* If we're about to enter a nested class, clear
|
|
|
|
|
IDENTIFIER_CLASS_VALUE for the enclosing classes. */
|
|
|
|
|
if (modify && current_class_depth > 1)
|
|
|
|
|
clear_identifier_class_values ();
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
pushlevel_class ();
|
|
|
|
|
|
|
|
|
|
if (modify)
|
|
|
|
|
{
|
1996-02-28 23:01:56 +01:00
|
|
|
|
if (type != previous_class_type || current_class_depth > 1)
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
push_class_decls (type);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree item;
|
|
|
|
|
|
1998-12-13 15:46:07 +01:00
|
|
|
|
/* We are re-entering the same class we just left, so we
|
|
|
|
|
don't have to search the whole inheritance matrix to find
|
|
|
|
|
all the decls to bind again. Instead, we install the
|
|
|
|
|
cached class_shadowed list, and walk through it binding
|
|
|
|
|
names and setting up IDENTIFIER_TYPE_VALUEs. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
set_class_shadows (previous_class_values);
|
|
|
|
|
for (item = previous_class_values; item; item = TREE_CHAIN (item))
|
|
|
|
|
{
|
|
|
|
|
tree id = TREE_PURPOSE (item);
|
1998-12-14 16:35:40 +01:00
|
|
|
|
tree decl = TREE_TYPE (item);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-12-13 15:46:07 +01:00
|
|
|
|
push_class_binding (id, decl);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TREE_CODE (decl) == TYPE_DECL)
|
|
|
|
|
set_identifier_type_value (id, TREE_TYPE (decl));
|
|
|
|
|
}
|
|
|
|
|
unuse_fields (type);
|
|
|
|
|
}
|
|
|
|
|
|
2003-05-18 15:40:54 +02:00
|
|
|
|
cxx_remember_type_decls (CLASSTYPE_NESTED_UTDS (type));
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* When we exit a toplevel class scope, we save the
|
|
|
|
|
IDENTIFIER_CLASS_VALUEs so that we can restore them quickly if we
|
|
|
|
|
reenter the class. Here, we've entered some other class, so we
|
|
|
|
|
must invalidate our cache. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
invalidate_class_lookup_cache (void)
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
{
|
|
|
|
|
tree t;
|
|
|
|
|
|
2001-01-03 01:24:04 +01:00
|
|
|
|
/* The IDENTIFIER_CLASS_VALUEs are no longer valid. */
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
for (t = previous_class_values; t; t = TREE_CHAIN (t))
|
|
|
|
|
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE;
|
2001-01-03 01:24:04 +01:00
|
|
|
|
|
|
|
|
|
previous_class_values = NULL_TREE;
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
previous_class_type = NULL_TREE;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get out of the current class scope. If we were in a class scope
|
1999-04-14 15:20:19 +02:00
|
|
|
|
previously, that is the one popped to. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
popclass (void)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1999-09-17 09:35:07 +02:00
|
|
|
|
poplevel_class ();
|
1999-04-14 15:20:19 +02:00
|
|
|
|
pop_class_decls ();
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
current_class_depth--;
|
1998-10-06 16:20:30 +02:00
|
|
|
|
current_class_name = current_class_stack[current_class_depth].name;
|
|
|
|
|
current_class_type = current_class_stack[current_class_depth].type;
|
|
|
|
|
current_access_specifier = current_class_stack[current_class_depth].access;
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
if (current_class_stack[current_class_depth].names_used)
|
|
|
|
|
splay_tree_delete (current_class_stack[current_class_depth].names_used);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2000-02-07 21:36:36 +01:00
|
|
|
|
/* Returns 1 if current_class_type is either T or a nested type of T.
|
|
|
|
|
We start looking from 1 because entry 0 is from global scope, and has
|
|
|
|
|
no type. */
|
1998-05-09 20:10:28 +02:00
|
|
|
|
|
|
|
|
|
int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
currently_open_class (tree t)
|
1998-05-09 20:10:28 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* call.c (build_field_call): Use build_new_op, not build_opfncall.
(prep_operand): New function.
(build_new_op): Use it. Remove dead code.
* class.c (pushclass): Change "modify" parameter type from int to
bool.
(currently_open_class): Use same_type_p, not pointer equality.
(push_nested_class): Adjust calls to pushclass, remove modify
parameter.
* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
(pushclass): Change prototype.
(push_nested_class): Likewise.
(grokoptypename): Remove.
(build_opfncall): Remove.
(value_dependent_expression_p): Declare.
(resolve_typename_type): Likewise.
(resolve_typename_type_in_current_instantiation): Likewise.
(enter_scope_of): Remove.
(tsubst): Remove.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
* decl.c (warn_about_implicit_typename_lookup): Remove.
(finish_case_label): Return error_mark_node for erroneous labels.
(start_decl): Adjust calls to push_nested_class.
(grokfndecl): Call push_scope/pop_scope around call to
duplicate_decls.
(grokdeclarator): Do not call tsubst.
(start_function): Adjust calls to push_nested_class.
* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
(check_classfn): Use push_scope/pop_scope around type comparisions.
(grokoptypename): Remove.
(push_sscope): Adjust call to push_nested_class.
* error.c (dump_type): Show cv-qualification of typename types.
* init.c (build_member_call): Use build_new_op, not
build_opfncall.
* method.c (build_opfncall): Remove.
* parser.c (cp_parser): Add allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_constant_expression): Adjust prototype.
(cp_parser_resolve_typename_type): Remove.
(cp_parser_non_constant_expression): New function.
(cp_parser_non_constant_id_expression): Likewise.
(cp_parser_new): Set allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_primary_expression): Reject `this' and `va_arg' in
constant-expressions. Note that dependent names aren't really
constant.
(cp_parser_postfix_expression): Reject conversions to non-integral
types in constant-expressions. Neither are increments or
decrements.
(cp_parser_unary_expression): Reject increments and decrements in
constant-expressions.
(cp_parser_direct_new_declarator): Adjust call to
cp_parser_constant_expression.
(cp_parser_cast_expression): Reject conversions to non-integral
types in constant-expressions.
(cp_parser_assignment_expression): Rejects assignments in
constant-expressions.
(cp_parser_expression): Reject commas in constant-expressions.
(cp_parser_labeled_statement): Adjust call to
cp_parser_constant_expression.
(cp_parser_direct_declarator): Simplify array bounds, even in
templates, when they are non-dependent. Use
resolve_typename_type, not cp_parser_resolve_typename_type.
(cp_parser_class_head): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_member_declaration): Adjust call to
cp_parser_constant_expression.
(cp_parser_constant_initializer): Likewise.
(cp_parser_constructor_declarator): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_late_parsing_default_args): Adjust call to
push_nested_class.
* pt.c (tsubst): Give it internal linkage.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
(push_access_scope_real): Likewise.
(tsubst_friend_class): Likewise.
(instantiate_class_template): Adjust call to pushclass.
(value_dependent_expression_p): Give it external linkage.
Robustify.
(resolve_typename_type): New function.
* semantics.c (finish_call_expr): Use build_new_op, not
build_opfncall.
(begin_constructor_declarator): Remove.
(begin_class_definition): Adjust call to pushclass.
(enter_scope_of): Remove.
* typeck.c (comptypes): Resolve typename types as appropriate.
(build_x_indirect_ref): Use build_new_op, not build_opfncall.
(build_x_compound_expr): Likewise.
(build_modify_expr): Likewise.
(build_x_modify_expr): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* g++.dg/parser/constant1.C: New test.
* include/std/std_limits.h (numeric_limits<float>::has_infinity):
Use __FLT_HAS_INIFINITY__ to initialize.
(numeric_limits<float>::has_quiet_NaN): Likewise.
(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
to initialize.
(numeric_limits<double>::has_quiet_NaN): Likewise.
(numeric_limits<long double>::has_infinity): Use
__LDBL_HAS_INIFINITY__ to initialize.
(numeric_limits<long_double>::has_quiet_NaN): Likewise.
From-SVN: r62130
2003-01-30 08:24:02 +01:00
|
|
|
|
if (current_class_type && same_type_p (t, current_class_type))
|
1998-05-09 20:10:28 +02:00
|
|
|
|
return 1;
|
2000-02-07 21:36:36 +01:00
|
|
|
|
for (i = 1; i < current_class_depth; ++i)
|
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* call.c (build_field_call): Use build_new_op, not build_opfncall.
(prep_operand): New function.
(build_new_op): Use it. Remove dead code.
* class.c (pushclass): Change "modify" parameter type from int to
bool.
(currently_open_class): Use same_type_p, not pointer equality.
(push_nested_class): Adjust calls to pushclass, remove modify
parameter.
* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
(pushclass): Change prototype.
(push_nested_class): Likewise.
(grokoptypename): Remove.
(build_opfncall): Remove.
(value_dependent_expression_p): Declare.
(resolve_typename_type): Likewise.
(resolve_typename_type_in_current_instantiation): Likewise.
(enter_scope_of): Remove.
(tsubst): Remove.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
* decl.c (warn_about_implicit_typename_lookup): Remove.
(finish_case_label): Return error_mark_node for erroneous labels.
(start_decl): Adjust calls to push_nested_class.
(grokfndecl): Call push_scope/pop_scope around call to
duplicate_decls.
(grokdeclarator): Do not call tsubst.
(start_function): Adjust calls to push_nested_class.
* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
(check_classfn): Use push_scope/pop_scope around type comparisions.
(grokoptypename): Remove.
(push_sscope): Adjust call to push_nested_class.
* error.c (dump_type): Show cv-qualification of typename types.
* init.c (build_member_call): Use build_new_op, not
build_opfncall.
* method.c (build_opfncall): Remove.
* parser.c (cp_parser): Add allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_constant_expression): Adjust prototype.
(cp_parser_resolve_typename_type): Remove.
(cp_parser_non_constant_expression): New function.
(cp_parser_non_constant_id_expression): Likewise.
(cp_parser_new): Set allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_primary_expression): Reject `this' and `va_arg' in
constant-expressions. Note that dependent names aren't really
constant.
(cp_parser_postfix_expression): Reject conversions to non-integral
types in constant-expressions. Neither are increments or
decrements.
(cp_parser_unary_expression): Reject increments and decrements in
constant-expressions.
(cp_parser_direct_new_declarator): Adjust call to
cp_parser_constant_expression.
(cp_parser_cast_expression): Reject conversions to non-integral
types in constant-expressions.
(cp_parser_assignment_expression): Rejects assignments in
constant-expressions.
(cp_parser_expression): Reject commas in constant-expressions.
(cp_parser_labeled_statement): Adjust call to
cp_parser_constant_expression.
(cp_parser_direct_declarator): Simplify array bounds, even in
templates, when they are non-dependent. Use
resolve_typename_type, not cp_parser_resolve_typename_type.
(cp_parser_class_head): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_member_declaration): Adjust call to
cp_parser_constant_expression.
(cp_parser_constant_initializer): Likewise.
(cp_parser_constructor_declarator): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_late_parsing_default_args): Adjust call to
push_nested_class.
* pt.c (tsubst): Give it internal linkage.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
(push_access_scope_real): Likewise.
(tsubst_friend_class): Likewise.
(instantiate_class_template): Adjust call to pushclass.
(value_dependent_expression_p): Give it external linkage.
Robustify.
(resolve_typename_type): New function.
* semantics.c (finish_call_expr): Use build_new_op, not
build_opfncall.
(begin_constructor_declarator): Remove.
(begin_class_definition): Adjust call to pushclass.
(enter_scope_of): Remove.
* typeck.c (comptypes): Resolve typename types as appropriate.
(build_x_indirect_ref): Use build_new_op, not build_opfncall.
(build_x_compound_expr): Likewise.
(build_modify_expr): Likewise.
(build_x_modify_expr): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* g++.dg/parser/constant1.C: New test.
* include/std/std_limits.h (numeric_limits<float>::has_infinity):
Use __FLT_HAS_INIFINITY__ to initialize.
(numeric_limits<float>::has_quiet_NaN): Likewise.
(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
to initialize.
(numeric_limits<double>::has_quiet_NaN): Likewise.
(numeric_limits<long double>::has_infinity): Use
__LDBL_HAS_INIFINITY__ to initialize.
(numeric_limits<long_double>::has_quiet_NaN): Likewise.
From-SVN: r62130
2003-01-30 08:24:02 +01:00
|
|
|
|
if (current_class_stack[i].type
|
|
|
|
|
&& same_type_p (current_class_stack [i].type, t))
|
1998-05-09 20:10:28 +02:00
|
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-07 21:36:36 +01:00
|
|
|
|
/* If either current_class_type or one of its enclosing classes are derived
|
|
|
|
|
from T, return the appropriate type. Used to determine how we found
|
|
|
|
|
something via unqualified lookup. */
|
|
|
|
|
|
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
currently_open_derived_class (tree t)
|
2000-02-07 21:36:36 +01:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
2003-07-07 01:23:46 +02:00
|
|
|
|
/* The bases of a dependent type are unknown. */
|
2003-01-22 18:39:15 +01:00
|
|
|
|
if (dependent_type_p (t))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
2000-02-07 21:36:36 +01:00
|
|
|
|
if (DERIVED_FROM_P (t, current_class_type))
|
|
|
|
|
return current_class_type;
|
|
|
|
|
|
|
|
|
|
for (i = current_class_depth - 1; i > 0; --i)
|
|
|
|
|
if (DERIVED_FROM_P (t, current_class_stack[i].type))
|
|
|
|
|
return current_class_stack[i].type;
|
|
|
|
|
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* When entering a class scope, all enclosing class scopes' names with
|
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* call.c (build_field_call): Use build_new_op, not build_opfncall.
(prep_operand): New function.
(build_new_op): Use it. Remove dead code.
* class.c (pushclass): Change "modify" parameter type from int to
bool.
(currently_open_class): Use same_type_p, not pointer equality.
(push_nested_class): Adjust calls to pushclass, remove modify
parameter.
* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
(pushclass): Change prototype.
(push_nested_class): Likewise.
(grokoptypename): Remove.
(build_opfncall): Remove.
(value_dependent_expression_p): Declare.
(resolve_typename_type): Likewise.
(resolve_typename_type_in_current_instantiation): Likewise.
(enter_scope_of): Remove.
(tsubst): Remove.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
* decl.c (warn_about_implicit_typename_lookup): Remove.
(finish_case_label): Return error_mark_node for erroneous labels.
(start_decl): Adjust calls to push_nested_class.
(grokfndecl): Call push_scope/pop_scope around call to
duplicate_decls.
(grokdeclarator): Do not call tsubst.
(start_function): Adjust calls to push_nested_class.
* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
(check_classfn): Use push_scope/pop_scope around type comparisions.
(grokoptypename): Remove.
(push_sscope): Adjust call to push_nested_class.
* error.c (dump_type): Show cv-qualification of typename types.
* init.c (build_member_call): Use build_new_op, not
build_opfncall.
* method.c (build_opfncall): Remove.
* parser.c (cp_parser): Add allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_constant_expression): Adjust prototype.
(cp_parser_resolve_typename_type): Remove.
(cp_parser_non_constant_expression): New function.
(cp_parser_non_constant_id_expression): Likewise.
(cp_parser_new): Set allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_primary_expression): Reject `this' and `va_arg' in
constant-expressions. Note that dependent names aren't really
constant.
(cp_parser_postfix_expression): Reject conversions to non-integral
types in constant-expressions. Neither are increments or
decrements.
(cp_parser_unary_expression): Reject increments and decrements in
constant-expressions.
(cp_parser_direct_new_declarator): Adjust call to
cp_parser_constant_expression.
(cp_parser_cast_expression): Reject conversions to non-integral
types in constant-expressions.
(cp_parser_assignment_expression): Rejects assignments in
constant-expressions.
(cp_parser_expression): Reject commas in constant-expressions.
(cp_parser_labeled_statement): Adjust call to
cp_parser_constant_expression.
(cp_parser_direct_declarator): Simplify array bounds, even in
templates, when they are non-dependent. Use
resolve_typename_type, not cp_parser_resolve_typename_type.
(cp_parser_class_head): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_member_declaration): Adjust call to
cp_parser_constant_expression.
(cp_parser_constant_initializer): Likewise.
(cp_parser_constructor_declarator): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_late_parsing_default_args): Adjust call to
push_nested_class.
* pt.c (tsubst): Give it internal linkage.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
(push_access_scope_real): Likewise.
(tsubst_friend_class): Likewise.
(instantiate_class_template): Adjust call to pushclass.
(value_dependent_expression_p): Give it external linkage.
Robustify.
(resolve_typename_type): New function.
* semantics.c (finish_call_expr): Use build_new_op, not
build_opfncall.
(begin_constructor_declarator): Remove.
(begin_class_definition): Adjust call to pushclass.
(enter_scope_of): Remove.
* typeck.c (comptypes): Resolve typename types as appropriate.
(build_x_indirect_ref): Use build_new_op, not build_opfncall.
(build_x_compound_expr): Likewise.
(build_modify_expr): Likewise.
(build_x_modify_expr): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* g++.dg/parser/constant1.C: New test.
* include/std/std_limits.h (numeric_limits<float>::has_infinity):
Use __FLT_HAS_INIFINITY__ to initialize.
(numeric_limits<float>::has_quiet_NaN): Likewise.
(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
to initialize.
(numeric_limits<double>::has_quiet_NaN): Likewise.
(numeric_limits<long double>::has_infinity): Use
__LDBL_HAS_INIFINITY__ to initialize.
(numeric_limits<long_double>::has_quiet_NaN): Likewise.
From-SVN: r62130
2003-01-30 08:24:02 +01:00
|
|
|
|
static meaning (static variables, static functions, types and
|
|
|
|
|
enumerators) have to be visible. This recursive function calls
|
|
|
|
|
pushclass for all enclosing class contexts until global or a local
|
|
|
|
|
scope is reached. TYPE is the enclosed class. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
void
|
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* call.c (build_field_call): Use build_new_op, not build_opfncall.
(prep_operand): New function.
(build_new_op): Use it. Remove dead code.
* class.c (pushclass): Change "modify" parameter type from int to
bool.
(currently_open_class): Use same_type_p, not pointer equality.
(push_nested_class): Adjust calls to pushclass, remove modify
parameter.
* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
(pushclass): Change prototype.
(push_nested_class): Likewise.
(grokoptypename): Remove.
(build_opfncall): Remove.
(value_dependent_expression_p): Declare.
(resolve_typename_type): Likewise.
(resolve_typename_type_in_current_instantiation): Likewise.
(enter_scope_of): Remove.
(tsubst): Remove.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
* decl.c (warn_about_implicit_typename_lookup): Remove.
(finish_case_label): Return error_mark_node for erroneous labels.
(start_decl): Adjust calls to push_nested_class.
(grokfndecl): Call push_scope/pop_scope around call to
duplicate_decls.
(grokdeclarator): Do not call tsubst.
(start_function): Adjust calls to push_nested_class.
* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
(check_classfn): Use push_scope/pop_scope around type comparisions.
(grokoptypename): Remove.
(push_sscope): Adjust call to push_nested_class.
* error.c (dump_type): Show cv-qualification of typename types.
* init.c (build_member_call): Use build_new_op, not
build_opfncall.
* method.c (build_opfncall): Remove.
* parser.c (cp_parser): Add allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_constant_expression): Adjust prototype.
(cp_parser_resolve_typename_type): Remove.
(cp_parser_non_constant_expression): New function.
(cp_parser_non_constant_id_expression): Likewise.
(cp_parser_new): Set allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_primary_expression): Reject `this' and `va_arg' in
constant-expressions. Note that dependent names aren't really
constant.
(cp_parser_postfix_expression): Reject conversions to non-integral
types in constant-expressions. Neither are increments or
decrements.
(cp_parser_unary_expression): Reject increments and decrements in
constant-expressions.
(cp_parser_direct_new_declarator): Adjust call to
cp_parser_constant_expression.
(cp_parser_cast_expression): Reject conversions to non-integral
types in constant-expressions.
(cp_parser_assignment_expression): Rejects assignments in
constant-expressions.
(cp_parser_expression): Reject commas in constant-expressions.
(cp_parser_labeled_statement): Adjust call to
cp_parser_constant_expression.
(cp_parser_direct_declarator): Simplify array bounds, even in
templates, when they are non-dependent. Use
resolve_typename_type, not cp_parser_resolve_typename_type.
(cp_parser_class_head): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_member_declaration): Adjust call to
cp_parser_constant_expression.
(cp_parser_constant_initializer): Likewise.
(cp_parser_constructor_declarator): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_late_parsing_default_args): Adjust call to
push_nested_class.
* pt.c (tsubst): Give it internal linkage.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
(push_access_scope_real): Likewise.
(tsubst_friend_class): Likewise.
(instantiate_class_template): Adjust call to pushclass.
(value_dependent_expression_p): Give it external linkage.
Robustify.
(resolve_typename_type): New function.
* semantics.c (finish_call_expr): Use build_new_op, not
build_opfncall.
(begin_constructor_declarator): Remove.
(begin_class_definition): Adjust call to pushclass.
(enter_scope_of): Remove.
* typeck.c (comptypes): Resolve typename types as appropriate.
(build_x_indirect_ref): Use build_new_op, not build_opfncall.
(build_x_compound_expr): Likewise.
(build_modify_expr): Likewise.
(build_x_modify_expr): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* g++.dg/parser/constant1.C: New test.
* include/std/std_limits.h (numeric_limits<float>::has_infinity):
Use __FLT_HAS_INIFINITY__ to initialize.
(numeric_limits<float>::has_quiet_NaN): Likewise.
(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
to initialize.
(numeric_limits<double>::has_quiet_NaN): Likewise.
(numeric_limits<long double>::has_infinity): Use
__LDBL_HAS_INIFINITY__ to initialize.
(numeric_limits<long_double>::has_quiet_NaN): Likewise.
From-SVN: r62130
2003-01-30 08:24:02 +01:00
|
|
|
|
push_nested_class (tree type)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1994-04-15 03:44:15 +02:00
|
|
|
|
tree context;
|
|
|
|
|
|
1999-02-25 01:11:35 +01:00
|
|
|
|
/* A namespace might be passed in error cases, like A::B:C. */
|
2000-01-13 00:27:46 +01:00
|
|
|
|
if (type == NULL_TREE
|
|
|
|
|
|| type == error_mark_node
|
1999-02-25 01:11:35 +01:00
|
|
|
|
|| TREE_CODE (type) == NAMESPACE_DECL
|
2000-01-13 00:27:46 +01:00
|
|
|
|
|| ! IS_AGGR_TYPE (type)
|
pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present.
Wed Jan 21 10:29:57 1998 Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu>
* pt.c (coerce_template_parms): Don't access elements of ARGLIST
that is not really present. Substitute default arguments in
template template arguments. Correctly convert TEMPLATE_DECL to
TEMPLATE_TEMPLATE_PARM.
(comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM
are no longer treated specially here.
* parse.y (template_template_parm): Fix copy error.
* decl.c (grokdeclarator): Warn about missing `typename' for nested
type created from template template parameters.
* parse.y (bad_parm): Likewise
* class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM.
(push_nested_class): Likewise.
* cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code.
* cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro.
(copy_template_template_parm): Declare.
* decl.c (arg_looking_for_template): New variable.
(lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM.
Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM
node if arg_looking_for_template is nonzero.
(pushdecl): Handle TEMPLATE_TEMPLATE_PARM.
(grok_op_properties, xref_tag, xref_basetypes): Likewise.
(grokdeclarator): Handle TEMPLATE_DECL.
* decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM.
* error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM.
(dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM.
(dump_decl): Handle unnamed template type parameters.
Handle template template parameters.
(dump_function_name): Handle template template parameters.
* init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef):
Handle TEMPLATE_TEMPLATE_PARM.
* method.c (build_template_template_parm_names): New function.
(build_template_parm_names): Handle TEMPLATE_DECL.
(build_overload_nested_name, build_overload_name):
Handle TEMPLATE_TEMPLATE_PARM.
* parse.y (maybe_identifier): New nonterminal.
(template_type_parm): Use it.
(template_template_parm, template_arg1): New nonterminal.
(template_parm): Add template_template_parm rules.
(template_arg): Set processing_template_arg.
(template_arg1): Rules moved from template_arg.
(primary, nonnested_type): Set arg_looking_for_template if we are
processing template arguments.
* pt.c (begin_member_template_processing): Handle TEMPLATE_DECL.
(process_template_parm): Handle template template parameters.
(coerce_template_parms, comp_template_args): Likewise.
(mangle_class_name_for_template, lookup_template_class): Likewise.
(uses_template_parms): Handle TEMPLATE_DECL and
TEMPLATE_TEMPLATE_PARM.
(current_template_args): Handle TEMPLATE_DECL.
(tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM.
* search.c (dfs_walk, dfs_record_inheritance):
Handle TEMPLATE_TEMPLATE_PARM.
* tree.c (copy_template_template_parm): New function.
(mapcar): Handle TEMPLATE_TEMPLATE_PARM.
* typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM.
From-SVN: r17441
1998-01-22 12:03:56 +01:00
|
|
|
|
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM
|
2000-09-05 03:01:39 +02:00
|
|
|
|
|| TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM)
|
1994-04-15 03:44:15 +02:00
|
|
|
|
return;
|
|
|
|
|
|
1996-12-18 03:46:25 +01:00
|
|
|
|
context = DECL_CONTEXT (TYPE_MAIN_DECL (type));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-04-15 21:21:21 +02:00
|
|
|
|
if (context && CLASS_TYPE_P (context))
|
c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* call.c (build_field_call): Use build_new_op, not build_opfncall.
(prep_operand): New function.
(build_new_op): Use it. Remove dead code.
* class.c (pushclass): Change "modify" parameter type from int to
bool.
(currently_open_class): Use same_type_p, not pointer equality.
(push_nested_class): Adjust calls to pushclass, remove modify
parameter.
* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
(pushclass): Change prototype.
(push_nested_class): Likewise.
(grokoptypename): Remove.
(build_opfncall): Remove.
(value_dependent_expression_p): Declare.
(resolve_typename_type): Likewise.
(resolve_typename_type_in_current_instantiation): Likewise.
(enter_scope_of): Remove.
(tsubst): Remove.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
* decl.c (warn_about_implicit_typename_lookup): Remove.
(finish_case_label): Return error_mark_node for erroneous labels.
(start_decl): Adjust calls to push_nested_class.
(grokfndecl): Call push_scope/pop_scope around call to
duplicate_decls.
(grokdeclarator): Do not call tsubst.
(start_function): Adjust calls to push_nested_class.
* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
(check_classfn): Use push_scope/pop_scope around type comparisions.
(grokoptypename): Remove.
(push_sscope): Adjust call to push_nested_class.
* error.c (dump_type): Show cv-qualification of typename types.
* init.c (build_member_call): Use build_new_op, not
build_opfncall.
* method.c (build_opfncall): Remove.
* parser.c (cp_parser): Add allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_constant_expression): Adjust prototype.
(cp_parser_resolve_typename_type): Remove.
(cp_parser_non_constant_expression): New function.
(cp_parser_non_constant_id_expression): Likewise.
(cp_parser_new): Set allow_non_constant_expression_p and
non_constant_expression_p.
(cp_parser_primary_expression): Reject `this' and `va_arg' in
constant-expressions. Note that dependent names aren't really
constant.
(cp_parser_postfix_expression): Reject conversions to non-integral
types in constant-expressions. Neither are increments or
decrements.
(cp_parser_unary_expression): Reject increments and decrements in
constant-expressions.
(cp_parser_direct_new_declarator): Adjust call to
cp_parser_constant_expression.
(cp_parser_cast_expression): Reject conversions to non-integral
types in constant-expressions.
(cp_parser_assignment_expression): Rejects assignments in
constant-expressions.
(cp_parser_expression): Reject commas in constant-expressions.
(cp_parser_labeled_statement): Adjust call to
cp_parser_constant_expression.
(cp_parser_direct_declarator): Simplify array bounds, even in
templates, when they are non-dependent. Use
resolve_typename_type, not cp_parser_resolve_typename_type.
(cp_parser_class_head): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_member_declaration): Adjust call to
cp_parser_constant_expression.
(cp_parser_constant_initializer): Likewise.
(cp_parser_constructor_declarator): Use resolve_typename_type, not
cp_parser_resolve_typename_type.
(cp_parser_late_parsing_default_args): Adjust call to
push_nested_class.
* pt.c (tsubst): Give it internal linkage.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(tsubst_copy_and_build): Likewise.
(push_access_scope_real): Likewise.
(tsubst_friend_class): Likewise.
(instantiate_class_template): Adjust call to pushclass.
(value_dependent_expression_p): Give it external linkage.
Robustify.
(resolve_typename_type): New function.
* semantics.c (finish_call_expr): Use build_new_op, not
build_opfncall.
(begin_constructor_declarator): Remove.
(begin_class_definition): Adjust call to pushclass.
(enter_scope_of): Remove.
* typeck.c (comptypes): Resolve typename types as appropriate.
(build_x_indirect_ref): Use build_new_op, not build_opfncall.
(build_x_compound_expr): Likewise.
(build_modify_expr): Likewise.
(build_x_modify_expr): Likewise.
* typeck2.c (build_x_arrow): Likewise.
* g++.dg/parser/constant1.C: New test.
* include/std/std_limits.h (numeric_limits<float>::has_infinity):
Use __FLT_HAS_INIFINITY__ to initialize.
(numeric_limits<float>::has_quiet_NaN): Likewise.
(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
to initialize.
(numeric_limits<double>::has_quiet_NaN): Likewise.
(numeric_limits<long double>::has_infinity): Use
__LDBL_HAS_INIFINITY__ to initialize.
(numeric_limits<long_double>::has_quiet_NaN): Likewise.
From-SVN: r62130
2003-01-30 08:24:02 +01:00
|
|
|
|
push_nested_class (context);
|
|
|
|
|
pushclass (type, true);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-28 09:03:42 +01:00
|
|
|
|
/* Undoes a push_nested_class call. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
pop_nested_class (void)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
1996-12-18 03:46:25 +01:00
|
|
|
|
tree context = DECL_CONTEXT (TYPE_MAIN_DECL (current_class_type));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-04-14 15:20:19 +02:00
|
|
|
|
popclass ();
|
1999-04-15 21:21:21 +02:00
|
|
|
|
if (context && CLASS_TYPE_P (context))
|
1999-04-14 15:20:19 +02:00
|
|
|
|
pop_nested_class ();
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-22 01:55:13 +01:00
|
|
|
|
/* Returns the number of extern "LANG" blocks we are nested within. */
|
|
|
|
|
|
|
|
|
|
int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
current_lang_depth (void)
|
2001-03-22 01:55:13 +01:00
|
|
|
|
{
|
|
|
|
|
return VARRAY_ACTIVE_SIZE (current_lang_base);
|
|
|
|
|
}
|
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* Set global variables CURRENT_LANG_NAME to appropriate value
|
|
|
|
|
so that behavior of name-mangling machinery is correct. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
push_lang_context (tree name)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2001-03-22 01:55:13 +01:00
|
|
|
|
VARRAY_PUSH_TREE (current_lang_base, current_lang_name);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1999-05-13 17:42:53 +02:00
|
|
|
|
if (name == lang_name_cplusplus)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
|
|
|
|
current_lang_name = name;
|
|
|
|
|
}
|
1999-05-13 17:42:53 +02:00
|
|
|
|
else if (name == lang_name_java)
|
|
|
|
|
{
|
|
|
|
|
current_lang_name = name;
|
|
|
|
|
/* DECL_IGNORED_P is initially set for these types, to avoid clutter.
|
|
|
|
|
(See record_builtin_java_type in decl.c.) However, that causes
|
|
|
|
|
incorrect debug entries if these types are actually used.
|
2002-09-13 02:22:59 +02:00
|
|
|
|
So we re-enable debug output after extern "Java". */
|
2000-06-21 20:18:11 +02:00
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_byte_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_short_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_int_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_long_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_float_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_double_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_char_type_node)) = 0;
|
|
|
|
|
DECL_IGNORED_P (TYPE_NAME (java_boolean_type_node)) = 0;
|
1999-05-13 17:42:53 +02:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
else if (name == lang_name_c)
|
|
|
|
|
{
|
|
|
|
|
current_lang_name = name;
|
|
|
|
|
}
|
|
|
|
|
else
|
1998-09-07 16:25:35 +02:00
|
|
|
|
error ("language string `\"%s\"' not recognized", IDENTIFIER_POINTER (name));
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get out of the current language scope. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
pop_lang_context (void)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2001-03-22 01:55:13 +01:00
|
|
|
|
current_lang_name = VARRAY_TOP_TREE (current_lang_base);
|
|
|
|
|
VARRAY_POP (current_lang_base);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Type instantiation routines. */
|
|
|
|
|
|
1998-12-09 17:20:05 +01:00
|
|
|
|
/* Given an OVERLOAD and a TARGET_TYPE, return the function that
|
|
|
|
|
matches the TARGET_TYPE. If there is no satisfactory match, return
|
|
|
|
|
error_mark_node, and issue an error message if COMPLAIN is
|
2002-09-21 14:51:56 +02:00
|
|
|
|
nonzero. Permit pointers to member function if PTRMEM is nonzero.
|
2000-08-18 11:31:11 +02:00
|
|
|
|
If TEMPLATE_ONLY, the name of the overloaded function
|
1998-12-09 17:20:05 +01:00
|
|
|
|
was a template-id, and EXPLICIT_TARGS are the explicitly provided
|
|
|
|
|
template arguments. */
|
|
|
|
|
|
1998-05-08 04:06:26 +02:00
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
resolve_address_of_overloaded_function (tree target_type,
|
|
|
|
|
tree overload,
|
|
|
|
|
int complain,
|
|
|
|
|
int ptrmem,
|
|
|
|
|
int template_only,
|
|
|
|
|
tree explicit_targs)
|
1998-05-08 04:06:26 +02:00
|
|
|
|
{
|
1998-12-09 17:20:05 +01:00
|
|
|
|
/* Here's what the standard says:
|
|
|
|
|
|
|
|
|
|
[over.over]
|
|
|
|
|
|
|
|
|
|
If the name is a function template, template argument deduction
|
|
|
|
|
is done, and if the argument deduction succeeds, the deduced
|
|
|
|
|
arguments are used to generate a single template function, which
|
|
|
|
|
is added to the set of overloaded functions considered.
|
|
|
|
|
|
|
|
|
|
Non-member functions and static member functions match targets of
|
|
|
|
|
type "pointer-to-function" or "reference-to-function." Nonstatic
|
|
|
|
|
member functions match targets of type "pointer-to-member
|
|
|
|
|
function;" the function type of the pointer to member is used to
|
|
|
|
|
select the member function from the set of overloaded member
|
|
|
|
|
functions. If a nonstatic member function is selected, the
|
|
|
|
|
reference to the overloaded function name is required to have the
|
|
|
|
|
form of a pointer to member as described in 5.3.1.
|
|
|
|
|
|
|
|
|
|
If more than one function is selected, any template functions in
|
|
|
|
|
the set are eliminated if the set also contains a non-template
|
|
|
|
|
function, and any given template function is eliminated if the
|
|
|
|
|
set contains a second template function that is more specialized
|
|
|
|
|
than the first according to the partial ordering rules 14.5.5.2.
|
|
|
|
|
After such eliminations, if any, there shall remain exactly one
|
|
|
|
|
selected function. */
|
|
|
|
|
|
|
|
|
|
int is_ptrmem = 0;
|
|
|
|
|
int is_reference = 0;
|
|
|
|
|
/* We store the matches in a TREE_LIST rooted here. The functions
|
|
|
|
|
are the TREE_PURPOSE, not the TREE_VALUE, in this list, for easy
|
|
|
|
|
interoperability with most_specialized_instantiation. */
|
|
|
|
|
tree matches = NULL_TREE;
|
1998-12-16 16:51:21 +01:00
|
|
|
|
tree fn;
|
1998-12-09 17:20:05 +01:00
|
|
|
|
|
1998-12-14 16:35:40 +01:00
|
|
|
|
/* By the time we get here, we should be seeing only real
|
|
|
|
|
pointer-to-member types, not the internal POINTER_TYPE to
|
|
|
|
|
METHOD_TYPE representation. */
|
|
|
|
|
my_friendly_assert (!(TREE_CODE (target_type) == POINTER_TYPE
|
|
|
|
|
&& (TREE_CODE (TREE_TYPE (target_type))
|
|
|
|
|
== METHOD_TYPE)), 0);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
|
2000-04-11 02:38:39 +02:00
|
|
|
|
if (TREE_CODE (overload) == COMPONENT_REF)
|
|
|
|
|
overload = TREE_OPERAND (overload, 1);
|
|
|
|
|
|
1998-12-09 17:20:05 +01:00
|
|
|
|
/* Check that the TARGET_TYPE is reasonable. */
|
|
|
|
|
if (TYPE_PTRFN_P (target_type))
|
2001-01-02 20:37:39 +01:00
|
|
|
|
/* This is OK. */;
|
1998-12-09 17:20:05 +01:00
|
|
|
|
else if (TYPE_PTRMEMFUNC_P (target_type))
|
|
|
|
|
/* This is OK, too. */
|
|
|
|
|
is_ptrmem = 1;
|
|
|
|
|
else if (TREE_CODE (target_type) == FUNCTION_TYPE)
|
|
|
|
|
{
|
|
|
|
|
/* This is OK, too. This comes from a conversion to reference
|
|
|
|
|
type. */
|
|
|
|
|
target_type = build_reference_type (target_type);
|
|
|
|
|
is_reference = 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (complain)
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
error ("\
|
2001-01-02 20:37:39 +01:00
|
|
|
|
cannot resolve overloaded function `%D' based on conversion to type `%T'",
|
|
|
|
|
DECL_NAME (OVL_FUNCTION (overload)), target_type);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we can find a non-template function that matches, we can just
|
|
|
|
|
use it. There's no point in generating template instantiations
|
|
|
|
|
if we're just going to throw them out anyhow. But, of course, we
|
|
|
|
|
can only do this when we don't *need* a template function. */
|
|
|
|
|
if (!template_only)
|
|
|
|
|
{
|
|
|
|
|
tree fns;
|
|
|
|
|
|
2002-12-28 09:03:42 +01:00
|
|
|
|
for (fns = overload; fns; fns = OVL_NEXT (fns))
|
1998-12-09 17:20:05 +01:00
|
|
|
|
{
|
2002-12-28 09:03:42 +01:00
|
|
|
|
tree fn = OVL_CURRENT (fns);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
tree fntype;
|
1998-05-08 04:06:26 +02:00
|
|
|
|
|
1998-12-09 17:20:05 +01:00
|
|
|
|
if (TREE_CODE (fn) == TEMPLATE_DECL)
|
|
|
|
|
/* We're not looking for templates just yet. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
|
|
|
|
|
!= is_ptrmem)
|
|
|
|
|
/* We're looking for a non-static member, and this isn't
|
|
|
|
|
one, or vice versa. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* See if there's a match. */
|
|
|
|
|
fntype = TREE_TYPE (fn);
|
|
|
|
|
if (is_ptrmem)
|
|
|
|
|
fntype = build_ptrmemfunc_type (build_pointer_type (fntype));
|
|
|
|
|
else if (!is_reference)
|
|
|
|
|
fntype = build_pointer_type (fntype);
|
|
|
|
|
|
|
|
|
|
if (can_convert_arg (target_type, fntype, fn))
|
1999-09-09 08:17:13 +02:00
|
|
|
|
matches = tree_cons (fn, NULL_TREE, matches);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now, if we've already got a match (or matches), there's no need
|
|
|
|
|
to proceed to the template functions. But, if we don't have a
|
|
|
|
|
match we need to look at them, too. */
|
|
|
|
|
if (!matches)
|
1998-05-08 04:06:26 +02:00
|
|
|
|
{
|
1998-12-09 17:20:05 +01:00
|
|
|
|
tree target_fn_type;
|
|
|
|
|
tree target_arg_types;
|
2000-02-29 11:29:52 +01:00
|
|
|
|
tree target_ret_type;
|
1998-12-09 17:20:05 +01:00
|
|
|
|
tree fns;
|
|
|
|
|
|
|
|
|
|
if (is_ptrmem)
|
1999-02-16 12:32:51 +01:00
|
|
|
|
target_fn_type
|
|
|
|
|
= TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (target_type));
|
1998-05-08 04:06:26 +02:00
|
|
|
|
else
|
1999-02-16 12:32:51 +01:00
|
|
|
|
target_fn_type = TREE_TYPE (target_type);
|
|
|
|
|
target_arg_types = TYPE_ARG_TYPES (target_fn_type);
|
2000-02-29 11:29:52 +01:00
|
|
|
|
target_ret_type = TREE_TYPE (target_fn_type);
|
2000-12-22 15:47:23 +01:00
|
|
|
|
|
|
|
|
|
/* Never do unification on the 'this' parameter. */
|
|
|
|
|
if (TREE_CODE (target_fn_type) == METHOD_TYPE)
|
|
|
|
|
target_arg_types = TREE_CHAIN (target_arg_types);
|
1999-02-16 12:32:51 +01:00
|
|
|
|
|
2002-12-28 09:03:42 +01:00
|
|
|
|
for (fns = overload; fns; fns = OVL_NEXT (fns))
|
1998-12-09 17:20:05 +01:00
|
|
|
|
{
|
2002-12-28 09:03:42 +01:00
|
|
|
|
tree fn = OVL_CURRENT (fns);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
tree instantiation;
|
|
|
|
|
tree instantiation_type;
|
|
|
|
|
tree targs;
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (fn) != TEMPLATE_DECL)
|
|
|
|
|
/* We're only looking for templates. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE)
|
|
|
|
|
!= is_ptrmem)
|
1999-02-16 12:32:51 +01:00
|
|
|
|
/* We're not looking for a non-static member, and this is
|
1998-12-09 17:20:05 +01:00
|
|
|
|
one, or vice versa. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Try to do argument deduction. */
|
1999-10-28 07:10:05 +02:00
|
|
|
|
targs = make_tree_vec (DECL_NTPARMS (fn));
|
1999-02-16 12:32:51 +01:00
|
|
|
|
if (fn_type_unification (fn, explicit_targs, targs,
|
2000-02-29 11:29:52 +01:00
|
|
|
|
target_arg_types, target_ret_type,
|
2000-12-22 15:47:23 +01:00
|
|
|
|
DEDUCE_EXACT, -1) != 0)
|
1998-12-09 17:20:05 +01:00
|
|
|
|
/* Argument deduction failed. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Instantiate the template. */
|
2003-03-22 16:34:41 +01:00
|
|
|
|
instantiation = instantiate_template (fn, targs,
|
|
|
|
|
complain ? tf_error : tf_none);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
if (instantiation == error_mark_node)
|
|
|
|
|
/* Instantiation failed. */
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* See if there's a match. */
|
|
|
|
|
instantiation_type = TREE_TYPE (instantiation);
|
|
|
|
|
if (is_ptrmem)
|
|
|
|
|
instantiation_type =
|
|
|
|
|
build_ptrmemfunc_type (build_pointer_type (instantiation_type));
|
|
|
|
|
else if (!is_reference)
|
|
|
|
|
instantiation_type = build_pointer_type (instantiation_type);
|
|
|
|
|
if (can_convert_arg (target_type, instantiation_type, instantiation))
|
1999-09-09 08:17:13 +02:00
|
|
|
|
matches = tree_cons (instantiation, fn, matches);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now, remove all but the most specialized of the matches. */
|
|
|
|
|
if (matches)
|
|
|
|
|
{
|
2000-12-22 15:47:23 +01:00
|
|
|
|
tree match = most_specialized_instantiation (matches);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
|
|
|
|
|
if (match != error_mark_node)
|
1999-09-09 08:17:13 +02:00
|
|
|
|
matches = tree_cons (match, NULL_TREE, NULL_TREE);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now we should have exactly one function in MATCHES. */
|
|
|
|
|
if (matches == NULL_TREE)
|
|
|
|
|
{
|
|
|
|
|
/* There were *no* matches. */
|
|
|
|
|
if (complain)
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
error ("no matches converting function `%D' to type `%#T'",
|
1998-12-09 17:20:05 +01:00
|
|
|
|
DECL_NAME (OVL_FUNCTION (overload)),
|
|
|
|
|
target_type);
|
1999-01-18 14:32:57 +01:00
|
|
|
|
|
|
|
|
|
/* print_candidates expects a chain with the functions in
|
|
|
|
|
TREE_VALUE slots, so we cons one up here (we're losing anyway,
|
|
|
|
|
so why be clever?). */
|
|
|
|
|
for (; overload; overload = OVL_NEXT (overload))
|
1999-09-09 08:17:13 +02:00
|
|
|
|
matches = tree_cons (NULL_TREE, OVL_CURRENT (overload),
|
|
|
|
|
matches);
|
1999-01-18 14:32:57 +01:00
|
|
|
|
|
|
|
|
|
print_candidates (matches);
|
1998-12-09 17:20:05 +01:00
|
|
|
|
}
|
|
|
|
|
return error_mark_node;
|
1998-05-08 04:06:26 +02:00
|
|
|
|
}
|
1998-12-09 17:20:05 +01:00
|
|
|
|
else if (TREE_CHAIN (matches))
|
|
|
|
|
{
|
|
|
|
|
/* There were too many matches. */
|
|
|
|
|
|
|
|
|
|
if (complain)
|
|
|
|
|
{
|
|
|
|
|
tree match;
|
|
|
|
|
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
error ("converting overloaded function `%D' to type `%#T' is ambiguous",
|
1998-12-09 17:20:05 +01:00
|
|
|
|
DECL_NAME (OVL_FUNCTION (overload)),
|
|
|
|
|
target_type);
|
|
|
|
|
|
|
|
|
|
/* Since print_candidates expects the functions in the
|
|
|
|
|
TREE_VALUE slot, we flip them here. */
|
|
|
|
|
for (match = matches; match; match = TREE_CHAIN (match))
|
|
|
|
|
TREE_VALUE (match) = TREE_PURPOSE (match);
|
|
|
|
|
|
|
|
|
|
print_candidates (matches);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
1998-12-16 16:51:21 +01:00
|
|
|
|
/* Good, exactly one match. Now, convert it to the correct type. */
|
|
|
|
|
fn = TREE_PURPOSE (matches);
|
|
|
|
|
|
2000-09-06 10:53:45 +02:00
|
|
|
|
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
|
2000-08-18 11:31:11 +02:00
|
|
|
|
&& !ptrmem && !flag_ms_extensions)
|
|
|
|
|
{
|
2000-09-06 10:53:45 +02:00
|
|
|
|
static int explained;
|
|
|
|
|
|
2000-08-18 11:31:11 +02:00
|
|
|
|
if (!complain)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
pedwarn ("assuming pointer to member `%D'", fn);
|
2000-09-06 10:53:45 +02:00
|
|
|
|
if (!explained)
|
|
|
|
|
{
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
pedwarn ("(a pointer to member can only be formed with `&%E')", fn);
|
2000-09-06 10:53:45 +02:00
|
|
|
|
explained = 1;
|
|
|
|
|
}
|
2000-08-18 11:31:11 +02:00
|
|
|
|
}
|
class.c (resolve_address_of_overloaded_function): Mark the chosen function used.
* class.c (resolve_address_of_overloaded_function): Mark the
chosen function used.
* call.c (build_call): Make sure that a function coming in has
been marked used already.
* decl.c (expand_static_init): Call mark_used instead of
assemble_external.
* except.c (call_eh_info, do_pop_exception, expand_end_eh_spec,
alloc_eh_object, expand_throw): Likewise.
* init.c (build_builtin_delete_call): Likewise.
* rtti.c (call_void_fn, get_tinfo_fn, build_dynamic_cast_1,
expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc,
expand_generic_desc): Likewise.
From-SVN: r24862
1999-01-25 21:43:21 +01:00
|
|
|
|
mark_used (fn);
|
|
|
|
|
|
1998-12-16 16:51:21 +01:00
|
|
|
|
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
|
|
|
|
|
return build_unary_op (ADDR_EXPR, fn, 0);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The target must be a REFERENCE_TYPE. Above, build_unary_op
|
|
|
|
|
will mark the function as addressed, but here we must do it
|
|
|
|
|
explicitly. */
|
c-decl.c (grokdeclarator): Update.
* c-decl.c (grokdeclarator): Update.
* c-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
* c-tree.h (c_mark_addressable): New.
* c-typeck.c (default_function_array_conversion, build_unary_op,
build_array_ref, convert_for_assignment): Update.
(mark_addressable): Rename.
* calls.c (try_to_integrate, expand_call): Use langhook.
* expr.c (expand_expr): Use langhook.
* langhooks-def.h (LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct lang_hooks): New hook.
* stmt.c (expand_asm_operands): Use langhook.
* tree.h (mark_addressable): Remove.
ada:
* decl.c (gnat_to_gnu_entity): Update.
* gigi.h (mark_addressable): Rename.
* misc.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
* trans.c (tree_transform): Update.
* utils.c (create_var_decl): Update.
* util2.c (build_binary_op, build_unary_op,
fill_vms_descriptor): Update.
(mark_addressable): Rename, update.
cp:
* call.c (build_addr_func): Update.
* class.c (resolve_address_of_overloaded_function): Update.
* cp-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
* cp-tree.h (cxx_mark_addressable): New.
* decl.c (register_dtor_fn, cxx_maybe_build_cleanup): Update.
* decl2.c (build_cleanup): Update.
* except.c (build_throw): Update.
* init.c (resolve_offset_ref): Update.
* pt.c (convert_nontype_argument): Update.
* semantics.c (finish_asm_stmt, simplify_affr_init_exprs_r): Update.
* typeck.c (decay_conversion, build_array_ref, build_unary_op,
unary_complex_lvalue): Update.
(mark_addressable): Rename.
f:
* com.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
(mark_addressable): Rename.
(ffecom_arrayref_, ffecom_1): Update.
java:
* java-tree.h (java_mark_addressable): New.
* lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
* typeck.c (mark_addressable): Rename, update.
objc:
* objc-lang.c (LANG_HOOKS_MARK_ADDRESSABLE): Redefine.
From-SVN: r51705
2002-04-01 22:26:18 +02:00
|
|
|
|
cxx_mark_addressable (fn);
|
1998-12-16 16:51:21 +01:00
|
|
|
|
|
|
|
|
|
return fn;
|
|
|
|
|
}
|
1998-05-08 04:06:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
1996-03-02 02:49:15 +01:00
|
|
|
|
/* This function will instantiate the type of the expression given in
|
|
|
|
|
RHS to match the type of LHSTYPE. If errors exist, then return
|
2000-08-17 15:10:50 +02:00
|
|
|
|
error_mark_node. FLAGS is a bit mask. If ITF_COMPLAIN is set, then
|
|
|
|
|
we complain on errors. If we are not complaining, never modify rhs,
|
|
|
|
|
as overload resolution wants to try many possible instantiations, in
|
|
|
|
|
the hope that at least one will work.
|
|
|
|
|
|
1998-10-27 23:33:40 +01:00
|
|
|
|
For non-recursive calls, LHSTYPE should be a function, pointer to
|
|
|
|
|
function, or a pointer to member function. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
Rename instantiate_type_flags to tsubst_flags_t & expand use.
* cp-tree.h (instantiate_type_flags): Rename to ...
(tsubst_flags_t): ... here. Rename itf_complain to tf_error,
add tf_warning flag.
(instantiate_type): Adjust prototype.
(tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
do_type_instantiation, cp_build_qualified_type_real): Likewise.
cp_build_qualified_type: Adjust.
* class.c (instantiate_type): Adjust parameter. Rename itf_* to
tf_*.
* call.c (standard_conversion): Rename itf_* to tf_*.
(reference_binding): Likewise.
(convert_like_real): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
* decl.c (lookup_namespace_name): Use tf_* flags.
(make_typename_type): Likewise.
(grokdeclarator): Likewise.
* pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
(coerce_template_template_parms, convert_template_argument,
coerce_template_parms, maybe_get_template_decl_from_type_decl,
lookup_template_class, tsubst_friend_function, tsubst_friend_class,
instantiate_class_template, tsubst_template_arg_vector,
tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
tsubst_decl, tsubst_arg_types, tsubst_function_type,
tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
instantiate_template, fn_type_unification,
resolve_overloaded_unification, verify_class_unification,
unify, get_bindings_real, do_type_instantiation,
regenerate_decl_from_template, instantiate_decl,
tsubst_initializer_list, tsubst_enum,
get_mostly_instantiated_function_type,
invalid_nontype_parm_type_p): Likewise.
* tree.c (cp_build_qualified_type_real): Likewise.
* typeck.c (build_binary_op): Rename itf_* to tf_*.
(build_ptrmemfunc): Likewise.
(convert_for_assignment): Likewise.
From-SVN: r49591
2002-02-07 21:51:15 +01:00
|
|
|
|
int complain = (flags & tf_error);
|
|
|
|
|
int allow_ptrmem = flags & tf_ptrmem_ok;
|
2000-08-18 11:31:11 +02:00
|
|
|
|
|
Rename instantiate_type_flags to tsubst_flags_t & expand use.
* cp-tree.h (instantiate_type_flags): Rename to ...
(tsubst_flags_t): ... here. Rename itf_complain to tf_error,
add tf_warning flag.
(instantiate_type): Adjust prototype.
(tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
do_type_instantiation, cp_build_qualified_type_real): Likewise.
cp_build_qualified_type: Adjust.
* class.c (instantiate_type): Adjust parameter. Rename itf_* to
tf_*.
* call.c (standard_conversion): Rename itf_* to tf_*.
(reference_binding): Likewise.
(convert_like_real): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
* decl.c (lookup_namespace_name): Use tf_* flags.
(make_typename_type): Likewise.
(grokdeclarator): Likewise.
* pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
(coerce_template_template_parms, convert_template_argument,
coerce_template_parms, maybe_get_template_decl_from_type_decl,
lookup_template_class, tsubst_friend_function, tsubst_friend_class,
instantiate_class_template, tsubst_template_arg_vector,
tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
tsubst_decl, tsubst_arg_types, tsubst_function_type,
tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
instantiate_template, fn_type_unification,
resolve_overloaded_unification, verify_class_unification,
unify, get_bindings_real, do_type_instantiation,
regenerate_decl_from_template, instantiate_decl,
tsubst_initializer_list, tsubst_enum,
get_mostly_instantiated_function_type,
invalid_nontype_parm_type_p): Likewise.
* tree.c (cp_build_qualified_type_real): Likewise.
* typeck.c (build_binary_op): Rename itf_* to tf_*.
(build_ptrmemfunc): Likewise.
(convert_for_assignment): Likewise.
From-SVN: r49591
2002-02-07 21:51:15 +01:00
|
|
|
|
flags &= ~tf_ptrmem_ok;
|
2000-08-17 15:26:14 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
|
|
|
|
|
{
|
|
|
|
|
if (complain)
|
1998-09-07 16:25:35 +02:00
|
|
|
|
error ("not enough type information");
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TREE_TYPE (rhs) != NULL_TREE && ! (type_unknown_p (rhs)))
|
1998-01-29 01:08:53 +01:00
|
|
|
|
{
|
2003-05-16 00:04:00 +02:00
|
|
|
|
if (same_type_p (lhstype, TREE_TYPE (rhs)))
|
1998-01-29 01:08:53 +01:00
|
|
|
|
return rhs;
|
2002-12-28 09:03:42 +01:00
|
|
|
|
if (flag_ms_extensions
|
|
|
|
|
&& TYPE_PTRMEMFUNC_P (lhstype)
|
|
|
|
|
&& !TYPE_PTRMEMFUNC_P (TREE_TYPE (rhs)))
|
|
|
|
|
/* Microsoft allows `A::f' to be resolved to a
|
|
|
|
|
pointer-to-member. */
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (complain)
|
|
|
|
|
error ("argument of type `%T' does not match `%T'",
|
|
|
|
|
TREE_TYPE (rhs), lhstype);
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
1998-01-29 01:08:53 +01:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2002-08-08 07:48:39 +02:00
|
|
|
|
if (TREE_CODE (rhs) == BASELINK)
|
|
|
|
|
rhs = BASELINK_FUNCTIONS (rhs);
|
|
|
|
|
|
1998-05-08 04:06:26 +02:00
|
|
|
|
/* We don't overwrite rhs if it is an overloaded function.
|
|
|
|
|
Copying it would destroy the tree link. */
|
|
|
|
|
if (TREE_CODE (rhs) != OVERLOAD)
|
|
|
|
|
rhs = copy_node (rhs);
|
1996-08-09 00:54:56 +02:00
|
|
|
|
|
1994-02-24 02:02:37 +01:00
|
|
|
|
/* This should really only be used when attempting to distinguish
|
|
|
|
|
what sort of a pointer to function we have. For now, any
|
|
|
|
|
arithmetic operation which is not supported on pointers
|
|
|
|
|
is rejected as an error. */
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (rhs))
|
|
|
|
|
{
|
|
|
|
|
case TYPE_EXPR:
|
|
|
|
|
case CONVERT_EXPR:
|
|
|
|
|
case SAVE_EXPR:
|
|
|
|
|
case CONSTRUCTOR:
|
|
|
|
|
case BUFFER_REF:
|
call.c, [...]: Change my_fancy_abort() to abort().
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
Change my_fancy_abort() to abort().
From-SVN: r49139
2002-01-23 15:26:07 +01:00
|
|
|
|
abort ();
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
case INDIRECT_REF:
|
|
|
|
|
case ARRAY_REF:
|
1996-03-02 02:49:15 +01:00
|
|
|
|
{
|
|
|
|
|
tree new_rhs;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1996-03-02 02:49:15 +01:00
|
|
|
|
new_rhs = instantiate_type (build_pointer_type (lhstype),
|
1999-04-13 02:20:42 +02:00
|
|
|
|
TREE_OPERAND (rhs, 0), flags);
|
1996-03-02 02:49:15 +01:00
|
|
|
|
if (new_rhs == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
TREE_TYPE (rhs) = lhstype;
|
|
|
|
|
TREE_OPERAND (rhs, 0) = new_rhs;
|
|
|
|
|
return rhs;
|
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case NOP_EXPR:
|
|
|
|
|
rhs = copy_node (TREE_OPERAND (rhs, 0));
|
|
|
|
|
TREE_TYPE (rhs) = unknown_type_node;
|
1999-04-13 02:20:42 +02:00
|
|
|
|
return instantiate_type (lhstype, rhs, flags);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case COMPONENT_REF:
|
2000-08-18 11:31:11 +02:00
|
|
|
|
return instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
1998-06-12 11:47:04 +02:00
|
|
|
|
case OFFSET_REF:
|
1999-05-10 14:12:58 +02:00
|
|
|
|
rhs = TREE_OPERAND (rhs, 1);
|
|
|
|
|
if (BASELINK_P (rhs))
|
2002-06-25 17:35:27 +02:00
|
|
|
|
return instantiate_type (lhstype, BASELINK_FUNCTIONS (rhs),
|
2000-08-18 11:31:11 +02:00
|
|
|
|
flags | allow_ptrmem);
|
1999-05-10 14:12:58 +02:00
|
|
|
|
|
1998-06-12 11:47:04 +02:00
|
|
|
|
/* This can happen if we are forming a pointer-to-member for a
|
|
|
|
|
member template. */
|
|
|
|
|
my_friendly_assert (TREE_CODE (rhs) == TEMPLATE_ID_EXPR, 0);
|
1999-05-10 14:12:58 +02:00
|
|
|
|
|
1998-06-12 11:47:04 +02:00
|
|
|
|
/* Fall through. */
|
1998-06-07 14:13:54 +02:00
|
|
|
|
|
1997-09-28 21:16:59 +02:00
|
|
|
|
case TEMPLATE_ID_EXPR:
|
2000-04-11 02:38:39 +02:00
|
|
|
|
{
|
|
|
|
|
tree fns = TREE_OPERAND (rhs, 0);
|
|
|
|
|
tree args = TREE_OPERAND (rhs, 1);
|
|
|
|
|
|
2000-08-18 11:31:11 +02:00
|
|
|
|
return
|
2000-04-11 02:38:39 +02:00
|
|
|
|
resolve_address_of_overloaded_function (lhstype,
|
|
|
|
|
fns,
|
|
|
|
|
complain,
|
2000-08-18 11:31:11 +02:00
|
|
|
|
allow_ptrmem,
|
2000-04-11 02:38:39 +02:00
|
|
|
|
/*template_only=*/1,
|
|
|
|
|
args);
|
|
|
|
|
}
|
1997-09-28 21:16:59 +02:00
|
|
|
|
|
1998-05-08 04:06:26 +02:00
|
|
|
|
case OVERLOAD:
|
2002-12-28 09:03:42 +01:00
|
|
|
|
case FUNCTION_DECL:
|
1998-12-09 17:20:05 +01:00
|
|
|
|
return
|
|
|
|
|
resolve_address_of_overloaded_function (lhstype,
|
|
|
|
|
rhs,
|
|
|
|
|
complain,
|
2000-08-18 11:31:11 +02:00
|
|
|
|
allow_ptrmem,
|
1998-12-09 17:20:05 +01:00
|
|
|
|
/*template_only=*/0,
|
|
|
|
|
/*explicit_targs=*/NULL_TREE);
|
1998-05-08 04:06:26 +02:00
|
|
|
|
|
|
|
|
|
case TREE_LIST:
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* Now we should have a baselink. */
|
1999-04-13 02:20:42 +02:00
|
|
|
|
my_friendly_assert (BASELINK_P (rhs), 990412);
|
1998-05-18 05:03:44 +02:00
|
|
|
|
|
2002-06-25 17:35:27 +02:00
|
|
|
|
return instantiate_type (lhstype, BASELINK_FUNCTIONS (rhs), flags);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
|
|
|
|
case CALL_EXPR:
|
|
|
|
|
/* This is too hard for now. */
|
call.c, [...]: Change my_fancy_abort() to abort().
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
Change my_fancy_abort() to abort().
From-SVN: r49139
2002-01-23 15:26:07 +01:00
|
|
|
|
abort ();
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
case PLUS_EXPR:
|
|
|
|
|
case MINUS_EXPR:
|
|
|
|
|
case COMPOUND_EXPR:
|
1994-06-03 23:42:31 +02:00
|
|
|
|
TREE_OPERAND (rhs, 0)
|
1999-04-13 02:20:42 +02:00
|
|
|
|
= instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TREE_OPERAND (rhs, 0) == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
1994-06-03 23:42:31 +02:00
|
|
|
|
TREE_OPERAND (rhs, 1)
|
1999-04-13 02:20:42 +02:00
|
|
|
|
= instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
|
1994-02-24 02:02:37 +01:00
|
|
|
|
if (TREE_OPERAND (rhs, 1) == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
TREE_TYPE (rhs) = lhstype;
|
|
|
|
|
return rhs;
|
|
|
|
|
|
|
|
|
|
case MULT_EXPR:
|
|
|
|
|
case TRUNC_DIV_EXPR:
|
|
|
|
|
case FLOOR_DIV_EXPR:
|
|
|
|
|
case CEIL_DIV_EXPR:
|
|
|
|
|
case ROUND_DIV_EXPR:
|
|
|
|
|
case RDIV_EXPR:
|
|
|
|
|
case TRUNC_MOD_EXPR:
|
|
|
|
|
case FLOOR_MOD_EXPR:
|
|
|
|
|
case CEIL_MOD_EXPR:
|
|
|
|
|
case ROUND_MOD_EXPR:
|
|
|
|
|
case FIX_ROUND_EXPR:
|
|
|
|
|
case FIX_FLOOR_EXPR:
|
|
|
|
|
case FIX_CEIL_EXPR:
|
|
|
|
|
case FIX_TRUNC_EXPR:
|
|
|
|
|
case FLOAT_EXPR:
|
|
|
|
|
case NEGATE_EXPR:
|
|
|
|
|
case ABS_EXPR:
|
|
|
|
|
case MAX_EXPR:
|
|
|
|
|
case MIN_EXPR:
|
|
|
|
|
case FFS_EXPR:
|
|
|
|
|
|
|
|
|
|
case BIT_AND_EXPR:
|
|
|
|
|
case BIT_IOR_EXPR:
|
|
|
|
|
case BIT_XOR_EXPR:
|
|
|
|
|
case LSHIFT_EXPR:
|
|
|
|
|
case RSHIFT_EXPR:
|
|
|
|
|
case LROTATE_EXPR:
|
|
|
|
|
case RROTATE_EXPR:
|
|
|
|
|
|
|
|
|
|
case PREINCREMENT_EXPR:
|
|
|
|
|
case PREDECREMENT_EXPR:
|
|
|
|
|
case POSTINCREMENT_EXPR:
|
|
|
|
|
case POSTDECREMENT_EXPR:
|
|
|
|
|
if (complain)
|
1998-09-07 16:25:35 +02:00
|
|
|
|
error ("invalid operation on uninstantiated type");
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
case TRUTH_AND_EXPR:
|
|
|
|
|
case TRUTH_OR_EXPR:
|
|
|
|
|
case TRUTH_XOR_EXPR:
|
|
|
|
|
case LT_EXPR:
|
|
|
|
|
case LE_EXPR:
|
|
|
|
|
case GT_EXPR:
|
|
|
|
|
case GE_EXPR:
|
|
|
|
|
case EQ_EXPR:
|
|
|
|
|
case NE_EXPR:
|
|
|
|
|
case TRUTH_ANDIF_EXPR:
|
|
|
|
|
case TRUTH_ORIF_EXPR:
|
|
|
|
|
case TRUTH_NOT_EXPR:
|
|
|
|
|
if (complain)
|
1998-09-07 16:25:35 +02:00
|
|
|
|
error ("not enough type information");
|
1994-02-24 02:02:37 +01:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
case COND_EXPR:
|
|
|
|
|
if (type_unknown_p (TREE_OPERAND (rhs, 0)))
|
|
|
|
|
{
|
|
|
|
|
if (complain)
|
|
|
|
|
error ("not enough type information");
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
TREE_OPERAND (rhs, 1)
|
|
|
|
|
= instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
|
|
|
|
|
if (TREE_OPERAND (rhs, 1) == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
TREE_OPERAND (rhs, 2)
|
|
|
|
|
= instantiate_type (lhstype, TREE_OPERAND (rhs, 2), flags);
|
|
|
|
|
if (TREE_OPERAND (rhs, 2) == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
TREE_TYPE (rhs) = lhstype;
|
|
|
|
|
return rhs;
|
|
|
|
|
|
|
|
|
|
case MODIFY_EXPR:
|
|
|
|
|
TREE_OPERAND (rhs, 1)
|
|
|
|
|
= instantiate_type (lhstype, TREE_OPERAND (rhs, 1), flags);
|
|
|
|
|
if (TREE_OPERAND (rhs, 1) == error_mark_node)
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
TREE_TYPE (rhs) = lhstype;
|
|
|
|
|
return rhs;
|
|
|
|
|
|
|
|
|
|
case ADDR_EXPR:
|
2000-08-18 11:31:11 +02:00
|
|
|
|
{
|
|
|
|
|
if (PTRMEM_OK_P (rhs))
|
Rename instantiate_type_flags to tsubst_flags_t & expand use.
* cp-tree.h (instantiate_type_flags): Rename to ...
(tsubst_flags_t): ... here. Rename itf_complain to tf_error,
add tf_warning flag.
(instantiate_type): Adjust prototype.
(tsubst, tsubst_expr, tsubst_copy, lookup_template_class,
do_type_instantiation, cp_build_qualified_type_real): Likewise.
cp_build_qualified_type: Adjust.
* class.c (instantiate_type): Adjust parameter. Rename itf_* to
tf_*.
* call.c (standard_conversion): Rename itf_* to tf_*.
(reference_binding): Likewise.
(convert_like_real): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
* decl.c (lookup_namespace_name): Use tf_* flags.
(make_typename_type): Likewise.
(grokdeclarator): Likewise.
* pt.c (convert_nontype_argument): Adjust COMPLAIN usage.
(coerce_template_template_parms, convert_template_argument,
coerce_template_parms, maybe_get_template_decl_from_type_decl,
lookup_template_class, tsubst_friend_function, tsubst_friend_class,
instantiate_class_template, tsubst_template_arg_vector,
tsubst_template_parms, tsubst_aggr_type, tsubst_default_argument,
tsubst_decl, tsubst_arg_types, tsubst_function_type,
tsubst_call_declarator_parms, tsubst, tsubst_copy, tsubst_expr,
instantiate_template, fn_type_unification,
resolve_overloaded_unification, verify_class_unification,
unify, get_bindings_real, do_type_instantiation,
regenerate_decl_from_template, instantiate_decl,
tsubst_initializer_list, tsubst_enum,
get_mostly_instantiated_function_type,
invalid_nontype_parm_type_p): Likewise.
* tree.c (cp_build_qualified_type_real): Likewise.
* typeck.c (build_binary_op): Rename itf_* to tf_*.
(build_ptrmemfunc): Likewise.
(convert_for_assignment): Likewise.
From-SVN: r49591
2002-02-07 21:51:15 +01:00
|
|
|
|
flags |= tf_ptrmem_ok;
|
2000-08-18 11:31:11 +02:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags);
|
2000-08-18 11:31:11 +02:00
|
|
|
|
}
|
2000-03-29 09:36:39 +02:00
|
|
|
|
case ENTRY_VALUE_EXPR:
|
call.c, [...]: Change my_fancy_abort() to abort().
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
Change my_fancy_abort() to abort().
From-SVN: r49139
2002-01-23 15:26:07 +01:00
|
|
|
|
abort ();
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
case ERROR_MARK:
|
|
|
|
|
return error_mark_node;
|
|
|
|
|
|
|
|
|
|
default:
|
call.c, [...]: Change my_fancy_abort() to abort().
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
Change my_fancy_abort() to abort().
From-SVN: r49139
2002-01-23 15:26:07 +01:00
|
|
|
|
abort ();
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return error_mark_node;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the name of the virtual function pointer field
|
|
|
|
|
(as an IDENTIFIER_NODE) for the given TYPE. Note that
|
|
|
|
|
this may have to look back through base types to find the
|
|
|
|
|
ultimate field name. (For single inheritance, these could
|
|
|
|
|
all be the same name. Who knows for multiple inheritance). */
|
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_vfield_name (tree type)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
tree binfo = TYPE_BINFO (type);
|
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
|
|
while (BINFO_BASETYPES (binfo)
|
|
|
|
|
&& TYPE_CONTAINS_VPTR_P (BINFO_TYPE (BINFO_BASETYPE (binfo, 0)))
|
|
|
|
|
&& ! TREE_VIA_VIRTUAL (BINFO_BASETYPE (binfo, 0)))
|
|
|
|
|
binfo = BINFO_BASETYPE (binfo, 0);
|
|
|
|
|
|
|
|
|
|
type = BINFO_TYPE (binfo);
|
2003-07-19 18:09:51 +02:00
|
|
|
|
buf = alloca (sizeof (VFIELD_NAME_FORMAT) + TYPE_NAME_LENGTH (type) + 2);
|
2002-03-20 17:58:24 +01:00
|
|
|
|
sprintf (buf, VFIELD_NAME_FORMAT,
|
|
|
|
|
IDENTIFIER_POINTER (constructor_name (type)));
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return get_identifier (buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
print_class_statistics (void)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
#ifdef GATHER_STATISTICS
|
|
|
|
|
fprintf (stderr, "convert_harshness = %d\n", n_convert_harshness);
|
|
|
|
|
fprintf (stderr, "compute_conversion_costs = %d\n", n_compute_conversion_costs);
|
|
|
|
|
fprintf (stderr, "build_method_call = %d (inner = %d)\n",
|
|
|
|
|
n_build_method_call, n_inner_fields_searched);
|
|
|
|
|
if (n_vtables)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "vtables = %d; vtable searches = %d\n",
|
|
|
|
|
n_vtables, n_vtable_searches);
|
|
|
|
|
fprintf (stderr, "vtable entries = %d; vtable elems = %d\n",
|
|
|
|
|
n_vtable_entries, n_vtable_elems);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Build a dummy reference to ourselves so Derived::Base (and A::A) works,
|
|
|
|
|
according to [class]:
|
|
|
|
|
The class-name is also inserted
|
|
|
|
|
into the scope of the class itself. For purposes of access checking,
|
|
|
|
|
the inserted class name is treated as if it were a public member name. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_self_reference (void)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
tree name = constructor_name (current_class_type);
|
|
|
|
|
tree value = build_lang_decl (TYPE_DECL, name, current_class_type);
|
|
|
|
|
tree saved_cas;
|
|
|
|
|
|
|
|
|
|
DECL_NONLOCAL (value) = 1;
|
|
|
|
|
DECL_CONTEXT (value) = current_class_type;
|
|
|
|
|
DECL_ARTIFICIAL (value) = 1;
|
2003-07-14 07:12:56 +02:00
|
|
|
|
SET_DECL_SELF_REFERENCE_P (value);
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
if (processing_template_decl)
|
|
|
|
|
value = push_template_decl (value);
|
|
|
|
|
|
|
|
|
|
saved_cas = current_access_specifier;
|
|
|
|
|
current_access_specifier = access_public_node;
|
|
|
|
|
finish_member_declaration (value);
|
|
|
|
|
current_access_specifier = saved_cas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns 1 if TYPE contains only padding bytes. */
|
|
|
|
|
|
|
|
|
|
int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
is_empty_class (tree type)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
if (type == error_mark_node)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (! IS_AGGR_TYPE (type))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2002-10-15 20:07:24 +02:00
|
|
|
|
/* In G++ 3.2, whether or not a class was empty was determined by
|
|
|
|
|
looking at its size. */
|
|
|
|
|
if (abi_version_at_least (2))
|
|
|
|
|
return CLASSTYPE_EMPTY_P (type);
|
|
|
|
|
else
|
|
|
|
|
return integer_zerop (CLASSTYPE_SIZE (type));
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2002-09-25 21:07:35 +02:00
|
|
|
|
/* Returns true if TYPE contains an empty class. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
contains_empty_class_p (tree type)
|
|
|
|
|
{
|
|
|
|
|
if (is_empty_class (type))
|
|
|
|
|
return true;
|
|
|
|
|
if (CLASS_TYPE_P (type))
|
|
|
|
|
{
|
|
|
|
|
tree field;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < CLASSTYPE_N_BASECLASSES (type); ++i)
|
|
|
|
|
if (contains_empty_class_p (TYPE_BINFO_BASETYPE (type, i)))
|
|
|
|
|
return true;
|
|
|
|
|
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
|
2002-09-30 18:52:19 +02:00
|
|
|
|
if (TREE_CODE (field) == FIELD_DECL
|
|
|
|
|
&& !DECL_ARTIFICIAL (field)
|
|
|
|
|
&& is_empty_class (TREE_TYPE (field)))
|
2002-09-25 21:07:35 +02:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (TREE_CODE (type) == ARRAY_TYPE)
|
|
|
|
|
return contains_empty_class_p (TREE_TYPE (type));
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
/* Find the enclosing class of the given NODE. NODE can be a *_DECL or
|
|
|
|
|
a *_TYPE node. NODE can also be a local class. */
|
|
|
|
|
|
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_enclosing_class (tree type)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
tree node = type;
|
|
|
|
|
|
|
|
|
|
while (node && TREE_CODE (node) != NAMESPACE_DECL)
|
|
|
|
|
{
|
|
|
|
|
switch (TREE_CODE_CLASS (TREE_CODE (node)))
|
|
|
|
|
{
|
|
|
|
|
case 'd':
|
|
|
|
|
node = DECL_CONTEXT (node);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 't':
|
|
|
|
|
if (node != type)
|
|
|
|
|
return node;
|
|
|
|
|
node = TYPE_CONTEXT (node);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
call.c, [...]: Change my_fancy_abort() to abort().
2002-01-23 Craig Rodrigues <rodrigc@gcc.gnu.org>
* call.c, class.c, decl.c, decl2.c, error.c, expr.c, friend.c,
init.c, lex.c, mangle.c, method.c, pt.c, repo.c, rtti.c, search.c,
semantics.c, spew.c, tree.c, typeck.c, typeck2.c, xref.c:
Change my_fancy_abort() to abort().
From-SVN: r49139
2002-01-23 15:26:07 +01:00
|
|
|
|
abort ();
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return 1 if TYPE or one of its enclosing classes is derived from BASE. */
|
|
|
|
|
|
|
|
|
|
int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
is_base_of_enclosing_class (tree base, tree type)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
while (type)
|
|
|
|
|
{
|
2001-11-29 18:15:56 +01:00
|
|
|
|
if (lookup_base (type, base, ba_any, NULL))
|
2000-03-29 09:36:39 +02:00
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
type = get_enclosing_class (type);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Note that NAME was looked up while the current class was being
|
|
|
|
|
defined and that the result of that lookup was DECL. */
|
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
maybe_note_name_used_in_class (tree name, tree decl)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
splay_tree names_used;
|
|
|
|
|
|
|
|
|
|
/* If we're not defining a class, there's nothing to do. */
|
|
|
|
|
if (!current_class_type || !TYPE_BEING_DEFINED (current_class_type))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If there's already a binding for this NAME, then we don't have
|
|
|
|
|
anything to worry about. */
|
|
|
|
|
if (IDENTIFIER_CLASS_VALUE (name))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!current_class_stack[current_class_depth - 1].names_used)
|
|
|
|
|
current_class_stack[current_class_depth - 1].names_used
|
|
|
|
|
= splay_tree_new (splay_tree_compare_pointers, 0, 0);
|
|
|
|
|
names_used = current_class_stack[current_class_depth - 1].names_used;
|
|
|
|
|
|
|
|
|
|
splay_tree_insert (names_used,
|
|
|
|
|
(splay_tree_key) name,
|
|
|
|
|
(splay_tree_value) decl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Note that NAME was declared (as DECL) in the current class. Check
|
2002-08-09 03:16:39 +02:00
|
|
|
|
to see that the declaration is valid. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
note_name_declared_in_class (tree name, tree decl)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
splay_tree names_used;
|
|
|
|
|
splay_tree_node n;
|
|
|
|
|
|
|
|
|
|
/* Look to see if we ever used this name. */
|
|
|
|
|
names_used
|
|
|
|
|
= current_class_stack[current_class_depth - 1].names_used;
|
|
|
|
|
if (!names_used)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
n = splay_tree_lookup (names_used, (splay_tree_key) name);
|
|
|
|
|
if (n)
|
|
|
|
|
{
|
|
|
|
|
/* [basic.scope.class]
|
|
|
|
|
|
|
|
|
|
A name N used in a class S shall refer to the same declaration
|
|
|
|
|
in its context and when re-evaluated in the completed scope of
|
|
|
|
|
S. */
|
cp-tree.h: Delete #defines for cp_error, cp_warning, cp_pedwarn, and cp_compiler_error.
* cp-tree.h: Delete #defines for cp_error, cp_warning,
cp_pedwarn, and cp_compiler_error.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, decl2.c, error.c,
except.c, friend.c, init.c, lex.c, method.c, parse.y, pt.c,
rtti.c, search.c, semantics.c, spew.c, tree.c, typeck.c,
typeck2.c: Change calls to the above macros to use their
language-independent equivalents: error, warning, pedwarn, and
internal_error respectively.
From-SVN: r48140
2001-12-18 04:35:42 +01:00
|
|
|
|
error ("declaration of `%#D'", decl);
|
2000-12-07 15:26:37 +01:00
|
|
|
|
cp_error_at ("changes meaning of `%D' from `%+#D'",
|
|
|
|
|
DECL_NAME (OVL_CURRENT (decl)),
|
2000-03-29 09:36:39 +02:00
|
|
|
|
(tree) n->value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* Returns the VAR_DECL for the complete vtable associated with BINFO.
|
|
|
|
|
Secondary vtables are merged with primary vtables; this function
|
|
|
|
|
will return the VAR_DECL for the primary vtable. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_vtbl_decl_for_binfo (tree binfo)
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
|
|
|
|
|
decl = BINFO_VTABLE (binfo);
|
|
|
|
|
if (decl && TREE_CODE (decl) == PLUS_EXPR)
|
|
|
|
|
{
|
|
|
|
|
my_friendly_assert (TREE_CODE (TREE_OPERAND (decl, 0)) == ADDR_EXPR,
|
|
|
|
|
2000403);
|
|
|
|
|
decl = TREE_OPERAND (TREE_OPERAND (decl, 0), 0);
|
|
|
|
|
}
|
|
|
|
|
if (decl)
|
|
|
|
|
my_friendly_assert (TREE_CODE (decl) == VAR_DECL, 20000403);
|
|
|
|
|
return decl;
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
/* Returns the binfo for the primary base of BINFO. If the resulting
|
|
|
|
|
BINFO is a virtual base, and it is inherited elsewhere in the
|
|
|
|
|
hierarchy, then the returned binfo might not be the primary base of
|
|
|
|
|
BINFO in the complete object. Check BINFO_PRIMARY_P or
|
|
|
|
|
BINFO_LOST_PRIMARY_P to be sure. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
|
|
|
|
|
tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
get_primary_binfo (tree binfo)
|
2000-07-31 02:24:44 +02:00
|
|
|
|
{
|
|
|
|
|
tree primary_base;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree result;
|
2001-06-12 20:08:05 +02:00
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
primary_base = CLASSTYPE_PRIMARY_BINFO (BINFO_TYPE (binfo));
|
|
|
|
|
if (!primary_base)
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
result = copied_binfo (primary_base, binfo);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-21 14:51:56 +02:00
|
|
|
|
/* If INDENTED_P is zero, indent to INDENT. Return nonzero. */
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2003-01-23 03:47:51 +01:00
|
|
|
|
maybe_indent_hierarchy (FILE * stream, int indent, int indented_p)
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
{
|
|
|
|
|
if (!indented_p)
|
|
|
|
|
fprintf (stream, "%*s", indent, "");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
/* Dump the offsets of all the bases rooted at BINFO to STREAM.
|
|
|
|
|
INDENT should be zero when called from the top level; it is
|
|
|
|
|
incremented recursively. IGO indicates the next expected BINFO in
|
2003-07-07 01:23:46 +02:00
|
|
|
|
inheritance graph ordering. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
static tree
|
|
|
|
|
dump_class_hierarchy_r (FILE *stream,
|
2003-01-23 03:47:51 +01:00
|
|
|
|
int flags,
|
|
|
|
|
tree binfo,
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree igo,
|
2003-01-23 03:47:51 +01:00
|
|
|
|
int indent)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
int indented = 0;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree base_binfos;
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent, 0);
|
|
|
|
|
fprintf (stream, "%s (0x%lx) ",
|
|
|
|
|
type_as_string (binfo, TFF_PLAIN_IDENTIFIER),
|
|
|
|
|
(unsigned long) binfo);
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
if (binfo != igo)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stream, "alternative-path\n");
|
|
|
|
|
return igo;
|
|
|
|
|
}
|
|
|
|
|
igo = TREE_CHAIN (binfo);
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
fprintf (stream, HOST_WIDE_INT_PRINT_DEC,
|
2000-03-29 09:36:39 +02:00
|
|
|
|
tree_low_cst (BINFO_OFFSET (binfo), 0));
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (is_empty_class (BINFO_TYPE (binfo)))
|
|
|
|
|
fprintf (stream, " empty");
|
|
|
|
|
else if (CLASSTYPE_NEARLY_EMPTY_P (BINFO_TYPE (binfo)))
|
|
|
|
|
fprintf (stream, " nearly-empty");
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
if (TREE_VIA_VIRTUAL (binfo))
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
fprintf (stream, " virtual");
|
2001-02-05 12:45:16 +01:00
|
|
|
|
fprintf (stream, "\n");
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
indented = 0;
|
|
|
|
|
if (BINFO_PRIMARY_BASE_OF (binfo))
|
|
|
|
|
{
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
|
|
|
|
|
fprintf (stream, " primary-for %s (0x%lx)",
|
|
|
|
|
type_as_string (BINFO_PRIMARY_BASE_OF (binfo),
|
|
|
|
|
TFF_PLAIN_IDENTIFIER),
|
|
|
|
|
(unsigned long)BINFO_PRIMARY_BASE_OF (binfo));
|
|
|
|
|
}
|
|
|
|
|
if (BINFO_LOST_PRIMARY_P (binfo))
|
|
|
|
|
{
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
|
|
|
|
|
fprintf (stream, " lost-primary");
|
|
|
|
|
}
|
|
|
|
|
if (indented)
|
|
|
|
|
fprintf (stream, "\n");
|
|
|
|
|
|
|
|
|
|
if (!(flags & TDF_SLIM))
|
|
|
|
|
{
|
|
|
|
|
int indented = 0;
|
|
|
|
|
|
|
|
|
|
if (BINFO_SUBVTT_INDEX (binfo))
|
|
|
|
|
{
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
|
|
|
|
|
fprintf (stream, " subvttidx=%s",
|
|
|
|
|
expr_as_string (BINFO_SUBVTT_INDEX (binfo),
|
|
|
|
|
TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
}
|
|
|
|
|
if (BINFO_VPTR_INDEX (binfo))
|
|
|
|
|
{
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
|
|
|
|
|
fprintf (stream, " vptridx=%s",
|
|
|
|
|
expr_as_string (BINFO_VPTR_INDEX (binfo),
|
|
|
|
|
TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
}
|
|
|
|
|
if (BINFO_VPTR_FIELD (binfo))
|
|
|
|
|
{
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
|
|
|
|
|
fprintf (stream, " vbaseoffset=%s",
|
|
|
|
|
expr_as_string (BINFO_VPTR_FIELD (binfo),
|
|
|
|
|
TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
}
|
|
|
|
|
if (BINFO_VTABLE (binfo))
|
|
|
|
|
{
|
|
|
|
|
indented = maybe_indent_hierarchy (stream, indent + 3, indented);
|
|
|
|
|
fprintf (stream, " vptr=%s",
|
|
|
|
|
expr_as_string (BINFO_VTABLE (binfo),
|
|
|
|
|
TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (indented)
|
|
|
|
|
fprintf (stream, "\n");
|
|
|
|
|
}
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
base_binfos = BINFO_BASETYPES (binfo);
|
|
|
|
|
if (base_binfos)
|
|
|
|
|
{
|
|
|
|
|
int ix, n;
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
n = TREE_VEC_LENGTH (base_binfos);
|
|
|
|
|
for (ix = 0; ix != n; ix++)
|
|
|
|
|
{
|
|
|
|
|
tree base_binfo = TREE_VEC_ELT (base_binfos, ix);
|
|
|
|
|
|
|
|
|
|
igo = dump_class_hierarchy_r (stream, flags, base_binfo,
|
|
|
|
|
igo, indent + 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return igo;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dump the BINFO hierarchy for T. */
|
|
|
|
|
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dump_class_hierarchy (tree t)
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
{
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
int flags;
|
|
|
|
|
FILE *stream = dump_begin (TDI_class, &flags);
|
|
|
|
|
|
|
|
|
|
if (!stream)
|
|
|
|
|
return;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
fprintf (stream, "Class %s\n", type_as_string (t, TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
fprintf (stream, " size=%lu align=%lu\n",
|
|
|
|
|
(unsigned long)(tree_low_cst (TYPE_SIZE (t), 0) / BITS_PER_UNIT),
|
|
|
|
|
(unsigned long)(TYPE_ALIGN (t) / BITS_PER_UNIT));
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
fprintf (stream, " base size=%lu base align=%lu\n",
|
|
|
|
|
(unsigned long)(tree_low_cst (TYPE_SIZE (CLASSTYPE_AS_BASE (t)), 0)
|
|
|
|
|
/ BITS_PER_UNIT),
|
|
|
|
|
(unsigned long)(TYPE_ALIGN (CLASSTYPE_AS_BASE (t))
|
|
|
|
|
/ BITS_PER_UNIT));
|
|
|
|
|
dump_class_hierarchy_r (stream, flags, TYPE_BINFO (t), TYPE_BINFO (t), 0);
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
fprintf (stream, "\n");
|
|
|
|
|
dump_end (TDI_class, stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dump_array (FILE * stream, tree decl)
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
{
|
|
|
|
|
tree inits;
|
|
|
|
|
int ix;
|
|
|
|
|
HOST_WIDE_INT elt;
|
|
|
|
|
tree size = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (decl)));
|
|
|
|
|
|
|
|
|
|
elt = (tree_low_cst (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl))), 0)
|
|
|
|
|
/ BITS_PER_UNIT);
|
|
|
|
|
fprintf (stream, "%s:", decl_as_string (decl, TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
fprintf (stream, " %s entries",
|
|
|
|
|
expr_as_string (size_binop (PLUS_EXPR, size, size_one_node),
|
|
|
|
|
TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
fprintf (stream, "\n");
|
|
|
|
|
|
2003-06-01 00:32:42 +02:00
|
|
|
|
for (ix = 0, inits = CONSTRUCTOR_ELTS (DECL_INITIAL (decl));
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
inits; ix++, inits = TREE_CHAIN (inits))
|
2001-11-10 00:08:36 +01:00
|
|
|
|
fprintf (stream, "%-4ld %s\n", (long)(ix * elt),
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
expr_as_string (TREE_VALUE (inits), TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dump_vtable (tree t, tree binfo, tree vtable)
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
{
|
|
|
|
|
int flags;
|
|
|
|
|
FILE *stream = dump_begin (TDI_class, &flags);
|
|
|
|
|
|
|
|
|
|
if (!stream)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!(flags & TDF_SLIM))
|
2001-02-05 12:45:16 +01:00
|
|
|
|
{
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
int ctor_vtbl_p = TYPE_BINFO (t) != binfo;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
fprintf (stream, "%s for %s",
|
|
|
|
|
ctor_vtbl_p ? "Construction vtable" : "Vtable",
|
|
|
|
|
type_as_string (binfo, TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
if (ctor_vtbl_p)
|
|
|
|
|
{
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
fprintf (stream, " (0x%lx instance)", (unsigned long)binfo);
|
|
|
|
|
fprintf (stream, " in %s", type_as_string (t, TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
}
|
|
|
|
|
fprintf (stream, "\n");
|
|
|
|
|
dump_array (stream, vtable);
|
|
|
|
|
fprintf (stream, "\n");
|
2001-02-05 12:45:16 +01:00
|
|
|
|
}
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
|
|
|
|
|
dump_end (TDI_class, stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dump_vtt (tree t, tree vtt)
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
{
|
|
|
|
|
int flags;
|
|
|
|
|
FILE *stream = dump_begin (TDI_class, &flags);
|
|
|
|
|
|
|
|
|
|
if (!stream)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!(flags & TDF_SLIM))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stream, "VTT for %s\n",
|
|
|
|
|
type_as_string (t, TFF_PLAIN_IDENTIFIER));
|
|
|
|
|
dump_array (stream, vtt);
|
|
|
|
|
fprintf (stream, "\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dump_end (TDI_class, stream);
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Virtual function table initialization. */
|
|
|
|
|
|
|
|
|
|
/* Create all the necessary vtables for T and its base classes. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
finish_vtbls (tree t)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
2001-07-21 02:03:21 +02:00
|
|
|
|
tree list;
|
|
|
|
|
tree vbase;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* We lay out the primary and secondary vtables in one contiguous
|
|
|
|
|
vtable. The primary vtable is first, followed by the non-virtual
|
|
|
|
|
secondary vtables in inheritance graph order. */
|
|
|
|
|
list = build_tree_list (TYPE_BINFO_VTABLE (t), NULL_TREE);
|
|
|
|
|
accumulate_vtbl_inits (TYPE_BINFO (t), TYPE_BINFO (t),
|
|
|
|
|
TYPE_BINFO (t), t, list);
|
|
|
|
|
|
|
|
|
|
/* Then come the virtual bases, also in inheritance graph order. */
|
|
|
|
|
for (vbase = TYPE_BINFO (t); vbase; vbase = TREE_CHAIN (vbase))
|
|
|
|
|
{
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (vbase))
|
|
|
|
|
continue;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
accumulate_vtbl_inits (vbase, vbase, TYPE_BINFO (t), t, list);
|
2001-12-03 03:43:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
if (TYPE_BINFO_VTABLE (t))
|
|
|
|
|
initialize_vtable (TYPE_BINFO (t), TREE_VALUE (list));
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize the vtable for BINFO with the INITS. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
initialize_vtable (tree binfo, tree inits)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
tree decl;
|
|
|
|
|
|
|
|
|
|
layout_vtable_decl (binfo, list_length (inits));
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
decl = get_vtbl_decl_for_binfo (binfo);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
initialize_array (decl, inits);
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
dump_vtable (BINFO_TYPE (binfo), binfo, decl);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize DECL (a declaration for a namespace-scope array) with
|
|
|
|
|
the INITS. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
initialize_array (tree decl, tree inits)
|
2000-05-22 03:08:46 +02:00
|
|
|
|
{
|
|
|
|
|
tree context;
|
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
context = DECL_CONTEXT (decl);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
DECL_CONTEXT (decl) = NULL_TREE;
|
tree.c (build_constructor): New function.
* tree.c (build_constructor): New function.
* tree.h: Prototype it.
* c-typeck.c (build_c_cast, pop_init_level)
* profile.c (build_function_info_value, build_gcov_info_value)
(create_profiler):
Use build_constructor.
* builtins.c (expand_builtin_args_info): Remove #if 0 blocks.
* objc/objc-act.c (build_constructor):
Rename objc_build_constructor. Use build_constructor.
(build_objc_string_object, objc_add_static_instance)
(init_def_list, init_objc_symtab, init_module_descriptor)
(generate_static_references, build_selector_translation_table)
(build_descriptor_table_initializer, generate_descriptor_table)
(build_protocol_initializer, build_ivar_list_initializer)
(generate_ivars_list, build_dispatch_table_initializer)
(generate_dispatch_table, generate_protocol_list)
(build_category_initializer, build_shared_structure_initializer):
Update to match.
ada:
* gigi.h, utils2.c (build_constructor):
Rename gnat_build_constructor. Use build_constructor.
* decl.c (gnat_to_gnu_entity)
* trans.c (tree_transform, pos_to_constructor, extract_values)
* ada/utils.c (build_template, convert_to_fat_pointer, convert)
(unchecked_convert)
* ada/utils2.c (build_binary_op, build_call_raise, build_allocator)
(fill_vms_descriptor):
Update to match.
cp:
* class.c (initialize_array)
* decl.c (reshape_init)
* decl2.c (build_expr_from_tree)
* init.c (build_zero_init)
* pt.c (tsubst_copy, tsubst_copy_and_build)
* rtti.c (tinfo_base_init, generic_initializer, ptr_initializer)
(ptm_initializer, class_initializer, get_pseudo_ti_init)
* semantics.c (finish_compound_literal)
* typeck.c (build_ptrmemfunc1)
* typeck2.c (store_init_value, process_init_constructor)
(build_functional_cast): Use build_constructor.
f:
* com.c (ffecom_build_complex_constant_, ffecom_expr_)
(ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_)
(ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2)
* ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_)
(ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_):
Use build_constructor.
java:
* class.c (make_field_value, make_method_value, get_dispatch_table)
(make_class_data, emit_offset_symbol_table)
* constants.c (build_constants_constructor)
* java-tree.h (START_RECORD_CONSTRUCTOR)
* parse.y (maybe_build_array_element_wfl):
Use build_constructor.
From-SVN: r65539
2003-04-13 03:45:35 +02:00
|
|
|
|
DECL_INITIAL (decl) = build_constructor (NULL_TREE, inits);
|
2002-10-11 18:50:44 +02:00
|
|
|
|
TREE_HAS_CONSTRUCTOR (DECL_INITIAL (decl)) = 1;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
cp_finish_decl (decl, DECL_INITIAL (decl), NULL_TREE, 0);
|
|
|
|
|
DECL_CONTEXT (decl) = context;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* Build the VTT (virtual table table) for T.
|
|
|
|
|
A class requires a VTT if it has virtual bases.
|
|
|
|
|
|
|
|
|
|
This holds
|
|
|
|
|
1 - primary virtual pointer for complete object T
|
2001-05-21 17:55:40 +02:00
|
|
|
|
2 - secondary VTTs for each direct non-virtual base of T which requires a
|
|
|
|
|
VTT
|
2001-02-05 12:45:16 +01:00
|
|
|
|
3 - secondary virtual pointers for each direct or indirect base of T which
|
|
|
|
|
has virtual bases or is reachable via a virtual path from T.
|
|
|
|
|
4 - secondary VTTs for each direct or indirect virtual base of T.
|
|
|
|
|
|
|
|
|
|
Secondary VTTs look like complete object VTTs without part 4. */
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtt (tree t)
|
2000-05-22 03:08:46 +02:00
|
|
|
|
{
|
|
|
|
|
tree inits;
|
|
|
|
|
tree type;
|
|
|
|
|
tree vtt;
|
2000-05-26 01:27:18 +02:00
|
|
|
|
tree index;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* Build up the initializers for the VTT. */
|
|
|
|
|
inits = NULL_TREE;
|
2000-05-26 01:27:18 +02:00
|
|
|
|
index = size_zero_node;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
build_vtt_inits (TYPE_BINFO (t), t, &inits, &index);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* If we didn't need a VTT, we're done. */
|
|
|
|
|
if (!inits)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Figure out the type of the VTT. */
|
2001-06-05 13:53:28 +02:00
|
|
|
|
type = build_index_type (size_int (list_length (inits) - 1));
|
2000-05-22 03:08:46 +02:00
|
|
|
|
type = build_cplus_array_type (const_ptr_type_node, type);
|
|
|
|
|
|
|
|
|
|
/* Now, build the VTT object itself. */
|
2000-06-09 18:26:24 +02:00
|
|
|
|
vtt = build_vtable (t, get_vtt_name (t), type);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
initialize_array (vtt, inits);
|
2002-11-04 02:45:58 +01:00
|
|
|
|
/* Add the VTT to the vtables list. */
|
|
|
|
|
TREE_CHAIN (vtt) = TREE_CHAIN (CLASSTYPE_VTABLES (t));
|
|
|
|
|
TREE_CHAIN (CLASSTYPE_VTABLES (t)) = vtt;
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
|
|
|
|
|
dump_vtt (t, vtt);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-15 16:03:09 +02:00
|
|
|
|
/* When building a secondary VTT, BINFO_VTABLE is set to a TREE_LIST with
|
|
|
|
|
PURPOSE the RTTI_BINFO, VALUE the real vtable pointer for this binfo,
|
|
|
|
|
and CHAIN the vtable pointer for this binfo after construction is
|
2002-09-13 02:22:59 +02:00
|
|
|
|
complete. VALUE can also be another BINFO, in which case we recurse. */
|
2001-06-15 16:03:09 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
binfo_ctor_vtable (tree binfo)
|
2001-06-15 16:03:09 +02:00
|
|
|
|
{
|
|
|
|
|
tree vt;
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
vt = BINFO_VTABLE (binfo);
|
|
|
|
|
if (TREE_CODE (vt) == TREE_LIST)
|
|
|
|
|
vt = TREE_VALUE (vt);
|
|
|
|
|
if (TREE_CODE (vt) == TREE_VEC)
|
|
|
|
|
binfo = vt;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return vt;
|
|
|
|
|
}
|
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Recursively build the VTT-initializer for BINFO (which is in the
|
2001-02-05 12:45:16 +01:00
|
|
|
|
hierarchy dominated by T). INITS points to the end of the initializer
|
|
|
|
|
list to date. INDEX is the VTT index where the next element will be
|
|
|
|
|
replaced. Iff BINFO is the binfo for T, this is the top level VTT (i.e.
|
|
|
|
|
not a subvtt for some base of T). When that is so, we emit the sub-VTTs
|
|
|
|
|
for virtual bases of T. When it is not so, we build the constructor
|
|
|
|
|
vtables for the BINFO-in-T variant. */
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
static tree *
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtt_inits (tree binfo, tree t, tree* inits, tree* index)
|
2000-05-22 03:08:46 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
tree b;
|
|
|
|
|
tree init;
|
|
|
|
|
tree secondary_vptrs;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
int top_level_p = same_type_p (TREE_TYPE (binfo), t);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* We only need VTTs for subobjects with virtual bases. */
|
|
|
|
|
if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
|
|
|
|
|
return inits;
|
|
|
|
|
|
|
|
|
|
/* We need to use a construction vtable if this is not the primary
|
|
|
|
|
VTT. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (!top_level_p)
|
2000-05-26 01:27:18 +02:00
|
|
|
|
{
|
|
|
|
|
build_ctor_vtbl_group (binfo, t);
|
|
|
|
|
|
|
|
|
|
/* Record the offset in the VTT where this sub-VTT can be found. */
|
|
|
|
|
BINFO_SUBVTT_INDEX (binfo) = *index;
|
|
|
|
|
}
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* Add the address of the primary vtable for the complete object. */
|
2001-06-15 16:03:09 +02:00
|
|
|
|
init = binfo_ctor_vtable (binfo);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
*inits = build_tree_list (NULL_TREE, init);
|
|
|
|
|
inits = &TREE_CHAIN (*inits);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (top_level_p)
|
|
|
|
|
{
|
|
|
|
|
my_friendly_assert (!BINFO_VPTR_INDEX (binfo), 20010129);
|
|
|
|
|
BINFO_VPTR_INDEX (binfo) = *index;
|
|
|
|
|
}
|
2000-05-26 01:27:18 +02:00
|
|
|
|
*index = size_binop (PLUS_EXPR, *index, TYPE_SIZE_UNIT (ptr_type_node));
|
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Recursively add the secondary VTTs for non-virtual bases. */
|
|
|
|
|
for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
|
|
|
|
|
{
|
|
|
|
|
b = BINFO_BASETYPE (binfo, i);
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (b))
|
2000-06-28 22:41:27 +02:00
|
|
|
|
inits = build_vtt_inits (BINFO_BASETYPE (binfo, i), t,
|
|
|
|
|
inits, index);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
}
|
2000-05-26 01:27:18 +02:00
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Add secondary virtual pointers for all subobjects of BINFO with
|
2001-02-05 12:45:16 +01:00
|
|
|
|
either virtual bases or reachable along a virtual path, except
|
|
|
|
|
subobjects that are non-virtual primary bases. */
|
2000-06-28 22:41:27 +02:00
|
|
|
|
secondary_vptrs = tree_cons (t, NULL_TREE, BINFO_TYPE (binfo));
|
2000-05-26 01:27:18 +02:00
|
|
|
|
TREE_TYPE (secondary_vptrs) = *index;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
VTT_TOP_LEVEL_P (secondary_vptrs) = top_level_p;
|
|
|
|
|
VTT_MARKED_BINFO_P (secondary_vptrs) = 0;
|
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
dfs_walk_real (binfo,
|
2000-06-28 22:41:27 +02:00
|
|
|
|
dfs_build_secondary_vptr_vtt_inits,
|
2000-05-22 03:08:46 +02:00
|
|
|
|
NULL,
|
2001-02-05 12:45:16 +01:00
|
|
|
|
dfs_ctor_vtable_bases_queue_p,
|
2000-05-22 03:08:46 +02:00
|
|
|
|
secondary_vptrs);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
VTT_MARKED_BINFO_P (secondary_vptrs) = 1;
|
|
|
|
|
dfs_walk (binfo, dfs_unmark, dfs_ctor_vtable_bases_queue_p,
|
|
|
|
|
secondary_vptrs);
|
|
|
|
|
|
2000-05-26 01:27:18 +02:00
|
|
|
|
*index = TREE_TYPE (secondary_vptrs);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* The secondary vptrs come back in reverse order. After we reverse
|
|
|
|
|
them, and add the INITS, the last init will be the first element
|
|
|
|
|
of the chain. */
|
|
|
|
|
secondary_vptrs = TREE_VALUE (secondary_vptrs);
|
|
|
|
|
if (secondary_vptrs)
|
|
|
|
|
{
|
|
|
|
|
*inits = nreverse (secondary_vptrs);
|
|
|
|
|
inits = &TREE_CHAIN (secondary_vptrs);
|
|
|
|
|
my_friendly_assert (*inits == NULL_TREE, 20000517);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add the secondary VTTs for virtual bases. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (top_level_p)
|
2000-06-28 22:41:27 +02:00
|
|
|
|
for (b = TYPE_BINFO (BINFO_TYPE (binfo)); b; b = TREE_CHAIN (b))
|
|
|
|
|
{
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (b))
|
|
|
|
|
continue;
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
inits = build_vtt_inits (b, t, inits, index);
|
2000-06-28 22:41:27 +02:00
|
|
|
|
}
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (!top_level_p)
|
|
|
|
|
{
|
|
|
|
|
tree data = tree_cons (t, binfo, NULL_TREE);
|
|
|
|
|
VTT_TOP_LEVEL_P (data) = 0;
|
|
|
|
|
VTT_MARKED_BINFO_P (data) = 0;
|
|
|
|
|
|
|
|
|
|
dfs_walk (binfo, dfs_fixup_binfo_vtbls,
|
|
|
|
|
dfs_ctor_vtable_bases_queue_p,
|
|
|
|
|
data);
|
|
|
|
|
}
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
return inits;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* Called from build_vtt_inits via dfs_walk. BINFO is the binfo
|
|
|
|
|
for the base in most derived. DATA is a TREE_LIST who's
|
|
|
|
|
TREE_CHAIN is the type of the base being
|
|
|
|
|
constructed whilst this secondary vptr is live. The TREE_UNSIGNED
|
|
|
|
|
flag of DATA indicates that this is a constructor vtable. The
|
|
|
|
|
TREE_TOP_LEVEL flag indicates that this is the primary VTT. */
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dfs_build_secondary_vptr_vtt_inits (tree binfo, void* data)
|
2000-05-22 03:08:46 +02:00
|
|
|
|
{
|
|
|
|
|
tree l;
|
|
|
|
|
tree t;
|
|
|
|
|
tree init;
|
2000-05-26 01:27:18 +02:00
|
|
|
|
tree index;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
int top_level_p;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
l = (tree) data;
|
2000-06-28 22:41:27 +02:00
|
|
|
|
t = TREE_CHAIN (l);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
top_level_p = VTT_TOP_LEVEL_P (l);
|
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_MARKED (binfo) = 1;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* We don't care about bases that don't have vtables. */
|
|
|
|
|
if (!TYPE_VFIELD (BINFO_TYPE (binfo)))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
|
|
|
|
/* We're only interested in proper subobjects of T. */
|
|
|
|
|
if (same_type_p (BINFO_TYPE (binfo), t))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
|
|
|
|
/* We're not interested in non-virtual primary bases. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (!TREE_VIA_VIRTUAL (binfo) && BINFO_PRIMARY_P (binfo))
|
2000-05-22 03:08:46 +02:00
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* If BINFO has virtual bases or is reachable via a virtual path
|
|
|
|
|
from T, it'll have a secondary vptr. */
|
2000-06-14 18:10:14 +02:00
|
|
|
|
if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo))
|
2001-02-05 12:45:16 +01:00
|
|
|
|
&& !binfo_via_virtual (binfo, t))
|
2000-06-14 18:10:14 +02:00
|
|
|
|
return NULL_TREE;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
2000-05-26 01:27:18 +02:00
|
|
|
|
/* Record the index where this secondary vptr can be found. */
|
|
|
|
|
index = TREE_TYPE (l);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (top_level_p)
|
|
|
|
|
{
|
|
|
|
|
my_friendly_assert (!BINFO_VPTR_INDEX (binfo), 20010129);
|
|
|
|
|
BINFO_VPTR_INDEX (binfo) = index;
|
|
|
|
|
}
|
2000-05-26 01:27:18 +02:00
|
|
|
|
TREE_TYPE (l) = size_binop (PLUS_EXPR, index,
|
|
|
|
|
TYPE_SIZE_UNIT (ptr_type_node));
|
|
|
|
|
|
|
|
|
|
/* Add the initializer for the secondary vptr itself. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (top_level_p && TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
{
|
|
|
|
|
/* It's a primary virtual base, and this is not the construction
|
|
|
|
|
vtable. Find the base this is primary of in the inheritance graph,
|
2002-09-13 02:22:59 +02:00
|
|
|
|
and use that base's vtable now. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
while (BINFO_PRIMARY_BASE_OF (binfo))
|
|
|
|
|
binfo = BINFO_PRIMARY_BASE_OF (binfo);
|
|
|
|
|
}
|
2001-06-15 16:03:09 +02:00
|
|
|
|
init = binfo_ctor_vtable (binfo);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
TREE_VALUE (l) = tree_cons (NULL_TREE, init, TREE_VALUE (l));
|
2000-05-26 01:27:18 +02:00
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* dfs_walk_real predicate for building vtables. DATA is a TREE_LIST,
|
2001-07-31 10:49:00 +02:00
|
|
|
|
VTT_MARKED_BINFO_P indicates whether marked or unmarked bases
|
|
|
|
|
should be walked. TREE_PURPOSE is the TREE_TYPE that dominates the
|
|
|
|
|
hierarchy. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
|
|
|
|
static tree
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
dfs_ctor_vtable_bases_queue_p (tree derived, int ix,
|
|
|
|
|
void* data)
|
2001-02-05 12:45:16 +01:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
tree binfo = BINFO_BASETYPE (derived, ix);
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (!BINFO_MARKED (binfo) == VTT_MARKED_BINFO_P ((tree) data))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
return binfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Called from build_vtt_inits via dfs_walk. After building constructor
|
|
|
|
|
vtables and generating the sub-vtt from them, we need to restore the
|
|
|
|
|
BINFO_VTABLES that were scribbled on. DATA is a TREE_LIST whose
|
|
|
|
|
TREE_VALUE is the TREE_TYPE of the base whose sub vtt was generated. */
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dfs_fixup_binfo_vtbls (tree binfo, void* data)
|
2000-05-22 03:08:46 +02:00
|
|
|
|
{
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_MARKED (binfo) = 0;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* We don't care about bases that don't have vtables. */
|
|
|
|
|
if (!TYPE_VFIELD (BINFO_TYPE (binfo)))
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
|
|
|
|
|
/* If we scribbled the construction vtable vptr into BINFO, clear it
|
|
|
|
|
out now. */
|
2001-06-08 13:10:29 +02:00
|
|
|
|
if (BINFO_VTABLE (binfo)
|
|
|
|
|
&& TREE_CODE (BINFO_VTABLE (binfo)) == TREE_LIST
|
2000-06-28 22:41:27 +02:00
|
|
|
|
&& (TREE_PURPOSE (BINFO_VTABLE (binfo))
|
|
|
|
|
== TREE_VALUE ((tree) data)))
|
|
|
|
|
BINFO_VTABLE (binfo) = TREE_CHAIN (BINFO_VTABLE (binfo));
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
return NULL_TREE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Build the construction vtable group for BINFO which is in the
|
|
|
|
|
hierarchy dominated by T. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_ctor_vtbl_group (tree binfo, tree t)
|
2000-05-22 03:08:46 +02:00
|
|
|
|
{
|
|
|
|
|
tree list;
|
|
|
|
|
tree type;
|
|
|
|
|
tree vtbl;
|
|
|
|
|
tree inits;
|
|
|
|
|
tree id;
|
2000-06-28 22:41:27 +02:00
|
|
|
|
tree vbase;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
2001-06-12 10:47:48 +02:00
|
|
|
|
/* See if we've already created this construction vtable group. */
|
2001-02-12 10:58:18 +01:00
|
|
|
|
id = mangle_ctor_vtbl_for_type (t, binfo);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
if (IDENTIFIER_GLOBAL_VALUE (id))
|
|
|
|
|
return;
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
my_friendly_assert (!same_type_p (BINFO_TYPE (binfo), t), 20010124);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Build a version of VTBL (with the wrong type) for use in
|
|
|
|
|
constructing the addresses of secondary vtables in the
|
|
|
|
|
construction vtable group. */
|
2000-06-12 08:43:27 +02:00
|
|
|
|
vtbl = build_vtable (t, id, ptr_type_node);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
list = build_tree_list (vtbl, NULL_TREE);
|
|
|
|
|
accumulate_vtbl_inits (binfo, TYPE_BINFO (TREE_TYPE (binfo)),
|
|
|
|
|
binfo, t, list);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
|
|
|
|
/* Add the vtables for each of our virtual bases using the vbase in T
|
|
|
|
|
binfo. */
|
|
|
|
|
for (vbase = TYPE_BINFO (BINFO_TYPE (binfo));
|
2000-06-28 22:41:27 +02:00
|
|
|
|
vbase;
|
|
|
|
|
vbase = TREE_CHAIN (vbase))
|
|
|
|
|
{
|
|
|
|
|
tree b;
|
|
|
|
|
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (vbase))
|
|
|
|
|
continue;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
b = copied_binfo (vbase, binfo);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
accumulate_vtbl_inits (b, vbase, binfo, t, list);
|
2000-06-28 22:41:27 +02:00
|
|
|
|
}
|
2000-05-23 08:31:16 +02:00
|
|
|
|
inits = TREE_VALUE (list);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
/* Figure out the type of the construction vtable. */
|
2001-06-05 13:53:28 +02:00
|
|
|
|
type = build_index_type (size_int (list_length (inits) - 1));
|
2000-05-22 03:08:46 +02:00
|
|
|
|
type = build_cplus_array_type (vtable_entry_type, type);
|
|
|
|
|
TREE_TYPE (vtbl) = type;
|
|
|
|
|
|
|
|
|
|
/* Initialize the construction vtable. */
|
2002-11-04 02:45:58 +01:00
|
|
|
|
CLASSTYPE_VTABLES (t) = chainon (CLASSTYPE_VTABLES (t), vtbl);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
initialize_array (vtbl, inits);
|
c-common.h (flag_dump_translation_unit): Remove.
* c-common.h (flag_dump_translation_unit): Remove.
(enum tree_dump_index): Define.
(TDF_ADDRESS, TDF_SLIM): New #defines.
(dump_node_to_file): Remove.
(dump_node): Make extern. Add flags.
(dump_flag, dump_enabled_p, dump_begin, dump_end,
dump_switch_p): Prototype.
* c-common.c (flag_dump_translation_unit): Remove.
* c-decl.c (c_decode_option): Remove -fdump-translation-unit
logic. Use dump_switch_p.
* c-dump.h (struct dump_info): Add node and user fields.
(dump_pointer): Declare.
* c-dump.c (dump_node): Make extern. Add flags.
(SOL_COLUMN, EOL_COLUMN, COLUMN_ALIGNMENT): New #defines.
(dump_new_line, dump_maybe_newline): Use them.
(dump_pointer): New function.
(dequeue_and_dump): Check TDF_SLIM before dumping a _DECL's
chain or function's body. Dump address, if TDF_ADDRESS set.
(dump_flag): Define.
(dump_node_to_file): Remove.
(struct dump_file_info): New struct.
(dump_files): New array.
(dump_begin, dump_end, dump_enabled_p, dump_switch_p): Define.
* c-lang.c (finish_file): Adjust dumping.
* toplev.h (dump_base_name): Make extern.
* invoke.texi: Document new flags.
cp:
* class.c (maybe_indent_hierarchy): New function.
(dump_class_hierarchy_r): Add flags. Dump extra binfo
information, if enabled. Use maybe_indent_hierarchy. Adjust
output format.
(dump_class_hierarchy): Adjust prototype. Adjust output format.
(dump_array, dump_vtable, dump_vtt): New functions.
(finish_struct_1): Adjust hierarchy dumping.
(initialize_vtable): Call dump_vtable.
(build_vtt): Call dump_vtt.
(build_ctor_vtbl_group): Call dump_vtable.
* decl2.c (flag_dump_class_layout): Remove.
(cxx_decode_option): Remove dump translation unit
and dump class hierarchy check. Call dump_switch_p.
(finish_file): Adjust dumping.
(dump.c): Only dump base classes if not TDF_SLIM.
Only dump namespace members if not TDF_SLIM.
* optimize.c (dump_function): New function.
(optimize_function): Call dump_function.
* semantics.c (expand_body): Use dump_enabled_p.
From-SVN: r42896
2001-06-05 10:03:45 +02:00
|
|
|
|
dump_vtable (t, binfo, vtbl);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* Add the vtbl initializers for BINFO (and its bases other than
|
|
|
|
|
non-virtual primaries) to the list of INITS. BINFO is in the
|
|
|
|
|
hierarchy dominated by T. RTTI_BINFO is the binfo within T of
|
|
|
|
|
the constructor the vtbl inits should be accumulated for. (If this
|
|
|
|
|
is the complete object vtbl then RTTI_BINFO will be TYPE_BINFO (T).)
|
|
|
|
|
ORIG_BINFO is the binfo for this object within BINFO_TYPE (RTTI_BINFO).
|
|
|
|
|
BINFO is the active base equivalent of ORIG_BINFO in the inheritance
|
|
|
|
|
graph of T. Both BINFO and ORIG_BINFO will have the same BINFO_TYPE,
|
|
|
|
|
but are not necessarily the same in terms of layout. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
accumulate_vtbl_inits (tree binfo,
|
|
|
|
|
tree orig_binfo,
|
|
|
|
|
tree rtti_binfo,
|
|
|
|
|
tree t,
|
|
|
|
|
tree inits)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
2000-05-22 03:08:46 +02:00
|
|
|
|
int i;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
|
|
|
|
my_friendly_assert (same_type_p (BINFO_TYPE (binfo),
|
|
|
|
|
BINFO_TYPE (orig_binfo)),
|
|
|
|
|
20000517);
|
|
|
|
|
|
2002-09-13 02:22:59 +02:00
|
|
|
|
/* If it doesn't have a vptr, we don't do anything. */
|
2001-06-12 20:08:05 +02:00
|
|
|
|
if (!TYPE_CONTAINS_VPTR_P (BINFO_TYPE (binfo)))
|
|
|
|
|
return;
|
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* If we're building a construction vtable, we're not interested in
|
|
|
|
|
subobjects that don't require construction vtables. */
|
|
|
|
|
if (ctor_vtbl_p
|
2000-06-28 22:41:27 +02:00
|
|
|
|
&& !TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo))
|
2001-02-05 12:45:16 +01:00
|
|
|
|
&& !binfo_via_virtual (orig_binfo, BINFO_TYPE (rtti_binfo)))
|
2000-05-22 03:08:46 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Build the initializers for the BINFO-in-T vtable. */
|
|
|
|
|
TREE_VALUE (inits)
|
|
|
|
|
= chainon (TREE_VALUE (inits),
|
|
|
|
|
dfs_accumulate_vtbl_inits (binfo, orig_binfo,
|
|
|
|
|
rtti_binfo, t, inits));
|
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* Walk the BINFO and its bases. We walk in preorder so that as we
|
|
|
|
|
initialize each vtable we can figure out at what offset the
|
2000-05-22 03:08:46 +02:00
|
|
|
|
secondary vtable lies from the primary vtable. We can't use
|
|
|
|
|
dfs_walk here because we need to iterate through bases of BINFO
|
|
|
|
|
and RTTI_BINFO simultaneously. */
|
|
|
|
|
for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
|
|
|
|
|
{
|
2001-02-05 12:45:16 +01:00
|
|
|
|
tree base_binfo = BINFO_BASETYPE (binfo, i);
|
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Skip virtual bases. */
|
|
|
|
|
if (TREE_VIA_VIRTUAL (base_binfo))
|
|
|
|
|
continue;
|
|
|
|
|
accumulate_vtbl_inits (base_binfo,
|
|
|
|
|
BINFO_BASETYPE (orig_binfo, i),
|
2001-02-05 12:45:16 +01:00
|
|
|
|
rtti_binfo, t,
|
2000-05-22 03:08:46 +02:00
|
|
|
|
inits);
|
|
|
|
|
}
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-07-21 02:03:21 +02:00
|
|
|
|
/* Called from accumulate_vtbl_inits. Returns the initializers for
|
|
|
|
|
the BINFO vtable. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
dfs_accumulate_vtbl_inits (tree binfo,
|
|
|
|
|
tree orig_binfo,
|
|
|
|
|
tree rtti_binfo,
|
|
|
|
|
tree t,
|
|
|
|
|
tree l)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
2000-05-22 03:08:46 +02:00
|
|
|
|
tree inits = NULL_TREE;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
tree vtbl = NULL_TREE;
|
|
|
|
|
int ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
|
|
|
|
|
|
2001-06-15 16:03:09 +02:00
|
|
|
|
if (ctor_vtbl_p
|
|
|
|
|
&& TREE_VIA_VIRTUAL (orig_binfo) && BINFO_PRIMARY_P (orig_binfo))
|
2001-02-05 12:45:16 +01:00
|
|
|
|
{
|
2001-06-15 16:03:09 +02:00
|
|
|
|
/* In the hierarchy of BINFO_TYPE (RTTI_BINFO), this is a
|
|
|
|
|
primary virtual base. If it is not the same primary in
|
|
|
|
|
the hierarchy of T, we'll need to generate a ctor vtable
|
|
|
|
|
for it, to place at its location in T. If it is the same
|
|
|
|
|
primary, we still need a VTT entry for the vtable, but it
|
|
|
|
|
should point to the ctor vtable for the base it is a
|
|
|
|
|
primary for within the sub-hierarchy of RTTI_BINFO.
|
2001-06-12 10:47:48 +02:00
|
|
|
|
|
2001-06-15 16:03:09 +02:00
|
|
|
|
There are three possible cases:
|
2001-06-12 10:47:48 +02:00
|
|
|
|
|
2001-06-15 16:03:09 +02:00
|
|
|
|
1) We are in the same place.
|
|
|
|
|
2) We are a primary base within a lost primary virtual base of
|
|
|
|
|
RTTI_BINFO.
|
2001-06-18 13:17:53 +02:00
|
|
|
|
3) We are primary to something not a base of RTTI_BINFO. */
|
2001-06-12 10:47:48 +02:00
|
|
|
|
|
2001-06-15 16:03:09 +02:00
|
|
|
|
tree b = BINFO_PRIMARY_BASE_OF (binfo);
|
|
|
|
|
tree last = NULL_TREE;
|
2001-06-08 13:10:29 +02:00
|
|
|
|
|
2001-06-15 16:03:09 +02:00
|
|
|
|
/* First, look through the bases we are primary to for RTTI_BINFO
|
|
|
|
|
or a virtual base. */
|
|
|
|
|
for (; b; b = BINFO_PRIMARY_BASE_OF (b))
|
2001-06-12 10:47:48 +02:00
|
|
|
|
{
|
2001-06-15 16:03:09 +02:00
|
|
|
|
last = b;
|
|
|
|
|
if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo)
|
|
|
|
|
break;
|
2001-06-12 10:47:48 +02:00
|
|
|
|
}
|
2001-06-15 16:03:09 +02:00
|
|
|
|
/* If we run out of primary links, keep looking down our
|
|
|
|
|
inheritance chain; we might be an indirect primary. */
|
|
|
|
|
if (b == NULL_TREE)
|
|
|
|
|
for (b = last; b; b = BINFO_INHERITANCE_CHAIN (b))
|
|
|
|
|
if (TREE_VIA_VIRTUAL (b) || b == rtti_binfo)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* If we found RTTI_BINFO, this is case 1. If we found a virtual
|
|
|
|
|
base B and it is a base of RTTI_BINFO, this is case 2. In
|
|
|
|
|
either case, we share our vtable with LAST, i.e. the
|
|
|
|
|
derived-most base within B of which we are a primary. */
|
|
|
|
|
if (b == rtti_binfo
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
|| (b && purpose_member (BINFO_TYPE (b),
|
|
|
|
|
CLASSTYPE_VBASECLASSES (BINFO_TYPE (rtti_binfo)))))
|
2001-06-18 13:17:53 +02:00
|
|
|
|
/* Just set our BINFO_VTABLE to point to LAST, as we may not have
|
|
|
|
|
set LAST's BINFO_VTABLE yet. We'll extract the actual vptr in
|
|
|
|
|
binfo_ctor_vtable after everything's been set up. */
|
|
|
|
|
vtbl = last;
|
2001-06-15 16:03:09 +02:00
|
|
|
|
|
2001-06-18 13:17:53 +02:00
|
|
|
|
/* Otherwise, this is case 3 and we get our own. */
|
2001-02-05 12:45:16 +01:00
|
|
|
|
}
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
else if (!BINFO_NEW_VTABLE_MARKED (orig_binfo))
|
2001-02-05 12:45:16 +01:00
|
|
|
|
return inits;
|
2001-06-12 10:47:48 +02:00
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
if (!vtbl)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree index;
|
|
|
|
|
int non_fn_entries;
|
|
|
|
|
|
|
|
|
|
/* Compute the initializer for this vtable. */
|
2000-05-22 03:08:46 +02:00
|
|
|
|
inits = build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo,
|
2000-05-17 00:44:17 +02:00
|
|
|
|
&non_fn_entries);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
/* Figure out the position to which the VPTR should point. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
vtbl = TREE_PURPOSE (l);
|
|
|
|
|
vtbl = build1 (ADDR_EXPR,
|
2000-05-22 03:08:46 +02:00
|
|
|
|
vtbl_ptr_type_node,
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
vtbl);
|
2001-05-21 17:55:40 +02:00
|
|
|
|
TREE_CONSTANT (vtbl) = 1;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
index = size_binop (PLUS_EXPR,
|
|
|
|
|
size_int (non_fn_entries),
|
|
|
|
|
size_int (list_length (TREE_VALUE (l))));
|
2000-05-22 03:08:46 +02:00
|
|
|
|
index = size_binop (MULT_EXPR,
|
|
|
|
|
TYPE_SIZE_UNIT (vtable_entry_type),
|
|
|
|
|
index);
|
|
|
|
|
vtbl = build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index);
|
|
|
|
|
TREE_CONSTANT (vtbl) = 1;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
}
|
2000-05-22 03:08:46 +02:00
|
|
|
|
|
2001-06-12 10:47:48 +02:00
|
|
|
|
if (ctor_vtbl_p)
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* For a construction vtable, we can't overwrite BINFO_VTABLE.
|
|
|
|
|
So, we make a TREE_LIST. Later, dfs_fixup_binfo_vtbls will
|
|
|
|
|
straighten this out. */
|
|
|
|
|
BINFO_VTABLE (binfo) = tree_cons (rtti_binfo, vtbl, BINFO_VTABLE (binfo));
|
2001-06-12 10:47:48 +02:00
|
|
|
|
else if (BINFO_PRIMARY_P (binfo) && TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
inits = NULL_TREE;
|
|
|
|
|
else
|
|
|
|
|
/* For an ordinary vtable, set BINFO_VTABLE. */
|
|
|
|
|
BINFO_VTABLE (binfo) = vtbl;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
2000-05-22 03:08:46 +02:00
|
|
|
|
return inits;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-21 17:55:40 +02:00
|
|
|
|
/* Construct the initializer for BINFO's virtual function table. BINFO
|
2000-05-17 00:44:17 +02:00
|
|
|
|
is part of the hierarchy dominated by T. If we're building a
|
2000-05-22 03:08:46 +02:00
|
|
|
|
construction vtable, the ORIG_BINFO is the binfo we should use to
|
2001-02-05 12:45:16 +01:00
|
|
|
|
find the actual function pointers to put in the vtable - but they
|
|
|
|
|
can be overridden on the path to most-derived in the graph that
|
|
|
|
|
ORIG_BINFO belongs. Otherwise,
|
2000-07-31 02:24:44 +02:00
|
|
|
|
ORIG_BINFO should be the same as BINFO. The RTTI_BINFO is the
|
2000-05-22 03:08:46 +02:00
|
|
|
|
BINFO that should be indicated by the RTTI information in the
|
|
|
|
|
vtable; it will be a base class of T, rather than T itself, if we
|
|
|
|
|
are building a construction vtable.
|
2000-05-17 00:44:17 +02:00
|
|
|
|
|
|
|
|
|
The value returned is a TREE_LIST suitable for wrapping in a
|
|
|
|
|
CONSTRUCTOR to use as the DECL_INITIAL for a vtable. If
|
|
|
|
|
NON_FN_ENTRIES_P is not NULL, *NON_FN_ENTRIES_P is set to the
|
2000-07-31 02:24:44 +02:00
|
|
|
|
number of non-function entries in the vtable.
|
|
|
|
|
|
|
|
|
|
It might seem that this function should never be called with a
|
2001-02-05 12:45:16 +01:00
|
|
|
|
BINFO for which BINFO_PRIMARY_P holds, the vtable for such a
|
2000-07-31 02:24:44 +02:00
|
|
|
|
base is always subsumed by a derived class vtable. However, when
|
2001-02-05 12:45:16 +01:00
|
|
|
|
we are building construction vtables, we do build vtables for
|
2000-07-31 02:24:44 +02:00
|
|
|
|
primary bases; we need these while the primary base is being
|
|
|
|
|
constructed. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vtbl_initializer (tree binfo,
|
|
|
|
|
tree orig_binfo,
|
|
|
|
|
tree t,
|
|
|
|
|
tree rtti_binfo,
|
|
|
|
|
int* non_fn_entries_p)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
2001-06-06 23:52:52 +02:00
|
|
|
|
tree v, b;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
tree vfun_inits;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree vbase;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vtbl_init_data vid;
|
|
|
|
|
|
|
|
|
|
/* Initialize VID. */
|
alias.c [...] (init_alias_analysis, [...]): Use memset () instead of bzero ().
* alias.c (init_alias_analysis), calls.c (expand_call,
emit_library_call_value_1), combine.c (init_reg_last_arrays),
cse.c (new_basic_block), dbxout.c (dbxout_type), diagnostic.c
(init_output_buffer, set_diagnostic_context), dwarf2out.c
(equate_decl_number_to_die, build_abbrev_table), emit-rtl.c
(init_emit_once), fold-const.c (mul_double, div_and_round_double),
function.c (assign_parms), gcse.c (compute_can_copy,
alloc_gcse_mem, alloc_reg_set_mem, record_one_set,
compute_hash_table, compute_set_hash_table,
compute_expr_hash_table), genattrtab.c (optimize_attrs), global.c
(global_alloc, global_conflicts), haifa-sched.c (compute_trg_info,
clear_units, schedule_block), integrate.c (initialize_for_inline,
expand_inline_function), jump.c (thread_jumps), local-alloc.c
(local_alloc), loop.c (combine_movables, count_loop_regs_set,
load_mems_and_recount_loop_regs_set), print-tree.c (debug_tree),
regclass.c (init_reg_sets, init_reg_sets_1, regclass,
record_reg_classes, allocate_reg_info), reload.c
(get_secondary_mem, remove_address_replacements, find_reloads),
reload1.c (reload, set_initial_label_offsets, finish_spills,
reload_as_needed, choose_reload_regs_init,
reload_cse_simplify_operands), reorg.c (dbr_schedule), sbitmap.c
(sbitmap_zero), simplify-rtx.c (simplify_plus_minus), ssa.c
(rename_registers), stmt.c (expand_end_case), unroll.c
(unroll_loop), varray.c (varray_grow), objc/objc-act.c: Use memset
() instead of bzero ().
ch:
* actions.c (check_missing_cases), typeck.c (build_chill_slice,
build_chill_cast): Use memset () instead of bzero ().
cp:
* class.c (duplicate_tag_error, build_vtbl_initializer), decl.c
(push_binding_level), error.c (cp_tree_printer), pt.c
(process_partial_specialization, tsubst_template_arg_vector),
search.c (lookup_member): Use memset () instead of bzero ().
java:
* expr.c (note_instructions), jcf-io.c (find_class), jcf-parse.c
(init_outgoing_cpool), lex.c (java_init_lex): Use memset ()
instead of bzero ().
From-SVN: r37303
2000-11-07 23:50:06 +01:00
|
|
|
|
memset (&vid, 0, sizeof (vid));
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vid.binfo = binfo;
|
|
|
|
|
vid.derived = t;
|
2001-02-27 14:12:17 +01:00
|
|
|
|
vid.rtti_binfo = rtti_binfo;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vid.last_init = &vid.inits;
|
|
|
|
|
vid.primary_vtbl_p = (binfo == TYPE_BINFO (t));
|
|
|
|
|
vid.ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
|
2002-11-04 02:45:58 +01:00
|
|
|
|
vid.generate_vcall_entries = true;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* The first vbase or vcall offset is at index -3 in the vtable. */
|
2002-06-14 02:50:34 +02:00
|
|
|
|
vid.index = ssize_int (-3 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
2000-06-12 22:46:28 +02:00
|
|
|
|
/* Add entries to the vtable for RTTI. */
|
2001-02-27 14:12:17 +01:00
|
|
|
|
build_rtti_vtbl_entries (binfo, &vid);
|
2000-06-12 22:46:28 +02:00
|
|
|
|
|
2000-08-21 06:39:29 +02:00
|
|
|
|
/* Create an array for keeping track of the functions we've
|
|
|
|
|
processed. When we see multiple functions with the same
|
|
|
|
|
signature, we share the vcall offsets. */
|
|
|
|
|
VARRAY_TREE_INIT (vid.fns, 32, "fns");
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* Add the vcall and vbase offset entries. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
build_vcall_and_vbase_vtbl_entries (binfo, &vid);
|
2000-11-15 06:07:03 +01:00
|
|
|
|
/* Clear BINFO_VTABLE_PATH_MARKED; it's set by
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
build_vbase_offset_vtbl_entries. */
|
|
|
|
|
for (vbase = CLASSTYPE_VBASECLASSES (t);
|
|
|
|
|
vbase;
|
|
|
|
|
vbase = TREE_CHAIN (vbase))
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_VTABLE_PATH_MARKED (TREE_VALUE (vbase)) = 0;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
2002-06-14 02:50:34 +02:00
|
|
|
|
/* If the target requires padding between data entries, add that now. */
|
|
|
|
|
if (TARGET_VTABLE_DATA_ENTRY_DISTANCE > 1)
|
|
|
|
|
{
|
|
|
|
|
tree cur, *prev;
|
|
|
|
|
|
|
|
|
|
for (prev = &vid.inits; (cur = *prev); prev = &TREE_CHAIN (cur))
|
|
|
|
|
{
|
|
|
|
|
tree add = cur;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 1; i < TARGET_VTABLE_DATA_ENTRY_DISTANCE; ++i)
|
2002-09-30 20:06:58 +02:00
|
|
|
|
add = tree_cons (NULL_TREE,
|
2002-10-02 00:47:09 +02:00
|
|
|
|
build1 (NOP_EXPR, vtable_entry_type,
|
|
|
|
|
null_pointer_node),
|
2002-09-30 20:06:58 +02:00
|
|
|
|
add);
|
2002-06-14 02:50:34 +02:00
|
|
|
|
*prev = add;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
if (non_fn_entries_p)
|
2000-07-31 02:24:44 +02:00
|
|
|
|
*non_fn_entries_p = list_length (vid.inits);
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
|
|
|
|
/* Go through all the ordinary virtual functions, building up
|
|
|
|
|
initializers. */
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
vfun_inits = NULL_TREE;
|
2000-05-22 03:08:46 +02:00
|
|
|
|
for (v = BINFO_VIRTUALS (orig_binfo); v; v = TREE_CHAIN (v))
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
|
|
|
|
tree delta;
|
|
|
|
|
tree vcall_index;
|
2002-12-16 19:23:00 +01:00
|
|
|
|
tree fn, fn_original;
|
2002-01-04 15:02:14 +01:00
|
|
|
|
tree init = NULL_TREE;
|
2001-02-27 14:12:17 +01:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
fn = BV_FN (v);
|
2002-12-30 14:39:48 +01:00
|
|
|
|
fn_original = fn;
|
|
|
|
|
if (DECL_THUNK_P (fn))
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
2002-12-30 14:39:48 +01:00
|
|
|
|
if (!DECL_NAME (fn))
|
|
|
|
|
finish_thunk (fn);
|
|
|
|
|
fn_original = THUNK_TARGET (fn);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* If the only definition of this function signature along our
|
|
|
|
|
primary base chain is from a lost primary, this vtable slot will
|
|
|
|
|
never be used, so just zero it out. This is important to avoid
|
|
|
|
|
requiring extra thunks which cannot be generated with the function.
|
|
|
|
|
|
2002-01-04 15:02:14 +01:00
|
|
|
|
We first check this in update_vtable_entry_for_fn, so we handle
|
|
|
|
|
restored primary bases properly; we also need to do it here so we
|
|
|
|
|
zero out unused slots in ctor vtables, rather than filling themff
|
|
|
|
|
with erroneous values (though harmless, apart from relocation
|
|
|
|
|
costs). */
|
|
|
|
|
for (b = binfo; ; b = get_primary_binfo (b))
|
|
|
|
|
{
|
|
|
|
|
/* We found a defn before a lost primary; go ahead as normal. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (look_for_overrides_here (BINFO_TYPE (b), fn_original))
|
2002-01-04 15:02:14 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* The nearest definition is from a lost primary; clear the
|
|
|
|
|
slot. */
|
|
|
|
|
if (BINFO_LOST_PRIMARY_P (b))
|
|
|
|
|
{
|
|
|
|
|
init = size_zero_node;
|
2001-06-06 23:52:52 +02:00
|
|
|
|
break;
|
2002-01-04 15:02:14 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-06-06 23:52:52 +02:00
|
|
|
|
|
2002-01-04 15:02:14 +01:00
|
|
|
|
if (! init)
|
|
|
|
|
{
|
|
|
|
|
/* Pull the offset for `this', and the function to call, out of
|
|
|
|
|
the list. */
|
|
|
|
|
delta = BV_DELTA (v);
|
2002-11-04 02:45:58 +01:00
|
|
|
|
vcall_index = BV_VCALL_INDEX (v);
|
2002-01-04 15:02:14 +01:00
|
|
|
|
|
|
|
|
|
my_friendly_assert (TREE_CODE (delta) == INTEGER_CST, 19990727);
|
|
|
|
|
my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 19990727);
|
|
|
|
|
|
|
|
|
|
/* You can't call an abstract virtual function; it's abstract.
|
|
|
|
|
So, we replace these functions with __pure_virtual. */
|
2002-12-16 19:23:00 +01:00
|
|
|
|
if (DECL_PURE_VIRTUAL_P (fn_original))
|
2002-01-04 15:02:14 +01:00
|
|
|
|
fn = abort_fndecl;
|
2002-10-25 21:39:47 +02:00
|
|
|
|
else if (!integer_zerop (delta) || vcall_index)
|
2002-12-16 19:23:00 +01:00
|
|
|
|
{
|
|
|
|
|
fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
|
|
|
|
|
if (!DECL_NAME (fn))
|
2002-12-30 14:39:48 +01:00
|
|
|
|
finish_thunk (fn);
|
2002-12-16 19:23:00 +01:00
|
|
|
|
}
|
2002-01-04 15:02:14 +01:00
|
|
|
|
/* Take the address of the function, considering it to be of an
|
|
|
|
|
appropriate generic type. */
|
2002-10-25 21:39:47 +02:00
|
|
|
|
init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
|
2002-01-04 15:02:14 +01:00
|
|
|
|
/* The address of a function can't change. */
|
2002-10-25 21:39:47 +02:00
|
|
|
|
TREE_CONSTANT (init) = 1;
|
2002-01-04 15:02:14 +01:00
|
|
|
|
}
|
2001-06-06 23:52:52 +02:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
/* And add it to the chain of initializers. */
|
2001-09-21 18:58:22 +02:00
|
|
|
|
if (TARGET_VTABLE_USES_DESCRIPTORS)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
if (init == size_zero_node)
|
|
|
|
|
for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
|
|
|
|
|
vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
|
|
|
|
|
else
|
|
|
|
|
for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
|
|
|
|
|
{
|
|
|
|
|
tree fdesc = build (FDESC_EXPR, vfunc_ptr_type_node,
|
|
|
|
|
TREE_OPERAND (init, 0),
|
|
|
|
|
build_int_2 (i, 0));
|
|
|
|
|
TREE_CONSTANT (fdesc) = 1;
|
|
|
|
|
|
|
|
|
|
vfun_inits = tree_cons (NULL_TREE, fdesc, vfun_inits);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
vfun_inits = tree_cons (NULL_TREE, init, vfun_inits);
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* The initializers for virtual functions were built up in reverse
|
|
|
|
|
order; straighten them out now. */
|
|
|
|
|
vfun_inits = nreverse (vfun_inits);
|
|
|
|
|
|
2000-06-12 22:46:28 +02:00
|
|
|
|
/* The negative offset initializers are also in reverse order. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vid.inits = nreverse (vid.inits);
|
2000-06-12 22:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* Chain the two together. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
return chainon (vid.inits, vfun_inits);
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-06 23:52:52 +02:00
|
|
|
|
/* Adds to vid->inits the initializers for the vbase and vcall
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
offsets in BINFO, which is in the hierarchy dominated by T. */
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vcall_and_vbase_vtbl_entries (tree binfo, vtbl_init_data* vid)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree b;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* If this is a derived class, we must first create entries
|
2000-06-12 22:46:28 +02:00
|
|
|
|
corresponding to the primary base class. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
b = get_primary_binfo (binfo);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
if (b)
|
2000-07-31 02:24:44 +02:00
|
|
|
|
build_vcall_and_vbase_vtbl_entries (b, vid);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
|
|
|
|
/* Add the vbase entries for this base. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
build_vbase_offset_vtbl_entries (binfo, vid);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* Add the vcall entries for this base. */
|
2000-07-31 02:24:44 +02:00
|
|
|
|
build_vcall_offset_vtbl_entries (binfo, vid);
|
2000-03-29 09:36:39 +02:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
/* Returns the initializers for the vbase offset entries in the vtable
|
|
|
|
|
for BINFO (which is part of the class hierarchy dominated by T), in
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
reverse order. VBASE_OFFSET_INDEX gives the vtable index
|
|
|
|
|
where the next vbase offset will go. */
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
|
2000-03-29 09:36:39 +02:00
|
|
|
|
{
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree vbase;
|
|
|
|
|
tree t;
|
2001-07-25 10:52:32 +02:00
|
|
|
|
tree non_primary_binfo;
|
1994-02-24 02:02:37 +01:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
/* If there are no virtual baseclasses, then there is nothing to
|
|
|
|
|
do. */
|
|
|
|
|
if (!TYPE_USES_VIRTUAL_BASECLASSES (BINFO_TYPE (binfo)))
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
return;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
t = vid->derived;
|
2001-07-25 10:52:32 +02:00
|
|
|
|
|
|
|
|
|
/* We might be a primary base class. Go up the inheritance hierarchy
|
|
|
|
|
until we find the most derived class of which we are a primary base:
|
|
|
|
|
it is the offset of that which we need to use. */
|
|
|
|
|
non_primary_binfo = binfo;
|
|
|
|
|
while (BINFO_INHERITANCE_CHAIN (non_primary_binfo))
|
|
|
|
|
{
|
|
|
|
|
tree b;
|
|
|
|
|
|
|
|
|
|
/* If we have reached a virtual base, then it must be a primary
|
|
|
|
|
base (possibly multi-level) of vid->binfo, or we wouldn't
|
|
|
|
|
have called build_vcall_and_vbase_vtbl_entries for it. But it
|
|
|
|
|
might be a lost primary, so just skip down to vid->binfo. */
|
|
|
|
|
if (TREE_VIA_VIRTUAL (non_primary_binfo))
|
|
|
|
|
{
|
|
|
|
|
non_primary_binfo = vid->binfo;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
b = BINFO_INHERITANCE_CHAIN (non_primary_binfo);
|
|
|
|
|
if (get_primary_binfo (b) != non_primary_binfo)
|
|
|
|
|
break;
|
|
|
|
|
non_primary_binfo = b;
|
|
|
|
|
}
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* Go through the virtual bases, adding the offsets. */
|
|
|
|
|
for (vbase = TYPE_BINFO (BINFO_TYPE (binfo));
|
|
|
|
|
vbase;
|
|
|
|
|
vbase = TREE_CHAIN (vbase))
|
|
|
|
|
{
|
|
|
|
|
tree b;
|
|
|
|
|
tree delta;
|
|
|
|
|
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (vbase))
|
|
|
|
|
continue;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* Find the instance of this virtual base in the complete
|
|
|
|
|
object. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
b = copied_binfo (vbase, binfo);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
|
|
|
|
/* If we've already got an offset for this virtual base, we
|
|
|
|
|
don't need another one. */
|
|
|
|
|
if (BINFO_VTABLE_PATH_MARKED (b))
|
|
|
|
|
continue;
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
BINFO_VTABLE_PATH_MARKED (b) = 1;
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
|
|
|
|
/* Figure out where we can find this vbase offset. */
|
|
|
|
|
delta = size_binop (MULT_EXPR,
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vid->index,
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
convert (ssizetype,
|
|
|
|
|
TYPE_SIZE_UNIT (vtable_entry_type)));
|
2000-07-31 02:24:44 +02:00
|
|
|
|
if (vid->primary_vtbl_p)
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
BINFO_VPTR_FIELD (b) = delta;
|
|
|
|
|
|
|
|
|
|
if (binfo != TYPE_BINFO (t))
|
|
|
|
|
{
|
|
|
|
|
/* The vbase offset had better be the same. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
my_friendly_assert (tree_int_cst_equal (delta,
|
|
|
|
|
BINFO_VPTR_FIELD (vbase)),
|
|
|
|
|
20030202);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The next vbase will come at a more negative offset. */
|
2002-06-14 02:50:34 +02:00
|
|
|
|
vid->index = size_binop (MINUS_EXPR, vid->index,
|
|
|
|
|
ssize_int (TARGET_VTABLE_DATA_ENTRY_DISTANCE));
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
|
|
|
|
|
/* The initializer is the delta from BINFO to this virtual base.
|
2000-04-16 21:45:32 +02:00
|
|
|
|
The vbase offsets go in reverse inheritance-graph order, and
|
|
|
|
|
we are walking in inheritance graph order so these end up in
|
|
|
|
|
the right order. */
|
2001-07-25 10:52:32 +02:00
|
|
|
|
delta = size_diffop (BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
*vid->last_init
|
2000-06-12 22:46:28 +02:00
|
|
|
|
= build_tree_list (NULL_TREE,
|
|
|
|
|
fold (build1 (NOP_EXPR,
|
|
|
|
|
vtable_entry_type,
|
|
|
|
|
delta)));
|
2000-07-31 02:24:44 +02:00
|
|
|
|
vid->last_init = &TREE_CHAIN (*vid->last_init);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
}
|
1994-02-24 02:02:37 +01:00
|
|
|
|
}
|
2000-03-29 09:36:39 +02:00
|
|
|
|
|
2000-08-21 06:39:29 +02:00
|
|
|
|
/* Adds the initializers for the vcall offset entries in the vtable
|
2001-06-06 23:52:52 +02:00
|
|
|
|
for BINFO (which is part of the class hierarchy dominated by VID->DERIVED)
|
|
|
|
|
to VID->INITS. */
|
2000-08-21 06:39:29 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_vcall_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
|
2000-08-21 06:39:29 +02:00
|
|
|
|
{
|
2002-11-04 02:45:58 +01:00
|
|
|
|
/* We only need these entries if this base is a virtual base. We
|
|
|
|
|
compute the indices -- but do not add to the vtable -- when
|
|
|
|
|
building the main vtable for a class. */
|
|
|
|
|
if (TREE_VIA_VIRTUAL (binfo) || binfo == TYPE_BINFO (vid->derived))
|
|
|
|
|
{
|
|
|
|
|
/* We need a vcall offset for each of the virtual functions in this
|
|
|
|
|
vtable. For example:
|
2000-08-21 06:39:29 +02:00
|
|
|
|
|
2002-11-04 02:45:58 +01:00
|
|
|
|
class A { virtual void f (); };
|
|
|
|
|
class B1 : virtual public A { virtual void f (); };
|
|
|
|
|
class B2 : virtual public A { virtual void f (); };
|
|
|
|
|
class C: public B1, public B2 { virtual void f (); };
|
2001-06-06 23:52:52 +02:00
|
|
|
|
|
2002-11-04 02:45:58 +01:00
|
|
|
|
A C object has a primary base of B1, which has a primary base of A. A
|
|
|
|
|
C also has a secondary base of B2, which no longer has a primary base
|
|
|
|
|
of A. So the B2-in-C construction vtable needs a secondary vtable for
|
|
|
|
|
A, which will adjust the A* to a B2* to call f. We have no way of
|
|
|
|
|
knowing what (or even whether) this offset will be when we define B2,
|
|
|
|
|
so we store this "vcall offset" in the A sub-vtable and look it up in
|
|
|
|
|
a "virtual thunk" for B2::f.
|
2000-08-21 06:39:29 +02:00
|
|
|
|
|
2002-11-04 02:45:58 +01:00
|
|
|
|
We need entries for all the functions in our primary vtable and
|
|
|
|
|
in our non-virtual bases' secondary vtables. */
|
|
|
|
|
vid->vbase = binfo;
|
|
|
|
|
/* If we are just computing the vcall indices -- but do not need
|
|
|
|
|
the actual entries -- not that. */
|
|
|
|
|
if (!TREE_VIA_VIRTUAL (binfo))
|
|
|
|
|
vid->generate_vcall_entries = false;
|
|
|
|
|
/* Now, walk through the non-virtual bases, adding vcall offsets. */
|
|
|
|
|
add_vcall_offset_vtbl_entries_r (binfo, vid);
|
|
|
|
|
}
|
2000-08-21 06:39:29 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Build vcall offsets, starting with those for BINFO. */
|
|
|
|
|
|
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
add_vcall_offset_vtbl_entries_r (tree binfo, vtbl_init_data* vid)
|
2000-08-21 06:39:29 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
tree primary_binfo;
|
|
|
|
|
|
|
|
|
|
/* Don't walk into virtual bases -- except, of course, for the
|
2001-06-06 23:52:52 +02:00
|
|
|
|
virtual base for which we are building vcall offsets. Any
|
|
|
|
|
primary virtual base will have already had its offsets generated
|
|
|
|
|
through the recursion in build_vcall_and_vbase_vtbl_entries. */
|
2000-08-21 06:39:29 +02:00
|
|
|
|
if (TREE_VIA_VIRTUAL (binfo) && vid->vbase != binfo)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* If BINFO has a primary base, process it first. */
|
|
|
|
|
primary_binfo = get_primary_binfo (binfo);
|
|
|
|
|
if (primary_binfo)
|
|
|
|
|
add_vcall_offset_vtbl_entries_r (primary_binfo, vid);
|
|
|
|
|
|
|
|
|
|
/* Add BINFO itself to the list. */
|
|
|
|
|
add_vcall_offset_vtbl_entries_1 (binfo, vid);
|
|
|
|
|
|
|
|
|
|
/* Scan the non-primary bases of BINFO. */
|
|
|
|
|
for (i = 0; i < BINFO_N_BASETYPES (binfo); ++i)
|
|
|
|
|
{
|
|
|
|
|
tree base_binfo;
|
|
|
|
|
|
|
|
|
|
base_binfo = BINFO_BASETYPE (binfo, i);
|
|
|
|
|
if (base_binfo != primary_binfo)
|
|
|
|
|
add_vcall_offset_vtbl_entries_r (base_binfo, vid);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 12:45:16 +01:00
|
|
|
|
/* Called from build_vcall_offset_vtbl_entries_r. */
|
1996-07-11 03:13:25 +02:00
|
|
|
|
|
2000-08-21 06:39:29 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
add_vcall_offset_vtbl_entries_1 (tree binfo, vtbl_init_data* vid)
|
1994-02-24 02:02:37 +01:00
|
|
|
|
{
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* Make entries for the rest of the virtuals. */
|
|
|
|
|
if (abi_version_at_least (2))
|
2000-06-23 03:14:40 +02:00
|
|
|
|
{
|
2002-11-08 03:16:48 +01:00
|
|
|
|
tree orig_fn;
|
2000-07-31 02:24:44 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* The ABI requires that the methods be processed in declaration
|
|
|
|
|
order. G++ 3.2 used the order in the vtable. */
|
|
|
|
|
for (orig_fn = TYPE_METHODS (BINFO_TYPE (binfo));
|
|
|
|
|
orig_fn;
|
|
|
|
|
orig_fn = TREE_CHAIN (orig_fn))
|
|
|
|
|
if (DECL_VINDEX (orig_fn))
|
2002-11-14 17:59:23 +01:00
|
|
|
|
add_vcall_offset (orig_fn, binfo, vid);
|
2002-11-08 03:16:48 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree derived_virtuals;
|
|
|
|
|
tree base_virtuals;
|
|
|
|
|
tree orig_virtuals;
|
|
|
|
|
/* If BINFO is a primary base, the most derived class which has
|
|
|
|
|
BINFO as a primary base; otherwise, just BINFO. */
|
|
|
|
|
tree non_primary_binfo;
|
|
|
|
|
|
|
|
|
|
/* We might be a primary base class. Go up the inheritance hierarchy
|
|
|
|
|
until we find the most derived class of which we are a primary base:
|
|
|
|
|
it is the BINFO_VIRTUALS there that we need to consider. */
|
|
|
|
|
non_primary_binfo = binfo;
|
|
|
|
|
while (BINFO_INHERITANCE_CHAIN (non_primary_binfo))
|
2000-07-31 02:24:44 +02:00
|
|
|
|
{
|
2002-11-08 03:16:48 +01:00
|
|
|
|
tree b;
|
|
|
|
|
|
|
|
|
|
/* If we have reached a virtual base, then it must be vid->vbase,
|
|
|
|
|
because we ignore other virtual bases in
|
|
|
|
|
add_vcall_offset_vtbl_entries_r. In turn, it must be a primary
|
|
|
|
|
base (possibly multi-level) of vid->binfo, or we wouldn't
|
|
|
|
|
have called build_vcall_and_vbase_vtbl_entries for it. But it
|
|
|
|
|
might be a lost primary, so just skip down to vid->binfo. */
|
|
|
|
|
if (TREE_VIA_VIRTUAL (non_primary_binfo))
|
|
|
|
|
{
|
|
|
|
|
if (non_primary_binfo != vid->vbase)
|
|
|
|
|
abort ();
|
|
|
|
|
non_primary_binfo = vid->binfo;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2000-07-31 02:24:44 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
b = BINFO_INHERITANCE_CHAIN (non_primary_binfo);
|
|
|
|
|
if (get_primary_binfo (b) != non_primary_binfo)
|
|
|
|
|
break;
|
|
|
|
|
non_primary_binfo = b;
|
|
|
|
|
}
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
if (vid->ctor_vtbl_p)
|
|
|
|
|
/* For a ctor vtable we need the equivalent binfo within the hierarchy
|
|
|
|
|
where rtti_binfo is the most derived type. */
|
Change base class access representation.
* tree.h (TREE_VIA_PUBLIC, TREE_VIA_PROTECTED,
TREE_VIA_PRIVATE): Remove.
(BINFO_BASEACCESSES): New binfo elt.
(BINFO_BASEACCESS): New accessor.
(BINFO_ELTS): Increase.
(TI_ACCESS_PUBLIC, TI_ACCESS_PROTECTED, TI_ACCESS_PRIVATE): New.
(access_public_node, access_protected_node,
access_private_node): New global nodes.
* tree.c (build_common_tree_nodes_2): Initialize access nodes.
* dbxout.c (dbxout_type): Adjust.
* dwarf2out.c (gen_inheritance_die): Add access parameter.
(gen_member_die): Adjust.
* dwarfout.c (output_inheritance_die): ARG is array of two trees.
(output_type): Adjust.
* tree-dump.c (dequeue_and_dump): Adjust binfo dumping.
Change base class access representation. Share virtual base
binfos.
* cp/call.c (build_special_member_call): Remove binfo_for_vbase
call.
* cp/class.c (build_base_path): Likewise.
(build_primary_vtable): Adjust BINFO_NEW_VTABLE_MARKED use.
(build_secondary_vtable): Remove FOR_TYPE arg. Adjust.
(make_new_vtable): Adjust.
(force_canonical_binfo_r): Delete.
(force_canonical_binfo): Delete.
(mark_primary_virtual_base): Delete.
(dfs_unshared_virtual_bases): Delete.
(mark_primary_bases): Adjust.
(maybe_warn_about_overly_private_class): Adjust.
(dfs_base_derived_from): Delete.
(base_derived_from): Follow the inheritance chain.
(struct find_final_overrider_data): Add vpath member.
(dfs_find_final_overrider): Adjust.
(dfs_find_final_overrider_q, dfs_find_final_overrider_post): New.
(find_final_overrider): Adjust.
(update_vtable_entry_for_fn): Adjust.
(modify_all_vtables): Adjust.
(walk_subobject_offsets): Adjust.
(layout_nonempty_base_or_field): Adjust.
(layout_empty_base): Remove last parameter. Adjust.
(build_base_field): Adjust.
(build_base_fields): Adjust.
(propagate_binfo_offsets): Remove last parameter. Adjust.
(dfs_set_offset_for_unshared_vbases): Delete.
(layout_virtual_bases): Adjust.
(finish_struct_1): Adjust.
(init_class_processing): Don't init access nodes.
(dfs_get_primary_binfo): Delete.
(get_primary_binfo): Adjust.
(dump_class_hierarchy_r): Remove most derived arg, add IGO
parameter. Adjust.
(dump_class_hierarchy): Adjust.
(finish_vtbls): Adjust.
(get_original_base): Delete.
(build_vtt_inits): Adjust.
(dfs_build_secondary_vptr_vtt_inits): Adjust.
(dfs_ctor_vtable_bases_queue_p): Adjust.
(build_ctor_vtbl_group): Adjust.
(dfs_accumulate_vtbl_inits): Adjust.
(build_vtbl_initializer): Adjust.
(build_vbase_offset_vtbl_entries): Adjust.
(add_vcall_offset_vtbl_entries_1): Adjust.
* cp/cp-tree.h (CPTI_ACCESS_*): Remove.
(access_*_node): Remove.
(CANONICAL_BINFO): Delete.
(BINFO_UNSHARED_MARKED): Remove.
(BINFO_MARKED): Set LANG_FLAG_0 directly.
(SET_BINFO_MARKED, CLEAR_BINFO_MARKED): Delete.
(BINFO_VTABLE_PATH_MARKED): Set LANG_FLAG_3 directly.
(SET_BINFO_VTABLE_PATH_MARKED, CLEAR_BINFO_VTABLE_PATH_MARKED):
Delete.
(BINFO_NEW_VTABLE_MARKED): Set LANG_FLAG_4 directly.
(SET_BINFO_NEW_VTABLE_MARKED): Adjust.
(SET_BINFO_PUSHDECLS_MARKED, CLEAR_BINFO_PUSHDECLS_MARKED):
Delete.
(BINFO_DEPENDENT_BASE_P): New.
(dfs_walk, dfs_walk_real): Queue function takes derived binfo and
index.
(markedp, unmarkedp): Adjust.
(dfs_unmarked_real_bases_queue_p, dfs_marked_real_bases_queue_p,
dfs_skip_vbases, marked_vtable_pathp, unmarked_vtable_pathp,
find_vbase_instance, binfo_for_vbase): Delete.
(copied_binfo, original_binfo): Declare.
(finish_base_specifier): Add virtual_p arg.
(unshare_base_binfos): Delete.
(copy_base_binfos): Declare.
(reverse_path): Delete.
* cp/decl.c (xref_basetypes): Access and virtuality passed
differently. Don't copy direct base binfos here. Call
copy_base_binfos.
* cp/init.c (dfs_initialize_vtbl_ptrs): Adjust.
(initialize_vtbl_ptrs): Adjust.
(expand_member_init): Adjust.
* cp/parser.c (cp_parser_base_specifier): Adjust.
* cp/pt.c (instantiate_class_template): Adjust.
(get_template_base_recursive): Adjust.
* cp/rtti.c (get_pseudo_ti_init): Adjust.
(get_pseudo_ti_desc): Adjust.
* cp/tree.c (unshare_base_binfos): Rename to ...
(copy_base_binfos): ... here, reimplement.
(make_binfo): Set BINFO_DEPENDENT_BASE_P.
(reverse_path): Remove.
* cp/typeck.c (get_delta_difference): Adjust error messages.
* cp/semantics.c (finish_base_specifier): Add virtual arg, adjust.
* cp/search.c (lookup_base_r): Adjust.
(dynamic_cast_base_recurse): Adjust.
(canonical_binfo): Remove.
(dfs_canonical_queue): Remove.
(dfs_assert_unmarked_p): Remove.
(assert_canonical_unmarked): Remove.
(shared_marked_p, shared_unmarked_p): Remove.
(BINFO_ACCESS, SET_BINFO_ACCESS): Use TREE_PUBLIC & TREE_PRIVATE.
(dfs_access_in_type): Adjust.
(access_in_type): Adjust.
(dfs_accessible_queue_p): Adjust.
(dfs_accessible_p): Adjust.
(is_subobject_of_p_1, is_subobject_of_p): Remove.
(struct lookup_field_info): Remove from_dep_base_p field.
(lookup_field_queue_p): Adjust, test BINFO_DEPENDENT_BASE_P.
(lookup_field_r): Remove dependent base code.
(lookup_member): Likewise.
(dfs_walk, dfs_walk_real): Add access arg to queue fn.
(dfs_unmarked_real_bases_queue_p): Remove.
(dfs_marked_real_bases_queue_p): Remove.
(dfs_skip_vbases): Remove.
(dfs_get_pure_virtuals): Adjust.
(markedp, unmarkedp): Adjust.
(marked_vtable_pathp, unmarked_vtable_pathp): Remove.
(marked_pushdecls_p, unmarked_pushdecls_p): Adjust.
(dfs_unmark): Adjust.
(dfs_get_vbase_types):Remove.
(dfs_build_inheritance_graph_order): Remove.
(get_vbase_types): Remove
(dfs_find_vbase_instance): Remove.
(find_vbase_instance): Remove.
(dfs_debug_unmarkedp): Adjust.
(dependent_base_p): Remove.
(dfs_push_type_decls): Adjust.
(dfs_push_decls): Adjust.
(dfs_no_overlap_yet): Adjust.
(copied_binfo): New function.
(original_binfo): New function.
(binfo_for_vbase): Remove.
Change base class access representation.
* java/class.c (set_super_info): Don't set TREE_VIA_PUBLIC.
(add_interface_do): Likewise.
From-SVN: r63172
2003-02-20 18:51:46 +01:00
|
|
|
|
non_primary_binfo
|
|
|
|
|
= original_binfo (non_primary_binfo, vid->rtti_binfo);
|
2002-11-08 03:16:48 +01:00
|
|
|
|
|
|
|
|
|
for (base_virtuals = BINFO_VIRTUALS (binfo),
|
|
|
|
|
derived_virtuals = BINFO_VIRTUALS (non_primary_binfo),
|
|
|
|
|
orig_virtuals = BINFO_VIRTUALS (TYPE_BINFO (BINFO_TYPE (binfo)));
|
|
|
|
|
base_virtuals;
|
|
|
|
|
base_virtuals = TREE_CHAIN (base_virtuals),
|
|
|
|
|
derived_virtuals = TREE_CHAIN (derived_virtuals),
|
|
|
|
|
orig_virtuals = TREE_CHAIN (orig_virtuals))
|
|
|
|
|
{
|
|
|
|
|
tree orig_fn;
|
2001-02-27 14:12:17 +01:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* Find the declaration that originally caused this function to
|
|
|
|
|
be present in BINFO_TYPE (binfo). */
|
|
|
|
|
orig_fn = BV_FN (orig_virtuals);
|
2000-06-12 22:46:28 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* When processing BINFO, we only want to generate vcall slots for
|
|
|
|
|
function slots introduced in BINFO. So don't try to generate
|
|
|
|
|
one if the function isn't even defined in BINFO. */
|
|
|
|
|
if (!same_type_p (DECL_CONTEXT (orig_fn), BINFO_TYPE (binfo)))
|
|
|
|
|
continue;
|
2000-08-21 06:39:29 +02:00
|
|
|
|
|
2002-11-14 17:59:23 +01:00
|
|
|
|
add_vcall_offset (orig_fn, binfo, vid);
|
2002-11-08 03:16:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-08-21 06:39:29 +02:00
|
|
|
|
|
2002-11-14 17:59:23 +01:00
|
|
|
|
/* Add a vcall offset entry for ORIG_FN to the vtable. */
|
2000-08-21 06:39:29 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
static void
|
2002-11-14 17:59:23 +01:00
|
|
|
|
add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
|
2002-11-08 03:16:48 +01:00
|
|
|
|
{
|
|
|
|
|
size_t i;
|
|
|
|
|
tree vcall_offset;
|
2000-06-12 22:46:28 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* If there is already an entry for a function with the same
|
|
|
|
|
signature as FN, then we do not need a second vcall offset.
|
|
|
|
|
Check the list of functions already present in the derived
|
|
|
|
|
class vtable. */
|
|
|
|
|
for (i = 0; i < VARRAY_ACTIVE_SIZE (vid->fns); ++i)
|
|
|
|
|
{
|
|
|
|
|
tree derived_entry;
|
2000-05-17 00:44:17 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
derived_entry = VARRAY_TREE (vid->fns, i);
|
|
|
|
|
if (same_signature_p (derived_entry, orig_fn)
|
|
|
|
|
/* We only use one vcall offset for virtual destructors,
|
|
|
|
|
even though there are two virtual table entries. */
|
|
|
|
|
|| (DECL_DESTRUCTOR_P (derived_entry)
|
|
|
|
|
&& DECL_DESTRUCTOR_P (orig_fn)))
|
|
|
|
|
return;
|
|
|
|
|
}
|
2000-04-16 21:45:32 +02:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* If we are building these vcall offsets as part of building
|
|
|
|
|
the vtable for the most derived class, remember the vcall
|
|
|
|
|
offset. */
|
|
|
|
|
if (vid->binfo == TYPE_BINFO (vid->derived))
|
|
|
|
|
CLASSTYPE_VCALL_INDICES (vid->derived)
|
|
|
|
|
= tree_cons (orig_fn, vid->index,
|
|
|
|
|
CLASSTYPE_VCALL_INDICES (vid->derived));
|
2002-11-04 02:45:58 +01:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* The next vcall offset will be found at a more negative
|
|
|
|
|
offset. */
|
|
|
|
|
vid->index = size_binop (MINUS_EXPR, vid->index,
|
|
|
|
|
ssize_int (TARGET_VTABLE_DATA_ENTRY_DISTANCE));
|
|
|
|
|
|
|
|
|
|
/* Keep track of this function. */
|
|
|
|
|
VARRAY_PUSH_TREE (vid->fns, orig_fn);
|
|
|
|
|
|
|
|
|
|
if (vid->generate_vcall_entries)
|
|
|
|
|
{
|
|
|
|
|
tree base;
|
|
|
|
|
tree fn;
|
2002-11-04 02:45:58 +01:00
|
|
|
|
|
2002-11-08 03:16:48 +01:00
|
|
|
|
/* Find the overriding function. */
|
2002-11-14 17:59:23 +01:00
|
|
|
|
fn = find_final_overrider (vid->rtti_binfo, binfo, orig_fn);
|
2002-11-08 03:16:48 +01:00
|
|
|
|
if (fn == error_mark_node)
|
|
|
|
|
vcall_offset = build1 (NOP_EXPR, vtable_entry_type,
|
|
|
|
|
integer_zero_node);
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-11-14 17:59:23 +01:00
|
|
|
|
base = TREE_VALUE (fn);
|
|
|
|
|
|
|
|
|
|
/* The vbase we're working on is a primary base of
|
|
|
|
|
vid->binfo. But it might be a lost primary, so its
|
|
|
|
|
BINFO_OFFSET might be wrong, so we just use the
|
|
|
|
|
BINFO_OFFSET from vid->binfo. */
|
|
|
|
|
vcall_offset = size_diffop (BINFO_OFFSET (base),
|
|
|
|
|
BINFO_OFFSET (vid->binfo));
|
2002-11-04 02:45:58 +01:00
|
|
|
|
vcall_offset = fold (build1 (NOP_EXPR, vtable_entry_type,
|
|
|
|
|
vcall_offset));
|
|
|
|
|
}
|
2003-07-05 05:02:05 +02:00
|
|
|
|
/* Add the initializer to the vtable. */
|
2002-11-08 03:16:48 +01:00
|
|
|
|
*vid->last_init = build_tree_list (NULL_TREE, vcall_offset);
|
|
|
|
|
vid->last_init = &TREE_CHAIN (*vid->last_init);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
}
|
1998-04-01 19:05:25 +02:00
|
|
|
|
}
|
1998-09-09 04:14:55 +02:00
|
|
|
|
|
2003-07-05 05:02:05 +02:00
|
|
|
|
/* Return vtbl initializers for the RTTI entries corresponding to the
|
2000-05-17 00:44:17 +02:00
|
|
|
|
BINFO's vtable. The RTTI entries should indicate the object given
|
2001-02-27 14:12:17 +01:00
|
|
|
|
by VID->rtti_binfo. */
|
1998-09-09 04:14:55 +02:00
|
|
|
|
|
2000-06-12 22:46:28 +02:00
|
|
|
|
static void
|
2003-01-23 03:47:51 +01:00
|
|
|
|
build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
|
1998-09-09 04:14:55 +02:00
|
|
|
|
{
|
2000-03-29 09:36:39 +02:00
|
|
|
|
tree b;
|
2000-05-17 00:44:17 +02:00
|
|
|
|
tree t;
|
2000-03-29 09:36:39 +02:00
|
|
|
|
tree basetype;
|
|
|
|
|
tree offset;
|
|
|
|
|
tree decl;
|
|
|
|
|
tree init;
|
1998-09-09 04:14:55 +02:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
basetype = BINFO_TYPE (binfo);
|
2001-02-27 14:12:17 +01:00
|
|
|
|
t = BINFO_TYPE (vid->rtti_binfo);
|
1998-09-09 04:14:55 +02:00
|
|
|
|
|
2000-03-29 09:36:39 +02:00
|
|
|
|
/* To find the complete object, we will first convert to our most
|
|
|
|
|
primary base, and then add the offset in the vtbl to that value. */
|
|
|
|
|
b = binfo;
|
2001-02-05 12:45:16 +01:00
|
|
|
|
while (CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (b))
|
|
|
|
|
&& !BINFO_LOST_PRIMARY_P (b))
|
1998-09-09 04:14:55 +02:00
|
|
|
|
{
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
tree primary_base;
|
|
|
|
|
|
2000-07-31 02:24:44 +02:00
|
|
|
|
primary_base = get_primary_binfo (b);
|
2001-02-05 12:45:16 +01:00
|
|
|
|
my_friendly_assert (BINFO_PRIMARY_BASE_OF (primary_base) == b, 20010127);
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
b = primary_base;
|
1998-09-09 04:14:55 +02:00
|
|
|
|
}
|
2001-02-27 14:12:17 +01:00
|
|
|
|
offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
|
2001-02-18 21:31:44 +01:00
|
|
|
|
/* The second entry is the address of the typeinfo object. */
|
|
|
|
|
if (flag_rtti)
|
2003-03-03 22:55:25 +01:00
|
|
|
|
decl = build_address (get_tinfo_decl (t));
|
2000-03-29 09:36:39 +02:00
|
|
|
|
else
|
2001-02-18 21:31:44 +01:00
|
|
|
|
decl = integer_zero_node;
|
|
|
|
|
|
|
|
|
|
/* Convert the declaration to a type that can be stored in the
|
|
|
|
|
vtable. */
|
2003-03-03 22:55:25 +01:00
|
|
|
|
init = build_nop (vfunc_ptr_type_node, decl);
|
2000-07-31 02:24:44 +02:00
|
|
|
|
*vid->last_init = build_tree_list (NULL_TREE, init);
|
|
|
|
|
vid->last_init = &TREE_CHAIN (*vid->last_init);
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
|
Correct many new ABI issues regarding vbase and vcall offset layout.
Correct many new ABI issues regarding vbase and vcall offset
layout.
* cp-tree.h (BINFO_VTABLE): Document.
(struct lang_type): Tweak formatting.
(BINFO_PRIMARY_BINFO): Add to documentation.
(CLASSTYPE_VSIZE): Fix typo in comment.
(CLASSTYPE_VBASECLASSES): Update documentation.
(BINFO_VBASE_MARKED): Remove.
(SET_BINFO_VBASE_MARKED): Likewise.
(CLEAR_BINFO_VBASE_MARKED): Likewise.
(BINFO_FIELDS_MARKED): Remove.
(SET_BINFO_FIELDS_MARKED): Likewise.
(CLEAR_BINFO_FIELDS_MARKED): Likewise.
(enum access_kind): New enumeration.
(num_extra_vtbl_entries): Remove declaration.
(size_extra_vtbl_entries): Likewise.
(get_vtbl_decl_for_binfo): New function.
(dfs_vbase_unmark): Remove declaration.
(mark_primary_bases): Likewise.
* class.c (SAME_FN): Remove.
(struct vcall_offset_data_s): Move definition.
(build_vbase_pointer): Use `build', not `build_binary_op', to
access the vbase pointer under the new ABI.
(build_vtable_entry_ref): Use get_vtbl_decl_for_binfo.
(build_primary_vtable): Likewise.
(dfs_mark_primary_bases): Move here from search.c.
(mark_primary_bases): Likewise.
(determine_primary_bases): Under the new ABI, don't make a base
class a primary base just because we don't yet have any virtual
functions.
(layout_vtable_decl): Use get_vtbl_decl_for_binfo.
(num_vfun_entries): Remove.
(dfs_count_virtuals): Likewise.
(num_extra_vtbl_entries): Likewise.
(size_extra_vtbl_entries): Likewise.
(layout_virtual_bases): Iterate in inheritance graph order under
the new ABI.
(finish_struct_1): Use TYPE_VFIELD, not CLASSTYPE_VSIZE, to
indicate that a vfield is present.
(init_class_processing): Initialize access_public_node, etc., from
ak_public, etc.
(get_vtbl_decl_for_binfo): New function.
(dump_class_hierarchy_r): Likewise.
(dump_class_hierarchy): Use it.
(finish_vtbls): Build the vtbls in inheritance graph order.
(dfs_finish_vtbls): Adjust call to build_vtbl_initializer.
(initialize_vtable): Use get_vtbl_decl_for_binfo.
(accumulate_vtbl_inits): Add comments explaining why a pre-order
walk is required.
(dfs_accumulate_vtbl_inits): Set BINFO_VTABLE to the location
where the vptr points, even for primary vtables.
(build_vtbl_initializer): Adjust handling of vbase and vcall
offsets.
(build_vcall_and_vbase_vtable_entries): New function.
(dfs_build_vbase_offset_vtbl_entries): Remove.
(build_vbase_offset_vtbl_entries): Reimplement.
(dfs_build_vcall_offset_vtbl_entries): Don't include virtuals that
were already handled in a primary base class vtable.
(build_vcall_offset_vtbl_entries): Adjust.
(build_rtti_vtbl_entries): Adjust.
* decl2.c (output_vtable_inherit): Use get_vtbl_decl_for_binfo.
* init.c (expand_virtual_init): Simplify.
* repo.c (repo_get_id): Use get_vtbl_decl_for_binfo.
* rtti.c (create_pseudo_type_info): Adjust calculation of vptr.
* search.c (BINFO_ACCESS): New macro.
(SET_BINFO_ACCESS): Likewise.
(dfs_access_in_type): Manipulate access_kinds, not access nodes.
(access_in_type): Likewise.
(dfs_accessible_p): Likewise.
(protected_accessible_p): Likewise.
(lookup_fnfields_1): Adjust documentation.
(dfs_mark_primary_bases): Move to class.c
(mark_primary_bases): Likewise.
(dfs_vbase_unmark): Remove.
(virtual_context): Use BINFO_FOR_VBASE.
(dfs_get_vbase_types): Simplify.
(dfs_build_inheritance_graph_order): New function.
(get_vbase_types): Use it.
* tree.c (debug_binfo): Use get_vtbl_decl_for_binfo.
* tinfo.cc (get_vbase_offset): New function.
(__vmi_class_type_info::do_find_public_src): Use it.
(__vmi_class_type_info::do_dyncast): Likewise.
(__vmi_class_type_info::do_upcast): Likewise.
From-SVN: r32905
2000-04-04 20:13:22 +02:00
|
|
|
|
/* Add the offset-to-top entry. It comes earlier in the vtable that
|
2001-07-21 11:42:21 +02:00
|
|
|
|
the the typeinfo entry. Convert the offset to look like a
|
|
|
|
|
function pointer, so that we can put it in the vtable. */
|
2003-03-03 22:55:25 +01:00
|
|
|
|
init = build_nop (vfunc_ptr_type_node, offset);
|
2001-07-21 11:42:21 +02:00
|
|
|
|
*vid->last_init = build_tree_list (NULL_TREE, init);
|
|
|
|
|
vid->last_init = &TREE_CHAIN (*vid->last_init);
|
tinfo.h (__class_type_info): Fix illegal declaration.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
* tinfo.h (__class_type_info): Fix illegal declaration.
* cp-tree.def (TEMPLATE_ID_EXPR): Update comment.
* cp-tree.h (INHERITED_VALUE_BINDING_P): New macro.
(IDENTIFIER_CLASS_VALUE): Improve documentation.
(is_properly_derived_from): Declare.
(invalidate_class_lookup_cache): Likewise.
(maybe_maybe_note_name_used_in_class): Likewise.
(note_name_declared_in_class): Likewise.
(push_using_decl): Remove duplicate declaration.
(id_in_current_class): Remove declaration.
(push_class_binding): Change prototype.
(clear_identitifer_class_values): Declare.
* call.c (is_properly_derived_from): Make it global.
(build_new_function_call): Be careful about updating candidates.
(build_new_method_call): Handle COMPONENT_REFs. Don't crash when
asked to make illegal calls.
* class.c: Include splay-tree.h.
(class_stack_node): Add names_used slot.
(check_member_decl_is_same_in_complete_scope): Remove.
(add_method): Fix comment. Push the declaration into class
scope.
(finish_struct_1): When popping the class, pop the bindings too.
Remove check for data member/function member conflict.
(finish_struct): Remove calls to
check_member_decl_is_same_in_complete_scope. Change calls to
popclass.
(pushclass): Clear names_used in the class stack entry.
Use invalidate_class_lookup_cache to remove cached entries, rather
than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE
before entering a new class. Remove dead code. Don't mess with
current_function_decl when pushing declarations.
(invalidate_class_lookup_cache): New function, split out from ...
(popclass): Here. Clean up names_used on our way out.
(instantiate_type): Adjust.
(build_self_reference): Don't push the declaration here.
(maybe_note_name_used_in_class): New function.
(note_name_declared_in_class): Likewise.
* decl.c (add_binding): Change prototype.
(find_class_binding_level): New function.
(innermost_nonclass_level): Likewise.
(current_binding_level): Update documentation.
(inner_binding_level): Remove. Replace with current_binding_level
throughout.
(push_binding_level): Remove special handling of
class_binding_level.
(pop_binding_level): Likewise. Use find_class_binding_level.
(suspend_binding_level): Likewise.
(global_bindings_p): Use innermost_nonclass_level.
(toplevel_bindings_p): Likewise.
(namespace_bindings_p): Likewise.
(pseudo_global_level_p): Likewise.
(push_binding): Clear INHERITED_VALUE_BINDING_P.
(add_binding): Check for illegal multiple declarations. Return a
value indicating whether or not the new binding was legal.
(push_local_binding): Skip over class binding levels. Check
return value from add_binding.
(push_class_binding): Set INHERITED_VALUE_BINDING_P. Call
note_name_declared_in_class.
(pushlevel_class): Remove "fake out the rest of the compiler"
code.
(poplevel_class): Reset IDENTIFIER_CLASS_VALUEs.
(clear_identifier_class_values): New function.
(pop_from_top_level): Use it.
(pop_everything): Tweak.
(maybe_process_template_type_declaration): Don't push the
declaration for the template here.
(pushtag): Don't push tag declarations into class scope here.
(pushdecl): Apply DeMorgan's law for readability.
(pushdecl_class_level): Remove special-case code for
TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions.
(push_class_level_bindng): Deal with inherited bindings.
(lookup_name_real): Remove special-case code for
TYPE_BEING_DEFINED, and some implicit typename magic.
(grokdeclarator): Handle COMPONENT_REF for a template function.
(build_enumerator): Don't call pushdecl_class_level here.
(id_in_current_class): Remove.
* decl2.c (grokfield): Don't call pushdecl_class_level or
check_template_shadow.
* errfn.c (cp_file_of): Don't declare.
(cp_line_of): Likewise.
* error.c (dump_decl): Handle an OVERLOAD.
(cp_file_of): Likewise.
(cp_line_of): Likewise.
* init.c (build_member_call): Handle a COMPONENT_REF.
* lex.c (do_identifier): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* method.c (hack_identifier): Build COMPONENT_REFs for references
to member templates as well as member functions. Remove dead
code.
* parse.y (left_curly): Remove.
(nonnested_type): Call maybe_note_name_used_in_class, not
pushdecl_class_level.
* parse.c: Regenerated.
(nested_name_specifier_1): Likewise.
* pt.c (check_explicit_specialization): Adjust, for robustness.
(check_template_shadow): Handle OVERLOADs.
(build_template_decl): Set DECL_CONSTRUCTOR_P on the
TEMPLATE_DECL, if appropriate.
* search.c (envelope_add_decl): Remove.
(dfs_pushdecls): Likewise.
(dfs_compress_decls): Likewise.
(dfs_push_decls): New function.
(dfs_push_type_decls): Likewise.
(setup_class_bindings): Likewise.
(template_self_reference_p): Likewise.
(lookup_field_r): Use it.
(looup_member): Remove old comment. Deal with ambiguity.
(push_class_decls): Use dfs_push_decls and dfs_push_type_decls,
and remove envelope processing.
* semantics.c (begin_class_definition): Let pushclass push
declarations for base classes.
(finish_member_declaration): Push declarations into class scope.
* typeck.c (build_component_ref): Just put an OVERLOAD into the
COMPONENT_REF, not a TREE_LIST of an OVERLOAD.
(build_x_function_call): Deal with OVERLOAD. Handle template-ids.
* Makefile.in (class.o): Depend on splay-tree.h.
From-SVN: r26133
1999-04-02 17:36:57 +02:00
|
|
|
|
}
|