Commit 5e19c053 by Mark Mitchell Committed by Mark Mitchell

cp-tree.h (BINFO_VIRTUALS): Tweak documentation.

	* cp-tree.h (BINFO_VIRTUALS): Tweak documentation.
	(CLASSTYPE_PRIMARY_BINFO): Use BINFO_PRIMARY_BINFO.
	(BINFO_PRIMARY_BINFO): New macro.
	(BF_DELTA): Rename to ...
	(BV_DELTA): ... this.
	(BF_VCALL_INDEX): Rename to ...
	(BV_VCALL_INDEX): ... this.
	(BF_FN): Rename to ...
	(BV_FN): ... this.
	* class.c (build_vbase_path): Adjust for changes to reverse_path.
	(set_rtti_entry): Rename BF_ macros to BV_ variants.
	(modify_vtable_entry): Simplify.
	(add_virtual_function): Rename BF_ macros to BV_ variants.
	(build_vtable_initializer): Likewise.
	(get_class_offset_1): Remove.
	(dfs_get_class_offset): Likewise.
	(get_class_offset): Likewise.
	(dfs_find_final_overrider): New function.
	(find_final_overrider): Likewise.
	(modify_one_vtable): Remove.
	(dfs_find_base): New function.
	(dfs_modify_vtables): Fold modify_one_vtable in here.  Use
	find_final_overrider.
	(modify_all_vtables): Adjust.  Set BV_VCALL_INDEX on new
	virtuals.
	(dfs_fixup_vtable_deltas): Remove.
	(override_one_vtable): Remove.
	(merge_overrides): Likewise.
	(layout_virtual_bases): Make sure BINFO_OFFSET is set right for
	unreal chilren of virtual bases.
	(finish_struct_1): Don't use merge_overrides.  Don't use
	dfs_fixup_vtable_deltas.
	* tree.c (reverse_path): Return a TREE_LIST, not a chain of
	BINFOs.

From-SVN: r31724
parent d4cf5733
2000-01-31 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (BINFO_VIRTUALS): Tweak documentation.
(CLASSTYPE_PRIMARY_BINFO): Use BINFO_PRIMARY_BINFO.
(BINFO_PRIMARY_BINFO): New macro.
(BF_DELTA): Rename to ...
(BV_DELTA): ... this.
(BF_VCALL_INDEX): Rename to ...
(BV_VCALL_INDEX): ... this.
(BF_FN): Rename to ...
(BV_FN): ... this.
* class.c (build_vbase_path): Adjust for changes to reverse_path.
(set_rtti_entry): Rename BF_ macros to BV_ variants.
(modify_vtable_entry): Simplify.
(add_virtual_function): Rename BF_ macros to BV_ variants.
(build_vtable_initializer): Likewise.
(get_class_offset_1): Remove.
(dfs_get_class_offset): Likewise.
(get_class_offset): Likewise.
(dfs_find_final_overrider): New function.
(find_final_overrider): Likewise.
(modify_one_vtable): Remove.
(dfs_find_base): New function.
(dfs_modify_vtables): Fold modify_one_vtable in here. Use
find_final_overrider.
(modify_all_vtables): Adjust. Set BV_VCALL_INDEX on new
virtuals.
(dfs_fixup_vtable_deltas): Remove.
(override_one_vtable): Remove.
(merge_overrides): Likewise.
(layout_virtual_bases): Make sure BINFO_OFFSET is set right for
unreal chilren of virtual bases.
(finish_struct_1): Don't use merge_overrides. Don't use
dfs_fixup_vtable_deltas.
* tree.c (reverse_path): Return a TREE_LIST, not a chain of
BINFOs.
2000-01-31 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
Jason Merrill <jason@yorick.cygnus.com>
......
......@@ -115,18 +115,22 @@ Boston, MA 02111-1307, USA. */
For a static VAR_DECL, this is DECL_INIT_PRIORITY.
BINFO_VIRTUALS
For a binfo, this is a TREE_LIST. The BF_DELTA of each node
For a binfo, this is a TREE_LIST. The BV_DELTA of each node
gives the amount by which to adjust the `this' pointer when
calling the function. If the method is an overriden version of a
base class method, then it is assumed that, prior to adjustment,
the this pointer points to an object of the base class.
The BF_VCALL_INDEX of each node, if non-NULL, gives the vtable
The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable
index of the vcall offset for this entry.
The BF_FN is the declaration for the virtual function itself.
The BV_FN is the declaration for the virtual function itself.
When CLASSTYPE_COM_INTERFACE_P does not hold, the first entry
does not have a BF_FN; it is just an offset.
does not have a BV_FN; it is just an offset.
The BV_OVERRIDING_BASE is the binfo for the final overrider for
this function. (This binfo's BINFO_TYPE will always be the same
as the DECL_CLASS_CONTEXT for the function.)
DECL_ARGUMENTS
For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
......@@ -1500,10 +1504,14 @@ struct lang_type
/* If non-NULL, this is the binfo for the primary base class, i.e.,
the base class which contains the virtual function table pointer
for this class. */
#define CLASSTYPE_PRIMARY_BINFO(NODE) \
(CLASSTYPE_HAS_PRIMARY_BASE_P (NODE) \
? TREE_VEC_ELT (TYPE_BINFO_BASETYPES (NODE), \
CLASSTYPE_VFIELD_PARENT (NODE)) \
#define CLASSTYPE_PRIMARY_BINFO(NODE) \
(BINFO_PRIMARY_BINFO (TYPE_BINFO (NODE)))
/* If non-NULL, this is the binfo for the primary base of BINFO. */
#define BINFO_PRIMARY_BINFO(NODE) \
(CLASSTYPE_HAS_PRIMARY_BASE_P (BINFO_TYPE (NODE)) \
? BINFO_BASETYPE (NODE, \
CLASSTYPE_VFIELD_PARENT (BINFO_TYPE (NODE))) \
: NULL_TREE)
/* The number of virtual functions defined for this
......@@ -1726,14 +1734,16 @@ struct lang_type
/* The number of bytes by which to adjust the `this' pointer when
calling this virtual function. */
#define BF_DELTA(NODE) (TREE_PURPOSE (NODE))
#define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
/* If non-NULL, the vtable index at which to find the vcall offset
when calling this virtual function. */
#define BF_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
#define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
/* The function to call. */
#define BF_FN(NODE) (TREE_VALUE (NODE))
#define BV_FN(NODE) (TREE_VALUE (NODE))
/* The most derived class. */
/* Nonzero for TREE_LIST node means that this list of things
......
......@@ -883,23 +883,26 @@ binfo_value (elem, type)
return get_binfo (elem, type, 0);
}
/* Return a reversed copy of the BINFO-chain given by PATH. (If the
BINFO_INHERITANCE_CHAIN points from base classes to derived
classes, it will instead point from derived classes to base
classes.) Returns the first node in the reversed chain. */
/* Return a TREE_LIST whose TREE_VALUE nodes along the
BINFO_INHERITANCE_CHAIN for BINFO, but in the opposite order. In
other words, while the BINFO_INHERITANCE_CHAIN goes from base
classes to derived classes, the reversed path goes from derived
classes to base classes. */
tree
reverse_path (path)
tree path;
reverse_path (binfo)
tree binfo;
{
register tree prev = NULL_TREE, cur;
for (cur = path; cur; cur = BINFO_INHERITANCE_CHAIN (cur))
tree reversed_path;
reversed_path = NULL_TREE;
while (binfo)
{
tree r = copy_node (cur);
BINFO_INHERITANCE_CHAIN (r) = prev;
prev = r;
reversed_path = tree_cons (NULL_TREE, binfo, reversed_path);
binfo = BINFO_INHERITANCE_CHAIN (binfo);
}
return prev;
return reversed_path;
}
void
......
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