Commit 58010b57 by Mark Mitchell Committed by Mark Mitchell

class.c (handle_using_decl): Get TYPE_FIELDS and TYPE_METHODS out of the class...

	* class.c (handle_using_decl): Get TYPE_FIELDS and TYPE_METHODS
	out of the class, rather than taking them as parameters.
	(build_vbase_pointer_fields): Move here from tree.c.
	(build_vtbl_or_vbase_field): New function.
	(check_methods): Likewise.
	(remove_zero_width_bitfields): Likewise.
	(add_virtual_function): Use tree_cons instead of temp_tree_cons.
	(delete_duplicate_fields_1): Tidy.  Don't delete duplicate
	USING_DECLs here.
	(finish_struct_methods): Handle the case where there are no
	methods here.
	(get_basefndecls): Use tree_cons instead of temp_tree_cons.
	(check_field_decls): Call delete_duplicate_fields here.
	(finish_struct_1): Tidy.  Use check_methods and
	remove_zero_width_bitfields.
	* cp-tree.h (build_vbase_pointer_fields): Remove.
	* decl.c (grokdeclarator): Use tree_cons instead of
	temp_tree_cons.
	* decl2.c (qualified_lookup_using_namespace): Use tree_cons
	instead of temp_tree_cons.
	* lex.c (cons_up_default_function): Remove dead code.
	* method.c (fixup_pending_inline): New function, split out from	...
	(do_inline_function_hair): ... here.
	* tree.c (build_vbase_pointer_fields): Remove.

From-SVN: r30966
parent 5afb79e7
1999-12-15 Mark Mitchell <mark@codesourcery.com>
* class.c (handle_using_decl): Get TYPE_FIELDS and TYPE_METHODS
out of the class, rather than taking them as parameters.
(build_vbase_pointer_fields): Move here from tree.c.
(build_vtbl_or_vbase_field): New function.
(check_methods): Likewise.
(remove_zero_width_bitfields): Likewise.
(add_virtual_function): Use tree_cons instead of temp_tree_cons.
(delete_duplicate_fields_1): Tidy. Don't delete duplicate
USING_DECLs here.
(finish_struct_methods): Handle the case where there are no
methods here.
(get_basefndecls): Use tree_cons instead of temp_tree_cons.
(check_field_decls): Call delete_duplicate_fields here.
(finish_struct_1): Tidy. Use check_methods and
remove_zero_width_bitfields.
* cp-tree.h (build_vbase_pointer_fields): Remove.
* decl.c (grokdeclarator): Use tree_cons instead of
temp_tree_cons.
* decl2.c (qualified_lookup_using_namespace): Use tree_cons
instead of temp_tree_cons.
* lex.c (cons_up_default_function): Remove dead code.
* method.c (fixup_pending_inline): New function, split out from ...
(do_inline_function_hair): ... here.
* tree.c (build_vbase_pointer_fields): Remove.
1999-12-15 Jason Merrill <jason@casey.cygnus.com>
* tree.c (walk_tree): Walk operand subtrees in forward order.
......
......@@ -4012,7 +4012,6 @@ extern tree build_cplus_method_type PROTO((tree, tree, tree));
extern tree build_cplus_staticfn_type PROTO((tree, tree, tree));
extern tree build_cplus_array_type PROTO((tree, tree));
extern int layout_basetypes PROTO((tree, int));
extern tree build_vbase_pointer_fields PROTO((tree));
extern tree build_base_fields PROTO((tree));
extern tree hash_tree_cons PROTO((tree, tree, tree));
extern tree hash_tree_chain PROTO((tree, tree));
......
......@@ -9293,8 +9293,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
/* Avoid giving two errors for this. */
IDENTIFIER_CLASS_VALUE (dname) = NULL_TREE;
declspecs = temp_tree_cons (NULL_TREE, integer_type_node,
declspecs);
declspecs = tree_cons (NULL_TREE, integer_type_node, declspecs);
*next = dname;
next = 0;
break;
......
......@@ -4335,7 +4335,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
tree usings;
while (scope && (result != error_mark_node))
{
seen = temp_tree_cons (scope, NULL_TREE, seen);
seen = tree_cons (scope, NULL_TREE, seen);
result = ambiguous_decl (name, result,
binding_for_name (name, scope), flags);
if (!BINDING_VALUE (result) && !BINDING_TYPE (result))
......@@ -4345,7 +4345,7 @@ qualified_lookup_using_namespace (name, scope, result, flags)
/* If this was a real directive, and we have not seen it. */
if (!TREE_INDIRECT_USING (usings)
&& !purpose_member (TREE_PURPOSE (usings), seen))
todo = temp_tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
todo = tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
if (todo)
{
scope = TREE_PURPOSE (todo);
......
......@@ -2000,9 +2000,6 @@ cons_up_default_function (type, full_name, kind)
switch (kind)
{
/* Destructors. */
case 1:
declspecs = build_decl_list (NULL_TREE, ridpointers [(int) RID_VIRTUAL]);
/* Fall through... */
case 0:
name = build_parse_node (BIT_NOT_EXPR, name);
args = void_list_node;
......
......@@ -989,86 +989,6 @@ build_base_fields (rec)
return base_decls;
}
/* Returns list of virtual base class pointers in a FIELD_DECL chain. */
tree
build_vbase_pointer_fields (rec)
tree rec;
{
/* Chain to hold all the new FIELD_DECLs which point at virtual
base classes. */
tree vbase_decls = NULL_TREE;
tree binfos = TYPE_BINFO_BASETYPES (rec);
int n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
tree decl;
int i;
/* Handle basetypes almost like fields, but record their
offsets differently. */
for (i = 0; i < n_baseclasses; i++)
{
register tree base_binfo = TREE_VEC_ELT (binfos, i);
register tree basetype = BINFO_TYPE (base_binfo);
if (TYPE_SIZE (basetype) == 0)
/* This error is now reported in xref_tag, thus giving better
location information. */
continue;
/* All basetypes are recorded in the association list of the
derived type. */
if (TREE_VIA_VIRTUAL (base_binfo))
{
int j;
const char *name;
/* The offset for a virtual base class is only used in computing
virtual function tables and for initializing virtual base
pointers. It is built once `get_vbase_types' is called. */
/* If this basetype can come from another vbase pointer
without an additional indirection, we will share
that pointer. If an indirection is involved, we
make our own pointer. */
for (j = 0; j < n_baseclasses; j++)
{
tree other_base_binfo = TREE_VEC_ELT (binfos, j);
if (! TREE_VIA_VIRTUAL (other_base_binfo)
&& binfo_member (basetype,
CLASSTYPE_VBASECLASSES (BINFO_TYPE
(other_base_binfo))
))
goto got_it;
}
FORMAT_VBASE_NAME (name, basetype);
decl = build_lang_decl (FIELD_DECL, get_identifier (name),
build_pointer_type (basetype));
/* If you change any of the below, take a look at all the
other VFIELD_BASEs and VTABLE_BASEs in the code, and change
them too. */
DECL_ASSEMBLER_NAME (decl) = get_identifier (VTABLE_BASE);
DECL_VIRTUAL_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_FIELD_CONTEXT (decl) = rec;
DECL_CLASS_CONTEXT (decl) = rec;
DECL_FCONTEXT (decl) = basetype;
DECL_SAVED_INSNS (decl) = 0;
DECL_FIELD_SIZE (decl) = 0;
DECL_ALIGN (decl) = TYPE_ALIGN (ptr_type_node);
TREE_CHAIN (decl) = vbase_decls;
BINFO_VPTR_FIELD (base_binfo) = decl;
vbase_decls = decl;
got_it:
/* The space this decl occupies has already been accounted for. */
;
}
}
return vbase_decls;
}
/* Hashing of lists so that we don't make duplicates.
The entry point is `list_hash_canon'. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment