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> 2000-01-31 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
Jason Merrill <jason@yorick.cygnus.com> Jason Merrill <jason@yorick.cygnus.com>
......
...@@ -115,18 +115,22 @@ Boston, MA 02111-1307, USA. */ ...@@ -115,18 +115,22 @@ Boston, MA 02111-1307, USA. */
For a static VAR_DECL, this is DECL_INIT_PRIORITY. For a static VAR_DECL, this is DECL_INIT_PRIORITY.
BINFO_VIRTUALS 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 gives the amount by which to adjust the `this' pointer when
calling the function. If the method is an overriden version of a calling the function. If the method is an overriden version of a
base class method, then it is assumed that, prior to adjustment, base class method, then it is assumed that, prior to adjustment,
the this pointer points to an object of the base class. 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. 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 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 DECL_ARGUMENTS
For a VAR_DECL this is DECL_ANON_UNION_ELEMS. For a VAR_DECL this is DECL_ANON_UNION_ELEMS.
...@@ -1500,10 +1504,14 @@ struct lang_type ...@@ -1500,10 +1504,14 @@ struct lang_type
/* If non-NULL, this is the binfo for the primary base class, i.e., /* If non-NULL, this is the binfo for the primary base class, i.e.,
the base class which contains the virtual function table pointer the base class which contains the virtual function table pointer
for this class. */ for this class. */
#define CLASSTYPE_PRIMARY_BINFO(NODE) \ #define CLASSTYPE_PRIMARY_BINFO(NODE) \
(CLASSTYPE_HAS_PRIMARY_BASE_P (NODE) \ (BINFO_PRIMARY_BINFO (TYPE_BINFO (NODE)))
? TREE_VEC_ELT (TYPE_BINFO_BASETYPES (NODE), \
CLASSTYPE_VFIELD_PARENT (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) : NULL_TREE)
/* The number of virtual functions defined for this /* The number of virtual functions defined for this
...@@ -1726,14 +1734,16 @@ struct lang_type ...@@ -1726,14 +1734,16 @@ struct lang_type
/* The number of bytes by which to adjust the `this' pointer when /* The number of bytes by which to adjust the `this' pointer when
calling this virtual function. */ 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 /* If non-NULL, the vtable index at which to find the vcall offset
when calling this virtual function. */ 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. */ /* 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 /* Nonzero for TREE_LIST node means that this list of things
......
...@@ -883,23 +883,26 @@ binfo_value (elem, type) ...@@ -883,23 +883,26 @@ binfo_value (elem, type)
return get_binfo (elem, type, 0); return get_binfo (elem, type, 0);
} }
/* Return a reversed copy of the BINFO-chain given by PATH. (If the /* Return a TREE_LIST whose TREE_VALUE nodes along the
BINFO_INHERITANCE_CHAIN points from base classes to derived BINFO_INHERITANCE_CHAIN for BINFO, but in the opposite order. In
classes, it will instead point from derived classes to base other words, while the BINFO_INHERITANCE_CHAIN goes from base
classes.) Returns the first node in the reversed chain. */ classes to derived classes, the reversed path goes from derived
classes to base classes. */
tree tree
reverse_path (path) reverse_path (binfo)
tree path; tree binfo;
{ {
register tree prev = NULL_TREE, cur; tree reversed_path;
for (cur = path; cur; cur = BINFO_INHERITANCE_CHAIN (cur))
reversed_path = NULL_TREE;
while (binfo)
{ {
tree r = copy_node (cur); reversed_path = tree_cons (NULL_TREE, binfo, reversed_path);
BINFO_INHERITANCE_CHAIN (r) = prev; binfo = BINFO_INHERITANCE_CHAIN (binfo);
prev = r;
} }
return prev;
return reversed_path;
} }
void 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