Commit 83f2ccf4 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (BINFO_VIRTUALS): Document new format.

	* cp-tree.h (BINFO_VIRTUALS): Document new format.
	* class.c (modify_one_vtable): Change prototype accordingly.
	(modify_all_vtables): Likewise.
	(modify_all_direct_vtables): Likewise.
	(modify_all_indirect_vtables): Likewise.
	(build_vtable_entry_for_fn): New function.
	(set_rtti_entry): Simplify for new BINFO_VIRTUALS format.
	(modify_vtable_entry): Likewise.
	(add_virtual_function): Likewise.
	(build_vtbl_initializer): New function.
	(finish_vtbls): Simplify for new BINFO_VIRTUALS format.
	(fixup_vtable_deltas1): Likewise.
	(fixup_vtable_deltas): Likewise.
	(override_one_vtable): Likewise.
	(finish_struct_1): Likewise.
	* error.c (dump_expr): Likewise.
	* search.c (get_abstract_virtuals_1): Likewise.
	(get_abstract_virtuals): Likewise.
	(expand_upcast_fixups): Likewise.
	* tree.c (debug_binfo): Likewise.
	* decl2.c (mark_vtable_entries): Don't bash abstract virtuals to
	__pure_virtual here.

From-SVN: r28298
parent f55dcd41
1999-07-27 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (BINFO_VIRTUALS): Document new format.
* class.c (modify_one_vtable): Change prototype accordingly.
(modify_all_vtables): Likewise.
(modify_all_direct_vtables): Likewise.
(modify_all_indirect_vtables): Likewise.
(build_vtable_entry_for_fn): New function.
(set_rtti_entry): Simplify for new BINFO_VIRTUALS format.
(modify_vtable_entry): Likewise.
(add_virtual_function): Likewise.
(build_vtbl_initializer): New function.
(finish_vtbls): Simplify for new BINFO_VIRTUALS format.
(fixup_vtable_deltas1): Likewise.
(fixup_vtable_deltas): Likewise.
(override_one_vtable): Likewise.
(finish_struct_1): Likewise.
* error.c (dump_expr): Likewise.
* search.c (get_abstract_virtuals_1): Likewise.
(get_abstract_virtuals): Likewise.
(expand_upcast_fixups): Likewise.
* tree.c (debug_binfo): Likewise.
* decl2.c (mark_vtable_entries): Don't bash abstract virtuals to
__pure_virtual here.
1999-07-26 Mark Mitchell <mark@codesourcery.com> 1999-07-26 Mark Mitchell <mark@codesourcery.com>
* tree.c (build_cplus_new): Adjust call to abstract_virtuals_error * tree.c (build_cplus_new): Adjust call to abstract_virtuals_error
......
...@@ -98,7 +98,14 @@ Boston, MA 02111-1307, USA. */ ...@@ -98,7 +98,14 @@ Boston, MA 02111-1307, USA. */
DECL_SAVED_INSNS/DECL_FIELD_SIZE DECL_SAVED_INSNS/DECL_FIELD_SIZE
For a static VAR_DECL, this is DECL_INIT_PRIORITY. For a static VAR_DECL, this is DECL_INIT_PRIORITY.
*/
BINFO_VIRTUALS
For a binfo, this is a TREE_LIST. The TREE_PURPOSE of each node
gives the amount by which to adjust the `this' pointer when
calling the function. The TREE_VALUE is the declaration for the
virtual function itself. When CLASSTYPE_COM_INTERFACE_P does not
hold, the first entry does not have a TREE_VALUE; it is just an
offset. */
/* Language-dependent contents of an identifier. */ /* Language-dependent contents of an identifier. */
......
...@@ -2414,11 +2414,6 @@ mark_vtable_entries (decl) ...@@ -2414,11 +2414,6 @@ mark_vtable_entries (decl)
fn = TREE_OPERAND (fnaddr, 0); fn = TREE_OPERAND (fnaddr, 0);
TREE_ADDRESSABLE (fn) = 1; TREE_ADDRESSABLE (fn) = 1;
if (DECL_LANG_SPECIFIC (fn) && DECL_ABSTRACT_VIRTUAL_P (fn))
{
TREE_OPERAND (fnaddr, 0) = abort_fndecl;
mark_used (abort_fndecl);
}
if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn)) if (TREE_CODE (fn) == THUNK_DECL && DECL_EXTERNAL (fn))
{ {
DECL_EXTERNAL (fn) = 0; DECL_EXTERNAL (fn) = 0;
......
...@@ -1670,7 +1670,7 @@ dump_expr (t, nop) ...@@ -1670,7 +1670,7 @@ dump_expr (t, nop)
t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t))); t = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (t)));
t = TYPE_METHOD_BASETYPE (t); t = TYPE_METHOD_BASETYPE (t);
virtuals = BINFO_VIRTUALS (TYPE_BINFO (TYPE_MAIN_VARIANT (t))); virtuals = TYPE_BINFO_VIRTUALS (TYPE_MAIN_VARIANT (t));
n = TREE_INT_CST_LOW (idx); n = TREE_INT_CST_LOW (idx);
...@@ -1685,7 +1685,7 @@ dump_expr (t, nop) ...@@ -1685,7 +1685,7 @@ dump_expr (t, nop)
} }
if (virtuals) if (virtuals)
{ {
dump_expr (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0); dump_expr (TREE_VALUE (virtuals), 0);
break; break;
} }
} }
......
...@@ -2032,10 +2032,10 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals) ...@@ -2032,10 +2032,10 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
while (virtuals) while (virtuals)
{ {
tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)); tree base_fndecl = TREE_VALUE (virtuals);
tree base_fndecl = TREE_OPERAND (base_pfn, 0);
if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl)) if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals); abstract_virtuals = tree_cons (NULL_TREE, base_fndecl,
abstract_virtuals);
virtuals = TREE_CHAIN (virtuals); virtuals = TREE_CHAIN (virtuals);
} }
} }
...@@ -2065,12 +2065,12 @@ get_abstract_virtuals (type) ...@@ -2065,12 +2065,12 @@ get_abstract_virtuals (type)
while (virtuals) while (virtuals)
{ {
tree base_pfn = FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)); tree base_fndecl = TREE_VALUE (virtuals);
tree base_fndecl = TREE_OPERAND (base_pfn, 0);
if (DECL_NEEDS_FINAL_OVERRIDER_P (base_fndecl)) if (DECL_NEEDS_FINAL_OVERRIDER_P (base_fndecl))
cp_error ("`%#D' needs a final overrider", base_fndecl); cp_error ("`%#D' needs a final overrider", base_fndecl);
else if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl)) else if (DECL_ABSTRACT_VIRTUAL_P (base_fndecl))
abstract_virtuals = tree_cons (NULL_TREE, base_fndecl, abstract_virtuals); abstract_virtuals = tree_cons (NULL_TREE, base_fndecl,
abstract_virtuals);
virtuals = TREE_CHAIN (virtuals); virtuals = TREE_CHAIN (virtuals);
} }
} }
...@@ -2541,8 +2541,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t, ...@@ -2541,8 +2541,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
while (virtuals) while (virtuals)
{ {
tree current_fndecl = TREE_VALUE (virtuals); tree current_fndecl = TREE_VALUE (virtuals);
current_fndecl = FNADDR_FROM_VTABLE_ENTRY (current_fndecl);
current_fndecl = TREE_OPERAND (current_fndecl, 0);
if (current_fndecl if (current_fndecl
&& current_fndecl != abort_fndecl && current_fndecl != abort_fndecl
&& (vc=virtual_context (current_fndecl, t, vbase)) != vbase) && (vc=virtual_context (current_fndecl, t, vbase)) != vbase)
......
...@@ -1245,7 +1245,7 @@ debug_binfo (elem) ...@@ -1245,7 +1245,7 @@ debug_binfo (elem)
while (virtuals) while (virtuals)
{ {
tree fndecl = TREE_OPERAND (FNADDR_FROM_VTABLE_ENTRY (TREE_VALUE (virtuals)), 0); tree fndecl = TREE_VALUE (virtuals);
fprintf (stderr, "%s [%ld =? %ld]\n", fprintf (stderr, "%s [%ld =? %ld]\n",
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)), IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)),
(long) n, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl))); (long) n, (long) TREE_INT_CST_LOW (DECL_VINDEX (fndecl)));
......
// Origin: Mark Mitchell <mark@codesourcery.com>
struct B
{
B ();
virtual void f () = 0;
};
B::B ()
{
}
extern B* bp;
template <class T>
struct C : public B
{
virtual void f ()
{
}
};
template <class T>
struct D : public B
{
virtual void f ()
{
bp = new C<T*>;
}
};
B* bp = new D<int>;
int main ()
{
bp->f ();
bp->f ();
}
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