Commit 67f7c391 by Jason Merrill Committed by Jason Merrill

class.c (build_vtable): Pass at_eof to import_export_vtable.

	* class.c (build_vtable): Pass at_eof to import_export_vtable.
	(prepare_fresh_vtable): Likewise.
	* decl2.c (import_export_class): Split out...
	(finish_prevtable_vardecl): From here.
	* class.c (finish_struct_1): Call import_export_class if at_eof.
	* decl.c (start_function): #if 0 mysterious code I wrote and have
	forgotten why.
	* rtti.c (get_tinfo_fn): If this is for a class type, set
	DECL_CONTEXT.

From-SVN: r21345
parent 1af1ed70
1998-07-23 Jason Merrill <jason@yorick.cygnus.com>
* class.c (build_vtable): Pass at_eof to import_export_vtable.
(prepare_fresh_vtable): Likewise.
* decl2.c (import_export_class): Split out...
(finish_prevtable_vardecl): From here.
* class.c (finish_struct_1): Call import_export_class if at_eof.
* decl.c (start_function): #if 0 mysterious code I wrote and have
forgotten why.
* rtti.c (get_tinfo_fn): If this is for a class type, set
DECL_CONTEXT.
1998-07-22 Jason Merrill <jason@yorick.cygnus.com> 1998-07-22 Jason Merrill <jason@yorick.cygnus.com>
* inc/exception: Change terminate and unexpected to (). * inc/exception: Change terminate and unexpected to ().
......
...@@ -704,7 +704,7 @@ build_vtable (binfo, type) ...@@ -704,7 +704,7 @@ build_vtable (binfo, type)
#endif #endif
/* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */ /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
import_export_vtable (decl, type, 0); import_export_vtable (decl, type, at_eof);
decl = pushdecl_top_level (decl); decl = pushdecl_top_level (decl);
SET_IDENTIFIER_GLOBAL_VALUE (name, decl); SET_IDENTIFIER_GLOBAL_VALUE (name, decl);
...@@ -890,7 +890,7 @@ prepare_fresh_vtable (binfo, for_type) ...@@ -890,7 +890,7 @@ prepare_fresh_vtable (binfo, for_type)
#endif #endif
/* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */ /* Set TREE_PUBLIC and TREE_EXTERN as appropriate. */
import_export_vtable (new_decl, for_type, 0); import_export_vtable (new_decl, for_type, at_eof);
if (TREE_VIA_VIRTUAL (binfo)) if (TREE_VIA_VIRTUAL (binfo))
my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo), my_friendly_assert (binfo == binfo_member (BINFO_TYPE (binfo),
...@@ -3943,6 +3943,11 @@ finish_struct_1 (t, warn_anon) ...@@ -3943,6 +3943,11 @@ finish_struct_1 (t, warn_anon)
if (max_has_virtual > 0) if (max_has_virtual > 0)
TYPE_VIRTUAL_P (t) = 1; TYPE_VIRTUAL_P (t) = 1;
/* Do this here before we start messing with vtables so that we are ready
for import_export_vtable. */
if (at_eof)
import_export_class (t);
if (flag_rtti && TYPE_VIRTUAL_P (t) && !pending_hard_virtuals) if (flag_rtti && TYPE_VIRTUAL_P (t) && !pending_hard_virtuals)
modify_all_vtables (t, NULL_TREE, NULL_TREE); modify_all_vtables (t, NULL_TREE, NULL_TREE);
......
...@@ -11959,8 +11959,11 @@ start_function (declspecs, declarator, attrs, pre_parsed_p) ...@@ -11959,8 +11959,11 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
{ {
decl1 = declarator; decl1 = declarator;
#if 0
/* What was this testing for, exactly? */
if (! DECL_ARGUMENTS (decl1) if (! DECL_ARGUMENTS (decl1)
&& !DECL_STATIC_FUNCTION_P (decl1) && !DECL_STATIC_FUNCTION_P (decl1)
&& !DECL_ARTIFICIAL (decl1)
&& DECL_CLASS_SCOPE_P (decl1) && DECL_CLASS_SCOPE_P (decl1)
&& TYPE_IDENTIFIER (DECL_CONTEXT (decl1)) && TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
&& IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1)))) && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
...@@ -11973,6 +11976,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p) ...@@ -11973,6 +11976,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
else if (BINDING_VALUE (binding)) else if (BINDING_VALUE (binding))
cp_error_at ("previous declaration here", BINDING_VALUE (binding)); cp_error_at ("previous declaration here", BINDING_VALUE (binding));
} }
#endif
fntype = TREE_TYPE (decl1); fntype = TREE_TYPE (decl1);
if (TREE_CODE (fntype) == METHOD_TYPE) if (TREE_CODE (fntype) == METHOD_TYPE)
......
...@@ -2607,12 +2607,11 @@ import_export_template (type) ...@@ -2607,12 +2607,11 @@ import_export_template (type)
CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 0; CLASSTYPE_VTABLE_NEEDS_WRITING (type) = 0;
} }
} }
int void
finish_prevtable_vardecl (prev, vars) import_export_class (ctype)
tree prev, vars; tree ctype;
{ {
tree ctype = DECL_CONTEXT (vars);
import_export_template (ctype); import_export_template (ctype);
#ifndef MULTIPLE_SYMBOL_SPACES #ifndef MULTIPLE_SYMBOL_SPACES
...@@ -2636,7 +2635,14 @@ finish_prevtable_vardecl (prev, vars) ...@@ -2636,7 +2635,14 @@ finish_prevtable_vardecl (prev, vars)
} }
} }
#endif #endif
}
int
finish_prevtable_vardecl (prev, vars)
tree prev, vars;
{
tree ctype = DECL_CONTEXT (vars);
import_export_class (ctype);
import_export_vtable (vars, ctype, 1); import_export_vtable (vars, ctype, 1);
return 1; return 1;
} }
......
...@@ -368,6 +368,17 @@ get_tinfo_fn (type) ...@@ -368,6 +368,17 @@ get_tinfo_fn (type)
DECL_NOT_REALLY_EXTERN (d) = 1; DECL_NOT_REALLY_EXTERN (d) = 1;
DECL_MUTABLE_P (d) = 1; DECL_MUTABLE_P (d) = 1;
TREE_TYPE (name) = copy_to_permanent (type); TREE_TYPE (name) = copy_to_permanent (type);
/* We set DECL_CONTEXT for the benefit of backend stuff that wants to
know what type this artificial function is associated with. dllexport
handling, for instance. This is a kludge, and the DECL_NO_STATIC_CHAIN
bit is necessary to keep local classes from breaking. */
if (IS_AGGR_TYPE (type))
{
DECL_CONTEXT (d) = type;
DECL_NO_STATIC_CHAIN (d) = 1;
}
pushdecl_top_level (d); pushdecl_top_level (d);
make_function_rtl (d); make_function_rtl (d);
assemble_external (d); assemble_external (d);
......
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