gcc/gcc/cp/search.c

2871 lines
80 KiB
C
Raw Normal View History

1994-02-24 02:02:37 +01:00
/* Breadth-first and depth-first routines for
searching multiple-inheritance lattice for GNU C++.
Copyright (C) 1987-2017 Free Software Foundation, Inc.
1994-02-24 02:02:37 +01:00
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
1994-02-24 02:02:37 +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 3, or (at your option)
1994-02-24 02:02:37 +01:00
any later version.
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
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
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"
#include "system.h"
#include "coretypes.h"
1994-02-24 02:02:37 +01:00
#include "cp-tree.h"
#include "intl.h"
#include "toplev.h"
#include "spellcheck-tree.h"
1994-02-24 02:02:37 +01:00
static int is_subobject_of_p (tree, tree);
static tree dfs_lookup_base (tree, void *);
static tree dfs_dcast_hint_pre (tree, void *);
static tree dfs_dcast_hint_post (tree, void *);
static tree dfs_debug_mark (tree, void *);
static int check_hidden_convs (tree, int, int, tree, tree, tree);
static tree split_conversions (tree, tree, tree, tree);
static int lookup_conversions_r (tree, int, int,
tree, tree, tree, tree, tree *, tree *);
static int look_for_overrides_r (tree, tree);
static tree lookup_field_r (tree, void *);
static tree dfs_accessible_post (tree, void *);
static tree dfs_walk_once_accessible (tree, bool,
tree (*pre_fn) (tree, void *),
tree (*post_fn) (tree, void *),
void *data);
static tree dfs_access_in_type (tree, void *);
static access_kind access_in_type (tree, tree);
static tree dfs_get_pure_virtuals (tree, void *);
1994-02-24 02:02:37 +01:00
/* Variables for gathering statistics. */
static int n_fields_searched;
static int n_calls_lookup_field, n_calls_lookup_field_1;
static int n_calls_lookup_fnfields, n_calls_lookup_fnfields_1;
static int n_calls_get_base_type;
static int n_outer_fields_searched;
static int n_contexts_saved;
/* Data for lookup_base and its workers. */
struct lookup_base_data_s
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
{
tree t; /* type being searched. */
tree base; /* The base type we're looking for. */
tree binfo; /* Found binfo. */
bool via_virtual; /* Found via a virtual path. */
bool ambiguous; /* Found multiply ambiguous */
bool repeated_base; /* Whether there are repeated bases in the
hierarchy. */
bool want_any; /* Whether we want any matching binfo. */
};
/* Worker function for lookup_base. See if we've found the desired
base and update DATA_ (a pointer to LOOKUP_BASE_DATA_S). */
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
static tree
dfs_lookup_base (tree binfo, void *data_)
{
struct lookup_base_data_s *data = (struct lookup_base_data_s *) data_;
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), data->base))
{
if (!data->binfo)
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
{
data->binfo = binfo;
data->via_virtual
= binfo_via_virtual (data->binfo, data->t) != NULL_TREE;
if (!data->repeated_base)
/* If there are no repeated bases, we can stop now. */
return binfo;
if (data->want_any && !data->via_virtual)
/* If this is a non-virtual base, then we can't do
better. */
return binfo;
return dfs_skip_bases;
}
else
{
gcc_assert (binfo != data->binfo);
/* We've found more than one matching binfo. */
if (!data->want_any)
{
/* This is immediately ambiguous. */
data->binfo = NULL_TREE;
data->ambiguous = true;
return error_mark_node;
}
/* Prefer one via a non-virtual path. */
if (!binfo_via_virtual (binfo, data->t))
{
data->binfo = binfo;
data->via_virtual = false;
return binfo;
}
/* There must be repeated bases, otherwise we'd have stopped
on the first base we found. */
return dfs_skip_bases;
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
}
}
return NULL_TREE;
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
}
/* Returns true if type BASE is accessible in T. (BASE is known to be
a (possibly non-proper) base class of T.) If CONSIDER_LOCAL_P is
true, consider any special access of the current scope, or access
bestowed by friendship. */
bool
accessible_base_p (tree t, tree base, bool consider_local_p)
{
tree decl;
/* [class.access.base]
A base class is said to be accessible if an invented public
member of the base class is accessible.
If BASE is a non-proper base, this condition is trivially
true. */
if (same_type_p (t, base))
return true;
/* Rather than inventing a public member, we use the implicit
public typedef created in the scope of every class. */
decl = TYPE_FIELDS (base);
while (!DECL_SELF_REFERENCE_P (decl))
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
decl = DECL_CHAIN (decl);
while (ANON_AGGR_TYPE_P (t))
t = TYPE_CONTEXT (t);
return accessible_p (t, decl, consider_local_p);
}
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
/* Lookup BASE in the hierarchy dominated by T. Do access checking as
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
ACCESS specifies. Return the binfo we discover. If KIND_PTR is
non-NULL, fill with information about what kind of base we
discovered.
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
If the base is inaccessible, or ambiguous, then error_mark_node is
returned. If the tf_error bit of COMPLAIN is not set, no error
is issued. */
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
tree
lookup_base (tree t, tree base, base_access access,
base_kind *kind_ptr, tsubst_flags_t complain)
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
{
tree binfo;
tree t_binfo;
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
base_kind bk;
/* "Nothing" is definitely not derived from Base. */
if (t == NULL_TREE)
{
if (kind_ptr)
*kind_ptr = bk_not_base;
return NULL_TREE;
}
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
if (t == error_mark_node || base == error_mark_node)
{
if (kind_ptr)
*kind_ptr = bk_not_base;
return error_mark_node;
}
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TYPE_P (base));
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
if (!TYPE_P (t))
{
t_binfo = t;
t = BINFO_TYPE (t);
}
else
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
2004-07-12 18:06:40 +02:00
{
t = complete_type (TYPE_MAIN_VARIANT (t));
t_binfo = TYPE_BINFO (t);
}
base = TYPE_MAIN_VARIANT (base);
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
2004-07-12 18:06:40 +02:00
/* If BASE is incomplete, it can't be a base of T--and instantiating it
might cause an error. */
if (t_binfo && CLASS_TYPE_P (base) && COMPLETE_OR_OPEN_TYPE_P (base))
{
struct lookup_base_data_s data;
data.t = t;
data.base = base;
data.binfo = NULL_TREE;
data.ambiguous = data.via_virtual = false;
data.repeated_base = CLASSTYPE_REPEATED_BASE_P (t);
data.want_any = access == ba_any;
dfs_walk_once (t_binfo, dfs_lookup_base, NULL, &data);
binfo = data.binfo;
if (!binfo)
bk = data.ambiguous ? bk_ambig : bk_not_base;
else if (binfo == t_binfo)
bk = bk_same_type;
else if (data.via_virtual)
bk = bk_via_virtual;
else
bk = bk_proper_base;
}
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
2004-07-12 18:06:40 +02:00
else
{
binfo = NULL_TREE;
bk = bk_not_base;
}
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
/* Check that the base is unambiguous and accessible. */
if (access != ba_any)
switch (bk)
{
case bk_not_base:
break;
case bk_ambig:
if (complain & tf_error)
error ("%qT is an ambiguous base of %qT", base, t);
binfo = error_mark_node;
break;
default:
if ((access & ba_check_bit)
/* If BASE is incomplete, then BASE and TYPE are probably
the same, in which case BASE is accessible. If they
are not the same, then TYPE is invalid. In that case,
there's no need to issue another error here, and
there's no implicit typedef to use in the code that
follows, so we skip the check. */
&& COMPLETE_TYPE_P (base)
&& !accessible_base_p (t, base, !(access & ba_ignore_scope)))
{
if (complain & tf_error)
error ("%qT is an inaccessible base of %qT", base, t);
binfo = error_mark_node;
bk = bk_inaccessible;
}
break;
}
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
if (kind_ptr)
*kind_ptr = bk;
re PR c++/3145 (virtual inheritance still creates wrong code) cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
2001-11-25 14:21:45 +01:00
return binfo;
}
/* Data for dcast_base_hint walker. */
1999-09-21 16:40:13 +02:00
struct dcast_data_s
1999-09-21 16:40:13 +02:00
{
tree subtype; /* The base type we're looking for. */
int virt_depth; /* Number of virtual bases encountered from most
derived. */
tree offset; /* Best hint offset discovered so far. */
bool repeated_base; /* Whether there are repeated bases in the
hierarchy. */
};
/* Worker for dcast_base_hint. Search for the base type being cast
from. */
static tree
dfs_dcast_hint_pre (tree binfo, void *data_)
{
struct dcast_data_s *data = (struct dcast_data_s *) data_;
if (BINFO_VIRTUAL_P (binfo))
data->virt_depth++;
if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), data->subtype))
1999-09-21 16:40:13 +02:00
{
if (data->virt_depth)
{
data->offset = ssize_int (-1);
return data->offset;
}
if (data->offset)
data->offset = ssize_int (-3);
1999-09-21 16:40:13 +02:00
else
data->offset = BINFO_OFFSET (binfo);
return data->repeated_base ? dfs_skip_bases : data->offset;
1999-09-21 16:40:13 +02:00
}
return NULL_TREE;
}
/* Worker for dcast_base_hint. Track the virtual depth. */
static tree
dfs_dcast_hint_post (tree binfo, void *data_)
{
struct dcast_data_s *data = (struct dcast_data_s *) data_;
if (BINFO_VIRTUAL_P (binfo))
data->virt_depth--;
return NULL_TREE;
1999-09-21 16:40:13 +02:00
}
/* The dynamic cast runtime needs a hint about how the static SUBTYPE type
started from is related to the required TARGET type, in order to optimize
the inheritance graph search. This information is independent of the
1999-09-21 16:40:13 +02:00
current context, and ignores private paths, hence get_base_distance is
inappropriate. Return a TREE specifying the base offset, BOFF.
BOFF >= 0, there is only one public non-virtual SUBTYPE base at offset BOFF,
and there are no public virtual SUBTYPE bases.
BOFF == -1, SUBTYPE occurs as multiple public virtual or non-virtual bases.
BOFF == -2, SUBTYPE is not a public base.
BOFF == -3, SUBTYPE occurs as multiple public non-virtual bases. */
1999-09-21 16:40:13 +02:00
tree
dcast_base_hint (tree subtype, tree target)
1999-09-21 16:40:13 +02:00
{
struct dcast_data_s data;
data.subtype = subtype;
data.virt_depth = 0;
data.offset = NULL_TREE;
data.repeated_base = CLASSTYPE_REPEATED_BASE_P (target);
dfs_walk_once_accessible (TYPE_BINFO (target), /*friends=*/false,
dfs_dcast_hint_pre, dfs_dcast_hint_post, &data);
return data.offset ? data.offset : ssize_int (-2);
1999-09-21 16:40:13 +02:00
}
/* Search for a member with name NAME in a multiple inheritance
lattice specified by TYPE. If it does not exist, return NULL_TREE.
1994-02-24 02:02:37 +01:00
If the member is ambiguously referenced, return `error_mark_node'.
Otherwise, return a DECL with the indicated name. If WANT_TYPE is
true, type declarations are preferred. */
1994-02-24 02:02:37 +01:00
/* Do a 1-level search for NAME as a member of TYPE. The caller must
figure out whether it can access this field. (Since it is only one
level, this is reasonable.) */
1996-07-11 03:13:25 +02:00
tree
lookup_field_1 (tree type, tree name, bool want_type)
1994-02-24 02:02:37 +01:00
{
tree field;
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
gcc_assert (identifier_p (name));
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM
|| TREE_CODE (type) == TYPENAME_TYPE)
/* The TYPE_FIELDS of a TEMPLATE_TYPE_PARM and
BOUND_TEMPLATE_TEMPLATE_PARM are not fields at all;
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
instead TYPE_FIELDS is the TEMPLATE_PARM_INDEX. (Miraculously,
the code often worked even when we treated the index as a list
of fields!)
The TYPE_FIELDS of TYPENAME_TYPE is its TYPENAME_TYPE_FULLNAME. */
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
return NULL_TREE;
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
if (CLASSTYPE_SORTED_FIELDS (type))
{
cp-tree.h (struct lang_decl): Overhaul. * cp-tree.h (struct lang_decl): Overhaul. (struct lang_decl_flags): Remove. (struct lang_decl_base): New. (struct lang_decl_min): New. (struct lang_decl_fn): New. (struct lang_decl_ns): New. (CAN_HAVE_FULL_LANG_DECL_P): Replace with LANG_DECL_HAS_MIN. (LANG_DECL_MIN_CHECK): New. (LANG_DECL_FN_CHECK): New. (LANG_DECL_NS_CHECK): New. (STRIP_TEMPLATE): New. (NON_THUNK_FUNCTION_CHECK): Remove. (DECL_DECLARES_FUNCTION_P): New. (lots): Adjust. * lex.c (retrofit_lang_decl, cxx_dup_lang_specific_decl): Adjust. * decl.c (push_local_name, duplicate_decls): Adjust. * decl2.c (start_objects): Don't set u2sel. * semantics.c (finish_omp_threadprivate): Adjust. * class.c (build_clone): Don't do much on TEMPLATE_DECLs. (decl_cloned_function_p): Out-of-line implementation of macros. (clone_function_decl, adjust_clone_args): Use DECL_CLONED_FUNCTION_P. * mangle.c (write_unqualified_name): Don't check function flags on non-functions. * method.c (make_alias_for): Don't set DECL_CLONED_FUNCTION. * pt.c (build_template_decl): Don't set function flags. (check_default_tmpl_args): Check that it's a function. (instantiate_template): Use DECL_ABSTRACT_ORIGIN to find the cloned template. * pt.c (tsubst_decl) [FUNCTION_DECL]: Don't tsubst DECL_CLONED_FUNCTION. * cp-tree.h (struct lang_type_class): Move sorted_fields here. * class.c (finish_struct_1): Adjust. * ptree.c (cxx_print_decl, cxx_print_type): Adjust. * search.c (lookup_field_1): Adjust. * cp-tree.h (CLASSTYPE_INLINE_FRIENDS): Remove. * decl.c (finish_method): Don't add to it. * class.c (fixup_pending_inline): Remove. (fixup_inline_methods): Remove. (finish_struct_1): Don't call it. * error.c (dump_function_name): Handle null name. From-SVN: r149217
2009-07-04 02:43:26 +02:00
tree *fields = &CLASSTYPE_SORTED_FIELDS (type)->elts[0];
int lo = 0, hi = CLASSTYPE_SORTED_FIELDS (type)->len;
int i;
while (lo < hi)
{
i = (lo + hi) / 2;
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_fields_searched++;
if (DECL_NAME (fields[i]) > name)
hi = i;
else if (DECL_NAME (fields[i]) < name)
lo = i + 1;
else
{
field = NULL_TREE;
/* We might have a nested class and a field with the
same name; we sorted them appropriately via
field_decl_cmp, so just look for the first or last
field with this name. */
if (want_type)
{
do
field = fields[i--];
while (i >= lo && DECL_NAME (fields[i]) == name);
if (!DECL_DECLARES_TYPE_P (field))
field = NULL_TREE;
}
else
{
do
field = fields[i++];
while (i < hi && DECL_NAME (fields[i]) == name);
}
if (field)
{
field = strip_using_decl (field);
if (is_overloaded_fn (field))
field = NULL_TREE;
}
return field;
}
}
return NULL_TREE;
}
Support for friend templates. * typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. From-SVN: r18198
1998-02-23 04:17:44 +01:00
field = TYPE_FIELDS (type);
1994-02-24 02:02:37 +01:00
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_calls_lookup_field_1++;
tree.h (DECL_CHAIN): Define. gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. From-SVN: r162223
2010-07-15 16:31:28 +02:00
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
1994-02-24 02:02:37 +01:00
{
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
tree decl = field;
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_fields_searched++;
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (DECL_P (field));
1994-02-24 02:02:37 +01:00
if (DECL_NAME (field) == NULL_TREE
&& ANON_AGGR_TYPE_P (TREE_TYPE (field)))
1994-02-24 02:02:37 +01:00
{
tree temp = lookup_field_1 (TREE_TYPE (field), name, want_type);
1994-02-24 02:02:37 +01:00
if (temp)
return temp;
}
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
if (TREE_CODE (decl) == USING_DECL
&& DECL_NAME (decl) == name)
cp-tree.h (IDENTIFIER_VALUE): Remove. * cp-tree.h (IDENTIFIER_VALUE): Remove. (BINFO_PUSHDECLS_MARKED): Likewise. (maybe_inject_for_scope_var): Likewise. (push_class_decls): Likewise. * name-lookup.h (push_class_binding): Remove. (innermost_non_namespace_value): New function. (outer_binding): Likewise. * class.c (add_method): Push bindings before adding to TYPE_METHODS. (restore_class_cache): Do not restore class_shadowed. (pushclass): Do not add USING_DECLs. Do not call push_class_decls. * config-lang.in (gtfiles): Remove $(srcdir)/cp/search.c. * decl.c (pushdecl): Use outer_binding. (poplevel): Set the scope for an out-of-scope for-loop declaration appropriately. (cp_finish_decl): Don't call maybe_inject_for_scope_var. * name-lookup.c (new_class_binding): New function. (push_binding): Use it. (pushdecl): Use innermost_non_namespace_value. (maybe_inject_for_scope_var): Remove. (push_class_binding): Remove. (set_inherited_value_binding_p): New function. (get_class_binding): New function. (push_class_level_binding): Assert that the current_class_type is being defined. (outer_binding): New function. (innermost_non_namespace_value): Likewise. (lookup_name_real): Use outer_binding. (lookup_name_current_level): Ignore out-of-scope variables. * pt.c (check_template_shadow): Use innermost_non_namespace_value. (lookup_template_class): Likewise. * search.c (dfs_push_type_decls): Remove. (dfs_push_decls): Likewise. (setup_class_bindings): Likewise. (lookup_field_1): Handle USING_DECLs from dependent scopes. (marked_pushdecls_p): Remove. (unmarked_pushdecls_p): Remove. (marked_identifiers): Remove. (setup_class_bindings): Remove. (dfs_push_type_decls): Remove. (dfs_push_decls): Remove. (push_class_decls): Remove. From-SVN: r84689
2004-07-14 17:34:30 +02:00
{
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
decl = strip_using_decl (decl);
if (is_overloaded_fn (decl))
cp-tree.h (IDENTIFIER_VALUE): Remove. * cp-tree.h (IDENTIFIER_VALUE): Remove. (BINFO_PUSHDECLS_MARKED): Likewise. (maybe_inject_for_scope_var): Likewise. (push_class_decls): Likewise. * name-lookup.h (push_class_binding): Remove. (innermost_non_namespace_value): New function. (outer_binding): Likewise. * class.c (add_method): Push bindings before adding to TYPE_METHODS. (restore_class_cache): Do not restore class_shadowed. (pushclass): Do not add USING_DECLs. Do not call push_class_decls. * config-lang.in (gtfiles): Remove $(srcdir)/cp/search.c. * decl.c (pushdecl): Use outer_binding. (poplevel): Set the scope for an out-of-scope for-loop declaration appropriately. (cp_finish_decl): Don't call maybe_inject_for_scope_var. * name-lookup.c (new_class_binding): New function. (push_binding): Use it. (pushdecl): Use innermost_non_namespace_value. (maybe_inject_for_scope_var): Remove. (push_class_binding): Remove. (set_inherited_value_binding_p): New function. (get_class_binding): New function. (push_class_level_binding): Assert that the current_class_type is being defined. (outer_binding): New function. (innermost_non_namespace_value): Likewise. (lookup_name_real): Use outer_binding. (lookup_name_current_level): Ignore out-of-scope variables. * pt.c (check_template_shadow): Use innermost_non_namespace_value. (lookup_template_class): Likewise. * search.c (dfs_push_type_decls): Remove. (dfs_push_decls): Likewise. (setup_class_bindings): Likewise. (lookup_field_1): Handle USING_DECLs from dependent scopes. (marked_pushdecls_p): Remove. (unmarked_pushdecls_p): Remove. (marked_identifiers): Remove. (setup_class_bindings): Remove. (dfs_push_type_decls): Remove. (dfs_push_decls): Remove. (push_class_decls): Remove. From-SVN: r84689
2004-07-14 17:34:30 +02:00
continue;
}
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
if (DECL_NAME (decl) == name
&& (!want_type || DECL_DECLARES_TYPE_P (decl)))
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
return decl;
1994-02-24 02:02:37 +01:00
}
/* Not found. */
Get ready for garbage collection. * Makefile.in (CXX_TREE_H): Add varray.h (lex.o): Depend on ggc.h. (decl.o): Likewise. (decl2.o): Likewise. (method.o): Likewise. (search.o): Likewise. (pt.o): Likewise. (repo.o): Likewise. * class.c: Include ggc.h. (current_class_name): Remove. (current_class_type): Likewise. (current_access_specifier): Likewise. (previous_class_type): Likewise. (previous_class_values): Likewise. (class_cache_firstobj): Likewise. (current_lang_base): Likewise. (current_lang_stack): Likewise. (current_lang_stacksize): Likewise. (lang_name_c): Likewise. (lang_name_cplusplus): Likewise. (lang_name_java): Likewise. (current_lang_name): Likewise. (base_layout_decl): Likewise. (access_default_node): Likewise. (access_public_node): Likewise. (access_protected_node): Likewise. (access_private_node): Likewise. (access_default_virtual_node): Likewise. (access_public_virtual_node): Likewise. (access_protected_virtual_node): Likewise. (access_private_virtual_node): Likewise. (signed_zero_node): Likewise. (init_class_processing): Don't build base_layout_decl. (push_lang_context): Adjust now that current_lang_base is a varray. (pop_lang_context): Likewise. * cp-tree.h: Include varray.h. (cp_global_trees): Add access_default, access_public, access_protected, access_private, access_default_virtual, access_public_virtual, access_protected_virtual, access_private_virtual, ctor_identifier, delta2_identifier, delta_identifier, dtor_identifier, in_charge_identifier, index_identifier, nelts_identifier, this_identifier, pfn_identifier, pfn_or_delta2_identifier, vptr_identifier, lang_name_c, lang_name_cplusplus, lang_name_java, empty_except_spec, null, jclass, minus_one, terminate. (saved_scope): Move here from decl.c. Define globals in terms of saved_scope: current_namespace, current_class_name, current_class_type, current_access_specifier, current_lang_stack, current_lang_base, current_lang_name, current_function_parms, current_template_parms, processing_template_decl, processing_specialization, processing_explicit_instantiation, previous_class_type, previous_class_values, class_cache_firstobj. (scope_chain): New variable. (init_pt): New function. * decl.c (current_namespace): Remove. (this_identifier, in_charge_identifier, ctor_identifier): Likewise. (dtor_identifier, pfn_identifier, index_identifier): Likewise. (delta_identifier, delta2_identifier): Likewise. (pfn_or_delta2_identifier, tag_identifier): Likewise (vt_off_identifier, empty_except_spec, null_node): Likewise. (current_function_parms, current_lang_base): Remove. (current_lang_stack, previous_class_values): Remove. (class_binding_level): Macroize. (saved_scope): Remove. (current_saved_scope): Rename to scope_chain. (mark_saved_scope): Adjust for new scope structure. (maybe_push_to_top_level): Likewise. (pop_from_top_level): Likewise. (duplicate_decls): Adjust now that current_lang_base is a varray. (build_typename_type): Call ggc_add_tree_hash_table_root. (init_decl_processing): Call init_pt. Call push_to_top_level to set up globals. Add GC roots. (xref_basetypes): Adjust now that current_lang_base is a varray. * decl.h (this_identifier): Remove. (in_charge_identifier): Likewise. * decl2.c: Don't include varray.h. (current_namespace): Remove. (init_decl2): Add GC roots. * except.c (Terminate): Remove. (init_exception_processing): Use terminate_node instead. (build_terminate_handler): Likewise. * init.c (nc_nelts_field_id): Remove. (minus_one): Likewise. (init_init_processing): Use minus_one_node and nelts_identifier instead. Add GC roots. (jclass_node): Remove. (build_new_1): Use nelts_identifier. (build_vec_init): Likewise. (build_vec_delete): Likewise. * lex.c: Include ggc.h. (defarg_fn): Move declaration early. (defarg_parms): Likewise. (init_parse): Add GC roots. (handle_cp_pragma): Remove redundant declaration of pending_vtables. * method.c: Include ggc.h. (btypelist): Make it a varray. All uses changed. (ktypelist): Likewise. (init_method): Add GC roots. * pt.c: Don't include varray.h. Include ggc.h. (current_template_parms): Remove. (processing_template_decl): Likewise. (processing_specialization): Likewise. (processing_explicit_instantiation): Likewise. (init_pt): New function. * repo.c: Include ggc.h. (init_repo): Add GC roots. * search.c: Don't include varray.h. (_vptr_name): Remove. (lookup_field_1): Use vtpr_identifier instead. (expand_indirect_vtbls_init): Remove redundant declaration of in_charge_identifier. (init_search_processing): Use vptr_identifier. From-SVN: r29135
1999-09-06 04:43:09 +02:00
if (name == vptr_identifier)
1994-02-24 02:02:37 +01:00
{
/* Give the user what s/he thinks s/he wants. */
if (TYPE_POLYMORPHIC_P (type))
return TYPE_VFIELD (type);
1994-02-24 02:02:37 +01:00
}
return NULL_TREE;
}
/* Return the FUNCTION_DECL, RECORD_TYPE, UNION_TYPE, or
NAMESPACE_DECL corresponding to the innermost non-block scope. */
tree
current_scope (void)
{
/* There are a number of cases we need to be aware of here:
current_class_type current_function_decl
1996-07-11 03:13:25 +02:00
global NULL NULL
fn-local NULL SET
class-local SET NULL
class->fn SET SET
fn->class SET SET
Those last two make life interesting. If we're in a function which is
itself inside a class, we need decls to go into the fn's decls (our
second case below). But if we're in a class and the class itself is
inside a function, we need decls to go into the decls for the class. To
achieve this last goal, we must see if, when both current_class_ptr and
current_function_decl are set, the class was declared inside that
function. If so, we know to put the decls into the class's scope. */
if (current_function_decl && current_class_type
&& ((DECL_FUNCTION_MEMBER_P (current_function_decl)
&& same_type_p (DECL_CONTEXT (current_function_decl),
current_class_type))
|| (DECL_FRIEND_CONTEXT (current_function_decl)
&& same_type_p (DECL_FRIEND_CONTEXT (current_function_decl),
current_class_type))))
1994-02-24 02:02:37 +01:00
return current_function_decl;
if (current_class_type)
return current_class_type;
if (current_function_decl)
1994-02-24 02:02:37 +01:00
return current_function_decl;
return current_namespace;
1994-02-24 02:02:37 +01:00
}
/* Returns nonzero if we are currently in a function scope. Note
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
that this function returns zero if we are within a local class, but
not within a member function body of the local class. */
int
at_function_scope_p (void)
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
{
tree cs = current_scope ();
/* Also check cfun to make sure that we're really compiling
this function (as opposed to having set current_function_decl
for access checking or some such). */
return (cs && TREE_CODE (cs) == FUNCTION_DECL
&& cfun && cfun->decl == current_function_decl);
cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.def (DECL_STMT): Make it smaller. * cp-tree.h (lang_decl_flags): Move saved_tree to ... (lang_decl): ... here. Add next. (DECL_SAVED_TREE): Adjust accordingly. (DECL_IMPLICIT_TYPEDEF_P): New macro. (SET_DECL_IMPLICIT_TYPEDEF_P): Likewise. (DECL_STMT_DECL): Likewise. (create_implicit_typedef): New function. (maybe_push_decl): Likewise. (tsubst_default_argument): New function. (at_function_scope_p): Likewise. (add_decl_stmt): Likewise. (push_permanent_obstack): Likewise. * call.c (convert_default_arg): Use tsubst_default_argument. * class.c (add_method): Use push_permanent_obstack. (build_self_reference): Create a TEMPLATE_DECL for the self-reference, if necessary. * decl.c (pseudo_global_level_p): Only look at the current binding level. (push_binding): Use push_permanent_obstack. (create_implicit_typedef): New function. (pushtag): Use it. (duplicate_decls): Use push_permanent_obstack. (maybe_push_decl): New function. (start_decl): Use it. Remove dead code. Use add_decl_stmt. (start_decl_1): Remove dead code. (cp_finish_decl): Remove DECL_STMT handling here. Don't use pseudo_global_level_p. (grokvardecl): Create DECL_LANG_SPECIFIC for a VAR_DECL in a template. (grokdeclarator): Likewise, for TYPE_DECLs. Don't use pseudo_global_level_p. * decl2.c (grokfield): Call push_template_decl for a TYPE_DECL in a template. (get_sentry): Use push_permanent_obstack. * dump.c (dequeue_and_dump): Enable DECL_STMT. * except.c (call_eh_info): Use push_permanent_obstack. (build_eh_type_ref): Likewise. (do_pop_exception): Likewise. (expand_eh_spec): Likewise. (alloc_eh_object): Likewise. (expand_throw): Likewise. * init.c (build_java_class_ref): Likewise. * lex.c (get_time_identifier): Likewise. (free_lang_decl_chain): Correct type. (retrofit_lang_decl): Adjust accordingly. (build_lang_field_decl): Likewise. * lex.h (free_lang_decl_chain): Likewise. * parse.y (lang_extdef): Don't use pseudo_global_level_p. * parse.c: Regenerated. * pt.c (tsubst_default_arguments): New function. (retrieve_local_specialization): Likewise. (register_local_specialization): Likewise. (push_template_decl_real): Use DECL_IMPLICIT_TYPEDEF_P. Just use pseudo_global_level_p to determine whether or not a template is primary. (lookup_template_class): Likewise. Use create_implicit_typedef. (instantiate_class_template): Call tsubst_default_arguments for member functions, if appropriate. (tsubst_default_argument): New function. (tsubst_decl): Use it. Change TYPE_DECL handling to match VAR_DECLs. * search.c (at_function_scope_p): New function. * semantics.c (finish_asm_stmt): Use push_permanent_obstack. (finish_label_stmt): Likewise. (add_decl_stmt): New function. (begin_class_definition): Likewise. (finish_typeof): Likewise. * tree.c (copy_template_template_parm): Likewise. (copy_to_permanent): Likewise. (push_permanent_obstack): Define. (mark_addressable): Use it. * typeck.c (mark_addressable): Likewise. From-SVN: r28709
1999-08-14 11:23:49 +02:00
}
/* Returns true if the innermost active scope is a class scope. */
bool
at_class_scope_p (void)
{
tree cs = current_scope ();
return cs && TYPE_P (cs);
}
/* Returns true if the innermost active scope is a namespace scope. */
bool
at_namespace_scope_p (void)
{
tree cs = current_scope ();
return cs && TREE_CODE (cs) == NAMESPACE_DECL;
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Return the scope of DECL, as appropriate when doing name-lookup. */
1994-02-24 02:02:37 +01:00
tree
context_for_name_lookup (tree decl)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
/* [class.union]
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
For the purposes of name lookup, after the anonymous union
definition, the members of the anonymous union are considered to
have been defined in the scope in which the anonymous union is
declared. */
tree context = DECL_CONTEXT (decl);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
while (context && TYPE_P (context)
&& (ANON_AGGR_TYPE_P (context) || UNSCOPED_ENUM_P (context)))
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
context = TYPE_CONTEXT (context);
if (!context)
context = global_namespace;
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return context;
}
1994-02-24 02:02:37 +01:00
/* Returns true iff DECL is declared in TYPE. */
static bool
member_declared_in_type (tree decl, tree type)
{
/* A normal declaration obviously counts. */
if (context_for_name_lookup (decl) == type)
return true;
/* So does a using or access declaration. */
if (DECL_LANG_SPECIFIC (decl) && !DECL_DISCRIMINATOR_P (decl)
&& purpose_member (type, DECL_ACCESS (decl)))
return true;
return 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
/* The accessibility routines use BINFO_ACCESS for scratch space
during the computation of the accessibility of some declaration. */
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
/* Avoid walking up past a declaration of the member. */
static tree
dfs_access_in_type_pre (tree binfo, void *data)
{
tree decl = (tree) data;
tree type = BINFO_TYPE (binfo);
if (member_declared_in_type (decl, type))
return dfs_skip_bases;
return NULL_TREE;
}
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
#define BINFO_ACCESS(NODE) \
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
((access_kind) ((TREE_PUBLIC (NODE) << 1) | TREE_PRIVATE (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
/* Set the access associated with NODE to ACCESS. */
#define SET_BINFO_ACCESS(NODE, ACCESS) \
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_PUBLIC (NODE) = ((ACCESS) & 2) != 0), \
(TREE_PRIVATE (NODE) = ((ACCESS) & 1) != 0))
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
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Called from access_in_type via dfs_walk. Calculate the access to
DATA (which is really a DECL) in BINFO. */
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
static tree
dfs_access_in_type (tree binfo, void *data)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
tree decl = (tree) data;
tree type = 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
access_kind access = ak_none;
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
if (context_for_name_lookup (decl) == type)
1994-02-24 02:02:37 +01:00
{
/* If we have descended to the scope of DECL, just note the
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
appropriate access. */
if (TREE_PRIVATE (decl))
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
access = ak_private;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
else if (TREE_PROTECTED (decl))
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
access = ak_protected;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
else
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
access = ak_public;
1994-02-24 02:02:37 +01:00
}
else
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
/* First, check for an access-declaration that gives us more
access to the DECL. */
2001-03-23 13:04:11 +01:00
if (DECL_LANG_SPECIFIC (decl) && !DECL_DISCRIMINATOR_P (decl))
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +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
tree decl_access = purpose_member (type, DECL_ACCESS (decl));
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 (decl_access)
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
{
decl_access = TREE_VALUE (decl_access);
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 (decl_access == access_public_node)
access = ak_public;
else if (decl_access == access_protected_node)
access = ak_protected;
else if (decl_access == access_private_node)
access = ak_private;
else
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_unreachable ();
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
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
}
if (!access)
{
int i;
tree base_binfo;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *accesses;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Otherwise, scan our baseclasses, and pick the most favorable
access. */
tree.h (TYPE_BINFO_OFFSET, [...]): Remove. * tree.h (TYPE_BINFO_OFFSET, TYPE_BINFO_VTABLE, TYPE_BINFO_VIRTUALS, TYPE_BINFO_BASETYPES, TYPE_BINFO_BASETYPE): Remove. (BINFO_BASETYPES, BINFO_N_BASETYPES, BINFO_BASETYPE): Rename to ... (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): ... here. (BINFO_BASEACCESSES, BINFO_BASEACCESS): Rename to ... (BINFO_BASE_ACCESSES, BINFO_BASE_ACCESS): ... here. (BINFO_INHERITANCE_CHAIN): Redocument as it is actually used. (struct tree_binfo): Rename base_types to base_binfos. * alias.c (record_component_aliases): Adjust BINFO macros. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * cp/cp-tree.h (CLASSTYPE_N_BASECLASSES): Remove. * cp/class.c (build_primary_vtable, check_bases, determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, dfs_find_final_overrider_q, get_basefndecls, warn_hidden, walk_subobject_offsets, build_base_fields, create_vtable_ptr, propagate_binfo_offsets, layout_virtual_bases, end_of_class, warn_about_ambiguous_bases, finish_struct_1, get_vfield_name, contains_empty_class_p, dump_class_hierarchy_r, finish_vtbls, build_vtt_inits, dfs_ctor_vtable_bases_queue_p, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r, cp_fold_obj_type_ref): Adjust BINFO macros. * cp/decl.c (xref_basetypes): Likewise. * cp/dump.c (cp_dump_tree): Likewise. * cp/error.c (dump_expr): Likewise. * cp/init.c (sort_mem_initializers, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor, do_build_assign_reg, synthesize_exception_spec): Likewise. * cp/name-lookup.c (arg_assoc_class): * cp/pt.c (instantiate_class_template, tsubst, get_template_base_recursive): * cp/ptree.c (cxx_print_type): * cp/rtti.c (get_psuedo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, access_in_type, lookup_field_queue_p, bfs_walk, dfs_walk_real, look_for_overrides, markedp, unmarkedp, marked_pushdecls_p, unmarked_pushdecls_p, dfs_debug_markedp, dfs_debug_unmarkedp, dfs_check_overlap, dfs_no_overlap_yet, binfo_for_vtable, copied_binfo, original_binfo): Likewise * cp/tree.c (copy_base_binfos, make_binfo): Likewise. * cp/typeck.c (commmon_base_type): Likewise * cp/typeck2.c (process_init_constructor): Likewise * java/java-tree.h (CLASSTYPE_SPUER): Adjust BINFO macros. (TYPE_NVIRTUALS, TYPE_VTABLE): Likewise. * java/class.c (set_super_info, class_depth, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO macros. * java/expr.c (can_widen_reference_to, lookup_field): Likewise. * java/jcf-write.c (generate_classfile): Likewise. * java/parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Likewise. * java/typeck.c (find_method_in_interface): Likewise. * java/verify.c (merge_types): Likewise. From-SVN: r84198
2004-07-07 12:21:04 +02:00
accesses = BINFO_BASE_ACCESSES (binfo);
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
tree base_access = (*accesses)[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
access_kind base_access_now = BINFO_ACCESS (base_binfo);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +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 (base_access_now == ak_none || base_access_now == ak_private)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* If it was not accessible in the base, or only
accessible as a private member, we can't access it
all. */
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_access_now = ak_none;
else if (base_access == access_protected_node)
/* Public and protected members in the base become
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
protected here. */
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_access_now = ak_protected;
else if (base_access == access_private_node)
/* Public and protected members in the base become
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
private here. */
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_access_now = ak_private;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* See if the new access, via this base, gives more
access than our previous best access. */
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_access_now != ak_none
&& (access == ak_none || base_access_now < access))
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +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
access = base_access_now;
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* If the new access is public, we can't do better. */
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 (access == ak_public)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
break;
}
}
}
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Note the access to DECL in 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
SET_BINFO_ACCESS (binfo, access);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return NULL_TREE;
}
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Return the access to DECL in TYPE. */
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 access_kind
access_in_type (tree type, tree decl)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
tree binfo = TYPE_BINFO (type);
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* We must take into account
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
[class.paths]
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
If a name can be reached by several paths through a multiple
inheritance graph, the access is that of the path that gives
most access.
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
The algorithm we use is to make a post-order depth-first traversal
of the base-class hierarchy. As we come up the tree, we annotate
each node with the most lenient access. */
dfs_walk_once (binfo, dfs_access_in_type_pre, dfs_access_in_type, decl);
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
return BINFO_ACCESS (binfo);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
}
/* Returns nonzero if it is OK to access DECL named in TYPE through an object
of OTYPE in the context of DERIVED. */
static int
protected_accessible_p (tree decl, tree derived, tree type, tree otype)
{
/* We're checking this clause from [class.access.base]
m as a member of N is protected, and the reference occurs in a
member or friend of class N, or in a member or friend of a
class P derived from N, where m as a member of P is public, private
or protected.
Here DERIVED is a possible P, DECL is m and TYPE is N. */
/* If DERIVED isn't derived from N, then it can't be a P. */
if (!DERIVED_FROM_P (type, derived))
return 0;
/* [class.protected]
When a friend or a member function of a derived class references
a protected nonstatic member of a base class, an access check
applies in addition to those described earlier in clause
_class.access_) Except when forming a pointer to member
(_expr.unary.op_), the access must be through a pointer to,
reference to, or object of the derived class itself (or any class
derived from that class) (_expr.ref_). If the access is to form
a pointer to member, the nested-name-specifier shall name the
derived class (or any class derived from that class). */
if (DECL_NONSTATIC_MEMBER_P (decl)
&& !DERIVED_FROM_P (derived, otype))
return 0;
return 1;
}
/* Returns nonzero if SCOPE is a type or a friend of a type which would be able
to access DECL through TYPE. OTYPE is the type of the object. */
static int
friend_accessible_p (tree scope, tree decl, tree type, tree otype)
{
/* We're checking this clause from [class.access.base]
m as a member of N is protected, and the reference occurs in a
member or friend of class N, or in a member or friend of a
class P derived from N, where m as a member of P is public, private
or protected.
Here DECL is m and TYPE is N. SCOPE is the current context,
and we check all its possible Ps. */
tree befriending_classes;
tree t;
if (!scope)
return 0;
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
if (is_global_friend (scope))
return 1;
/* Is SCOPE itself a suitable P? */
if (TYPE_P (scope) && protected_accessible_p (decl, scope, type, otype))
return 1;
if (DECL_DECLARES_FUNCTION_P (scope))
befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
else if (TYPE_P (scope))
befriending_classes = CLASSTYPE_BEFRIENDING_CLASSES (scope);
else
return 0;
for (t = befriending_classes; t; t = TREE_CHAIN (t))
if (protected_accessible_p (decl, TREE_VALUE (t), type, otype))
return 1;
/* Nested classes have the same access as their enclosing types, as
per DR 45 (this is a change from C++98). */
if (TYPE_P (scope))
if (friend_accessible_p (TYPE_CONTEXT (scope), decl, type, otype))
return 1;
if (DECL_DECLARES_FUNCTION_P (scope))
{
/* Perhaps this SCOPE is a member of a class which is a
friend. */
if (DECL_CLASS_SCOPE_P (scope)
&& friend_accessible_p (DECL_CONTEXT (scope), decl, type, otype))
return 1;
}
/* Maybe scope's template is a friend. */
if (tree tinfo = get_template_info (scope))
{
tree tmpl = TI_TEMPLATE (tinfo);
if (DECL_CLASS_TEMPLATE_P (tmpl))
tmpl = TREE_TYPE (tmpl);
else
tmpl = DECL_TEMPLATE_RESULT (tmpl);
if (tmpl != scope)
{
/* Increment processing_template_decl to make sure that
dependent_type_p works correctly. */
++processing_template_decl;
int ret = friend_accessible_p (tmpl, decl, type, otype);
--processing_template_decl;
if (ret)
return 1;
}
}
/* If is_friend is true, we should have found a befriending class. */
gcc_checking_assert (!is_friend (type, scope));
return 0;
cp-tree.h (struct saved_scope): Add incomplete field. * cp-tree.h (struct saved_scope): Add incomplete field. (namespace_scope_incomplete): New macro. * decl.c (pushdecl): Use it. (hack_incomplete_structures): Use it. See through artificial binding levels. (mark_saved_scope): Mark it. Implement access control for nested types. * search.c (type_access_control): New fn. (accessible_p): Now we do perform access control for types. * semantics.c (deferred_type_access_control): New fn. (initial_deferred_type_access_control): New fn. (begin_function_definition): Call it. Add lookups parm. * decl.c (struct binding_level): Add this_class field. (pushlevel_class): Set it. (mark_binding_level): Mark it. (lookup_name_real): Use it. Call type_access_control. (mark_saved_scope): Mark lookups field. * cp-tree.h (flagged_type_tree): Add lookups field. (struct saved_scope): Add lookups field. (type_lookups): New macro. * parse.y (declmods): Now <ftype>. (parse_decl): Add lookups parm. Call initial_deferred_type_access_control. (lang_extdef): Clear type_lookups. (typed_declspecs, declmods, typespec): Set lookups field. (initdcl): Call deferred_type_access_control. (fn.def1, fn.def2, typed_declspecs1, initdcl0_innards, nomods_initdcl0, component_decl_1, named_parm): Adjust. * friend.c (is_friend): Nested classes are friends of their enclosing classes. * class.c (currently_open_derived_class): New fn. * method.c (hack_identifier): Use it. * lex.c (do_identifier): Remove obsolete code. * parse.y (typed_typespecs): Propagate new_type_flag properly. From-SVN: r31837
2000-02-07 21:36:36 +01:00
}
struct dfs_accessible_data
{
tree decl;
tree object_type;
};
/* Avoid walking up past a declaration of the member. */
static tree
dfs_accessible_pre (tree binfo, void *data)
{
dfs_accessible_data *d = (dfs_accessible_data *)data;
tree type = BINFO_TYPE (binfo);
if (member_declared_in_type (d->decl, type))
return dfs_skip_bases;
return NULL_TREE;
}
/* Called via dfs_walk_once_accessible from accessible_p */
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
static tree
dfs_accessible_post (tree binfo, void *data)
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
{
/* access_in_type already set BINFO_ACCESS for us. */
access_kind access = BINFO_ACCESS (binfo);
tree N = BINFO_TYPE (binfo);
dfs_accessible_data *d = (dfs_accessible_data *)data;
tree decl = d->decl;
tree scope = current_nonlambda_scope ();
/* A member m is accessible at the point R when named in class N if */
switch (access)
{
case ak_none:
return NULL_TREE;
case ak_public:
/* m as a member of N is public, or */
return binfo;
case ak_private:
{
/* m as a member of N is private, and R occurs in a member or friend of
class N, or */
if (scope && TREE_CODE (scope) != NAMESPACE_DECL
&& is_friend (N, scope))
return binfo;
return NULL_TREE;
}
case ak_protected:
{
/* m as a member of N is protected, and R occurs in a member or friend
of class N, or in a member or friend of a class P derived from N,
where m as a member of P is public, private, or protected */
if (friend_accessible_p (scope, decl, N, d->object_type))
return binfo;
return NULL_TREE;
}
default:
gcc_unreachable ();
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
}
/* Like accessible_p below, but within a template returns true iff DECL is
accessible in TYPE to all possible instantiations of the template. */
int
accessible_in_template_p (tree type, tree decl)
{
int save_ptd = processing_template_decl;
processing_template_decl = 0;
int val = accessible_p (type, decl, false);
processing_template_decl = save_ptd;
return val;
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* DECL is a declaration from a base class of TYPE, which was the
class used to name DECL. Return nonzero if, in the current
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
context, DECL is accessible. If TYPE is actually a BINFO node,
then we can tell in what context the access is occurring by looking
at the most derived class along the path indicated by BINFO. If
CONSIDER_LOCAL is true, do consider special access the current
scope or friendship thereof we might have. */
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
int
accessible_p (tree type, tree decl, bool consider_local_p)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
tree binfo;
access_kind access;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* If this declaration is in a block or namespace scope, there's no
access control. */
if (!TYPE_P (context_for_name_lookup (decl)))
return 1;
/* There is no need to perform access checks inside a thunk. */
if (current_function_decl && DECL_THUNK_P (current_function_decl))
return 1;
/* In a template declaration, we cannot be sure whether the
particular specialization that is instantiated will be a friend
or not. Therefore, all access checks are deferred until
instantiation. However, PROCESSING_TEMPLATE_DECL is set in the
parameter list for a template (because we may see dependent types
in default arguments for template parameters), and access
2006-06-06 13:44:09 +02:00
checking should be performed in the outermost parameter list. */
if (processing_template_decl
Improving concepts performance and diagnostics. PR c++/67565 PR c++/67579 PR c++/71843 gcc/ * timevar.def (TV_CONSTRAINT_SAT, TV_CONSTRAINT_SUB): New time vars for constraint satisfaction and subsumption. * timevar.h (auto_timevar): New constructor that matches the push/pop pattern of usage in pt.c. gcc/cp/ * cp-tree.def (CHECK_CONSTR): New. * cp-tree.h (CHECK_CONSTR_CONCEPT): New. (CHECK_CONSTR_ARGS): New. * constraint.cc (make_predicate_constraint): Remove in favor of normalize_expression. (resolve_constraint_check): Actually return error_mark_node when resolution fails. (resolve_variable_concept_check): Perform coercion as if processing a template. Also return errors on resolution failure. (lift_*): Remove all of these functions. Don't unnecessarily inline concepts. (learn_*): Add facilities to memoize implications for subsumption during normalization. (expanding_concept): New. (expand_concept): New. Return the inlined and normalized definition of a concept when needed. (transform_*, xform_*): Rename to normalize_* to better reflect the responsibility of those functions. (normalize_template_id_expression): Check for non-boolean operands when possible. Generate check constraints instead of normal variable references. (normalize_call_expression): Report errors when resolution fails. (check_for_logical_overloads): Rewrite this check to more accurately report the error. (normalize_atom): Check for overloaded calls and invalid types before determining if the expression refers to a concept. (build_constraints): Don't cache normalized constraints or decmposed assumptions. (finish_shorthand_constraint): Return a normalized expression instead of a predicate constraint. (finish_template_introduction): Same. (placeholder_extract_concept_and_args): Rewrite this since we only ever get check constraints here. (equivalent_placeholder_constraints): Rewrite in terms of check constraints, and handle error_mark_nodes correctly. (tsubst_check_constraint, tsubst_expr_constr, tsubst_type_constr) (tsubst_implicit_conversion_constr) (tsubst_argument_deduction_constr, tsubst_exception_constr) (tsubst_parameterized_constraint, tsubst_constraint): New. (tsbust_conjunection): Replace with tsubst_logical_operator and actually generate the right kind of constraint. (tsubst_requirement_body): Reverse the order of substituted arguments so that they appear in the order written (helps diagnostics). (satisfy_check_constraint): New. (satisfy_conjunction): Simplify. (satisfy_disjunction): Same. (satisfy_constraint_1): Handle check constraints. (eval_constr): New (private) global state. (evaluating_constraints_sentinel): New. Manages eval_constr. (satisfy_constraint): Add timing variables. (satisfy_associated_constraints): Add hooks for memoization. (evaluate_function_concept): Build a check constraint instead of normalizing its definition. (evaluate_variable_concept): Same. (evaluate_constraint_expression): Normalize, but in the current declaration processing context. (evaluating_constraints_p): New. (elide_constraint_failure_p): Actually emit constraint_thresh errors. (diagnose_*): Remove artificial indentation. Add a new parameter to each that tracks the current (complete) constraint prior to any substitutions. (diagnose_expression): Removed. (diagnose_call_expression): Same. (diagnose_template_id): Same. (diagnose_template_id): New. (diagnose_logical_constraint): New. (diagnose_expression_constraint): Show the original expression. (diagnose_type_constraint): Show the original type. (diagnose_implicit_conversion_constraint): Be specific about failures, don't re-diagnose a known-to-be-failed substitutions, and manage elisions properly. (diagnose_argument_deduction_constraint): Same. (diagnose_exception_constraint): Same. (diagnose_parameterized_constraint): Same. (constraint_p): Allow EXPR_PACK_EXPANSION. * logic.cc (next_by_distance): Removed. No longer used. (any_p): Renamed from any_of. (term_entry, term_hasher): New. (term_list): Rewrite to include a hash table for quick lookup. Also, make less stateful. (proof_state): Extend to allow goals to be discharged once satisfied. (non_atomic_constraint_p): New. (any_non_atomic_constraints_p): New. (...rest...): Previous implementation completely replaced with an iterative algorithm that opportunistically prunes the search space before committing to using more memory. * parser.c: (cp_parser_type_parameter): Normalize constraints. (cp_parser_explicit_template_declaration): Same. * pt.c: (finish_template_variable): Be less redundant with this error message. (template_args_equal): No longer static. (tsubst_decl): Don't try to find specializations of variables that have already been instantiated. (build_non_dependent_expr): Avoid infinite recursion during concept expansion. (make_constrained_auto): Normalize constraints. (do_auto_deduction): When doing auto deduction from a partial-concept-id, be sure to include the explicit args checking the constraints. (constraint_sat_*): New. Memoize satisfied constraints. (concept_spec_*): New. Memoize expressions associated with a concept specialization. (constraint_memos, concept_memos): New. (lookup_constraint_satisfaction, memoize_constraint_satisfaction): New. (lookup_concept_satisfaction, memoize_concept_satisfaction): New. (get_concept_expansion, save_concept_expansion): New. (hash_subsumption_args): New. (comp_subsumption_args): New. (subsumption_*): New. Memoize parts of the subsumption relation. (lookup_subsumption_result, save_subsumption_result): New. (init_constraint_processing): Initialize memo tables. (get_constraints): Shortcut if !flag_concepts. * decl.c (grokfndecl): Normalize constraints. * error.c (dump_simple_decl): Print "concept" when appropriate. (dump_function_decl): Same. (dump_template_decl): Don't write requirements when we're not printing the header. (dump_expr): Handle fold expressions. * cxx-pretty-print.c (cxx_pretty_printer::expression): Handle fold expressions. (get_fold_operator): New. (pp_cxx_unary_left_fold_expression): New. (pp_cxx_unary_right_fold_expression): New. (pp_cxx_binary_fold_expression): New. (pp_cxx_check_constraint): New. (pp_cxx_*_constraint): Rewrite the grammar of internal constraints to make them easier to read when debugging. * search.c (accessible_p): Don't shortcut when evaluating constraints. * tree.c (cp_tree_equal): Handle CHECK_CONSTR. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r238558
2016-07-21 08:05:24 +02:00
&& !expanding_concept ()
&& (!processing_template_parmlist || processing_template_decl > 1))
return 1;
tree otype = NULL_TREE;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
if (!TYPE_P (type))
{
/* When accessing a non-static member, the most derived type in the
binfo chain is the type of the object; remember that type for
protected_accessible_p. */
for (tree b = type; b; b = BINFO_INHERITANCE_CHAIN (b))
otype = BINFO_TYPE (b);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
type = BINFO_TYPE (type);
1994-02-24 02:02:37 +01:00
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
else
otype = type;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* [class.access.base]
A member m is accessible when named in class N if
--m as a member of N is public, or
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
--m as a member of N is private, and the reference occurs in a
member or friend of class N, or
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
--m as a member of N is protected, and the reference occurs in a
member or friend of class N, or in a member or friend of a
class P derived from N, where m as a member of P is public, private or
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
protected, or
--there exists a base class B of N that is accessible at the point
of reference, and m is accessible when named in class B.
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
We walk the base class hierarchy, checking these conditions. */
/* We walk using TYPE_BINFO (type) because access_in_type will set
BINFO_ACCESS on it and its bases. */
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
binfo = TYPE_BINFO (type);
/* Compute the accessibility of DECL in the class hierarchy
dominated by type. */
access = access_in_type (type, decl);
if (access == ak_public)
return 1;
/* If we aren't considering the point of reference, only the first bullet
applies. */
if (!consider_local_p)
return 0;
dfs_accessible_data d = { decl, otype };
/* Walk the hierarchy again, looking for a base class that allows
access. */
return dfs_walk_once_accessible (binfo, /*friends=*/true,
dfs_accessible_pre,
dfs_accessible_post, &d)
!= NULL_TREE;
1994-02-24 02:02:37 +01:00
}
struct lookup_field_info {
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* The type in which we're looking. */
tree type;
/* The name of the field for which we're looking. */
tree name;
/* If non-NULL, the current result of the lookup. */
tree rval;
/* The path to RVAL. */
tree rval_binfo;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* If non-NULL, the lookup was ambiguous, and this is a list of the
candidates. */
tree ambiguous;
/* If nonzero, we are looking for types, not data members. */
int want_type;
/* If something went wrong, a message indicating what. */
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
const char *errstr;
};
/* Nonzero for a class member means that it is shared between all objects
of that class.
[class.member.lookup]:If the resulting set of declarations are not all
from sub-objects of the same type, or the set has a nonstatic member
and includes members from distinct sub-objects, there is an ambiguity
and the program is ill-formed.
This function checks that T contains no nonstatic members. */
int
shared_member_p (tree t)
{
tree.h (VAR_P): New. * tree.h (VAR_P): New. cp/ * call.c (build_java_interface_fn_ref): Likewise. (make_temporary_var_for_ref_to_temp): Likewise. * class.c (check_field_decls): Likewise. (layout_class_type): Likewise. (finish_struct_1): Likewise. (fixed_type_or_null): Likewise. (get_vtbl_decl_for_binfo): Likewise. * cp-gimplify.c (omp_var_to_track): Likewise. (cp_genericize_r): Likewise. * cp-objcp-common.c (cxx_warn_unused_global_decl): Likewise. * cp-tree.h (LANG_DECL_HAS_MIN): Likewise. (DECL_DISCRIMINATOR_P): Likewise. * decl.c (poplevel): Likewise. (decls_match): Likewise. (duplicate_decls): Likewise. (decl_jump_unsafe): Likewise. (start_decl): Likewise. (check_for_uninitialized_const_var): Likewise. (make_rtl_for_nonlocal_decl): Likewise. (cp_finish_decl): Likewise. (expand_static_init): Likewise. (local_variable_p): Likewise. (maybe_register_incomplete_var): Likewise. * decl2.c (grokfield): Likewise. (comdat_linkage): Likewise. (determine_visibility): Likewise. (import_export_decl): Likewise. (prune_vars_needing_no_initialization): Likewise. (decl_maybe_constant_var_p): Likewise. * error.c (dump_simple_decl): Likewise. (dump_template_decl): Likewise. (cp_printer): Likewise. * except.c (build_throw): Likewise. * init.c (build_vtbl_address): Likewise. (member_init_ok_or_else): Likewise. (build_aggr_init): Likewise. (expand_aggr_init_1): Likewise. (build_offset_ref): Likewise. (constant_value_1): Likewise. * mangle.c (write_mangled_name): Likewise. (write_prefix): Likewise. * name-lookup.c (supplement_binding_1): Likewise. (add_decl_to_level): Likewise. (pushdecl_maybe_friend_1): Likewise. (check_for_out_of_scope_variable): Likewise. (validate_nonmember_using_decl): Likewise. (lookup_name_innermost_nonclass_level_1): Likewise. (lookup_arg_dependent_1): Likewise. * parser.c (cp_parser_lambda_introducer): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_single_declaration): Likewise. * pt.c (convert_nontype_argument): Likewise. (instantiate_class_template_1): Likewise. (tsubst_decl): Likewise. (tsubst_expr): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. (regenerate_decl_from_template): Likewise. (always_instantiate_p): Likewise. (instantiate_decl): Likewise. (type_dependent_expression_p): Likewise. (build_non_dependent_expr): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_dynamic_cast_1): Likewise. * search.c (shared_member_p): Likewise. * semantics.c (outer_var_p): Likewise. (finish_id_expression): Likewise. (finish_omp_clauses): Likewise. (finish_decltype_type): Likewise. (ensure_literal_type_for_constexpr_object): Likewise. * tree.c (lvalue_kind): Likewise. (bot_replace): Likewise. (cp_tree_equal): Likewise. (handle_init_priority_attribute): Likewise. (decl_storage_duration): Likewise. * typeck.c (cxx_sizeof_expr): Likewise. (cxx_alignof_expr): Likewise. (decay_conversion): Likewise. (build_class_member_access_expr): Likewise. (cp_build_array_ref): Likewise. (cxx_mark_addressable): Likewise. (maybe_warn_about_returning_address_of_local): Likewise. (check_return_expr): Likewise. * typeck2.c (cxx_readonly_error): Likewise. (abstract_virtuals_error_sfinae): Likewise. (cxx_incomplete_type_diagnostic): Likewise. From-SVN: r197240
2013-03-29 17:09:35 +01:00
if (VAR_P (t) || TREE_CODE (t) == TYPE_DECL \
|| TREE_CODE (t) == CONST_DECL)
return 1;
if (is_overloaded_fn (t))
{
t = get_fns (t);
for (; t; t = OVL_NEXT (t))
{
tree fn = OVL_CURRENT (t);
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
return 0;
}
return 1;
}
return 0;
}
/* Routine to see if the sub-object denoted by the binfo PARENT can be
found as a base class and sub-object of the object denoted by
BINFO. */
static int
is_subobject_of_p (tree parent, tree binfo)
{
tree probe;
for (probe = parent; probe; probe = BINFO_INHERITANCE_CHAIN (probe))
{
if (probe == binfo)
return 1;
if (BINFO_VIRTUAL_P (probe))
return (binfo_for_vbase (BINFO_TYPE (probe), BINFO_TYPE (binfo))
!= NULL_TREE);
}
return 0;
}
/* DATA is really a struct lookup_field_info. Look for a field with
the name indicated there in BINFO. If this function returns a
non-NULL value it is the result of the lookup. Called from
lookup_field via breadth_first_search. */
static tree
lookup_field_r (tree binfo, void *data)
{
struct lookup_field_info *lfi = (struct lookup_field_info *) data;
tree type = BINFO_TYPE (binfo);
tree nval = NULL_TREE;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
/* If this is a dependent base, don't look in it. */
if (BINFO_DEPENDENT_BASE_P (binfo))
return NULL_TREE;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
/* If this base class is hidden by the best-known value so far, we
don't need to look. */
if (lfi->rval_binfo && BINFO_INHERITANCE_CHAIN (binfo) == lfi->rval_binfo
&& !BINFO_VIRTUAL_P (binfo))
return dfs_skip_bases;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* First, look for a function. There can't be a function and a data
member with the same name, and if there's a function and a type
with the same name, the type is hidden by the function. */
if (!lfi->want_type)
re PR c++/6936 (member "using" binds wrong) PR c++/6936 PR c++/25994 PR c++/26256 PR c++/30195 * search.c (lookup_field_1): Look through USING_DECL. (lookup_field_r): Call lookup_fnfields_slot instead of lookup_fnfields_1. * semantics.c (finish_member_declaration): Remove the check that prevents USING_DECLs from being verified by pushdecl_class_level. Call add_method for using declarations that designates functions if the using declaration is in a template class. Set DECL_IGNORED_P on class-scope using declarations. * typeck.c (build_class_member_access_expr): Handle USING_DECLs. * class.c (check_field_decls): Keep using declarations. (add_method): Remove two diagnostics about conflicting using declarations. * parser.c (cp_parser_nonclass_name): Handle USING_DECLs. * decl.c (start_enum): Call xref_tag whenever possible. * cp-tree.h (strip_using_decl): Declare, and reident the previous function. * name-lookup.c (strip_using_decl): New function. (supplement_binding_1): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Also check that the target decl and the target bval does not refer to the same declaration. Allow pushing an enum multiple times in a template class. Adjustment to diagnose using redeclarations. Call diagnose_name_conflict. (push_class_level_binding): Call strip_using_decl on decl and bval. Perform most of the checks with USING_DECLs stripped. Return true if both decl and bval refer to USING_DECLs and are dependent. (diagnose_name_conflict): New function. From-SVN: r181359
2011-11-14 18:55:57 +01:00
nval = lookup_fnfields_slot (type, lfi->name);
if (!nval)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Look for a data member or type. */
nval = lookup_field_1 (type, lfi->name, lfi->want_type);
else if (TREE_CODE (nval) == OVERLOAD && OVL_USED (nval))
{
/* If we have both dependent and non-dependent using-declarations, return
the dependent one rather than an incomplete list of functions. */
tree dep_using = lookup_field_1 (type, lfi->name, lfi->want_type);
if (dep_using && TREE_CODE (dep_using) == USING_DECL)
nval = dep_using;
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* If there is no declaration with the indicated name in this type,
then there's nothing to do. */
if (!nval)
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
goto done;
/* If we're looking up a type (as with an elaborated type specifier)
we ignore all non-types we find. */
if (lfi->want_type && !DECL_DECLARES_TYPE_P (nval))
{
if (lfi->name == TYPE_IDENTIFIER (type))
{
/* If the aggregate has no user defined constructors, we allow
it to have fields with the same name as the enclosing type.
If we are looking for that name, find the corresponding
TYPE_DECL. */
for (nval = TREE_CHAIN (nval); nval; nval = TREE_CHAIN (nval))
if (DECL_NAME (nval) == lfi->name
&& TREE_CODE (nval) == TYPE_DECL)
break;
}
else
nval = NULL_TREE;
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
2003-05-18 15:40:54 +02:00
if (!nval && CLASSTYPE_NESTED_UTDS (type) != NULL)
{
binding_entry e = binding_table_find (CLASSTYPE_NESTED_UTDS (type),
lfi->name);
hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.h (struct ht_identifier): Add data member "hash_value". * hashtable.c (ht_lookup): Use it when searching, remember. (ht_expand): Do not recompute. * tree.h (IDENTIFIER_HASH_VALUE): New macro. cp/ * cp-tree.h (struct lang_type_class): Replace data member tags with hash-table nested_udts. (CLASSTYPE_NESTED_UTDS): Rename from CLASSTYPE_TAGS. * class.c (unreverse_member_declarations): Don't touch CLASSTYPE_TAGS. (pushclass): Use cxx_remember_type_decls. * decl.c (struct cp_binding_level): Replace data member tags with hash-table type_decls. (pop_binding_level): Handle level->type_decls. (kept_level_p): Adjust. (poplevel): Remove unused local variable. (bt_print_entry): New function. (print_binding_level): Use it. (push_namespace): Build current_binding_level->type_decls. (maybe_process_template_type_declaration): Adjust. (pushtag): Likewise. (clear_anon_tags): Use binding_table_remove_anonymous_types. (gettags): Remove. (cxx_remember_type_decls): Rename from storetags. Adjust. (lookup_tag): Use binding_table_find_anon_type. Tidy. (lookup_tag_reverse): Use binding_table_reverse_maybe_remap. (cxx_init_decl_processing): Build global_binding_level->type_decls. (store_parm_decls): Remove pointless code. * name-lookup.c (free_binding_entry): New variable. (ENTRY_INDEX): New macro. (struct binding_table_s): New datatype. (binding_entry_make): New function. (binding_entry_free): Likewise. (binding_table_construct): Likewise. (binding_table_free): Likewise. (binding_table_new): Likewise. (binding_table_expand): Likewise. (binding_table_insert): Likewise. (binding_table_find): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. * name-lookup.h (binding_table): New type. (binding_entry): Likewise. (bt_foreach_proc): Likewise. (struct binding_entry_s): New datatype. (SCOPE_DEFAULT_HT_SIZE): New macro. (CLASS_SCOPE_HT_SIZE): Likewise. (NAMESPACE_ORDINARY_HT_SIZE): Likewise. (NAMESPACE_STD_HT_SIZE): Likewise. (GLOBAL_SCOPE_HT_SIZE): Likewise. (binding_table_new): Declare. (binding_table_free): Likewise. (binding_table_insert): Likewise. (binding_table_find_anon_type): Likewise. (binding_table_reverse_maybe_remap): Likewise. (binding_table_remove_anonymous_types): Likewise. (binding_table_foreach): Likewise. (binding_table_find): Likewise. (cxx_remember_type_decls): Likewise. * pt.c (bt_instantiate_type_proc): New function. (do_type_instantiation): Use it. * search.c (lookup_field_r): Use binding_table_find. From-SVN: r66930
2003-05-18 15:40:54 +02:00
if (e != NULL)
nval = TYPE_MAIN_DECL (e->type);
else
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
goto done;
}
}
/* If the lookup already found a match, and the new value doesn't
hide the old one, we might have an ambiguity. */
if (lfi->rval_binfo
&& !is_subobject_of_p (lfi->rval_binfo, binfo))
{
if (nval == lfi->rval && shared_member_p (nval))
/* The two things are really the same. */
;
else if (is_subobject_of_p (binfo, lfi->rval_binfo))
/* The previous value hides the new one. */
;
else
{
/* We have a real ambiguity. We keep a chain of all the
candidates. */
if (!lfi->ambiguous && lfi->rval)
{
/* This is the first time we noticed an ambiguity. Add
what we previously thought was a reasonable candidate
to the list. */
lfi->ambiguous = tree_cons (NULL_TREE, lfi->rval, NULL_TREE);
TREE_TYPE (lfi->ambiguous) = error_mark_node;
}
/* Add the new value. */
lfi->ambiguous = tree_cons (NULL_TREE, nval, lfi->ambiguous);
TREE_TYPE (lfi->ambiguous) = error_mark_node;
lfi->errstr = G_("request for member %qD is ambiguous");
}
}
else
{
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
lfi->rval = nval;
lfi->rval_binfo = binfo;
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
done:
/* Don't look for constructors or destructors in base classes. */
if (IDENTIFIER_CTOR_OR_DTOR_P (lfi->name))
return dfs_skip_bases;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return NULL_TREE;
}
/* Return a "baselink" with BASELINK_BINFO, BASELINK_ACCESS_BINFO,
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
BASELINK_FUNCTIONS, and BASELINK_OPTYPE set to BINFO, ACCESS_BINFO,
FUNCTIONS, and OPTYPE respectively. */
tree
build_baselink (tree binfo, tree access_binfo, tree functions, tree optype)
{
tree baselink;
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (TREE_CODE (functions) == FUNCTION_DECL
|| TREE_CODE (functions) == TEMPLATE_DECL
|| TREE_CODE (functions) == TEMPLATE_ID_EXPR
|| TREE_CODE (functions) == OVERLOAD);
gcc_assert (!optype || TYPE_P (optype));
gcc_assert (TREE_TYPE (functions));
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
baselink = make_node (BASELINK);
TREE_TYPE (baselink) = TREE_TYPE (functions);
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
BASELINK_BINFO (baselink) = binfo;
BASELINK_ACCESS_BINFO (baselink) = access_binfo;
BASELINK_FUNCTIONS (baselink) = functions;
BASELINK_OPTYPE (baselink) = optype;
return baselink;
}
/* Look for a member named NAME in an inheritance lattice dominated by
XBASETYPE. If PROTECT is 0 or two, we do not check access. If it
is 1, we enforce accessibility. If PROTECT is zero, then, for an
ambiguous lookup, we return NULL. If PROTECT is 1, we issue error
messages about inaccessible or ambiguous lookup. If PROTECT is 2,
we return a TREE_LIST whose TREE_TYPE is error_mark_node and whose
TREE_VALUEs are the list of ambiguous candidates.
WANT_TYPE is 1 when we should only return TYPE_DECLs.
If nothing can be found return NULL_TREE and do not issue an error. */
1996-07-11 03:13:25 +02:00
1994-02-24 02:02:37 +01:00
tree
lookup_member (tree xbasetype, tree name, int protect, bool want_type,
tsubst_flags_t complain)
1994-02-24 02:02:37 +01:00
{
tree rval, rval_binfo = NULL_TREE;
tree type = NULL_TREE, basetype_path = NULL_TREE;
struct lookup_field_info lfi;
1994-02-24 02:02:37 +01:00
/* rval_binfo is the binfo associated with the found member, note,
this can be set with useful information, even when rval is not
set, because it must deal with ALL members, not just non-function
members. It is used for ambiguity checking and the hidden
checks. Whereas rval is only set if a proper (not hidden)
non-function member is found. */
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
const char *errstr = 0;
1994-02-24 02:02:37 +01:00
if (name == error_mark_node
|| xbasetype == NULL_TREE
|| xbasetype == error_mark_node)
return NULL_TREE;
gcc_assert (identifier_p (name));
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
if (TREE_CODE (xbasetype) == TREE_BINFO)
1994-02-24 02:02:37 +01:00
{
type = BINFO_TYPE (xbasetype);
basetype_path = xbasetype;
1994-02-24 02:02:37 +01:00
}
else
{
cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. 2008-03-21 Paolo Carlini <pcarlini@suse.de> * cp-tree.h (IS_AGGR_TYPE): Rename to MAYBE_CLASS_TYPE_P. (SET_IS_AGGR_TYPE): Rename to SET_CLASS_TYPE_P. (IS_AGGR_TYPE_CODE): Rename to RECORD_OR_UNION_CODE_P. (PROMOTES_TO_AGGR_TYPE): Remove. (CLASS_TYPE_P, TYPE_NON_AGGREGATE_CLASS): Adjust. * typeck.c (unary_complex_lvalue, build_modify_expr, convert_for_initialization): Adjust. * init.c (is_aggr_type): Remove. (is_class_type): Add. (build_offset_ref, build_new_1, build_vec_delete_1, build_vec_init, build_delete): Adjust. * lex.c (make_aggr_type): Remove. (make_class_type): Add. (cxx_make_type): Adjust. * class.c (finish_struct_1, fixed_type_or_null, is_empty_class): Adjust. * decl.c (build_typename_type, make_typename_type, make_unbound_class_template, cxx_init_decl_processing, check_tag_decl, groktypename, start_decl_1, layout_var_decl, check_initializer, cp_finish_decl, build_ptrmemfunc_type, grokparms, grok_op_properties, xref_tag, check_function_type): Adjust. * call.c (check_dtor_name, standard_conversion, implicit_conversion, add_builtin_candidate, add_builtin_candidates, build_user_type_conversion_1, convert_like_real, build_cxx_call, is_subseq, compare_ics): Adjust. * method.c (use_thunk): Adjust. * rtti.c (build_dynamic_cast_1, create_pseudo_type_info, create_tinfo_types): Adjust. * cvt.c (cp_convert_to_pointer, convert_to_pointer_force, build_up_reference, convert_to_reference, convert_from_reference, ocp_convert, build_expr_type_conversion): Adjust. * tree.c (bind_template_template_parm, error_type): Adjust. * dump.c (cp_dump_tree): Adjust. * search.c (lookup_member): Adjust. * friend.c (make_friend_class, do_friend): Adjust. * typeck2.c (store_init_value, process_init_constructor_array, process_init_constructor_record, build_x_arrow, build_m_component_ref, build_functional_cast): Adjust. * pt.c (finish_member_template_decl, process_template_parm, lookup_template_class, tsubst_function_type, tsubst, tsubst_copy_and_build, get_template_base, bt_instantiate_type_proc): Adjust. * semantics.c (begin_class_definition, finish_base_specifier, finish_typeof, cxx_omp_predetermined_sharing, finish_decltype_type): Adjust. * name-lookup.c (constructor_name_p, push_overloaded_decl, do_class_using_decl, lookup_qualified_name, maybe_process_template_type_declaration): Adjust. * decl2.c (grok_array_decl, check_member_template, constrain_class_visibility): Adjust. * parser.c (cp_parser_class_name): Adjust. From-SVN: r133434
2008-03-21 19:56:51 +01:00
if (!RECORD_OR_UNION_CODE_P (TREE_CODE (xbasetype)))
return NULL_TREE;
type = xbasetype;
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
2004-07-12 18:06:40 +02:00
xbasetype = NULL_TREE;
}
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
2004-07-12 18:06:40 +02:00
type = complete_type (type);
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
/* Make sure we're looking for a member of the current instantiation in the
right partial specialization. */
if (flag_concepts && dependent_type_p (type))
if (tree t = currently_open_class (type))
type = t;
Add C++ Concepts TS support. gcc/c-family/ * c-common.c (c_common_reswords): Add __is_same_as, concept, requires. * c-common.h (enum rid): Add RID_IS_SAME_AS, RID_CONCEPT, RID_REQUIRES. (D_CXX_CONCEPTS, D_CXX_CONCEPTS_FLAGS): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_concepts. * c-opts.c (set_std_cxx1z): Set flag_concepts. * c.opt (fconcepts): New. gcc/cp/ * constraint.cc, logic.cc: New files. * Make-lang.in (CXX_AND_OBJCXX_OBJS): Add constraint.o and logic.o. (c++.tags): Also process .cc files. * call.c (enum rejection_reason_code): Add rr_constraint_failure. (print_z_candidate): Handle it. (constraint_failure): New. (add_function_candidate): Check constraints. (build_new_function_call): Handle evaluating concepts. (joust): Check more_constrained. * class.c (add_method): Check equivalently_constrained. (build_clone): Copy constraints. (currently_open_class): Return tree. (resolve_address_of_overloaded_function): Check constraints. * constexpr.c (cxx_eval_constant_expression): Handle REQUIRES_EXPR. (potential_constant_expression_1): Likewise. * cp-objcp-common.c (cp_tree_size): Handle CONSTRAINT_INFO. (cp_common_init_ts): Handle WILDCARD_DECL and REQUIRES_EXPR. * cp-tree.def: Add CONSTRAINT_INFO, WILDCARD_DECL, REQUIRES_EXPR, SIMPLE_REQ, TYPE_REQ, COMPOUND_REQ, NESTED_REQ, PRED_CONSTR, EXPR_CONSTR, TYPE_CONSTR, ICONV_CONSTR, DEDUCT_CONSTR, EXCEPT_CONSTR, PARM_CONSTR, CONJ_CONSTR, DISJ_CONSTR. * cp-tree.h (struct tree_constraint_info, check_nonnull) (check_constraint_info, CI_TEMPLATE_REQS, CI_DECLARATOR_REQS) (CI_ASSOCIATED_CONSTRAINTS, CI_NORMALIZED_CONSTRAINTS) (CI_ASSUMPTIONS, TEMPLATE_PARMS_CONSTRAINTS) (TEMPLATE_PARM_CONSTRAINTS, COMPOUND_REQ_NOEXCEPT_P) (PLACEHOLDER_TYPE_CONSTRAINTS, PRED_CONSTR_EXPR, EXPR_CONSTR_EXPR) (TYPE_CONSTR_TYPE, ICONV_CONSTR_EXPR, ICONV_CONSTR_TYPE) (DEDUCT_CONSTR_EXPR, DEDUCT_CONSTR_PATTERN) (DEDUCT_CONSTR_PLACEHOLDER, EXCEPT_CONSTR_EXPR, PARM_CONSTR_PARMS) (PARM_CONSTR_OPERAND, CONSTRAINT_VAR_P, CONSTRAINED_PARM_CONCEPT) (CONSTRAINED_PARM_EXTRA_ARGS, CONSTRAINED_PARM_PROTOTYPE) (DECL_DECLARED_CONCEPT_P, WILDCARD_PACK_P, struct cp_unevaluated) (struct local_specialization_stack, enum auto_deduction_context) (variable_concept_p, concept_template_p) (struct deferring_access_check_sentinel): New. (enum cp_tree_node_structure_enum): Add TS_CP_CONSTRAINT_INFO. (union lang_tree_node): Add constraint_info field. (struct lang_decl_base): Add concept_p flag. (enum cp_decl_spec): Add ds_concept. (struct cp_declarator): Add requires_clause. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression) (cxx_pretty_printer::expression): Handle REQUIRES_EXPR, TRAIT_EXPR, *_CONSTR. (pp_cxx_parameter_declaration_clause): Accept a chain of PARM_DECLs. (cxx_pretty_printer::declarator): Print requires-clause. (pp_cxx_template_declaration): Likewise. (pp_cxx_trait_expression): Handle CPTK_IS_SAME_AS. (pp_cxx_requires_clause, pp_cxx_requirement) (pp_cxx_requirement_list, pp_cxx_requirement_body) (pp_cxx_requires_expr, pp_cxx_simple_requirement) (pp_cxx_type_requirement, pp_cxx_compound_requirement) (pp_cxx_nested_requirement, pp_cxx_predicate_constraint) (pp_cxx_expression_constraint, pp_cxx_type_constraint) (pp_cxx_implicit_conversion_constraint) (pp_cxx_argument_deduction_constraint) (pp_cxx_exception_constraint, pp_cxx_parameterized_constraint) (pp_cxx_conjunction, pp_cxx_disjunction, pp_cxx_constraint): New. * cxx-pretty-print.h: Declare them. * decl.c (decls_match): Compare constraints. (duplicate_decls): Likewise. Remove constraints before freeing. (cxx_init_decl_processing): Call init_constraint_processing. (cp_finish_decl): Diagnose concept without initializer. (grokfndecl, grokvardecl): Handle concepts and constraints. (grokdeclarator): Handle concept, requires-clause. (grokparms): No longer static. (xref_tag_1): Check constraints. (finish_function): Call check_function_concept. (cp_tree_node_structure): Handle CONSTRAINT_INFO. (check_concept_refinement, is_concept_var, check_concept_fn): New. * decl2.c (check_classfn): Compare constraints. (mark_used): Don't instantiate concepts. * error.c (dump_template_decl): Print constraints. (dump_function_decl): Likewise. (dump_expr): Handle REQUIRES_EXPR, *_REQ, *_CONSTR. * lex.c (init_reswords): Set D_CXX_CONCEPTS. * method.c (implicitly_declare_fn): Copy constraints from inherited ctor. * parser.h (struct cp_parser): Add in_result_type_constraint_p and prevent_constrained_type_specifiers fields. * parser.c (make_call_declarator): Add requires_clause parm. (cp_parser_new): Clear prevent_constrained_type_specifiers. (cp_parser_primary_expression): Handle RID_IS_SAME_AS, RID_REQUIRES. (cp_parser_postfix_expression): Set prevent_constrained_type_specifiers. (cp_parser_trait_expr): Handle RID_IS_SAME_AS. (cp_parser_declaration): Handle concept introduction. (cp_parser_member_declaration): Likewise. (cp_parser_template_parameter): Handle constrained parameter. (cp_parser_type_parameter): Handle constraints. (cp_parser_decl_specifier_seq): Handle RID_CONCEPT. (cp_parser_template_id): Handle partial concept id. (cp_parser_type_name): Add overload that takes typename_keyword_p. Handle constrained parameter. (cp_parser_nonclass_name): Handle concept names. (cp_parser_alias_declaration): Handle constraints. (cp_parser_late_return_type_opt): Also handle requires-clause. (cp_parser_type_id_1): Handle deduction constraint. (cp_parser_parameter_declaration): Handle constrained parameters. (cp_parser_class_specifier_1): Handle constraints. (cp_parser_template_declaration_after_parameters): Split out from cp_parser_template_declaration_after_export. (cp_parser_single_declaration): Handle constraints. (synthesize_implicit_template_parm): Handle constraints. (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_introduction_list, get_id_declarator) (get_unqualified_id, is_constrained_parameter) (cp_parser_check_constrained_type_parm) (cp_parser_constrained_type_template_parm) (cp_parser_constrained_template_template_parm) (constrained_non_type_template_parm, finish_constrained_parameter) (declares_constrained_type_template_parameter) (declares_constrained_template_template_parameter) (check_type_concept, cp_parser_maybe_constrained_type_specifier) (cp_parser_maybe_concept_name, cp_parser_maybe_partial_concept_id) (cp_parser_requires_clause, cp_parser_requires_clause_opt) (cp_parser_requires_expression) (cp_parser_requirement_parameter_list, cp_parser_requirement_body) (cp_parser_requirement_list, cp_parser_requirement) (cp_parser_simple_requirement, cp_parser_type_requirement) (cp_parser_compound_requirement, cp_parser_nested_requirement) (cp_parser_template_introduction) (cp_parser_explicit_template_declaration) (get_concept_from_constraint): New. * pt.c (local_specialization_stack): Implement. (maybe_new_partial_specialization): New. (maybe_process_partial_specialization): Use it. (retrieve_local_specialization, register_local_specialization) (template_parm_to_arg, build_template_decl, extract_fnparm_pack) (tsubst_expr): No longer static. (spec_hasher::equal): Compare constraints. (determine_specialization): Handle constraints. (check_explicit_specialization): Handle concepts. (process_template_parm): Handle constraints. (end_template_parm_list): Add overload taking no arguments. (process_partial_specialization): Handle concepts and constraints. Register partial specializations of variable templates. (redeclare_class_template): Handle constraints. (convert_template_argument): Handle WILDCARD_DECL. Check is_compatible_template_arg. (coerce_template_parameter_pack): Handle wildcard packs. (coerce_template_parms): DR 1430 also applies to concepts. Add overloads taking fewer parameters. (lookup_template_class_1): Handle constraints. (lookup_template_variable): Concepts are always bool. (finish_template_variable): Handle concepts and constraints. (tsubst_friend_class): Handle constraints. (gen_elem_of_pack_expansion_instantiation): Handle constraints. (tsubst_pack_expansion): Handle local parameters. (tsubst_decl) [FUNCTION_DECL]: Handle constraints. (tsubst) [TEMPLATE_TYPE_PARM]: Handle deduction constraints. (tsubst_copy_and_build): Handle REQUIRES_EXPR. (more_specialized_fn, more_specialized_partial_spec): Check constraints. (more_specialized_inst): Split out from most_specialized_instantiation. (most_specialized_partial_spec): Check constraints. (instantiate_decl): Never instantiate a concept. (value_dependent_expression_p): Handle REQUIRES_EXPR, TYPE_REQ, variable concepts. (type_dependent_expression_p): Handle WILDCARD_DECL, REQUIRES_EXPR. (instantiation_dependent_r): Handle REQUIRES_EXPR and concepts. (do_auto_deduction): Add overload taking tsubst flags and context enum. Handle constraints. (get_template_for_ordering, most_constrained_function) (is_compatible_template_arg, convert_wildcard_argument) (struct constr_entry, struct constr_hasher, decl_constraints) (valid_constraints_p, get_constraints, set_constraints) (remove_constraints, init_constraint_processing): New. * ptree.c (cxx_print_xnode): Handle CONSTRAINT_INFO. * search.c (lookup_member): Do lookup in the open partial instantiation. * semantics.c (finish_template_template_parm): Handle constraints. (fixup_template_type): New. (finish_template_type): Call it. (trait_expr_value, finish_trait_expr): Handle CPTK_IS_SAME_AS. * tree.c (cp_tree_equal): Handle local parameters, CONSTRAINT_INFO. (cp_walk_subtrees): Handle REQUIRES_EXPR. * typeck.c (cp_build_function_call_vec): Check constraints. Co-Authored-By: Braden Obrzut <admin@maniacsvault.net> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r226713
2015-08-07 07:44:49 +02:00
call.c (build_user_type_conversion_1, [...]): Pass type directly to lookup_fnfields & build_special_member_call. * call.c (build_user_type_conversion_1, build_new_op, check_constructor_callable, build_temp, perform_direct_initialization_of_possible): Pass type directly to lookup_fnfields & build_special_member_call. (build_special_member_call): Accept a type, and complete it. * class.c (finish_stuct_bits): Copy the BINFOs here. * cvt.c (ocp_convert): Pass type directly to build_special_member_call. * decl.c (build_ptrmemfunc_type): Call xref_bastypes here. (xref_basetypes): Allocate the binfo here. Adjust. * init.c (build_init, build_new_1): Pass type directly to build_special_member_call. * lex.c (cxx_make_type): Do not allocate binfo here. * name-lookup.c (arg_assoc_class): Incomplete types have no binfo. * parser.c (cp_parser_class_head): Always call xref_basetypes. * pt.c (instantiate_class_template): Likewise. Inhibit access checking for template friends. * ptree.c (cxx_print_type): Adjust record printing. * search.c (lookup_base): When taking a type, complete it before looking for a binfo. (lookup_member): Delay completing a type. (push_class_decls): Don't walk an incomplete type. (lookup_conversions): Likewise. * semantics.c (finish_stmt_expr_expr): Pass type directly to build_special_member_call. * tree.c (copy_base_binfos): Adjust. (make_binfo): Likewise. * typeck.c (build_modify_expr): Pass type directly to build_special_member_call. * typeck2.c (process_init_constructor): Check a binfo exists. (build_m_component_ref): Allow accessing an incomplete type. (build_functional_cast): Pass type directly to build_special_member_call. From-SVN: r84562
2004-07-12 18:06:40 +02:00
if (!basetype_path)
basetype_path = TYPE_BINFO (type);
if (!basetype_path)
return NULL_TREE;
1994-02-24 02:02:37 +01:00
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_calls_lookup_field++;
1994-02-24 02:02:37 +01:00
memset (&lfi, 0, sizeof (lfi));
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
lfi.type = type;
lfi.name = name;
lfi.want_type = want_type;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
dfs_walk_all (basetype_path, &lookup_field_r, NULL, &lfi);
rval = lfi.rval;
rval_binfo = lfi.rval_binfo;
if (rval_binfo)
type = BINFO_TYPE (rval_binfo);
errstr = lfi.errstr;
/* If we are not interested in ambiguities, don't report them;
just return NULL_TREE. */
if (!protect && lfi.ambiguous)
return NULL_TREE;
if (protect == 2)
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 (lfi.ambiguous)
return lfi.ambiguous;
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
else
protect = 0;
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* [class.access]
In the case of overloaded function names, access control is
applied to the function selected by overloaded resolution.
We cannot check here, even if RVAL is only a single non-static
member function, since we do not know what the "this" pointer
will be. For:
class A { protected: void f(); };
class B : public A {
void g(A *p) {
f(); // OK
p->f(); // Not OK.
}
};
only the first call to "f" is valid. However, if the function is
static, we can check. */
if (rval && protect
&& !really_overloaded_fn (rval))
{
tree decl = is_overloaded_fn (rval) ? get_first_fn (rval) : rval;
if (!DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
&& !perform_or_defer_access_check (basetype_path, decl, decl,
complain))
rval = error_mark_node;
}
if (errstr && protect)
1994-02-24 02:02:37 +01:00
{
if (complain & tf_error)
{
error (errstr, name, type);
if (lfi.ambiguous)
print_candidates (lfi.ambiguous);
}
1994-02-24 02:02:37 +01:00
rval = error_mark_node;
}
if (rval && is_overloaded_fn (rval))
call.c (build_field_call): Do not look up the field by name. * call.c (build_field_call): Do not look up the field by name. (build_method_call): Simplify. (struct z_candidate): Add access_path and conversion_path. Remove basetype_path. (convert_class_to_reference): Adjust use of add_function_candidate. (add_candidate): Add conversion_path argument. (add_function_candidate): Use it. (add_conv_dndidate): Likewise. (build_builtin_candidate): Likewise. (add_template_candidate_real): Add conversion_path argument. (add_template_conv_candidate): Likewise. (add_template_candidate): Likewise. (build_user_type_conversion_1): Use it. (build_new_function_call): Remove name lookup code. Adjust use of add_template_candidate and add_function_candidate. (build_new_op): Likewise. (convert_like_real): Use build_special_member_call. (build_over_call): Use cand->conversion_path. (build_special_member_call): New method. (build_new_method_call): Remove name lookup code. * cp-tree.def (OFFSET_REF): Update documentation. (TEMPLATE_ID_EXPR): Likewise. * cp-tree.h (BASELINK_ACCESS_BINFO): New macro. (BASELINK_OPTYPE): Likewise. (build_new_method_call): Adjust prototype. (build_special_member_call): New method. (build_baselink): New method. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Likewise. (finish_qualified_call_expr): Remove. (finish_call_expr): Adjust prototype. (build_x_function_call): Remove. * cvt.c (ocp_convert): Use build_special_member_call. * decl2.c (reparse_absdcl_as_expr): Use finish_call_expr. (build_expr_from_tree): Adjust handling for TEMPLATE_ID_EXPR and CALL_EXPR. (build_offset_ref_call_from_tree): New function. (build_call_from_tree): Likewise. * init.c (expand_cleanup): Use build_special_member_call. (expand_default_init): Likewise. (build_member_call): Use finish_call_expr. (build_new_1): Use build_special_member_call. (push_base_cleanups): Likewise. * method.c (do_build_assign_ref): Likewise. * parse.y (template_id): Do not pass a COMPONENT_REF to lookup_template_function. (primary): Use parse_finish_call_epxr, not finish_call_expr. (parse_finish_call_expr): New function. * pt.c (lookup_template_function): Add assertions. * search.c (lookup_base): Allow T to be a binfo. (build_baselink): New function. (lookup_member): Use it. * semantics.c (finish_call_expr): Do not do name lookup. (finish_object_call_expr): Remove #if 0'd code. (finish_qualified_call_expr): Remove. * typeck.c (build_x_function_call): Remove. (build_static_case): Use build_special_member_call. * typeck2.c (build_functional_cast): Likewise. * g++.dg/inherit/operator1.C: New test. * g++.dg/lookup/disamb1.C: Fix typo in comment. * g++.dg/other/error1.C: Change expected error message. * g++.dg/template/conv4.C: Likewise. From-SVN: r55920
2002-08-01 06:46:23 +02:00
rval = build_baselink (rval_binfo, basetype_path, rval,
(IDENTIFIER_TYPENAME_P (name)
? TREE_TYPE (name): NULL_TREE));
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return rval;
}
/* Helper class for lookup_member_fuzzy. */
class lookup_field_fuzzy_info
{
public:
lookup_field_fuzzy_info (bool want_type_p) :
m_want_type_p (want_type_p), m_candidates () {}
void fuzzy_lookup_fnfields (tree type);
void fuzzy_lookup_field (tree type);
/* If true, we are looking for types, not data members. */
bool m_want_type_p;
/* The result: a vec of identifiers. */
auto_vec<tree> m_candidates;
};
/* Locate all methods within TYPE, append them to m_candidates. */
void
lookup_field_fuzzy_info::fuzzy_lookup_fnfields (tree type)
{
vec<tree, va_gc> *method_vec;
tree fn;
size_t i;
if (!CLASS_TYPE_P (type))
return;
method_vec = CLASSTYPE_METHOD_VEC (type);
if (!method_vec)
return;
for (i = 0; vec_safe_iterate (method_vec, i, &fn); ++i)
if (fn)
m_candidates.safe_push (DECL_NAME (OVL_CURRENT (fn)));
}
/* Locate all fields within TYPE, append them to m_candidates. */
void
lookup_field_fuzzy_info::fuzzy_lookup_field (tree type)
{
if (!CLASS_TYPE_P (type))
return;
for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
{
if (!m_want_type_p || DECL_DECLARES_TYPE_P (field))
if (DECL_NAME (field))
m_candidates.safe_push (DECL_NAME (field));
}
}
/* Helper function for lookup_member_fuzzy, called via dfs_walk_all
DATA is really a lookup_field_fuzzy_info. Look for a field with
the name indicated there in BINFO. Gathers pertinent identifiers into
m_candidates. */
static tree
lookup_field_fuzzy_r (tree binfo, void *data)
{
lookup_field_fuzzy_info *lffi = (lookup_field_fuzzy_info *) data;
tree type = BINFO_TYPE (binfo);
/* First, look for functions. */
if (!lffi->m_want_type_p)
lffi->fuzzy_lookup_fnfields (type);
/* Look for data member and types. */
lffi->fuzzy_lookup_field (type);
return NULL_TREE;
}
/* Like lookup_member, but try to find the closest match for NAME,
rather than an exact match, and return an identifier (or NULL_TREE).
Do not complain. */
tree
lookup_member_fuzzy (tree xbasetype, tree name, bool want_type_p)
{
tree type = NULL_TREE, basetype_path = NULL_TREE;
struct lookup_field_fuzzy_info lffi (want_type_p);
/* rval_binfo is the binfo associated with the found member, note,
this can be set with useful information, even when rval is not
set, because it must deal with ALL members, not just non-function
members. It is used for ambiguity checking and the hidden
checks. Whereas rval is only set if a proper (not hidden)
non-function member is found. */
if (name == error_mark_node
|| xbasetype == NULL_TREE
|| xbasetype == error_mark_node)
return NULL_TREE;
gcc_assert (identifier_p (name));
if (TREE_CODE (xbasetype) == TREE_BINFO)
{
type = BINFO_TYPE (xbasetype);
basetype_path = xbasetype;
}
else
{
if (!RECORD_OR_UNION_CODE_P (TREE_CODE (xbasetype)))
return NULL_TREE;
type = xbasetype;
xbasetype = NULL_TREE;
}
type = complete_type (type);
/* Make sure we're looking for a member of the current instantiation in the
right partial specialization. */
if (flag_concepts && dependent_type_p (type))
type = currently_open_class (type);
if (!basetype_path)
basetype_path = TYPE_BINFO (type);
if (!basetype_path)
return NULL_TREE;
/* Populate lffi.m_candidates. */
dfs_walk_all (basetype_path, &lookup_field_fuzzy_r, NULL, &lffi);
return find_closest_identifier (name, &lffi.m_candidates);
}
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Like lookup_member, except that if we find a function member we
return NULL_TREE. */
tree
lookup_field (tree xbasetype, tree name, int protect, bool want_type)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
tree rval = lookup_member (xbasetype, name, protect, want_type,
tf_warning_or_error);
/* Ignore functions, but propagate the ambiguity list. */
if (!error_operand_p (rval)
&& (rval && BASELINK_P (rval)))
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return NULL_TREE;
return rval;
}
/* Like lookup_member, except that if we find a non-function member we
return NULL_TREE. */
tree
lookup_fnfields (tree xbasetype, tree name, int protect)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/false,
tf_warning_or_error);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Ignore non-functions, but propagate the ambiguity list. */
if (!error_operand_p (rval)
&& (rval && !BASELINK_P (rval)))
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return NULL_TREE;
1994-02-24 02:02:37 +01:00
return rval;
}
/* Return the index in the CLASSTYPE_METHOD_VEC for CLASS_TYPE
corresponding to "operator TYPE ()", or -1 if there is no such
operator. Only CLASS_TYPE itself is searched; this routine does
not scan the base classes of CLASS_TYPE. */
static int
lookup_conversion_operator (tree class_type, tree type)
{
int tpl_slot = -1;
if (TYPE_HAS_CONVERSION (class_type))
{
int i;
tree fn;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *methods = CLASSTYPE_METHOD_VEC (class_type);
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_iterate (methods, i, &fn); ++i)
{
/* All the conversion operators come near the beginning of
the class. Therefore, if FN is not a conversion
operator, there is no matching conversion operator in
CLASS_TYPE. */
fn = OVL_CURRENT (fn);
if (!DECL_CONV_FN_P (fn))
break;
if (TREE_CODE (fn) == TEMPLATE_DECL)
/* All the templated conversion functions are on the same
slot, so remember it. */
tpl_slot = i;
else if (same_type_p (DECL_CONV_FN_TYPE (fn), type))
return i;
}
}
return tpl_slot;
}
1994-02-24 02:02:37 +01:00
/* TYPE is a class type. Return the index of the fields within
the method vector with name NAME, or -1 if no such field exists.
Does not lazily declare implicitly-declared member functions. */
1996-07-11 03:13:25 +02:00
static int
lookup_fnfields_idx_nolazy (tree type, tree name)
1994-02-24 02:02:37 +01:00
{
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *method_vec;
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
tree fn;
tree tmp;
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
size_t i;
if (!CLASS_TYPE_P (type))
return -1;
1994-02-24 02:02:37 +01:00
method_vec = CLASSTYPE_METHOD_VEC (type);
if (!method_vec)
return -1;
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_calls_lookup_fnfields_1++;
/* Constructors are first... */
if (name == ctor_identifier)
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
{
fn = CLASSTYPE_CONSTRUCTORS (type);
return fn ? CLASSTYPE_CONSTRUCTOR_SLOT : -1;
}
/* and destructors are second. */
if (name == dtor_identifier)
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
{
fn = CLASSTYPE_DESTRUCTORS (type);
return fn ? CLASSTYPE_DESTRUCTOR_SLOT : -1;
}
if (IDENTIFIER_TYPENAME_P (name))
return lookup_conversion_operator (type, TREE_TYPE (name));
/* Skip the conversion operators. */
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_iterate (method_vec, i, &fn);
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
++i)
if (!DECL_CONV_FN_P (OVL_CURRENT (fn)))
break;
/* If the type is complete, use binary search. */
if (COMPLETE_TYPE_P (type))
{
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
int lo;
int hi;
lo = i;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
hi = method_vec->length ();
while (lo < hi)
{
i = (lo + hi) / 2;
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_outer_fields_searched++;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
tmp = (*method_vec)[i];
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
tmp = DECL_NAME (OVL_CURRENT (tmp));
if (tmp > name)
hi = i;
else if (tmp < name)
lo = i + 1;
else
return i;
1994-02-24 02:02:37 +01:00
}
}
else
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
for (; vec_safe_iterate (method_vec, i, &fn); ++i)
{
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (GATHER_STATISTICS)
n_outer_fields_searched++;
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
if (DECL_NAME (OVL_CURRENT (fn)) == name)
return i;
}
1994-02-24 02:02:37 +01:00
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
return -1;
}
/* TYPE is a class type. Return the index of the fields within
the method vector with name NAME, or -1 if no such field exists. */
int
lookup_fnfields_1 (tree type, tree name)
{
if (!CLASS_TYPE_P (type))
return -1;
if (COMPLETE_TYPE_P (type))
{
if ((name == ctor_identifier
|| name == base_ctor_identifier
|| name == complete_ctor_identifier))
{
if (CLASSTYPE_LAZY_DEFAULT_CTOR (type))
lazily_declare_fn (sfk_constructor, type);
if (CLASSTYPE_LAZY_COPY_CTOR (type))
lazily_declare_fn (sfk_copy_constructor, type);
if (CLASSTYPE_LAZY_MOVE_CTOR (type))
lazily_declare_fn (sfk_move_constructor, type);
}
Introduce C++ support in libcc1 Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-31 02:02:03 +01:00
else if (name == cp_assignment_operator_id (NOP_EXPR))
{
if (CLASSTYPE_LAZY_COPY_ASSIGN (type))
lazily_declare_fn (sfk_copy_assignment, type);
if (CLASSTYPE_LAZY_MOVE_ASSIGN (type))
lazily_declare_fn (sfk_move_assignment, type);
}
else if ((name == dtor_identifier
|| name == base_dtor_identifier
|| name == complete_dtor_identifier
|| name == deleting_dtor_identifier)
&& CLASSTYPE_LAZY_DESTRUCTOR (type))
lazily_declare_fn (sfk_destructor, type);
}
return lookup_fnfields_idx_nolazy (type, name);
}
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
/* TYPE is a class type. Return the field within the method vector with
name NAME, or NULL_TREE if no such field exists. */
tree
lookup_fnfields_slot (tree type, tree name)
{
int ix = lookup_fnfields_1 (complete_type (type), name);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
if (ix < 0)
return NULL_TREE;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
return (*CLASSTYPE_METHOD_VEC (type))[ix];
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
}
/* As above, but avoid lazily declaring functions. */
tree
lookup_fnfields_slot_nolazy (tree type, tree name)
{
int ix = lookup_fnfields_idx_nolazy (complete_type (type), name);
if (ix < 0)
return NULL_TREE;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
return (*CLASSTYPE_METHOD_VEC (type))[ix];
}
/* Like lookup_fnfields_1, except that the name is extracted from
FUNCTION, which is a FUNCTION_DECL or a TEMPLATE_DECL. */
int
class_method_index_for_fn (tree class_type, tree function)
{
gcc_assert (DECL_DECLARES_FUNCTION_P (function));
return lookup_fnfields_1 (class_type,
DECL_CONSTRUCTOR_P (function) ? ctor_identifier :
DECL_DESTRUCTOR_P (function) ? dtor_identifier :
DECL_NAME (function));
}
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
/* DECL is the result of a qualified name lookup. QUALIFYING_SCOPE is
the class or namespace used to qualify the name. CONTEXT_CLASS is
the class corresponding to the object in which DECL will be used.
Return a possibly modified version of DECL that takes into account
the CONTEXT_CLASS.
In particular, consider an expression like `B::m' in the context of
a derived class `D'. If `B::m' has been resolved to a BASELINK,
then the most derived class indicated by the BASELINK_BINFO will be
`B', not `D'. This function makes that adjustment. */
tree
adjust_result_of_qualified_name_lookup (tree decl,
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
tree qualifying_scope,
tree context_class)
{
if (context_class && context_class != error_mark_node
&& CLASS_TYPE_P (context_class)
&& CLASS_TYPE_P (qualifying_scope)
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
&& DERIVED_FROM_P (qualifying_scope, context_class)
&& BASELINK_P (decl))
{
tree base;
/* Look for the QUALIFYING_SCOPE as a base of the CONTEXT_CLASS.
Because we do not yet know which function will be chosen by
overload resolution, we cannot yet check either accessibility
or ambiguity -- in either case, the choice of a static member
function might make the usage valid. */
Make-lang.in (po-generated): Remove parse.c. * Make-lang.in (po-generated): Remove parse.c. (CXX_OBJS): Remove parse.o and spew.o. Add parser.o. ($(srcdir)/cp/parse.h): Remove target. ($(srcdir)/cp/parse.c): Likewise. (gt-cp-parse.h): Likewise. (gt-cp-parser.h): New target. (c++.distclean): Do not remove parse.output. (c++.maintainer-clean): Do not remove parse.c or parse.h. (cp/spew.o): Remove target. (cp/lex.o): Adjust dependencies. (cp/pt.o): Likewise. (cp/parse.o): Likewise. (cp/TAGS): Do not mention parse.c. (cp/parser.o): New target. * NEWS: Mention the new parser. * call.c (build_scoped_method_call): Simplify. (build_method_call): Likewise. (build_new_function_call): Adjust calls to add_function_candidate and add_template_candidate. (build_new_op): Improve handling of erroroneous operands. (convert_default_arg): Remove circular argument processing. (name_as_c_string): New function. (build_new_method_call): Use it. (perform_implicit_conversion): Use error_operand_p. * class.c (finish_struct_anon): Use constructor_name_p. (check_field_decls): Likewise. (pop_nested_class): Use OVL_NEXT, not OVL_CHAIN. (resolve_address_of_overloaded_function): Likewise. (instantiate_type): Tweak pointer-to-member handling. (get_primary_binfo): Remove incorrect assertion. * config-lang.in (gtfiles): Add parser.c, remove parse.c. * cp-tree.h (DEFARG_TOKENS): New macro. (default_arg): New structure. (cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG. (lang_tree_node): Add default_arg. (cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE. (type_info_ref_type): New macro. (saved_scope): Make processing_explicit_instantiation a boolean. (check_access): New field. (unparsed_text): Remove. (language_function): Remove unparsed_inlines. (error_operand_p): New macro. (lang_decl): Adjust pending_inline_info. (DEFARG_POINTER): Remove. (tag_types): Add typenames. (lookup_ualified_name): Declare. (lookup_name_real): Likewise. (shadow_tag): Adjust prototype. (get_scope_of_declarator): Declare it. (process_next_inline): Remove it. (check_for_missing_semicolon): Likewise. (maybe_get_template_decl_from_type_decl): Declare it. (finish_label_stmt): Adjust prototype. (finish_non_static_data_meber): Declare it. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_destructor_expr): ... this. (finish_compound_literal): Declare it. (begin_inline_definitions): Remove it. (init_spew): Remove. (peekyylex): Likewise. (arbitrate_lookup): Likewise. (frob_opname): Likewise. (maybe_snarf_defarg): Likewise. (add_defarg_fn): Likewise. (do_pending_defargs): Likewise. (done_pending_defargs): Likewise. (unprocessed_defarg_fn): Likewise. (replace_defarg): Likewise. (end_input): Likewise. (get_overloaded_fn): Likewise. * cvt.c (convert_to_reference): Improve error handling. * decl.c (lookup_name_real): Do not declare it static. (maybe_push_to_top_level): Set check_access. (identifier_type_value): Adjust call to lookup_name_real. (lookup_qualified_name): New method. (lookup_name_real): Remove special-case parsing code. (lookup_name-nonclass): Adjust call to lookup_name_real. (lookup_name_namespace_only): Likewise. (lookup_name): Likewise. (check_tag_decl): Return the type declared. (shadow_tag): Likewise. (register_dtor_fn): Tweak check_access. (grokfndecl): Use constructor_name_p. (get_scope_of_declarator): New function. (grokdeclarator): Obscure tweaks for slightly different declarator representations. (start_method): Return error_mark_node to indicate failure. (cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs. * decl2.c (constructor_name_full): Simplify. (constructor_name): Use it. (build_expr_from_tree): Adjust for changes to do new parser. (push_scope): Improve robustness. (validate_nonmember_using_decl): Process declarations, not names. (do_class_using_decl): Likewise. (handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS here. * error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs. * expr.c (cxx_expand_expr): Handle BASELINKs. * init.c (member_init_ok_or_else): Issue more errors. (build_offset_ref): Tweak handling of FUNCTION_DECLs. * lex.c: Do not include parse.h. (yypring): Do not declare. (yylval): Likewise. (make_reference_declarator): Remove error-generating code. (rid_to_yy): Remove. (cxx_init): Do not call init_spew. (yypring): Remove. (check_for_missing_semicolon): Remove. * lex.h (got_scope): Remove. (got_object): Remove. * method.c (hack_identifier): Use finish_non_static_data_member. (implicitly_declare_fn): Adjust use of constructor_name. * parser.c: New file. * pt.c (parse.h): Do not include it. (maybe_get_template_decl_from_template): Do not declare it. (finish_member_template_decl): Tweak. (begin_explicit_instantiation): Adjust for processing_explicit_instantiation being boolean. (end_explicit_instantiation): Likewise. (maybe_process_partial_specialization): Tighten specialization test. (retrieve_local_specialization): Adjust ue of hash table. (eq_local_specializations): New function. (register_local_specialization): Likewise. (push_template_decl_real): Remove unnecessary test. (maybe_get_template_decl_from_type_decl): Don't make it static. (for_each_template_parm_r): Handle TYPEOF_TYPE. (tsubst_copy): Use retrieive_local_specialization to handle PARM_DECL. Adjust handling of CONST_DECLs. Handle BASELINKs. Handle COMPONENT_REFs with pseudo-destructor-expressions. Simplify handling of CALL_EXPR and METHOD_CALL_EXPR. (tsubst_expr): Pass decls, not names, to do_local_using_decl. (unify): Tweak handling of CONST_DECLs. (regenerate_decl_from_template): Use push_nested_class. (template_for_substitution): New funciton. (instantiate_decl): Use it. Register parameters as local specializations. * rtti.c (init_rtti_processing): Set type_info_ref_type. (build_typeid): Use it. (get_typeid): Likeise. * search.c (accessible_p): Use check_access, not flag_access_control. (adjust_result_of_qualified_name_lookup): Pay attention to the context_class. * semantics.c (finish_asm_stmt): Adjust error handling. (finish_label_stmt): Return the statement. (finish_non_static_data_member): New function. (finish_class_expr): Handle BASELINKs. (finish_call_expr): Handle PSEUDO_DTOR_EXPR. (finish_object_call_expr): Simplify handling during templates. (finish_pseudo_destructor_call_expr): Rename to ... (finish_pseudo_dtor_expr): ... this. (finish_compound_literal): New function. (begin_inline_definitions): Remove. (finish_sizeof): Remove special template handling. * spew.c: Do not include parse.h. * tree.c (get_overloaded_fn): Remove. * typeck.c (build_class_member_access_expr): Handle PSEUDO_DTOR_EXPR. Adjust handling of static member functions. (lookup_destructor): New function. (finish_class_member_access_expr): Use it. (convert_arguments): Simplify. (build_unary_op): Handle BASELINKs. From-SVN: r60560
2002-12-28 09:03:42 +01:00
base = lookup_base (context_class, qualifying_scope,
ba_unique, NULL, tf_none);
if (base && base != error_mark_node)
{
BASELINK_ACCESS_BINFO (decl) = base;
tree decl_binfo
= lookup_base (base, BINFO_TYPE (BASELINK_BINFO (decl)),
ba_unique, NULL, tf_none);
if (decl_binfo && decl_binfo != error_mark_node)
BASELINK_BINFO (decl) = decl_binfo;
}
}
if (BASELINK_P (decl))
BASELINK_QUALIFIED_P (decl) = true;
return decl;
}
1994-02-24 02:02:37 +01:00
/* Walk the class hierarchy within BINFO, in a depth-first traversal.
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
PRE_FN is called in preorder, while POST_FN is called in postorder.
If PRE_FN returns DFS_SKIP_BASES, child binfos will not be
walked. If PRE_FN or POST_FN returns a different non-NULL value,
that value is immediately returned and the walk is terminated. One
of PRE_FN and POST_FN can be NULL. At each node, PRE_FN and
POST_FN are passed the binfo to examine and the caller's DATA
value. All paths are walked, thus virtual and morally virtual
binfos can be multiply walked. */
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
cp-tree.h (flag_new_abi): Move. * cp-tree.h (flag_new_abi): Move. (flag_use_cxa_atexit): Likewise. (flag_honor_std): Likewise. (flag_rtti): Likewise. (vbase_offsets_in_vtable_p): Define. (vptrs_present_everywhere_p): Likewise. (TYPE_CONTAINS_VPTR_P): Likewise. (dfs_walk_real): Declare. * class.c (build_vbase_pointer_fields): Check vbase_offsets_in_vtable_p. (dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in BINFO_VPTR_FIELD. (build_vbase_offset_vtbl_entries): Simplify. (build_vbase_offset_vtbl_entries): Adjust. (build_vbase_pointer): Add ability to look up vbase offsets in vtable. (start_vtable): New function. (add_virtual_function): Use it. (determine_primary_base): Use TYPE_CONTAINS_VPTR_P. (num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p. (build_vtbl_initializer): Take the type of the complete object as input. Use it to correctly calculate vbase offsets. (dfs_finish_vtbls): Pass the complete type to build_vtbl_initializer. (check_bases_and_members): Use TYPE_CONTAINS_VPTR_P. (create_vtable_ptr): Create a vtable even if there are no new virtual functions, under the new ABI. (finish_struct_1): Likewise. (get_vfield_name): Use TYPE_CONTAINS_VPTR_P. * decl.c (exapnd_static_init): Remove call to preserve_initializer. * decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in vtables. * init.c (initialize_vtbl_ptrs): Initialize them in pre-order. (expand_virtual_init): Use vbase_offsets_in_vtable_p. (construct_virtual_bases): Don't initialize virtual base pointers under the new ABI. (build_aggr_init): Clean up comment. (expand_aggr_init_1): Likewise. * rtti.c (expand_class_desc): Store the virtual function table index where the vbase offset lives in the offset field. * search.c (dfs_walk_real): Make it global. (dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P. * tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD. * tinfo.h (USItype): Make it signed under the new ABI. * tinfo.cc (convert_to_base): New function. Encapsulate base conversion logic here. (__class_type_info::do_upcast): Use it. (__class_type_info::do_dyncast): Likewise. (__class_type_info::do_find_public_subobj): Likewise. From-SVN: r31452
2000-01-17 05:08:01 +01:00
tree
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
dfs_walk_all (tree binfo, tree (*pre_fn) (tree, void *),
tree (*post_fn) (tree, void *), void *data)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
tree rval;
unsigned ix;
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
tree base_binfo;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Call the pre-order walking function. */
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
if (pre_fn)
{
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
rval = pre_fn (binfo, data);
if (rval)
{
if (rval == dfs_skip_bases)
goto skip_bases;
return rval;
}
}
/* Find the next child binfo to walk. */
for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
{
rval = dfs_walk_all (base_binfo, pre_fn, post_fn, data);
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
if (rval)
return rval;
1994-02-24 02:02:37 +01:00
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
skip_bases:
/* Call the post-order walking function. */
if (post_fn)
{
rval = post_fn (binfo, data);
gcc_assert (rval != dfs_skip_bases);
return rval;
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
return NULL_TREE;
}
/* Worker for dfs_walk_once. This behaves as dfs_walk_all, except
that binfos are walked at most once. */
static tree
dfs_walk_once_r (tree binfo, tree (*pre_fn) (tree, void *),
tree (*post_fn) (tree, void *), hash_set<tree> *pset,
void *data)
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
{
tree rval;
unsigned ix;
tree base_binfo;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
/* Call the pre-order walking function. */
if (pre_fn)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
rval = pre_fn (binfo, data);
if (rval)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
if (rval == dfs_skip_bases)
goto skip_bases;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
return rval;
}
}
/* Find the next child binfo to walk. */
for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
{
if (BINFO_VIRTUAL_P (base_binfo))
if (pset->add (base_binfo))
continue;
rval = dfs_walk_once_r (base_binfo, pre_fn, post_fn, pset, data);
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
if (rval)
return rval;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
skip_bases:
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
/* Call the post-order walking function. */
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
if (post_fn)
{
rval = post_fn (binfo, data);
gcc_assert (rval != dfs_skip_bases);
return rval;
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
return NULL_TREE;
}
/* Like dfs_walk_all, except that binfos are not multiply walked. For
non-diamond shaped hierarchies this is the same as dfs_walk_all.
For diamond shaped hierarchies we must mark the virtual bases, to
avoid multiple walks. */
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
tree
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
dfs_walk_once (tree binfo, tree (*pre_fn) (tree, void *),
tree (*post_fn) (tree, void *), void *data)
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
{
static int active = 0; /* We must not be called recursively. */
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
tree rval;
gcc_assert (pre_fn || post_fn);
gcc_assert (!active);
active++;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
if (!CLASSTYPE_DIAMOND_SHAPED_P (BINFO_TYPE (binfo)))
/* We are not diamond shaped, and therefore cannot encounter the
same binfo twice. */
rval = dfs_walk_all (binfo, pre_fn, post_fn, data);
else
{
hash_set<tree> pset;
rval = dfs_walk_once_r (binfo, pre_fn, post_fn, &pset, data);
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
}
active--;
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
return rval;
cp-tree.h (flag_access_control): Declare. * cp-tree.h (flag_access_control): Declare. (TREE_VIA_PPUBLIC): Document. (DECL_NONSTATIC_MEMBER_P): New macro. (enforce_access): Return an indication of whether or not access was permitted. (build_self_reference): Change prototype. (compute_access): Replace with ... (accessible_p): New function. (dfs_walk): Change prototype. (dfs_unmark): Likewise. (markedp): Likewise. * call.c (enforce_access): Use accessible_p. * class.c (build_self_reference): Insert the declaration into the list of members for this type, and make it public. * decl.c (xref_basetypes): Avoid ill-timed recursion. * init.c (build_offset_ref): Use lookup_member, not three separate name-lookups. Call enforce_access rather than checking for illegal accesses here. (resolve_offset_ref): Likewise. * lex.c (do_identifier): Likewise. * method.c (hack_identifier): Likewise. * parse.y (self_reference): Remove. (opt_component_decl_list): Don't use it. * parse.c: Regenerated. * pt.c (print_candidates): Generalize to handle lists of overloaded functions. (instantiate_class_template): Don't rely on TREE_VIA_PRIVATE; it's not set. (get_template_base): Use new calling convention for dfs_walk. * search.c: Include varray.h. Add prototypes. (dfs_walk): Accept a data pointer to pass to the work functions. All callers changed. All work functions changed. (breadth_first_search): Rename to bfs_walk, and make consistent with dfs_walk. (dfs_walk_real): New function. (canonical_binfo): New function. (context_for_name_lookup): Likewise. (shared_marked_p): Likewise. (shared_unmarked_p): Likewise. (lokup_field_queue_p): Likewise. (lookup_field_r): Generalize to handle both functions and fields. (lookup_field): Just call lookup_member. (lookup_fnfields): Likewise. (lookup_member): Move body of lookup_field here and generalize. (dfs_accessible_queue_p): Likewise. (dfs_accessible_p): Likewise. (dfs_access_in_type): Likewise. (access_in_type): Likewise. (compute_access): Remove, and replace with ... (accessible_p): New function. (vbase_types): Remove. (vbase_decl_ptr_intermediate): Likewise. (vbase_decl_ptr): Likewise. (vbase_init_result): Likewise. (closed_envelopes): Likewise. (bvtable): Likewise. From-SVN: r25661
1999-03-10 00:02:42 +01:00
}
/* Worker function for dfs_walk_once_accessible. Behaves like
dfs_walk_once_r, except (a) FRIENDS_P is true if special
access given by the current context should be considered, (b) ONCE
indicates whether bases should be marked during traversal. */
static tree
dfs_walk_once_accessible_r (tree binfo, bool friends_p, hash_set<tree> *pset,
tree (*pre_fn) (tree, void *),
tree (*post_fn) (tree, void *), void *data)
{
tree rval = NULL_TREE;
unsigned ix;
tree base_binfo;
/* Call the pre-order walking function. */
if (pre_fn)
{
rval = pre_fn (binfo, data);
if (rval)
{
if (rval == dfs_skip_bases)
goto skip_bases;
return rval;
}
}
/* Find the next child binfo to walk. */
for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
{
bool mark = pset && BINFO_VIRTUAL_P (base_binfo);
if (mark && pset->contains (base_binfo))
continue;
/* If the base is inherited via private or protected
inheritance, then we can't see it, unless we are a friend of
the current binfo. */
if (BINFO_BASE_ACCESS (binfo, ix) != access_public_node)
{
tree scope;
if (!friends_p)
continue;
scope = current_scope ();
if (!scope
|| TREE_CODE (scope) == NAMESPACE_DECL
|| !is_friend (BINFO_TYPE (binfo), scope))
continue;
}
if (mark)
pset->add (base_binfo);
rval = dfs_walk_once_accessible_r (base_binfo, friends_p, pset,
pre_fn, post_fn, data);
if (rval)
return rval;
}
skip_bases:
/* Call the post-order walking function. */
if (post_fn)
{
rval = post_fn (binfo, data);
gcc_assert (rval != dfs_skip_bases);
return rval;
}
return NULL_TREE;
}
/* Like dfs_walk_once except that only accessible bases are walked.
FRIENDS_P indicates whether friendship of the local context
should be considered when determining accessibility. */
static tree
dfs_walk_once_accessible (tree binfo, bool friends_p,
tree (*pre_fn) (tree, void *),
tree (*post_fn) (tree, void *), void *data)
{
hash_set<tree> *pset = NULL;
if (CLASSTYPE_DIAMOND_SHAPED_P (BINFO_TYPE (binfo)))
pset = new hash_set<tree>;
tree rval = dfs_walk_once_accessible_r (binfo, friends_p, pset,
pre_fn, post_fn, data);
if (pset)
delete pset;
return rval;
}
/* Check that virtual overrider OVERRIDER is acceptable for base function
BASEFN. Issue diagnostic, and return zero, if unacceptable. */
static int
check_final_overrider (tree overrider, tree basefn)
{
tree over_type = TREE_TYPE (overrider);
tree base_type = TREE_TYPE (basefn);
tree over_return = fndecl_declared_return_type (overrider);
tree base_return = fndecl_declared_return_type (basefn);
tree over_throw, base_throw;
int fail = 0;
if (DECL_INVALID_OVERRIDER_P (overrider))
return 0;
if (same_type_p (base_return, over_return))
/* OK */;
else if ((CLASS_TYPE_P (over_return) && CLASS_TYPE_P (base_return))
|| (TREE_CODE (base_return) == TREE_CODE (over_return)
&& POINTER_TYPE_P (base_return)))
{
/* Potentially covariant. */
unsigned base_quals, over_quals;
fail = !POINTER_TYPE_P (base_return);
if (!fail)
{
fail = cp_type_quals (base_return) != cp_type_quals (over_return);
base_return = TREE_TYPE (base_return);
over_return = TREE_TYPE (over_return);
}
base_quals = cp_type_quals (base_return);
over_quals = cp_type_quals (over_return);
if ((base_quals & over_quals) != over_quals)
fail = 1;
if (CLASS_TYPE_P (base_return) && CLASS_TYPE_P (over_return))
{
/* Strictly speaking, the standard requires the return type to be
complete even if it only differs in cv-quals, but that seems
like a bug in the wording. */
if (!same_type_ignoring_top_level_qualifiers_p (base_return,
over_return))
{
tree binfo = lookup_base (over_return, base_return,
ba_check, NULL, tf_none);
if (!binfo || binfo == error_mark_node)
fail = 1;
}
}
else if (can_convert_standard (TREE_TYPE (base_type),
TREE_TYPE (over_type),
tf_warning_or_error))
/* GNU extension, allow trivial pointer conversions such as
converting to void *, or qualification conversion. */
{
if (pedwarn (DECL_SOURCE_LOCATION (overrider), 0,
"invalid covariant return type for %q#D", overrider))
inform (DECL_SOURCE_LOCATION (basefn),
" overriding %q#D", basefn);
}
else
fail = 2;
}
else
fail = 2;
if (!fail)
/* OK */;
else
{
if (fail == 1)
{
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("invalid covariant return type for %q+#D", overrider);
error (" overriding %q+#D", basefn);
}
else
{
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("conflicting return type specified for %q+#D", overrider);
error (" overriding %q+#D", basefn);
}
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
/* Check throw specifier is at least as strict. */
maybe_instantiate_noexcept (basefn);
maybe_instantiate_noexcept (overrider);
base_throw = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (basefn));
over_throw = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (overrider));
if (!comp_except_specs (base_throw, over_throw, ce_derived))
{
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("looser throw specifier for %q+#F", overrider);
error (" overriding %q+#F", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
Implement N4514, C++ Extensions for Transactional Memory. gcc/ * builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute. gcc/c-family/ * c-common.c (c_common_reswords): Add C++ TM TS keywords. (c_common_attribute_table): Add transaction_safe_dynamic. transaction_safe now affects type identity. (handle_tm_attribute): Handle transaction_safe_dynamic. * c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT, RID_ATOMIC_CANCEL, RID_SYNCHRONIZED. (OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED. (D_TRANSMEM): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory. * c-pretty-print.c (pp_c_attributes_display): Don't print transaction_safe in C++. gcc/c/ * c-parser.c (c_lex_one_token): Handle @synchronized. * c-decl.c (match_builtin_function_types): A declaration of a built-in can change whether the function is transaction_safe. gcc/cp/ * cp-tree.h (struct cp_declarator): Add tx_qualifier field. (BCS_NORMAL, BCS_TRANSACTION): New enumerators. * lex.c (init_reswords): Limit TM kewords to -fgnu-tm. * parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized. (make_call_declarator): Take tx_qualifier. (cp_parser_tx_qualifier_opt): New. (cp_parser_lambda_declarator_opt): Use it. (cp_parser_direct_declarator): Likewise. (cp_parser_statement): Handle atomic_noexcept, atomic_cancel. (cp_parser_compound_statement): Change in_try parameter to bcs_flags. (cp_parser_std_attribute): Map optimize_for_synchronized to transaction_callable. (cp_parser_transaction): Take the token. Handle atomic_noexcept. * lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety. * call.c (enum conversion_kind): Add ck_tsafe. (standard_conversion): Handle transaction-safety conversion. (convert_like_real, resolve_address_of_overloaded_function): Likewise. (check_methods): Diagnose transaction_safe_dynamic on non-virtual function. (look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic. * cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant) (can_convert_tx_safety): New. * typeck.c (composite_pointer_type): Handle transaction-safety. * name-lookup.h (enum scope_kind): Add sk_transaction. * name-lookup.c (begin_scope): Handle it. * semantics.c (begin_compound_stmt): Pass it. * decl.c (check_previous_goto_1): Check it. (struct named_label_entry): Add in_transaction_scope. (poplevel_named_label_1): Set it. (check_goto): Check it. (duplicate_decls): A specialization can be transaction_safe independently of its template. (grokdeclarator): Handle tx-qualifier. * rtti.c (ptr_initializer): Handle transaction-safe. * search.c (check_final_overrider): Check transaction_safe_dynamic. Don't check transaction_safe. * mangle.c (write_function_type): Mangle transaction_safe here. (write_CV_qualifiers_for_type): Not here. (write_type): Preserve transaction_safe when stripping attributes. * error.c (dump_type_suffix): Print transaction_safe. libiberty/ * cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe. (cplus_demangle_type): Let d_cv_qualifiers handle it. (d_dump, d_make_comp, has_return_type, d_encoding) (d_count_templates_scopes, d_print_comp_inner) (d_print_mod_list, d_print_mod, d_print_function_type) (is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE. From-SVN: r228462
2015-10-04 21:17:19 +02:00
/* Check for conflicting type attributes. But leave transaction_safe for
set_one_vmethod_tm_attributes. */
if (!comp_type_attributes (over_type, base_type)
&& !tx_safe_fn_type_p (base_type)
&& !tx_safe_fn_type_p (over_type))
{
error ("conflicting type attributes specified for %q+#D", overrider);
error (" overriding %q+#D", basefn);
DECL_INVALID_OVERRIDER_P (overrider) = 1;
return 0;
}
Implement N4514, C++ Extensions for Transactional Memory. gcc/ * builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute. gcc/c-family/ * c-common.c (c_common_reswords): Add C++ TM TS keywords. (c_common_attribute_table): Add transaction_safe_dynamic. transaction_safe now affects type identity. (handle_tm_attribute): Handle transaction_safe_dynamic. * c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT, RID_ATOMIC_CANCEL, RID_SYNCHRONIZED. (OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED. (D_TRANSMEM): New. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory. * c-pretty-print.c (pp_c_attributes_display): Don't print transaction_safe in C++. gcc/c/ * c-parser.c (c_lex_one_token): Handle @synchronized. * c-decl.c (match_builtin_function_types): A declaration of a built-in can change whether the function is transaction_safe. gcc/cp/ * cp-tree.h (struct cp_declarator): Add tx_qualifier field. (BCS_NORMAL, BCS_TRANSACTION): New enumerators. * lex.c (init_reswords): Limit TM kewords to -fgnu-tm. * parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized. (make_call_declarator): Take tx_qualifier. (cp_parser_tx_qualifier_opt): New. (cp_parser_lambda_declarator_opt): Use it. (cp_parser_direct_declarator): Likewise. (cp_parser_statement): Handle atomic_noexcept, atomic_cancel. (cp_parser_compound_statement): Change in_try parameter to bcs_flags. (cp_parser_std_attribute): Map optimize_for_synchronized to transaction_callable. (cp_parser_transaction): Take the token. Handle atomic_noexcept. * lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety. * call.c (enum conversion_kind): Add ck_tsafe. (standard_conversion): Handle transaction-safety conversion. (convert_like_real, resolve_address_of_overloaded_function): Likewise. (check_methods): Diagnose transaction_safe_dynamic on non-virtual function. (look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic. * cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant) (can_convert_tx_safety): New. * typeck.c (composite_pointer_type): Handle transaction-safety. * name-lookup.h (enum scope_kind): Add sk_transaction. * name-lookup.c (begin_scope): Handle it. * semantics.c (begin_compound_stmt): Pass it. * decl.c (check_previous_goto_1): Check it. (struct named_label_entry): Add in_transaction_scope. (poplevel_named_label_1): Set it. (check_goto): Check it. (duplicate_decls): A specialization can be transaction_safe independently of its template. (grokdeclarator): Handle tx-qualifier. * rtti.c (ptr_initializer): Handle transaction-safe. * search.c (check_final_overrider): Check transaction_safe_dynamic. Don't check transaction_safe. * mangle.c (write_function_type): Mangle transaction_safe here. (write_CV_qualifiers_for_type): Not here. (write_type): Preserve transaction_safe when stripping attributes. * error.c (dump_type_suffix): Print transaction_safe. libiberty/ * cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe. (cplus_demangle_type): Let d_cv_qualifiers handle it. (d_dump, d_make_comp, has_return_type, d_encoding) (d_count_templates_scopes, d_print_comp_inner) (d_print_mod_list, d_print_mod, d_print_function_type) (is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE. From-SVN: r228462
2015-10-04 21:17:19 +02:00
/* A function declared transaction_safe_dynamic that overrides a function
declared transaction_safe (but not transaction_safe_dynamic) is
ill-formed. */
if (tx_safe_fn_type_p (base_type)
&& lookup_attribute ("transaction_safe_dynamic",
DECL_ATTRIBUTES (overrider))
&& !lookup_attribute ("transaction_safe_dynamic",
DECL_ATTRIBUTES (basefn)))
{
error_at (DECL_SOURCE_LOCATION (overrider),
"%qD declared %<transaction_safe_dynamic%>", overrider);
inform (DECL_SOURCE_LOCATION (basefn),
"overriding %qD declared %<transaction_safe%>", basefn);
}
if (DECL_DELETED_FN (basefn) != DECL_DELETED_FN (overrider))
{
if (DECL_DELETED_FN (overrider))
{
error ("deleted function %q+D", overrider);
error ("overriding non-deleted function %q+D", basefn);
Machinery to support implicit delete/move. * cp-tree.h: (struct lang_type_class): Add lazy_move_assign, has_complex_move_ctor, has_complex_move_assign bitfields. (CLASSTYPE_LAZY_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_ASSIGN): New. (TYPE_HAS_COMPLEX_MOVE_CTOR): New. (enum special_function_kind): Add sfk_move_assignment. (LOOKUP_SPECULATIVE): New. * call.c (build_over_call): Return early if it's set. (build_over_call): Use trivial_fn_p. * class.c (check_bases): If the base has no default constructor, the derived one is non-trivial. Handle move ctor/op=. (check_field_decl): Likewise. (check_bases_and_members): Handle move ctor/op=. (add_implicitly_declared_members): Handle CLASSTYPE_LAZY_MOVE_ASSIGN. (type_has_move_constructor, type_has_move_assign): New. * decl.c (grok_special_member_properties): Handle move ctor/op=. * method.c (type_has_trivial_fn, type_set_nontrivial_flag): New. (trivial_fn_p): New. (do_build_copy_constructor): Use it. (do_build_assign_ref): Likewise. Handle move assignment. (build_stub_type, build_stub_object, locate_fn_flags): New. (locate_ctor): Use locate_fn_flags. (locate_copy, locate_dtor): Remove. (get_dtor, get_default_ctor, get_copy_ctor, get_copy_assign): New. (process_subob_fn, synthesized_method_walk): New. (maybe_explain_implicit_delete): New. (implicitly_declare_fn): Use synthesized_method_walk, type_has_trivial_fn, and type_set_nontrivial_flag. (defaulted_late_check): Set DECL_DELETED_FN. (defaultable_fn_check): Handle sfk_move_assignment. (lazily_declare_fn): Clear CLASSTYPE_LAZY_* early. Don't declare implicitly deleted move ctor/op=. * search.c (lookup_fnfields_1): Handle sfk_move_assignment. (lookup_fnfields_slot): New. * semantics.c (omp_clause_info_fndecl): Remove. (cxx_omp_create_clause_info): Use get_default_ctor, get_copy_ctor, get_copy_assign, trivial_fn_p. (trait_expr_value): Adjust call to locate_ctor. * tree.c (special_function_p): Handle sfk_move_assignment. From-SVN: r161579
2010-06-30 02:50:57 +02:00
maybe_explain_implicit_delete (overrider);
}
else
{
error ("non-deleted function %q+D", overrider);
error ("overriding deleted function %q+D", basefn);
}
return 0;
}
if (DECL_FINAL_P (basefn))
{
error ("virtual function %q+D", overrider);
error ("overriding final function %q+D", basefn);
return 0;
}
return 1;
}
/* Given a class TYPE, and a function decl FNDECL, look for
virtual functions in TYPE's hierarchy which FNDECL overrides.
We do not look in TYPE itself, only its bases.
Returns nonzero, if we find any. Set FNDECL's DECL_VIRTUAL_P, if we
find that it overrides anything.
We check that every function which is overridden, is correctly
overridden. */
1996-07-11 03:13:25 +02:00
int
look_for_overrides (tree type, tree fndecl)
1994-02-24 02:02:37 +01:00
{
tree binfo = TYPE_BINFO (type);
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
tree base_binfo;
int ix;
int found = 0;
1994-02-24 02:02:37 +01:00
/* A constructor for a class T does not override a function T
in a base class. */
if (DECL_CONSTRUCTOR_P (fndecl))
return 0;
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
{
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
tree basetype = BINFO_TYPE (base_binfo);
if (TYPE_POLYMORPHIC_P (basetype))
found += look_for_overrides_r (basetype, fndecl);
}
return found;
}
call.c (build_special_member_call): Do not try to lookup VTTs by name. * call.c (build_special_member_call): Do not try to lookup VTTs by name. * class.c (vtbl_init_data): Add generate_vcall_entries. (get_vtable_decl): Do not look up virtual tables by name. (copy_virtuals): Do not use BV_USE_VCALL_INDEX_P. (set_primary_base): Do not set CLASSTYPE_RTTI. (determine_primary_base): Likewise. (get_matching_virtual): Remove. (get_vcall_index): New function. (update_vtable_entry_for_fn): Do not try to use virtual thunks when they are not required. Assign vcall indices at this point. (finish_struct_1): Do not set CLASSTYPE_NEEDS_VIRTUAL_REINIT. Do update dynamic_classes. (build_vtt): Do not add VTTs to the symbol table. (build_ctor_vtbl_group): Likewise. (build_vtbl_initializer): Simplify handling of vcall indices. (build_vcall_offset_vtbl_entries): Pretend to build vcall offsets for the most derived class. (add_vcall_offset_vtbl_entries_1): But do not actually add them to the vtable. * cp-tree.h (dynamic_classes): New macro. (lang_type_class): Remove rtti. Add vtables. Add vcall_indices. (CLASSTYPE_RTTI): Remove. (CLASSTYPE_NEEDS_VIRTUAL_REINIT): Remove. (CLASSTYPE_VCALL_INDICES): New macro. (CLASSTYPE_VTABLES): Likewise. (BV_USE_VCALL_INDEX_P): Remove. (build_vtable_path): Remove. * decl2.c (finish_vtable_vardecl): Remove. (key_method): Remove #if 0'd code. (finish_vtable_vardecl): Rename to ... (maybe_emit_vtables): ... this. (finish_file): Use it. * search.c (look_for_overrides_here): Update comment. * g++.dg/abi/thunk1.C: New test. * g++.dg/abi/thunk2.C: Likewise. * g++.dg/abi/vtt1.C: Likewise. From-SVN: r58779
2002-11-04 02:45:58 +01:00
/* Look in TYPE for virtual functions with the same signature as
FNDECL. */
tree
look_for_overrides_here (tree type, tree fndecl)
{
int ix;
/* If there are no methods in TYPE (meaning that only implicitly
declared methods will ever be provided for TYPE), then there are
no virtual functions. */
if (!CLASSTYPE_METHOD_VEC (type))
return NULL_TREE;
if (DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (fndecl))
ix = CLASSTYPE_DESTRUCTOR_SLOT;
1994-02-24 02:02:37 +01:00
else
ix = lookup_fnfields_1 (type, DECL_NAME (fndecl));
if (ix >= 0)
1994-02-24 02:02:37 +01:00
{
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
tree fns = (*CLASSTYPE_METHOD_VEC (type))[ix];
for (; fns; fns = OVL_NEXT (fns))
{
tree fn = OVL_CURRENT (fns);
if (!DECL_VIRTUAL_P (fn))
/* Not a virtual. */;
else if (DECL_CONTEXT (fn) != type)
/* Introduced with a using declaration. */;
else if (DECL_STATIC_FUNCTION_P (fndecl))
1994-02-24 02:02:37 +01:00
{
tree btypes = TYPE_ARG_TYPES (TREE_TYPE (fn));
tree dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
if (compparms (TREE_CHAIN (btypes), dtypes))
return fn;
}
else if (same_signature_p (fndecl, fn))
return fn;
}
}
return NULL_TREE;
}
Do put the VTT parameter in DECL_ARGUMENTS. * cp-tree.h (struct cp_language_function): Add x_vtt_parm. (current_vtt_parm): New macro. (struct lang_decl_flags): Add has_vtt_parm_p, remove vtt_parm. (DECL_HAS_VTT_PARM_P): New macro. (DECL_VTT_PARM): Remove. (FUNCTION_FIRST_USER_PARMTYPE, FUNCTION_FIRST_USER_PARM): New macros. * decl.c (duplicate_decls): Only copy the operator code if appropriate. (start_function): Set current_vtt_parm. (lang_mark_tree): Don't mark vtt_parm. * decl2.c (maybe_retrofit_in_chrg): Do add the VTT parm to DECL_ARGUMENTS. Set DECL_HAS_VTT_PARM_P. * class.c (build_clone): Maybe remove the VTT parm. * optimize.c (maybe_clone_body): Set up the VTT parm. * pt.c (copy_default_args_to_explicit_spec): Preserve the VTT parm. * call.c (build_over_call): Just allow the VTT arg. * method.c (make_thunk): Don't set DECL_VTT_PARM. (do_build_copy_constructor): Use FUNCTION_FIRST_USER_PARM. (synthesize_method): Use FUNCTION_FIRST_USER_PARMTYPE. * decl.c (grokdeclarator, copy_args_p, grok_ctor_properties): Likewise. * error.c (dump_function_decl): Likewise. * call.c (build_user_type_conversion_1, convert_like_real): Abort if we try to call a constructor with in-charge or VTT parms. * method.c (skip_artificial_parms_for): New fn. * call.c (add_function_candidate, build_over_call): Call it. * call.c (build_new_method_call): Use current_vtt_parm. * init.c (expand_virtual_init): Likewise. * class.c (same_signature_p): No longer static. * cp-tree.h: Declare it. * search.c (look_for_overrides_r): Use it. From-SVN: r39841
2001-02-18 20:08:00 +01:00
/* Look in TYPE for virtual functions overridden by FNDECL. Check both
TYPE itself and its bases. */
static int
look_for_overrides_r (tree type, tree fndecl)
{
tree fn = look_for_overrides_here (type, fndecl);
if (fn)
{
if (DECL_STATIC_FUNCTION_P (fndecl))
{
/* A static member function cannot match an inherited
virtual member function. */
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("%q+#D cannot be declared", fndecl);
error (" since %q+#D declared in base class", fn);
}
else
{
/* It's definitely virtual, even if not explicitly set. */
DECL_VIRTUAL_P (fndecl) = 1;
check_final_overrider (fndecl, fn);
1994-02-24 02:02:37 +01:00
}
return 1;
1994-02-24 02:02:37 +01:00
}
/* We failed to find one declared in this class. Look in its bases. */
return look_for_overrides (type, fndecl);
1994-02-24 02:02:37 +01:00
}
/* Called via dfs_walk from dfs_get_pure_virtuals. */
static tree
dfs_get_pure_virtuals (tree binfo, void *data)
{
tree type = (tree) data;
/* We're not interested in primary base classes; the derived class
of which they are a primary base will contain the information we
need. */
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
if (!BINFO_PRIMARY_P (binfo))
{
tree virtuals;
Put RTTI entries at negative offsets in new ABI. * class.c (dfs_build_vbase_offset_vtbl_entries): Put the first vbase offset at index -3, not -1. (build_vtabe_offset_vtbl_entries): Use unmarked_vtable_pathp, not dfs_vtable_path_unmarked_real_bases_queue_p to walk bases. (dfs_build_vcall_offset_vtbl_entries): Don't use skip_rtti_stuff. (build_rtti_vtbl_entries): New function. (set_rtti_entry): Remove. (build_primary_vtable): Don't use it. (build_secondary_vtable): Likewise. (start_vtable): Remove. (first_vfun_index): New function. (set_vindex): Likewise. (add_virtual_function): Don't call start_vtable. Do call set_vindex. (set_primary_base): Rename parameter. (determine_primary_base): Likewise. (num_vfun_entries): Don't use skip_rtti_stuff. (num_extra_vtbl_entries): Include RTTI information. (build_vtbl_initializer): Use build_rtti_vtbl_entries. (skip_rtti_stuff): Remove. (dfs_modify_vtables): Don't use it. (modify_all_vtables): Don't use start_vtable. Do use set_vindex. (layout_nonempty_base_or_field): Update size handling. (create_vtable_ptr): Tweak. (layout_class_type): Adjust parameter names. (finish_struct_1): Simplify. * cp-tree.h (CLASSTYPE_VSIZE): Tweak documentation. (skip_rtti_stuff): Remove. (first_vfun_index): New function. (dfs_vtable_path_unmarked_real_bases_queue_p): Remove. (dfs_vtable_path_marked_real_bases_queue_p): Remove. (marked_vtable_pathp): Declare. (unmarked_vtable_pathp): Likewise. * error.c (dump_expr): Use first_vfun_index to calculate vtable offsets. * rtti.c (build_headof): Look for RTTI at negative offsets. (get_tinfo_decl_dynamic): Likewise. (tinfo_base_init): Don't take the address of the TINFO_VTABLE_DECL here. (create_pseudo_type_info): Do it here instead. Adjust so that vptr points at first virtual function. * search.c (marked_vtable_pathp): Make it global. (unmarked_vtable_pathp): Likewise. (dfs_vtable_path_unmarked_real_bases_queue_p): Remove. (dfs_vtable_path_marked_real_bases_queue_p): Likewise. (dfs_get_pure_virtuals): Don't use skip_rtti_stuff. (get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. * tree.c (debug_binfo): Likewise. * tinfo.cc (__dynamic_cast): Look for vtable_prefix at appropriate negative offset. From-SVN: r32787
2000-03-28 21:27:15 +02:00
for (virtuals = BINFO_VIRTUALS (binfo);
virtuals;
virtuals = TREE_CHAIN (virtuals))
cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. * cp-tree.h (BV_USE_VCALL_INDEX_P): New macro. (BV_GENERATE_THUNK_WITH_VTABLE_P): Likewise. (lang_decl_flags): Add generate_with_vtable_p. Make vcall_offset a tree, not an int. (THUNK_GENERATE_WITH_VTABLE_P): New macro. (make_thunk): Change prototype. (emit_thunk): Rename to use_thunk. (mangle_thunk): Change prototype. * class.c (get_derived_offset): Simplify. (copy_virtuals): Clear BV_USE_VCALL_INDEX_P and BV_GENERATE_THUNK_WITH_VTABLE_P. (build_primary_vtable): Simplify. (add_virtual_function): Use BV_FN, rather than TREE_VALUE. (dfs_find_base): Remove. (update_vtable_entry_for_fn): Correct bug in finding the base where a virtual function was first declared. Figure out whether or not to emit a vcall-thunk with the vtables in which it appears. Correct logic for deciding whether to use an ordinary thunk, or a vcall thunk. (finish_struct_1): Remove unnecssary code. (build_vtbl_initializer): Use ssize_int for the running counter of negative indices. (build_vtbl_initializer): Only use vcall thunks where necessary. Mark thunks as needing to be emitted with their vtables, or not. (build_vbase_offset_vtbl_entries): Adjust for use of ssize_int in indices. Use size_binop. (dfs_build_vcall_offset_vtbl_entries): Don't rely on BINFO_PRIMARY_MARKED_P here. Use BV_FN consistently. Use size_binop. (build_rtti_vtbl_entries): Adjust call to build_vtable_entry. (build_vtable_entry): Mark thunks as needing to be emitted with their vtables, or not. * decl.c (lang_mark_tree): Mark the vcall_offset in a thunk. * decl2.c (mark_vtable_entries): Use use_thunk instead of emit_thunk. * dump.c (dequeue_and_dump): Remove dead code. Dump new thunk information. * error.c (dump_expr): Use BV_FN. * mangle.c (mangle_thunk): Adjust now that vcall_offset is a tree, not an int. * method.c (make_thunk): Likewise. (emit_thunk): Rename to use_thunk. Allow callers to decide whether or not to actually emit the thunk. Adjust for changes in representation of vcall offsets. * search.c (dfs_get_pure_virtuals): Use BV_FN. * semantics.c (emit_associated_thunks): New function. (expand_body): Use it. * ir.texi: Adjust decriptions of thunks. From-SVN: r34656
2000-06-23 03:14:40 +02:00
if (DECL_PURE_VIRTUAL_P (BV_FN (virtuals)))
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_push (CLASSTYPE_PURE_VIRTUALS (type), BV_FN (virtuals));
}
1994-02-24 02:02:37 +01:00
return NULL_TREE;
}
/* Set CLASSTYPE_PURE_VIRTUALS for TYPE. */
1996-07-11 03:13:25 +02:00
void
get_pure_virtuals (tree type)
{
/* Clear the CLASSTYPE_PURE_VIRTUALS list; whatever is already there
is going to be overridden. */
CLASSTYPE_PURE_VIRTUALS (type) = NULL;
/* Now, run through all the bases which are not primary bases, and
collect the pure virtual functions. We look at the vtable in
each class to determine what pure virtual functions are present.
(A primary base is not interesting because the derived class of
which it is a primary base will contain vtable entries for the
pure virtuals in the base class. */
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
dfs_walk_once (TYPE_BINFO (type), NULL, dfs_get_pure_virtuals, type);
1994-02-24 02:02:37 +01:00
}
/* Debug info for C++ classes can get very large; try to avoid
emitting it everywhere.
Note that this optimization wins even when the target supports
BINCL (if only slightly), and reduces the amount of work for the
linker. */
void
maybe_suppress_debug_info (tree t)
{
if (write_symbols == NO_DEBUG)
return;
/* We might have set this earlier in cp_finish_decl. */
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 0;
/* Always emit the information for each class every time. */
if (flag_emit_class_debug_always)
return;
/* If we already know how we're handling this class, handle debug info
the same way. */
if (CLASSTYPE_INTERFACE_KNOWN (t))
{
if (CLASSTYPE_INTERFACE_ONLY (t))
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
/* else don't set it. */
}
cp-tree.h (flag_new_abi): Move. * cp-tree.h (flag_new_abi): Move. (flag_use_cxa_atexit): Likewise. (flag_honor_std): Likewise. (flag_rtti): Likewise. (vbase_offsets_in_vtable_p): Define. (vptrs_present_everywhere_p): Likewise. (TYPE_CONTAINS_VPTR_P): Likewise. (dfs_walk_real): Declare. * class.c (build_vbase_pointer_fields): Check vbase_offsets_in_vtable_p. (dfs_build_vbase_offset_vtbl_entries): Record the vbase indices in BINFO_VPTR_FIELD. (build_vbase_offset_vtbl_entries): Simplify. (build_vbase_offset_vtbl_entries): Adjust. (build_vbase_pointer): Add ability to look up vbase offsets in vtable. (start_vtable): New function. (add_virtual_function): Use it. (determine_primary_base): Use TYPE_CONTAINS_VPTR_P. (num_extra_vtbl_entries): Use vbase_offsets_in_vtable_p. (build_vtbl_initializer): Take the type of the complete object as input. Use it to correctly calculate vbase offsets. (dfs_finish_vtbls): Pass the complete type to build_vtbl_initializer. (check_bases_and_members): Use TYPE_CONTAINS_VPTR_P. (create_vtable_ptr): Create a vtable even if there are no new virtual functions, under the new ABI. (finish_struct_1): Likewise. (get_vfield_name): Use TYPE_CONTAINS_VPTR_P. * decl.c (exapnd_static_init): Remove call to preserve_initializer. * decl2.c (mark_vtable_entries): Tweak to handle vbase offsets in vtables. * init.c (initialize_vtbl_ptrs): Initialize them in pre-order. (expand_virtual_init): Use vbase_offsets_in_vtable_p. (construct_virtual_bases): Don't initialize virtual base pointers under the new ABI. (build_aggr_init): Clean up comment. (expand_aggr_init_1): Likewise. * rtti.c (expand_class_desc): Store the virtual function table index where the vbase offset lives in the offset field. * search.c (dfs_walk_real): Make it global. (dfs_debug_mark): Use TYPE_CONTAINS_VPTR_P. * tree.c (make_binfo): Don't clear BINFO_VPTR_FIELD. * tinfo.h (USItype): Make it signed under the new ABI. * tinfo.cc (convert_to_base): New function. Encapsulate base conversion logic here. (__class_type_info::do_upcast): Use it. (__class_type_info::do_dyncast): Likewise. (__class_type_info::do_find_public_subobj): Likewise. From-SVN: r31452
2000-01-17 05:08:01 +01:00
/* If the class has a vtable, write out the debug info along with
the vtable. */
else if (TYPE_CONTAINS_VPTR_P (t))
TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t)) = 1;
/* Otherwise, just emit the debug info normally. */
}
/* Note that we want debugging information for a base class of a class
whose vtable is being emitted. Normally, this would happen because
calling the constructor for a derived class implies calling the
constructors for all bases, which involve initializing the
appropriate vptr with the vtable for the base class; but in the
presence of optimization, this initialization may be optimized
away, so we tell finish_vtable_vardecl that we want the debugging
information anyway. */
static tree
typeck.c (build_indirect_ref, [...]): Remove uses of ATTRIBUTE_UNUSED on the parameters. 2012-09-13 Paolo Carlini <paolo.carlini@oracle.com> * typeck.c (build_indirect_ref, build_function_call, build_function_call_vec, build_binary_op, build_unary_op, build_compound_expr, build_c_cast, build_modify_expr): Remove uses of ATTRIBUTE_UNUSED on the parameters. * class.c (set_linkage_according_to_type, resort_type_method_vec, dfs_find_final_overrider_post, empty_base_at_nonzero_offset_p): Likewise. * decl.c (local_variable_p_walkfn): Likewise. * except.c (wrap_cleanups_r, check_noexcept_r): Likewise. * error.c (find_typenames_r): Likewise. * tree.c (verify_stmt_tree_r, bot_replace, handle_java_interface_attribute, handle_com_interface_attribute, handle_init_priority_attribute, c_register_addr_space): Likewise. * cp-gimplify.c (cxx_omp_clause_default_ctor): Likewise. * cp-lang.c (objcp_tsubst_copy_and_build): Likewise. * pt.c (unify_success, unify_invalid, instantiation_dependent_r): Likewise. * semantics.c (dfs_calculate_bases_pre): Likewise. * decl2.c (fix_temporary_vars_context_r, clear_decl_external): Likewise. * parser.c (cp_lexer_token_at, cp_parser_omp_clause_mergeable, cp_parser_omp_clause_nowait, cp_parser_omp_clause_ordered, cp_parser_omp_clause_untied): Likewise. * mangle.c (write_unnamed_type_name, discriminator_for_string_literal): Likewise. * search.c (dfs_accessible_post, dfs_debug_mark): Likewise. * lex.c (handle_pragma_vtable, handle_pragma_unit, handle_pragma_interface, handle_pragma_implementation, handle_pragma_java_exceptions): Likewise. From-SVN: r191281
2012-09-14 00:20:14 +02:00
dfs_debug_mark (tree binfo, void * /*data*/)
{
tree t = BINFO_TYPE (binfo);
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
if (CLASSTYPE_DEBUG_REQUESTED (t))
return dfs_skip_bases;
CLASSTYPE_DEBUG_REQUESTED (t) = 1;
return NULL_TREE;
}
/* Write out the debugging information for TYPE, whose vtable is being
emitted. Also walk through our bases and note that we want to
write out information for them. This avoids the problem of not
writing any debug info for intermediate basetypes whose
constructors, and thus the references to their vtables, and thus
the vtables themselves, were optimized away. */
1994-02-24 02:02:37 +01:00
void
note_debug_info_needed (tree type)
1994-02-24 02:02:37 +01:00
{
if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)))
{
TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type)) = 0;
rest_of_type_compilation (type, toplevel_bindings_p ());
}
cp-tree.h (dfs_walk, [...]): Remove. * cp-tree.h (dfs_walk, dfs_walk_real, dfs_unmark, markedp, unmarkedp): Remove. (dfs_skip_bases, dfs_walk_all, dfs_walk_once): New. * class.c (struct find_final_overrider_data): Remove most_derived, vpath_list and vpath fields. Add path field. (dfs_find_final_ocerrider_1): Add DEPTH parameter. Adjust. (dfs_find_final_overrider): Rename to ... (dfs_find_final_overrider_pre): ... here. Adjust. (dfs_find_final_overrider_post): Adjust. (dfs_find_final_overrider_q): Fold into dfs_find_final_overrider_pre. (find_final_overrider): Adjust dfs searching. (dfs_modify_vtables): Don't mark binfo here. (modify_all_vtables): Use dfs_walk_once. (build_vtt_inits): Likwise. Use dfs_walk_all. (dfs_build_secondary_vptr_vtt_inits): Don't mark binfo here. Return dfs_skip_bases as appropriate. (dfs_fixup_binfo_vtbls): Return dfs_skip_bases as appropriate. * init.c (dfs_initialized_vtbl_ptrs): Return dfs_skip_bases as appropriate. Don't mark binfo here. (initialize_vtbl_ptrs): Use dfs_walk_once. * search.c (struct vbase_info): Remove unused struct. (access_in_type): Use dfs_walk_once. (dfs_access_in_type): Don't mark binfo here. (dfs_accessible_queue_p, dfs_accessible_p) Remove. Fold into ... (accessible_r): ... here. New. Specialize dfs_walk_once. (accessible_p): Use accessible_r. (lookup_field_queue_p): Remove. Fold into ... (lookup_field_r): ... here. Adjust. (lookup_member): Use dfs_walk_all. (dfs_walk_real, dfs_walk): Replace with ... (dfs_walk_all, dfs_walk_once): ... these. (dfs_walk_once_r, dfs_unmark_r): Workers for dfs_walk_once. (dfs_unmark, unmarkedp, markedp): Remove. (dfs_get_pure_virtuals): Don't mark binfo here. (get_pure_virtuals): Use dfs_walk_once. (dfs_debug_unmarked_p): Remove. Fold into ... (dfs_debug_mark): ... here. (note_debug_info_needed): Use dfs_walk_all. From-SVN: r88738
2004-10-08 11:33:55 +02:00
dfs_walk_all (TYPE_BINFO (type), dfs_debug_mark, NULL, 0);
1994-02-24 02:02:37 +01:00
}
void
print_search_statistics (void)
1994-02-24 02:02:37 +01:00
{
sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. gcc/ * sbitmap.h (SBITMAP_ELT_BITS): Use "1u" trick as for BITMAP_WORD_BITS. Move test to check that there is a popcount function for the the number of bits in SBITMAP_ELT_BITS to sbitmap.c. * sbitmap.c: Test SBITMAP_ELT_BITS, not HOST_BITS_PER_WIDEST_FAST_INT. MEM_STAT_INFO): Define in terms of their ALONE counterparts. * configure.ac (GATHER_STATISTICS): Always define, non-zero if enabled. * configure: Regenerate. * statistics.h (GATHER_STATISTICS): Error out if it is not defined. (GCC_MEM_STAT_ARGUMENTS): New define. (ALONE_MEM_STAT_DECL): Define in terms of GCC_MEM_STAT_ARGUMENTS. (ALONE_FINAL_MEM_STAT_DECL, ALONE_FINAL_PASS_MEM_STAT): New defines. (MEM_STAT_DECL, FINAL_MEM_STAT_DECL, PASS_MEM_STAT, FINAL_PASS_MEM_STAT, * ggc-internal.h (ggc_record_overhead): Use FINAL_MEM_STAT_DECL. * ggc.h (ggc_record_overhead, ggc_free_overhead, ggc_prune_overhead_list): Remove internal prototypes, they are defined already in ggc-internal.h. * ggc-common.c (struct loc_descriptor): Remove #ifdef GATHER_STATISTICS wrappers. (add_statistics): Likewise. (dump_ggc_loc_statistics): Likewise. Return if GATHER_STATISTICS is 0. * ggc-zone.c (struct page_entry): Remove #ifdef GATHER_STATISTICS wrappers around "survived" and "stats" members. (alloc_large_page): Always initialize survived. (ggc_internal_alloc_zone_stat): Likewise. Remove #ifdef GATHER_STATISTICS wrappers. Record overhead if GATHER_STATISTICS is non-0. (ggc_free): Convert #ifdef GATHER_STATISTICS to if-code. (sweep_pages): Always increase survived. (ggc_collect_1): Convert #ifdef GATHER_STATISTICS to if-code. (calculate_average_page_survival): Always define. (ggc_collect): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_print_statistics): Likewise. (ggc_pch_read): Likewise. * ggc-page.c (struct globals): Always define "stats" member. (ggc_internal_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (ggc_free): Likewise. (ggc_collec): Likewise. (ggc_print_statistics): Likewise. * bitmap.h (struct bitmap_head_def): Always define "desc" member. (bitmap_initialize_stat): Convert #ifdef GATHER_STATISTICS to if-code. * gimple.h (enum gimple_alloc_kind): Always define. (gimple_alloc_kind): Likewise. * tree-flow.h (phinodes_print_statistics): Always define. (ssanames_print_statistics): Likewise. * vec.h (vec_heap_free): Always define. (VEC_stack_alloc): Define if GATHER_STATISTICS is non-0. * alloc-pool.c (alloc_pool_descriptor): Always define. (create_alloc_pool): Convert #ifdef GATHER_STATISTICS to if-code. (empty_alloc_pool): Likewise. (pool_alloc): Likewise. (pool_free): Likewise. (dump_alloc_pool_statistics): Likewise. (print_statistics): Always define. * bitmap.c (struct bitmap_descriptor): Always define. (bitmap_register): Pass ALONE_FINAL_PASS_MEM_STAT. (register_overhead): Always define. (bitmap_element_free): Convert #ifdef GATHER_STATISTICS to if-code. (bitmap_element_allocate): Likewise. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_alloc_stat): Likewise. (bitmap_gc_alloc_stat): Likewise. (bitmap_obstack_free): Likewise. (bitmap_find_bit): Likewise. (bitmap_ior_and_into): Likewise. (bitmap_print): Likewise. (dump_bitmap_statistics): Likewise. Return if GATHER_STATISTICS is 0. * gimple.c (gimple_alloc_counts, gimple_alloc_sizes): Always define. (gimple_alloc_kind_names): Likewise. (gimple_alloc_stat): Convert #ifdef GATHER_STATISTICS to if-code. (dump_gimple_statistics): Likewise. Return if GATHER_STATISTICS is 0. * rtl.c (rtx_alloc_counts, rtx_alloc_sizes, rtvec_alloc_counts, rtvec_alloc_sizes): Always define. (rvec_alloc): Convert #ifdef GATHER_STATISTICS to if-code. (rtx_alloc_stat): Likewise. (dump_rtx_statistics): Likewise. Return if GATHER_STATISTICS is 0. * tree.c (_obstack_allocated_p, tree_code_counts, tree_node_counts, tree_node_sizes, tree_node_kind_names): Always define. (record_node_allocation_statistics): Convert #ifdef GATHER_STATISTICS to if-code. (type_hash_canon): Likewise. (dump_tree_statistics): Likewise. * tree-ssanames.c (ssa_name_nodes_reused, ssa_name_nodes_created): Always define. (ssanames_print_statistics): Likewise. (make_ssa_name_fn): Convert #ifdef GATHER_STATISTICS to if-code. * tree-phinodes.c (phi_nodes_reused, phi_nodes_created): Always define. (phinodes_print_statistics): Likewise. (allocate_phi_node): Convert #ifdef GATHER_STATISTICS to if-code. * vec.c (struct vec_descriptor): Always define. (hash_descriptor, eq_descriptor, ptr_hash_entry, hash_ptr, eq_ptr, vec_descriptor, rester_overhead, free_overhead): Likewise. (cmp_statistic): Likewise. (vec_heap_free): Convert #ifdef GATHER_STATISTICS to if-code. (vec_heap_o_reserve_1): Likewise. (dump_vec_loc_statistics): Likewise. cp/ * cp/class.c (n_vtables, n_vtable_entries, n_vtable_searches, n_vtable_elems, n_convert_harshness, n_compute_conversion_costs, n_inner_fields_searched): Always define. (build_primary_vtable): Convert #ifdef GATHER_STATISTICS to if-code. (print_class_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/tree.c (depth_reached): Always define global. (cxx_print_statistics): Convert #ifdef GATHER_STATISTICS to if-code. * cp/pt.c (depth_reached): Always define. (push_tinst_level): Convert #ifdef GATHER_STATISTICS to if-code. * cp/search.c (n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1, n_calls_lookup_fnfields, n_calls_lookup_fnfields_1, n_calls_get_base_type, n_outer_fields_searched, n_contexts_saved): Always define. (lookup_field_1): Convert #ifdef GATHER_STATISTICS to if-code. (lookup_member): Likewise. (lookup_fnfields_idx_nolazy): Likewise. (print_search_statistics): Likewise. (reinit_search_statistics): Unconditionally re-set counters. * cp/lex.c (retrofit_lang_decl): Convert #ifdef GATHER_STATISTICS to if-code. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. From-SVN: r189803
2012-07-24 11:49:56 +02:00
if (! GATHER_STATISTICS)
{
fprintf (stderr, "no search statistics\n");
return;
}
1994-02-24 02:02:37 +01:00
fprintf (stderr, "%d fields searched in %d[%d] calls to lookup_field[_1]\n",
n_fields_searched, n_calls_lookup_field, n_calls_lookup_field_1);
fprintf (stderr, "%d fnfields searched in %d calls to lookup_fnfields\n",
n_outer_fields_searched, n_calls_lookup_fnfields);
fprintf (stderr, "%d calls to get_base_type\n", n_calls_get_base_type);
}
void
reinit_search_statistics (void)
1994-02-24 02:02:37 +01:00
{
n_fields_searched = 0;
n_calls_lookup_field = 0, n_calls_lookup_field_1 = 0;
n_calls_lookup_fnfields = 0, n_calls_lookup_fnfields_1 = 0;
n_calls_get_base_type = 0;
n_outer_fields_searched = 0;
n_contexts_saved = 0;
}
/* Helper for lookup_conversions_r. TO_TYPE is the type converted to
by a conversion op in base BINFO. VIRTUAL_DEPTH is nonzero if
BINFO is morally virtual, and VIRTUALNESS is nonzero if virtual
bases have been encountered already in the tree walk. PARENT_CONVS
is the list of lists of conversion functions that could hide CONV
and OTHER_CONVS is the list of lists of conversion functions that
could hide or be hidden by CONV, should virtualness be involved in
the hierarchy. Merely checking the conversion op's name is not
enough because two conversion operators to the same type can have
different names. Return nonzero if we are visible. */
static int
check_hidden_convs (tree binfo, int virtual_depth, int virtualness,
tree to_type, tree parent_convs, tree other_convs)
{
tree level, probe;
/* See if we are hidden by a parent conversion. */
for (level = parent_convs; level; level = TREE_CHAIN (level))
for (probe = TREE_VALUE (level); probe; probe = TREE_CHAIN (probe))
if (same_type_p (to_type, TREE_TYPE (probe)))
return 0;
if (virtual_depth || virtualness)
{
/* In a virtual hierarchy, we could be hidden, or could hide a
conversion function on the other_convs list. */
for (level = other_convs; level; level = TREE_CHAIN (level))
{
int we_hide_them;
int they_hide_us;
tree *prev, other;
if (!(virtual_depth || TREE_STATIC (level)))
/* Neither is morally virtual, so cannot hide each other. */
continue;
if (!TREE_VALUE (level))
/* They evaporated away already. */
continue;
they_hide_us = (virtual_depth
&& original_binfo (binfo, TREE_PURPOSE (level)));
we_hide_them = (!they_hide_us && TREE_STATIC (level)
&& original_binfo (TREE_PURPOSE (level), binfo));
if (!(we_hide_them || they_hide_us))
/* Neither is within the other, so no hiding can occur. */
continue;
for (prev = &TREE_VALUE (level), other = *prev; other;)
{
if (same_type_p (to_type, TREE_TYPE (other)))
{
if (they_hide_us)
/* We are hidden. */
return 0;
if (we_hide_them)
{
/* We hide the other one. */
other = TREE_CHAIN (other);
*prev = other;
continue;
}
}
prev = &TREE_CHAIN (other);
other = *prev;
}
}
}
return 1;
}
/* Helper for lookup_conversions_r. PARENT_CONVS is a list of lists
of conversion functions, the first slot will be for the current
binfo, if MY_CONVS is non-NULL. CHILD_CONVS is the list of lists
of conversion functions from children of the current binfo,
concatenated with conversions from elsewhere in the hierarchy --
that list begins with OTHER_CONVS. Return a single list of lists
containing only conversions from the current binfo and its
children. */
static tree
split_conversions (tree my_convs, tree parent_convs,
tree child_convs, tree other_convs)
{
tree t;
tree prev;
/* Remove the original other_convs portion from child_convs. */
for (prev = NULL, t = child_convs;
t != other_convs; prev = t, t = TREE_CHAIN (t))
continue;
if (prev)
TREE_CHAIN (prev) = NULL_TREE;
else
child_convs = NULL_TREE;
/* Attach the child convs to any we had at this level. */
if (my_convs)
{
my_convs = parent_convs;
TREE_CHAIN (my_convs) = child_convs;
}
else
my_convs = child_convs;
return my_convs;
}
/* Worker for lookup_conversions. Lookup conversion functions in
BINFO and its children. VIRTUAL_DEPTH is nonzero, if BINFO is in
a morally virtual base, and VIRTUALNESS is nonzero, if we've
encountered virtual bases already in the tree walk. PARENT_CONVS &
PARENT_TPL_CONVS are lists of list of conversions within parent
binfos. OTHER_CONVS and OTHER_TPL_CONVS are conversions found
elsewhere in the tree. Return the conversions found within this
portion of the graph in CONVS and TPL_CONVS. Return nonzero is we
encountered virtualness. We keep template and non-template
conversions separate, to avoid unnecessary type comparisons.
The located conversion functions are held in lists of lists. The
TREE_VALUE of the outer list is the list of conversion functions
found in a particular binfo. The TREE_PURPOSE of both the outer
and inner lists is the binfo at which those conversions were
found. TREE_STATIC is set for those lists within of morally
virtual binfos. The TREE_VALUE of the inner list is the conversion
function or overload itself. The TREE_TYPE of each inner list node
is the converted-to type. */
static int
lookup_conversions_r (tree binfo,
int virtual_depth, int virtualness,
tree parent_convs, tree parent_tpl_convs,
tree other_convs, tree other_tpl_convs,
tree *convs, tree *tpl_convs)
{
int my_virtualness = 0;
tree my_convs = NULL_TREE;
tree my_tpl_convs = NULL_TREE;
tree child_convs = NULL_TREE;
tree child_tpl_convs = NULL_TREE;
unsigned i;
tree base_binfo;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *method_vec = CLASSTYPE_METHOD_VEC (BINFO_TYPE (binfo));
tree conv;
cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. * cp-tree.h (CP_INTEGRAL_TYPE_P): New macro. (ARITHMETIC_TYPE_P): Adjust definition for standard conformance. (strip_top_quals): Declare. (ncp_convert): Likewise. (type_after_usual_arithmetic_converions): Likewise. (composite_pointer_type): Likewise. * call.c (strip_top_quals): Don't make it static. (promoted_arithmetic_type_p): New function. (conditional_conversion): Likewise. (null_ptr_cst_p): Allow `false' as a NULL pointer constant. (standard_conversion): Use same_type_p. Don't build BASE_CONVs for converting a type to itself. (reference_binding): Honor LOOKUP_NO_TEMP_BIND. (implicit_conversion): Make sure the from and to types are complete. (add_builtin_candidate): Correct handling of ?: operator. (add_builtin_candidates): Improve documentation. (build_conditional_expr): New function. (can_convert): Implement in terms of can_convert_arg. (ncp_convert): New function. * typeck.c (type_after_usual_arithmetic_conversions): New function, split out from common_type. (composite_pointer_type): New function, split out from build_conditional_expr. (common_type): Use type_after_usual_arithmetic_conversions. Remove redundant attribute merging. (comptypes): Tidy. Handle COMPLEX_TYPE. (build_binary_op_nodefault): Use null_ptr_cst_p. (build_conditional_expr): Remove. (convert_for_assignment): Use new conversion functions. * cp-tree.h (abstract_virtuals_error): Change declaration. * typeck2.c (abstract_virtuals_error): Check to see if an error ocurred, and return a boolean value accordingly. (build_functional_cast): Adjust accordingly. * class.c (finish_struct_1): Likewise. * cvt.c (ocp_convert): Likewise. * decl.c (cp_finish_decl): Likewise. (grokparams): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. * init.c (build_new_1): Likewise. * pt.c (unify): Don't get confused by pointers-to-member functions. * search.c (build_cplus_new): Robustify. From-SVN: r28262
1999-07-26 10:18:19 +02:00
/* If we have no conversion operators, then don't look. */
if (!TYPE_HAS_CONVERSION (BINFO_TYPE (binfo)))
{
*convs = *tpl_convs = NULL_TREE;
return 0;
}
if (BINFO_VIRTUAL_P (binfo))
virtual_depth++;
/* First, locate the unhidden ones at this level. */
for (i = CLASSTYPE_FIRST_CONVERSION_SLOT;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_iterate (method_vec, i, &conv);
vec.h (VEC_address): New function. * vec.h (VEC_address): New function. * cp-tree.h (lang_type_class): Remove has_real_assign_ref and has_abstract_assign_ref. Make methods a VEC(tree) *. (TYPE_HAS_CONST_ASSIGN_REF): Add documentation. (CLASSTYPE_CONSTRUCTORS): Adjust for changes to CLASSTYPE_METHOD_VEC. (CLASSTYPE_DESTRUCTORS): Likewise. (TYPE_HAS_REAL_ASSIGN_REF): Remove. (TYPE_HAS_ABSTRACT_ASSIGN_REF): Likewise. (add_method): Change prototoype. * class.c (add_method): Remove error_p parameter. Adjust for changes to CLASSTYPE_METHOD_VEC. (handle_using_decl): Adjust call to add_method. (maybe_warn_about_overly_private_class): Adjust for changes to CLASSTYPE_METHOD_VEC. (resort_type_method_vec): Likewise. (finish_struct_methods): Likewise. (check_for_override): Likewise. (warn_hidden): Likewise. (add_implicitly_declared_members): Defer creation of assignment operators. Adjust call to add_method. (clone_function_decl): Adjust call to add_method. (check_bases_and_members): Don't set TYPE_HAS_REAL_ASSIGN_REF. (finish_struct_1): Use CLASSTYPE_DESTRUCTORS. * decl.c (grok_special_member_properties): Don't set TYPE_HAS_ABSTRACT_ASSIGN_REF. * decl2.c (check_classfn): Adjust for changes to CLASSTYPE_METHOD_VEC. * method.c (locate_dtor): Use CLASSTYPE_DESTRUCTORS. (locate_ctor): Use CLASSTYPE_CONSTRUCTORS. (locate_copy): Adjust for changes to CLASSTYPE_METHOD_VEC. (implicitly_declare_fn): Set DECL_SOURCE_LOCATION. Do not call cp_finish_decl. * pt.c (check_explicit_specialization): Adjust for changes to CLASSTYPE_METHOD_VEC. (instantiate_class_template): Do not set TYPE_HAS_ABSTRACT_ASSIGN_REF. * ptree.c (cxx_print_type): Don't try to print CLASSTYPE_METHOD_VEC. * rtti.c (emit_support_tinfos): Use CLASSTYPE_DESTRUCTORS. * search.c (lookup_field_r): Adjust for changes to CLASSTYPE_METHOD_VEC. (lookup_fnfields): Likewise. (lookup_conversion_operator): Likewise. (lookup_fnfields_1): Likewise. Create assignment operators lazily. (look_for_overrides_here): Adjust for changes to CLASSTYPE_METHOD_VEC. (add_conversions): Likewise. * semantics.c (finish_member_declaration): Adjust call to add_method. From-SVN: r84796
2004-07-16 03:15:43 +02:00
++i)
{
tree cur = OVL_CURRENT (conv);
cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.def (PTRMEM_CST): New tree node. * cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. From-SVN: r22869
1998-10-06 16:20:30 +02:00
if (!DECL_CONV_FN_P (cur))
break;
if (TREE_CODE (cur) == TEMPLATE_DECL)
{
/* Only template conversions can be overloaded, and we must
flatten them out and check each one individually. */
tree tpls;
for (tpls = conv; tpls; tpls = OVL_NEXT (tpls))
{
tree tpl = OVL_CURRENT (tpls);
tree type = DECL_CONV_FN_TYPE (tpl);
if (check_hidden_convs (binfo, virtual_depth, virtualness,
type, parent_tpl_convs, other_tpl_convs))
{
my_tpl_convs = tree_cons (binfo, tpl, my_tpl_convs);
TREE_TYPE (my_tpl_convs) = type;
if (virtual_depth)
{
TREE_STATIC (my_tpl_convs) = 1;
my_virtualness = 1;
}
}
}
}
else
{
tree name = DECL_NAME (cur);
if (!IDENTIFIER_MARKED (name))
{
tree type = DECL_CONV_FN_TYPE (cur);
Implement return type deduction for normal functions with -std=c++1y. * cp-tree.h (FNDECL_USED_AUTO): New macro. (LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P): Remove. (dependent_lambda_return_type_node): Remove. (CPTI_DEPENDENT_LAMBDA_RETURN_TYPE): Remove. (struct language_function): Add x_auto_return_pattern field. (current_function_auto_return_pattern): New. (enum tsubst_flags): Add tf_partial. * decl.c (decls_match): Handle auto return comparison. (duplicate_decls): Adjust error message for auto return. (cxx_init_decl_processing): Remove dependent_lambda_return_type_node. (cp_finish_decl): Don't do auto deduction for functions. (grokdeclarator): Allow auto return without trailing return type in C++1y mode. (check_function_type): Defer checking of deduced return type. (start_preparsed_function): Set current_function_auto_return_pattern. (finish_function): Set deduced return type to void if not previously deduced. * decl2.c (change_return_type): Handle error_mark_node. (mark_used): Always instantiate functions with deduced return type. Complain about use if deduction isn't done. * parser.c (cp_parser_lambda_declarator_opt): Use 'auto' for initial return type. (cp_parser_lambda_body): Don't deduce return type in a template. (cp_parser_conversion_type_id): Allow auto in C++1y. * pt.c (instantiate_class_template_1): Don't mess with LAMBDA_EXPR_DEDUCE_RETURN_TYPE_P. (tsubst_copy_and_build): Likewise. (fn_type_unification, tsubst): Don't reduce the template parm level of 'auto' during deduction. (unify): Compare 'auto' specially. (get_bindings): Change test. (always_instantiate_p): Always instantiate functions with deduced return type. (do_auto_deduction): Handle error_mark_node and lambda context. Don't check for use in initializer. (contains_auto_r): Remove. * search.c (lookup_conversions_r): Handle auto conversion function. * semantics.c (lambda_return_type): Handle null return. Don't mess with dependent_lambda_return_type_node. (apply_deduced_return_type): Rename from apply_lambda_return_type. * typeck.c (merge_types): Handle auto. (check_return_expr): Do auto deduction. * typeck2.c (add_exception_specifier): Fix complain check. From-SVN: r185768
2012-03-24 21:56:08 +01:00
if (type_uses_auto (type))
{
mark_used (cur);
type = DECL_CONV_FN_TYPE (cur);
}
if (check_hidden_convs (binfo, virtual_depth, virtualness,
type, parent_convs, other_convs))
{
my_convs = tree_cons (binfo, conv, my_convs);
TREE_TYPE (my_convs) = type;
if (virtual_depth)
{
TREE_STATIC (my_convs) = 1;
my_virtualness = 1;
}
IDENTIFIER_MARKED (name) = 1;
}
}
}
}
if (my_convs)
{
parent_convs = tree_cons (binfo, my_convs, parent_convs);
if (virtual_depth)
TREE_STATIC (parent_convs) = 1;
}
if (my_tpl_convs)
{
parent_tpl_convs = tree_cons (binfo, my_tpl_convs, parent_tpl_convs);
if (virtual_depth)
TREE_STATIC (parent_tpl_convs) = 1;
}
child_convs = other_convs;
child_tpl_convs = other_tpl_convs;
/* Now iterate over each base, looking for more conversions. */
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
{
tree base_convs, base_tpl_convs;
unsigned base_virtualness;
base_virtualness = lookup_conversions_r (base_binfo,
virtual_depth, virtualness,
parent_convs, parent_tpl_convs,
child_convs, child_tpl_convs,
&base_convs, &base_tpl_convs);
if (base_virtualness)
my_virtualness = virtualness = 1;
child_convs = chainon (base_convs, child_convs);
child_tpl_convs = chainon (base_tpl_convs, child_tpl_convs);
}
/* Unmark the conversions found at this level */
for (conv = my_convs; conv; conv = TREE_CHAIN (conv))
IDENTIFIER_MARKED (DECL_NAME (OVL_CURRENT (TREE_VALUE (conv)))) = 0;
*convs = split_conversions (my_convs, parent_convs,
child_convs, other_convs);
*tpl_convs = split_conversions (my_tpl_convs, parent_tpl_convs,
child_tpl_convs, other_tpl_convs);
return my_virtualness;
}
/* Return a TREE_LIST containing all the non-hidden user-defined
conversion functions for TYPE (and its base-classes). The
TREE_VALUE of each node is the FUNCTION_DECL of the conversion
function. The TREE_PURPOSE is the BINFO from which the conversion
functions in this node were selected. This function is effectively
performing a set of member lookups as lookup_fnfield does, but
using the type being converted to as the unique key, rather than the
field name. */
tree
lookup_conversions (tree type)
{
tree convs, tpl_convs;
tree list = NULL_TREE;
complete_type (type);
if (!CLASS_TYPE_P (type) || !TYPE_BINFO (type))
return NULL_TREE;
lookup_conversions_r (TYPE_BINFO (type), 0, 0,
NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE,
&convs, &tpl_convs);
/* Flatten the list-of-lists */
for (; convs; convs = TREE_CHAIN (convs))
{
tree probe, next;
for (probe = TREE_VALUE (convs); probe; probe = next)
{
next = TREE_CHAIN (probe);
TREE_CHAIN (probe) = list;
list = probe;
}
}
for (; tpl_convs; tpl_convs = TREE_CHAIN (tpl_convs))
{
tree probe, next;
for (probe = TREE_VALUE (tpl_convs); probe; probe = next)
{
next = TREE_CHAIN (probe);
TREE_CHAIN (probe) = list;
list = probe;
}
}
return list;
}
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
/* Returns the binfo of the first direct or indirect virtual base derived
from BINFO, or NULL if binfo is not via virtual. */
tree
binfo_from_vbase (tree binfo)
{
for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo))
{
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
if (BINFO_VIRTUAL_P (binfo))
return binfo;
}
return NULL_TREE;
}
Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. * cp-tree.h (CLASSTYPE_VBASECLASSES): Change documentation. (BINFO_FOR_VBASE): Remove. (CANONICAL_BINFO): Adjust. (binfo_for_vbase): New function. * class.c (build_vbase_pointer_fields): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (build_vbase_pointer): Likewise. (build_secondary_vtable): Likewise. (dfs_mark_primary_bases): Likewise. (mark_primary_bases): Likewise. (layout_nonempty_base_or_field): Likewise. (dfs_set_offset_for_shared_vbases): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dump_class_hierarchy_r): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (dump_class_hierarchy): Likewise. (finish_vtbls): Likewise. (build_vtbl_initializer): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (build_vbase_offset_vtbl_entries): Use binfo_for_vbase. * decl.c (finish_destructor_body): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * init.c (sort_base_init): Use binfo_for_vbase. (construct_virtual_bases): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_member_init): Use binfo_for_vbase. (build_vbase_delete): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * method.c (do_build_copy_constructor): Likewise. * rtti.c (get_base_offset): Use binfo_for_vbase. (expand_class_desc): Remove #if 0'd code. * search.c (struct vbase_info): Remove vbase_types. (get_base_distance): Use binfo_for_vbase. (lookup_field_queue_p): Use CANONICAL_BINFO. (get_shared_vbase_if_not_primary): Use binfo_for_vbase. (get_pure_virtuals): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dfs_find_vbases): Use binfo_for_vbase. (dfs_init_vbase_pointers): Likewise. (init_vbase_pointers): Don't initialize vi.vbase_types. (virtual_context): Use binfo_for_vbase. (fixup_all_virtual_upcast_offsets): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_indirect_vtbls_init): Simplify. (dfs_get_vbase_types): Don't replicate virtual bases. (find_vbase_instance): Use binfo_for_vbase. (binfo_for_vbase): New function. * typeck.c (get_delta_difference): Use binfo_for_vbase. From-SVN: r34040
2000-05-20 01:06:55 +02:00
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
/* Returns the binfo of the first direct or indirect virtual base derived
from BINFO up to the TREE_TYPE, LIMIT, or NULL if binfo is not
via virtual. */
tree
binfo_via_virtual (tree binfo, tree limit)
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
{
if (limit && !CLASSTYPE_VBASECLASSES (limit))
/* LIMIT has no virtual bases, so BINFO cannot be via one. */
return NULL_TREE;
for (; binfo && !SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), limit);
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
binfo = BINFO_INHERITANCE_CHAIN (binfo))
{
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
if (BINFO_VIRTUAL_P (binfo))
invoke.texi (-fdump-class-layout): Document. gcc: * invoke.texi (-fdump-class-layout): Document. (-fdump-translation-unit): Use `=' as filename separator. cp: Fix specification and implementation bugs in V3 ABI construction vtables. * cp-tree.h (flag_dump_class_layout): New flag. (BINFO_OVERRIDE_ALONG_VIRTUAL_PATH_P): Remove. (BINFO_LOST_PRIMARY_P): New flag. (SET_BINFO_NEW_VTABLE_MARKED): Adjust asserts. (BINFO_PRIMARY_MARKED_P): Rename to ... (BINFO_PRIMARY_P): ... here. (binfo_via_virtual): New prototype. * decl2.c (flag_dump_class_layout): New flag. (cxx_decode_option): Set it. Adjust -fdump-translation-unit to use `=' as a file name separator. * init.c (dfs_initialize_vtbl_ptrs): Walk into virtual primary bases. (build_vtbl_address): If this is a virtual primary base, then get the vtbl of what it is ultimately primary for. * search.c (dfs_skip_nonprimary_vbases_unmarkedp): Adjust for BINFO_PRIMARY_P. (dfs_skip_nonprimary_vbases_markedp): Likewise. (get_shared_vbase_if_not_primary): Likewise. (dfs_get_pure_virtuals): Likewise. (expand_upcast_fixups): Likewise. (fixup_virtual_upcast_offsets): Likewise. (dfs_find_vbase_instance): Likewise. (find_vbase_instance): Likewise. (binfo_from_vbase): Adjust comment to reflect reality. (binfo_via_virtual): New function. * class.c (VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P): New macros for binfo walking during VTT construction. (dfs_mark_primary_bases): Remove. (force_canonical_binfo_r): New function. (force_canonical_binfo): New function. (mark_primary_virtual_base): New function. (mark_primary_bases): Walk in inheritance graph order, use mark_primary_virtual_base. (determine_primary_base): Use some more intermediate variables. (dfs_find_final_overrider): Don't check for overriding along a virtual path. (dfs_modify_vtables): Walk into primary virtual bases too. (walk_subobject_offsets): Adjust for BINFO_PRIMARY_P. (build_base_fields): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. (end_of_class): Likewise. (finish_struct_1): Call dump_class_hierarchy, if requested. (dfs_get_primary_binfo): Use BINFO_TYPE for binfos. (dump_class_hierarchy_r): Add stream parameter. Emit more information. (dump_class_hierarchy): Add file parameter. Append to file, if required. (finish_vtbls): Adjust accumulate_vtbl_inits call. Use canonical base for virtual bases. (build_vtt): Add more comments. Adjust build_vtt_inits call. (build_vtt_inits): Remove VIRTUAL_VTTS_P parm. Only set BINFO_VPTR_INDEX on top level. Use VTT_TOP_LEVEL_P, VTT_MARKED_BINFO_P for binfo walking. Use canonical vbase for virtual VTTs. (dfs_build_secondary_vptr_vtt_inits): Extract VTT_TOP_LEVEL_P from DATA. We want virtual primary bases and all bases via virtual. Only set BINFO_VPTR_INDEX for top level. Look up from a primary virtual base when not a construction vtable. (dfs_ctor_vtable_bases_queue_p): New DFS predicate. (build_ctor_vtbl_group): Adjust accumulate_vtbl_inits call. Use canonical bases when processing virtual bases. (accumulate_vtbl_inits): We're interested in any base via a virtual path. (dfs_accumulate_vtbl_inits): If this is a primary virtual base within a construction vtable, determine what is being overridden. (build_vtbl_initializer): Add more comments (add_vcall_offset_vtbl_entries_1): Adjust comment. (build_rtti_vtbl_entries): Check if the base has lost its primary. testsuite: * g++.old-deja/g++.abi/primary2.C: New test. * g++.old-deja/g++.abi/primary3.C: New test. * g++.old-deja/g++.abi/primary4.C: New test. * g++.old-deja/g++.abi/primary5.C: New test. * g++.old-deja/g++.abi/vtable3.h: New test. * g++.old-deja/g++.abi/vtable3a.C: New test. * g++.old-deja/g++.abi/vtable3b.C: New test. * g++.old-deja/g++.abi/vtable3c.C: New test. * g++.old-deja/g++.abi/vtable3d.C: New test. * g++.old-deja/g++.abi/vtable3e.C: New test. * g++.old-deja/g++.abi/vtable3f.C: New test. * g++.old-deja/g++.abi/vtable3g.C: New test. * g++.old-deja/g++.abi/vtable3h.C: New test. * g++.old-deja/g++.abi/vtable3i.C: New test. * g++.old-deja/g++.abi/vtable3j.C: New test. * g++.old-deja/g++.oliva/thunk1.C: Remove XFAIL. From-SVN: r39455
2001-02-05 12:45:16 +01:00
return binfo;
}
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
/* BINFO is a base binfo in the complete type BINFO_TYPE (HERE).
Find the equivalent binfo within whatever graph HERE is located.
This is the inverse of original_binfo. */
Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. * cp-tree.h (CLASSTYPE_VBASECLASSES): Change documentation. (BINFO_FOR_VBASE): Remove. (CANONICAL_BINFO): Adjust. (binfo_for_vbase): New function. * class.c (build_vbase_pointer_fields): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (build_vbase_pointer): Likewise. (build_secondary_vtable): Likewise. (dfs_mark_primary_bases): Likewise. (mark_primary_bases): Likewise. (layout_nonempty_base_or_field): Likewise. (dfs_set_offset_for_shared_vbases): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dump_class_hierarchy_r): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (dump_class_hierarchy): Likewise. (finish_vtbls): Likewise. (build_vtbl_initializer): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (build_vbase_offset_vtbl_entries): Use binfo_for_vbase. * decl.c (finish_destructor_body): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * init.c (sort_base_init): Use binfo_for_vbase. (construct_virtual_bases): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_member_init): Use binfo_for_vbase. (build_vbase_delete): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * method.c (do_build_copy_constructor): Likewise. * rtti.c (get_base_offset): Use binfo_for_vbase. (expand_class_desc): Remove #if 0'd code. * search.c (struct vbase_info): Remove vbase_types. (get_base_distance): Use binfo_for_vbase. (lookup_field_queue_p): Use CANONICAL_BINFO. (get_shared_vbase_if_not_primary): Use binfo_for_vbase. (get_pure_virtuals): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dfs_find_vbases): Use binfo_for_vbase. (dfs_init_vbase_pointers): Likewise. (init_vbase_pointers): Don't initialize vi.vbase_types. (virtual_context): Use binfo_for_vbase. (fixup_all_virtual_upcast_offsets): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_indirect_vtbls_init): Simplify. (dfs_get_vbase_types): Don't replicate virtual bases. (find_vbase_instance): Use binfo_for_vbase. (binfo_for_vbase): New function. * typeck.c (get_delta_difference): Use binfo_for_vbase. From-SVN: r34040
2000-05-20 01:06:55 +02:00
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
copied_binfo (tree binfo, tree here)
Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. * cp-tree.h (CLASSTYPE_VBASECLASSES): Change documentation. (BINFO_FOR_VBASE): Remove. (CANONICAL_BINFO): Adjust. (binfo_for_vbase): New function. * class.c (build_vbase_pointer_fields): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (build_vbase_pointer): Likewise. (build_secondary_vtable): Likewise. (dfs_mark_primary_bases): Likewise. (mark_primary_bases): Likewise. (layout_nonempty_base_or_field): Likewise. (dfs_set_offset_for_shared_vbases): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dump_class_hierarchy_r): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (dump_class_hierarchy): Likewise. (finish_vtbls): Likewise. (build_vtbl_initializer): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (build_vbase_offset_vtbl_entries): Use binfo_for_vbase. * decl.c (finish_destructor_body): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * init.c (sort_base_init): Use binfo_for_vbase. (construct_virtual_bases): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_member_init): Use binfo_for_vbase. (build_vbase_delete): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * method.c (do_build_copy_constructor): Likewise. * rtti.c (get_base_offset): Use binfo_for_vbase. (expand_class_desc): Remove #if 0'd code. * search.c (struct vbase_info): Remove vbase_types. (get_base_distance): Use binfo_for_vbase. (lookup_field_queue_p): Use CANONICAL_BINFO. (get_shared_vbase_if_not_primary): Use binfo_for_vbase. (get_pure_virtuals): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dfs_find_vbases): Use binfo_for_vbase. (dfs_init_vbase_pointers): Likewise. (init_vbase_pointers): Don't initialize vi.vbase_types. (virtual_context): Use binfo_for_vbase. (fixup_all_virtual_upcast_offsets): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_indirect_vtbls_init): Simplify. (dfs_get_vbase_types): Don't replicate virtual bases. (find_vbase_instance): Use binfo_for_vbase. (binfo_for_vbase): New function. * typeck.c (get_delta_difference): Use binfo_for_vbase. From-SVN: r34040
2000-05-20 01:06:55 +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 result = NULL_TREE;
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
if (BINFO_VIRTUAL_P (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 t;
Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. * cp-tree.h (CLASSTYPE_VBASECLASSES): Change documentation. (BINFO_FOR_VBASE): Remove. (CANONICAL_BINFO): Adjust. (binfo_for_vbase): New function. * class.c (build_vbase_pointer_fields): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (build_vbase_pointer): Likewise. (build_secondary_vtable): Likewise. (dfs_mark_primary_bases): Likewise. (mark_primary_bases): Likewise. (layout_nonempty_base_or_field): Likewise. (dfs_set_offset_for_shared_vbases): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dump_class_hierarchy_r): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (dump_class_hierarchy): Likewise. (finish_vtbls): Likewise. (build_vtbl_initializer): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (build_vbase_offset_vtbl_entries): Use binfo_for_vbase. * decl.c (finish_destructor_body): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * init.c (sort_base_init): Use binfo_for_vbase. (construct_virtual_bases): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_member_init): Use binfo_for_vbase. (build_vbase_delete): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * method.c (do_build_copy_constructor): Likewise. * rtti.c (get_base_offset): Use binfo_for_vbase. (expand_class_desc): Remove #if 0'd code. * search.c (struct vbase_info): Remove vbase_types. (get_base_distance): Use binfo_for_vbase. (lookup_field_queue_p): Use CANONICAL_BINFO. (get_shared_vbase_if_not_primary): Use binfo_for_vbase. (get_pure_virtuals): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dfs_find_vbases): Use binfo_for_vbase. (dfs_init_vbase_pointers): Likewise. (init_vbase_pointers): Don't initialize vi.vbase_types. (virtual_context): Use binfo_for_vbase. (fixup_all_virtual_upcast_offsets): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_indirect_vtbls_init): Simplify. (dfs_get_vbase_types): Don't replicate virtual bases. (find_vbase_instance): Use binfo_for_vbase. (binfo_for_vbase): New function. * typeck.c (get_delta_difference): Use binfo_for_vbase. From-SVN: r34040
2000-05-20 01:06:55 +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
for (t = here; BINFO_INHERITANCE_CHAIN (t);
t = BINFO_INHERITANCE_CHAIN (t))
continue;
result = binfo_for_vbase (BINFO_TYPE (binfo), BINFO_TYPE (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_INHERITANCE_CHAIN (binfo))
{
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
tree cbinfo;
tree base_binfo;
int ix;
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
cbinfo = copied_binfo (BINFO_INHERITANCE_CHAIN (binfo), here);
for (ix = 0; BINFO_BASE_ITERATE (cbinfo, ix, base_binfo); ix++)
if (SAME_BINFO_TYPE_P (BINFO_TYPE (base_binfo), BINFO_TYPE (binfo)))
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
{
result = base_binfo;
break;
}
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
{
gcc_assert (SAME_BINFO_TYPE_P (BINFO_TYPE (here), 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
result = here;
}
call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. * call.c (validate_conversion_obstack): Replace my_friendly_assert with gcc_assert or gcc_unreachable. (direct_reference_binding, merge_conversion_sequences, build_user_type_conversion_1, perform_overload_resolution, build_op_delete_call, enforce_access, call_builtin_trap, build_over_call, build_special_member_call, build_new_method_call, initialize_reference): Likewise. * class.c (build_base_path, build_primary_vtable, alter_access, check_bases, update_vtable_entry_for_fn, layout_empty_base, clone_function_decl, adjust_clone_args, type_requires_array_cookie, include_empty_classes, finish_struct_1, resolve_address_of_overloaded_function, instantiate_type, get_vtbl_decl_for_binfo, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtbl_inits, build_vtbl_initializer, build_vbase_offset_vtbl_entries, build_rtti_vtbl_entries): Likewise. * cvt.c (build_up_reference, convert_to_reference): Likewise. * decl.c (poplevel, duplicate_decls, make_typename_type, cxx_init_decl_processing, reshape_init, check_initializer, make_rtl_for_nonlocal_decl, initialize_local_var, cp_finish_decl, expand_static_init, grokfndecl, grokvardecl, build_ptrmem_type, grokdeclarator, copy_fn_p, grok_op_properties, xref_tag, xref_basetypes, start_preparsed_function, save_function_data, finish_function, finish_method, maybe_register_incomplete_var, complete_vars): Likewise. * decl2.c (grok_array_decl, check_member_template, check_classfn, finish_static_data_member_decl, coerce_new_type, coerce_delete_type, import_export_class, decl_needed_p, determine_visibility, import_export_decl, build_cleanup, start_static_initialization_or_destructi, do_static_destruction, prune_vars_needing_no_initialization, build_offset_ref_call_from_tree): Likewise. * error.c (dump_decl, dump_expr): Likewise. * init.c (finish_init_stmts, build_zero_init, expand_virtual_init, expand_default_init, expand_aggr_init_1, build_offset_ref, build_new_1, build_delete, build_vbase_delete): Likewise. * mangle.c (write_method_parms, write_template_args, write_expression, write_template_arg): Likewise. * method.c (make_thunk, finish_thunk, use_thunk): Likewise. * name-lookup.c (pop_binding, begin_scope, leave_scope, resume_scope, push_using_decl, validate_nonmember_using_decl, is_ancestor, poplevel_class, set_inherited_value_binding_p, push_class_level_binding, do_class_using_decl, push_namespace, pop_namespace, add_using_namespace, ambiguous_decl, lookup_namespace_name, lookup_type_current_level, maybe_process_template_type_declaration): Likewise. * parser.c (cp_lexer_peek_nth_token, cp_parser_parse_and_diagnose_invalid_typ, cp_parser_translation_unit, cp_parser_template_id, cp_parser_lookup_name, cp_parser_late_parsing_for_member): Likewise. * pt.c (push_access_scope, finish_member_template_decl, push_inline_template_parms_recursive, add_outermost_template_args, get_innermost_template_args, begin_explicit_instantiation, end_explicit_instantiation, retrieve_specialization, is_specialization_of, is_specialization_of_friend, register_specialization, check_explicit_specialization, comp_template_parms, process_template_parm, process_partial_specialization, convert_nontype_argument, coerce_template_template_parms, coerce_template_parms, mangle_class_name_for_template, lookup_template_function, lookup_template_class, instantiate_class_template, tsubst_decl, tsubst_function_type, tsubst, tsubst_qualified_id, tsubst_copy, instantiate_template, fn_type_unification, type_unification_real, get_template_base, regenerate_decl_from_template, template_for_substitution, instantiate_decl, get_mostly_instantiated_function_type, dependent_scope_ref_p, value_dependent_expression_p, resolve_typename_type): Likewise. * repo.c (repo_emit_p): Likewise. * rtti.c (build_headof, get_tinfo_decl, get_pseudo_ti_init, create_tinfo_types, emit_tinfo_decl): Likewise. * search.c (lookup_base_r, lookup_base, lookup_field_1, dfs_access_in_type, build_baselink, lookup_member, adjust_result_of_qualified_name_lookup, copied_binfo): Likewise. * semantics.c (perform_or_defer_access_check, finish_non_static_data_member, finish_stmt_expr_expr, finish_stmt_expr, finish_call_expr, finish_pseudo_destructor_expr, finish_template_template_parm, finish_member_declaration, emit_associated_thunks): Likewise. * tree.c (build_target_expr_with_type, force_target_expr, copy_binfo, get_first_fn, cp_tree_equal): Likewise. * typeck.c (type_after_usual_arithmetic_conversions, comptypes, cxx_sizeof_or_alignof_type, perform_integral_promotions, build_class_member_access_expr, finish_class_member_access_expr, build_ptrmemfunc_access_expr, build_unary_op, unary_complex_lvalue, cxx_mark_addressable, build_modify_expr, build_ptrmemfunc, expand_ptrmemfunc_cst, check_return_expr * typeck2.c (complete_type_check_abstract, abstract_virtuals_error, process_init_constructor, add_exception_specifier): Likewise. From-SVN: r86669
2004-08-27 19:59:33 +02:00
gcc_assert (result);
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 result;
Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. Don't create a separate copy of virtual bases for the CLASSTYPE_VBASECLASSES list. * cp-tree.h (CLASSTYPE_VBASECLASSES): Change documentation. (BINFO_FOR_VBASE): Remove. (CANONICAL_BINFO): Adjust. (binfo_for_vbase): New function. * class.c (build_vbase_pointer_fields): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (build_vbase_pointer): Likewise. (build_secondary_vtable): Likewise. (dfs_mark_primary_bases): Likewise. (mark_primary_bases): Likewise. (layout_nonempty_base_or_field): Likewise. (dfs_set_offset_for_shared_vbases): Likewise. (dfs_set_offset_for_unshared_vbases): Likewise. (layout_virtual_bases): Likewise. Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dump_class_hierarchy_r): Use binfo_for_vbase instead of BINFO_FOR_VBASE. (dump_class_hierarchy): Likewise. (finish_vtbls): Likewise. (build_vtbl_initializer): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (build_vbase_offset_vtbl_entries): Use binfo_for_vbase. * decl.c (finish_destructor_body): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * init.c (sort_base_init): Use binfo_for_vbase. (construct_virtual_bases): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_member_init): Use binfo_for_vbase. (build_vbase_delete): Adjust for changes to the CLASSTYPE_VBASECLASSES list. * method.c (do_build_copy_constructor): Likewise. * rtti.c (get_base_offset): Use binfo_for_vbase. (expand_class_desc): Remove #if 0'd code. * search.c (struct vbase_info): Remove vbase_types. (get_base_distance): Use binfo_for_vbase. (lookup_field_queue_p): Use CANONICAL_BINFO. (get_shared_vbase_if_not_primary): Use binfo_for_vbase. (get_pure_virtuals): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (dfs_find_vbases): Use binfo_for_vbase. (dfs_init_vbase_pointers): Likewise. (init_vbase_pointers): Don't initialize vi.vbase_types. (virtual_context): Use binfo_for_vbase. (fixup_all_virtual_upcast_offsets): Adjust for changes to the CLASSTYPE_VBASECLASSES list. (expand_indirect_vtbls_init): Simplify. (dfs_get_vbase_types): Don't replicate virtual bases. (find_vbase_instance): Use binfo_for_vbase. (binfo_for_vbase): New function. * typeck.c (get_delta_difference): Use binfo_for_vbase. From-SVN: r34040
2000-05-20 01:06:55 +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
binfo_for_vbase (tree base, tree t)
{
unsigned ix;
tree binfo;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec<tree, va_gc> *vbases;
for (vbases = CLASSTYPE_VBASECLASSES (t), ix = 0;
This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. This patch rewrites the old VEC macro-based interface into a new one based on the template class 'vec'. The user-visible changes are described in http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec. I have tested the patch pretty extensively: - Regular bootstraps on x86_64, ppc, ia64, sparc and hppa. - Bootstraps with --enable-checking=release - Bootstraps with --enable-checking=gc,gcac - Basic builds on all targets (using contrib/config-list.mk). We no longer access the vectors via VEC_* macros. The pattern is "VEC_operation (T, A, V, args)" becomes "V.operation (args)". The only thing I could not do is create proper ctors and dtors for the vec class. Since these vectors are stored in unions, we have to keep them as PODs (C++03 does not allow non-PODs in unions). This means that creation and destruction must be explicit. There is a new method vec<type, allocation, layout>::create() and another vec<type, allocation, layout>::destroy() to allocate the internal vector. For vectors that must be pointers, there is a family of free functions that implement the operations that need to tolerate NULL vectors. These functions all start with the prefix 'vec_safe_'. See the wiki page for details. The gengtype change removes the special handling for VEC() that used to exist in gengtype. Additionally, it allows gengtype to recognize templates of more than one argument and introduces the concept of an undefined type (useful for template arguments that may or may not be types). When a TYPE_UNDEFINED is reached, gengtype will ignore it if it happens inside a type marked with GTY((user)). Otherwise, it will emit an error. Finally, gengtype rejects root types marked GTY((user)) that are not first class pointers. 2012-11-16 Diego Novillo <dnovillo@google.com> VEC API overhaul (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * vec.c (register_overhead): Convert it into member function of vec_prefix. (release_overhead): Likewise. (calculate_allocation): Likewise. (vec_heap_free): Remove. (vec_gc_o_reserve_1): Remove. (vec_heap_o_reserve_1): Remove. (vec_stack_o_reserve_1): Remove. (vec_stack_o_reserve_exact): Remove. (register_stack_vec): New. (stack_vec_register_index): New. (unregister_stack_vec): New. (vec_assert_fail): Remove. * vec.h: Conditionally include ggc.h. Document conditional hackery. Update top-level documentation. (ALONE_VEC_CHECK_INFO): Remove. (VEC_CHECK_INFO): Remove. (ALONE_VEC_CHECK_DECL): Remove. (VEC_CHECK_DECL): Remove. (ALONE_VEC_CHECK_PASS): Remove. (VEC_CHECK_PASS): Remove. (VEC_ASSERT): Remove. (vec_prefix): Add friends va_gc, va_gc_atomic, va_heap and va_stack. Mark fields alloc_ and num_ as protected. (struct vec_t): Remove. Remove all function members. (struct vl_embed): Declare. (struct vl_ptr): Declare. (free): Remove. (reserve_exact): Remove. (reserve): Remove. (safe_splice): Remove. (safe_push): Remove. (safe_grow): Remove. (safe_grow_cleared): Remove. (safe_insert): Remove. (DEF_VEC_I): Remove. (DEF_VEC_ALLOC_I): Remove. (DEF_VEC_P): Remove. (DEF_VEC_ALLOC_P): Remove. (DEF_VEC_O): Remove. (DEF_VEC_ALLOC_O): Remove. (DEF_VEC_ALLOC_P_STACK): Remove. (DEF_VEC_ALLOC_O_STACK): Remove. (DEF_VEC_ALLOC_I_STACK): Remove. (DEF_VEC_A): Remove. (DEF_VEC_ALLOC_A): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (VEC_length): Remove. (VEC_empty): Remove. (VEC_address): Remove. (vec_address): Remove. (VEC_last): Remove. (VEC_index): Remove. (VEC_iterate): Remove. (VEC_embedded_size): Remove. (VEC_embedded_init): Remove. (VEC_free): Remove. (VEC_copy): Remove. (VEC_space): Remove. (VEC_reserve): Remove. (VEC_reserve_exact): Remove. (VEC_splice): Remove. (VEC_safe_splice): Remove. (VEC_quick_push): Remove. (VEC_safe_push): Remove. (VEC_pop): Remove. (VEC_truncate): Remove. (VEC_safe_grow): Remove. (VEC_replace): Remove. (VEC_quick_insert): Remove. (VEC_safe_insert): Remove. (VEC_ordered_remove): Remove. (VEC_unordered_remove): Remove. (VEC_block_remove): Remove. (VEC_lower_bound): Remove. (VEC_alloc): Remove. (VEC_qsort): Remove. (va_heap): Declare. (va_heap::default_layout): New typedef to vl_ptr. (va_heap::reserve): New. (va_heap::release): New. (va_gc): Declare. (va_gc::default_layout): New typedef to vl_embed. (va_gc::reserve): New. (va_gc::release): New. (va_gc_atomic): Declare. Inherit from va_gc. (va_stack): Declare. (va_stack::default_layout): New typedef to vl_ptr. (va_stack::alloc): New. (va_stack::reserve): New. (va_stack::release): New. (register_stack_vec): Declare. (stack_vec_register_index): Declare. (unregister_stack_vec): Declare. (vec<T, A = va_heap, L = typename A::default_layout>): Declare empty vec template. (vec<T, A, vl_embed>): Partial specialization for embedded layout. (vec<T, A, vl_embed>::allocated): New. (vec<T, A, vl_embed>::length): New. (vec<T, A, vl_embed>::is_empty): New. (vec<T, A, vl_embed>::address): New. (vec<T, A, vl_embed>::operator[]): New. (vec<T, A, vl_embed>::last New. (vec<T, A, vl_embed>::space): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::iterate): New. (vec<T, A, vl_embed>::copy): New. (vec<T, A, vl_embed>::splice): New. (vec<T, A, vl_embed>::quick_push New. (vec<T, A, vl_embed>::pop New. (vec<T, A, vl_embed>::truncate): New. (vec<T, A, vl_embed>::quick_insert): New. (vec<T, A, vl_embed>::ordered_remove): New. (vec<T, A, vl_embed>::unordered_remove): New. (vec<T, A, vl_embed>::block_remove): New. (vec<T, A, vl_embed>::qsort): New. (vec<T, A, vl_embed>::lower_bound): New. (vec<T, A, vl_embed>::embedded_size): New. (vec<T, A, vl_embed>::embedded_init): New. (vec<T, A, vl_embed>::quick_grow): New. (vec<T, A, vl_embed>::quick_grow_cleared): New. (vec_safe_space): New. (vec_safe_length): New. (vec_safe_address): New. (vec_safe_is_empty): New. (vec_safe_reserve): New. (vec_safe_reserve_exact): New. (vec_alloc): New. (vec_free): New. (vec_safe_grow): New. (vec_safe_grow_cleared): New. (vec_safe_iterate): New. (vec_safe_push): New. (vec_safe_insert): New. (vec_safe_truncate): New. (vec_safe_copy): New. (vec_safe_splice): New. (vec<T, A, vl_ptr>): New partial specialization for the space efficient layout. (vec<T, A, vl_ptr>::exists): New. (vec<T, A, vl_ptr>::is_empty): New. (vec<T, A, vl_ptr>::length): New. (vec<T, A, vl_ptr>::address): New. (vec<T, A, vl_ptr>::operator[]): New. (vec<T, A, vl_ptr>::operator!=): New. (vec<T, A, vl_ptr>::operator==): New. (vec<T, A, vl_ptr>::last): New. (vec<T, A, vl_ptr>::space): New. (vec<T, A, vl_ptr>::iterate): New. (vec<T, A, vl_ptr>::copy): New. (vec<T, A, vl_ptr>::reserve): New. (vec<T, A, vl_ptr>::reserve_exact): New. (vec<T, A, vl_ptr>::splice): New. (vec<T, A, vl_ptr>::safe_splice): New. (vec<T, A, vl_ptr>::quick_push): New. (vec<T, A, vl_ptr>::safe_push): New. (vec<T, A, vl_ptr>::pop): New. (vec<T, A, vl_ptr>::truncate): New. (vec<T, A, vl_ptr>::safe_grow): New. (vec<T, A, vl_ptr>::safe_grow_cleared): New. (vec<T, A, vl_ptr>::quick_grow): New. (vec<T, A, vl_ptr>::quick_grow_cleared): New. (vec<T, A, vl_ptr>::quick_insert): New. (vec<T, A, vl_ptr>::safe_insert): New. (vec<T, A, vl_ptr>::ordered_remove): New. (vec<T, A, vl_ptr>::unordered_remove): New. (vec<T, A, vl_ptr>::block_remove): New. (vec<T, A, vl_ptr>::qsort): New. (vec<T, A, vl_ptr>::lower_bound): New. (vec_stack_alloc): Define. (FOR_EACH_VEC_SAFE_ELT): Define. * vecir.h: Remove. Update all users. * vecprim.h: Remove. Update all users. Move uchar to coretypes.h. * Makefile.in (VEC_H): Add $(GGC_H). Remove vecir.h and vecprim.h dependencies everywhere. 2012-11-16 Diego Novillo <dnovillo@google.com> * gengtype-lex.l (VEC): Remove. Add characters in the set [\!\>\.-]. * gengtype-parse.c (token_names): Remove "VEC". (require_template_declaration): Remove handling of VEC_TOKEN. (type): Likewise. Call create_user_defined_type when parsing GTY((user)). * gengtype-state.c (type_lineloc): handle TYPE_UNDEFINED. (write_state_undefined_type): New. (write_state_type): Call write_state_undefined_type for TYPE_UNDEFINED. (read_state_type): Call read_state_undefined_type for TYPE_UNDEFINED. * gengtype.c (dbgprint_count_type_at): Handle TYPE_UNDEFINED. (create_user_defined_type): Make extern. (type_for_name): Factor out of resolve_typedef. (create_undefined_type): New (resolve_typedef): Call it when we cannot find a previous typedef and the type is not a template. (find_structure): Accept TYPE_UNDEFINED. (set_gc_used_type): Add argument ALLOWED_UNDEFINED_TYPES, default to false. Emit an error for TYPE_UNDEFINED unless LEVEL is GC_UNUSED or ALLOWED_UNDEFINED_TYPES is set. Set ALLOWED_UNDEFINED_TYPES to true for TYPE_USER_STRUCT. (filter_type_name): Accept templates with more than one argument. (output_mangled_typename): Handle TYPE_UNDEFINED (walk_type): Likewise. (write_types_process_field): Likewise. (write_func_for_structure): If CHAIN_NEXT is set, ORIG_S should not be a user-defined type. (write_types_local_user_process_field): Handle TYPE_ARRAY, TYPE_NONE and TYPE_UNDEFINED. (write_types_local_process_field): Likewise. (contains_scalar_p): Return 0 for TYPE_USER_STRUCT. (write_root): Reject user-defined types that are not pointers. Handle TYPE_NONE, TYPE_UNDEFINED, TYPE_UNION, TYPE_LANG_STRUCT and TYPE_PARAM_STRUCT. (output_typename): Handle TYPE_NONE, TYPE_UNDEFINED, and TYPE_ARRAY. (dump_typekind): Handle TYPE_UNDEFINED. * gengtype.h (enum typekind): Add TYPE_UNDEFINED. (create_user_defined_type): Declare. (enum gty_token): Remove VEC_TOKEN. 2012-11-16 Diego Novillo <dnovillo@google.com> Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) * coretypes.h (uchar): Define. * alias.c: Use new vec API in vec.h. * asan.c: Likewise. * attribs.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * builtins.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgcleanup.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopanal.c: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphclones.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * compare-elim.c: Likewise. * coverage.c: Likewise. * cprop.c: Likewise. * data-streamer.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dse.c: Likewise. * dwarf2cfi.c: Likewise. * dwarf2out.c: Likewise. * dwarf2out.h: Likewise. * emit-rtl.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genextract.c: Likewise. * genopinit.c: Likewise * ggc-common.c: Likewise. * ggc.h: Likewise. * gimple-low.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * graphds.c: Likewise. * graphds.h: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-poly.h: Likewise. * graphite-scop-detection.c: Likewise. * graphite-scop-detection.h: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * godump.c: Likewise. * haifa-sched.c: Likewise. * hw-doloop.c: Likewise. * hw-doloop.h: Likewise. * ifcvt.c: Likewise. * insn-addr.h: Likewise. * ipa-cp.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline-transform.c: Likewise. * ipa-inline.c: Likewise. * ipa-inline.h: Likewise. * ipa-prop.c: Likewise. * ipa-prop.h: Likewise. * ipa-pure-const.c: Likewise. * ipa-ref-inline.h: Likewise. * ipa-ref.c: Likewise. * ipa-ref.h: Likewise. * ipa-reference.c: Likewise. * ipa-split.c: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira.c: Likewise. * loop-invariant.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lra-lives.c: Likewise. * lra.c: Likewise. * lto-cgraph.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * mcf.c: Likewise. * modulo-sched.c: Likewise. * omp-low.c: Likewise. * opts-common.c: Likewise. * opts-global.c: Likewise. * opts.c: Likewise. * opts.h: Likewise. * passes.c: Likewise. * predict.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * profile.h: Likewise. * read-rtl.c: Likewise. * ree.c: Likewise. * reg-stack.c: Likewise. * regrename.c: Likewise. * regrename.h: Likewise. * reload.c: Likewise. * reload.h: Likewise. * reload1.c: Likewise. * rtl.h: Likewise. * sched-deps.c: Likewise. * sched-int.h: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sese.c: Likewise. * sese.h: Likewise. * statistics.h: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * trans-mem.c: Likewise. * tree-browser.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-diagnostic.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-inline.h: Likewise. * tree-into-ssa.c: Likewise. * tree-iterator.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-mudflap.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sccvn.h: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-stdarg.c: Likewise. * tree-streamer-in.c: Likewise. * tree-streamer-out.c: Likewise. * tree-streamer.c: Likewise. * tree-streamer.h: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.h: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vmsdbgout.c: Likewise. * config/bfin/bfin.c: Likewise. * config/c6x/c6x.c: Likewise. * config/darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/pa.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/spu/spu-c.c: Likewise. * config/vms/vms.c: Likewise. * config/vxworks.c: Likewise. * config/epiphany/resolve-sw-modes.c: Likewise. From-SVN: r193595
2012-11-18 03:54:30 +01:00
vec_safe_iterate (vbases, ix, &binfo); ix++)
if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), base))
return binfo;
return NULL;
}
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 is some base binfo of HERE, within some other
hierarchy. Return the equivalent binfo, but in the hierarchy
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
dominated by HERE. This is the inverse of copied_binfo. If BINFO
is not a base binfo of HERE, returns 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
tree
original_binfo (tree binfo, tree here)
{
tree result = NULL;
if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), BINFO_TYPE (here)))
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 = here;
tree.h (TREE_VIA_VIRTUAL): Rename to ... * tree.h (TREE_VIA_VIRTUAL): Rename to ... (BINFO_VIRTUAL_P): ... here. Require TREE_BINFO only. (BINFO_MARKED, BINFO_FLAG_[16]): New binfo flags. * dbxout.c (dbxout_type): Use BINFO_VIRTUAL_P. * dwarf2out.c (add_data_member_location_attribute): Likewise. (gen_inheritance_die): Likewise. * tree-dump.c (deque_and_dump): Likewise. * doc/c-tree.texi (Binfos): Add under reconstruction note. * cp/cp-tree.h (BINFO_MARKED): Remove. (BINFO_VTABLE_PATH_MARKED, BINFO_NEW_VTABLE_MARKED, BINFO_DEPENDENT_BASE_P, BINFO_LOST_PRIMARY_P, BINFO_INDIRECT_PRIMARY_P): Use appropriate BINFO_FLAG_n. (SET_BINFO_NEW_VTABLE_MARKED): Use BINFO_VIRTUAL_P. * cp/class.c (build_base_path): Use BINFO_VIRTUAL_P. (mark_primary_bases, determine_primary_base, base_derived_from, dfs_find_final_overrider, dfs_find_final_overrider_q, dfs_find_inal_overrider_post, update_vtable_entry_for_fn, dfs_modify_vtables, walk_subobject_offsets, layout_nonempty_base_or_field, build_base_field, build_base_fields, propagate_binfo_offsets, layout_virtual_bases, end_of_class, get_vfield_name, dump_class_hierarchy, dump_vtable, finish_vtbls, build_vtt_inits, dfs_build_secondary_vptr_vtt_inits, build_ctor_vtbl_group, accumulate_vtble_inits, dfs_accumulate_vtbls_inits, build_vbase_offset_vtbl_entries, build_vcall_offset_vtbl_entries, add_vcall_offset_vtbl_entries_r, add_vcall_offset_vtbl_entries_1): Likewise. * cp/decl.c (xref_basetypes): Incomming virtual base indicated by TREE_TYPE. Adjust. * cp/dump.c (cp_dump_tree): Use BINFO_VIRTUAL_P. * cp/init.c (finish_init_stmts, sort_mem_initializers, emit_mem_initializers, build_vtble_address, expand_member_init, push_base_cleanups): Likewise. * cp/method.c (do_build_copy_constructor): Likewise. * cp/pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * cp/rtti.c (dfs_class_hint_mark, get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * cp/search.c (lookup_base_r, dynamic_cast_base_recurse, binfo_from_vbase, binfo_via_virtual, copied_binfo, original_binfo): Likewise. * cp/semantics.c (finish_base_specifier): Virtualness is indicated by TREE_TYPE. * cp/tree.c (copy_base_binfos): Use BINFO_VIRTUAL_P. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Use BINFO_FLAG_1. * java/class.c (add_interface_do): Use BINFO_VIRTUAL_P. From-SVN: r84148
2004-07-06 10:51:32 +02:00
else if (BINFO_VIRTUAL_P (binfo))
result = (CLASSTYPE_VBASECLASSES (BINFO_TYPE (here))
? binfo_for_vbase (BINFO_TYPE (binfo), BINFO_TYPE (here))
: 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
else if (BINFO_INHERITANCE_CHAIN (binfo))
{
tree base_binfos;
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 = original_binfo (BINFO_INHERITANCE_CHAIN (binfo), here);
if (base_binfos)
{
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
int ix;
tree base_binfo;
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
for (ix = 0; (base_binfo = BINFO_BASE_BINFO (base_binfos, ix)); ix++)
if (SAME_BINFO_TYPE_P (BINFO_TYPE (base_binfo),
BINFO_TYPE (binfo)))
tree.h: Include vec.h .: * tree.h: Include vec.h (DEF_VEC_P(tree)): New type. (BINFO_BASE_BINFOS, BINFO_N_BASE_BINFOS, BINFO_BASE_BINFO): Adjust. (BINFO_BASE_APPEND, BINFO_BASE_ITERATE): New. (BINFO_LANG_SLOT): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): New. (struct tree_binfo): Turn base_binfos into a trailing VEC(tree). Add vtt_subvtt, vtt_vptr, primary fields. (binfo_lang_slots): Remove. * tree.c (binfo_lang_slots): Remove. (make_tree_binfo_stat): Take a base binfo count, not a lang slot count. Adjust. * Makefile.in (TREE_H): Add vec.h * alias.c (record_component_aliases): Adjust BINFO access. * dbxout.c (dbxout_type): Likewise. * dwarf2out.c (gen_member_die): Likewise. * sdbout.c (sdbout_one_type): Likewise. * tree-dump.c (deque_and_dump): Likewise. * config/i386/i386.c (classify_argument, contains_128bit_aligned_vector_p): Likewise. * config/sh/symbian.c (symbian_export_vtable_and_rtti_p): Likewise. * doc/c-tree.texi (Classes): Update BINFO documentation. cp: * cp-tree.h (DEF_VEC_P(tree)): Remove here. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Moved to common. (BINFO_LANG_SLOTS): Remove. * tree.c (copy_binfo): Adjust BINFO creation and accessors. * decl.c (xref_basetypes): Adjust BINFO creation and accessors. * class.c (check_bases): Adjust BINFO accessors. (determine_primary_base, finish_struct_bits, maybe_warn_about_overly_private_class, warn_hidden, walk_subobject_offsets, propagate_binfo_offsets, end_of_class, warn_about_ambiguous_bases, get_vfield_name, dump_class_hierarchy_r, build_vtt_inits, accumulate_vtbl_inits, add_vcall_offset_vtbl_entries_r): Likewise. * dump.c (cp_dump_tree): Likewise. * init.c (sort_mem_initializers, expand_member_init, build_delete, push_base_cleanups): Likewise. * method.c (do_build_copy_constructor, do_build_assign_ref, synthesize_exception_spec): Likewise. name-lookup.c (arg_assoc_class): Likewise. * pt.c (instantiate_class_template, get_template_base_recursive): Likewise. * rtti.c (get_pseudo_ti_init, get_pseudo_ti_desc): Likewise. * typeck2.c (process_init_constructor): Likewise. * search.c (lookup_base_r, dynamic_cast_base_recurse, dfs_access_in_type, dfs_walk_real, look_for_overrides, types_overlap_p, copied_binfo, original_binfo): Likewise. (binfo_for_vtable): Remove java: * class.c (add_interface_do): Remove. (set_super_info, interface_of_p, maybe_add_interface, add_interface, make_class_data, layout_class, add_miranda_methods): Adjust BINFO accessors and addition. * expr.c (can_widen_reference_to, lookup_field): Adjust BINFO accessors. * jcf-write.c (generate_classfile): Likewise. * parse.y (patch_anonymous_class, check_inner_circular_reference, check_circular_reference, java_complete_class, check_abstract_method_definitions, java_check_abstract_method_definitions, check_interface_throws_clauses, java_check_abstract_methods, lookup_java_interface_method2, find_applicable_accessible_methods_list): Adjust BINFO accessors and addition. * typeck.c (find_method_in_interfaces): Adjust BINFO accessors. From-SVN: r84949
2004-07-20 14:26:02 +02:00
{
result = base_binfo;
break;
}
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
}
}
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 result;
}
/* True iff TYPE has any dependent bases (and therefore we can't say
definitively that another class is not a base of an instantiation of
TYPE). */
bool
any_dependent_bases_p (tree type)
{
if (!type || !CLASS_TYPE_P (type) || !processing_template_decl)
return false;
unsigned i;
tree base_binfo;
FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (type)), i, base_binfo)
if (BINFO_DEPENDENT_BASE_P (base_binfo))
return true;
return false;
}