aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-11-25 13:21:45 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-11-25 13:21:45 +0000
commit338d90b89f23deaa5ce2ae80b8adf9cb52808679 (patch)
tree0d461fab9e84fd53ebc0b813e9c60b27eb83f6e0 /gcc/cp/call.c
parent92fa4733ab20d5f4a8e9eb7c6f5c924427677549 (diff)
downloadgcc-338d90b89f23deaa5ce2ae80b8adf9cb52808679.zip
gcc-338d90b89f23deaa5ce2ae80b8adf9cb52808679.tar.gz
gcc-338d90b89f23deaa5ce2ae80b8adf9cb52808679.tar.bz2
re PR c++/3145 (virtual inheritance still creates wrong code)
cp: PR g++/3145 * class.c (build_vbase_pointer): Remove. (build_vbase_path): Remove. (build_base_path): New function. * cp-tree.h (base_access, base_kind): New enumerations. (build_base_path): Declare. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. (lookup_base): Declare. (convert_pointer_to_vbase): Remove. * call.c (build_scoped_method_call): Use lookup_base & build_base_path instead of convert_pointer_to_real, get_base_distance & get_binfo. (build_over_call): Likewise. * cvt.c (cp_convert_to_pointer): Likewise. (convert_to_pointer_force): Likewise. (build_up_reference): Likewise. (convert_pointer_to_real): Remove. (convert_pointer_to): Remove. * init.c (dfs_initialize_vtbl_ptrs): Use build_base_path instead of convert_pointer_to_vbase & build_vbase_path. (emit_base_init): Use build_base_path instead of convert_pointer_to_real. (expand_virtual_init): Lose unrequired conversions. (resolve_offset_ref): Use lookup_base and build_base_path instead of convert_pointer_to. * rtti.c (build_dynamic_cast_1): Use lookup_base & build_base_path instead of get_base_distance & build_vbase_path. * search.c (get_vbase_1): Remove. (get_vbase): Remove. (convert_pointer_to_vbase): Remove. (lookup_base_recursive): New function. (lookup_base): New function. * typeck.c (require_complete_type): Use lookup_base & build_base_path instead of convert_pointer_to. (build_component_ref): Likewise. (build_x_function_call): Likewise. (get_member_function_from_ptrfunc): Likewise. (build_component_addr): Likewise. * typeck2.c (build_scoped_ref): Likewise. testsuite: * g++.dg/abi/vbase8-4.C: New test. From-SVN: r47316
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 46aacca..c0ab2c2 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -298,7 +298,7 @@ build_scoped_method_call (exp, basetype, name, parms)
if (! binfo)
{
- binfo = get_binfo (basetype, type, 1);
+ binfo = lookup_base (type, basetype, ba_check, NULL);
if (binfo == error_mark_node)
return error_mark_node;
if (! binfo)
@@ -308,9 +308,12 @@ build_scoped_method_call (exp, basetype, name, parms)
if (binfo)
{
if (TREE_CODE (exp) == INDIRECT_REF)
- decl = build_indirect_ref
- (convert_pointer_to_real
- (binfo, build_unary_op (ADDR_EXPR, exp, 0)), NULL);
+ {
+ decl = build_base_path (PLUS_EXPR,
+ build_unary_op (ADDR_EXPR, exp, 0),
+ binfo, 1);
+ decl = build_indirect_ref (decl, NULL);
+ }
else
decl = build_scoped_ref (exp, basetype);
@@ -4157,7 +4160,9 @@ build_over_call (cand, args, flags)
So we can assume that anything passed as 'this' is non-null, and
optimize accordingly. */
my_friendly_assert (TREE_CODE (parmtype) == POINTER_TYPE, 19990811);
- t = convert_pointer_to_real (TREE_TYPE (parmtype), TREE_VALUE (arg));
+ t = lookup_base (TREE_TYPE (TREE_TYPE (TREE_VALUE (arg))),
+ TREE_TYPE (parmtype), ba_ignore, NULL);
+ t = build_base_path (PLUS_EXPR, TREE_VALUE (arg), t, 1);
converted_args = tree_cons (NULL_TREE, t, converted_args);
parm = TREE_CHAIN (parm);
arg = TREE_CHAIN (arg);
@@ -4307,9 +4312,12 @@ build_over_call (cand, args, flags)
if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
{
tree t, *p = &TREE_VALUE (converted_args);
- tree binfo = get_binfo
- (DECL_VIRTUAL_CONTEXT (fn), TREE_TYPE (TREE_TYPE (*p)), 0);
- *p = convert_pointer_to_real (binfo, *p);
+ tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (*p)),
+ DECL_VIRTUAL_CONTEXT (fn),
+ ba_any, NULL);
+ my_friendly_assert (binfo && binfo != error_mark_node, 20010730);
+
+ *p = build_base_path (PLUS_EXPR, *p, binfo, 1);
if (TREE_SIDE_EFFECTS (*p))
*p = save_expr (*p);
t = build_pointer_type (TREE_TYPE (fn));