Commit 6bc34b14 by Jason Merrill

* class.c (build_base_path): Tweak formatting.

From-SVN: r49075
parent cf403648
2002-01-22 Jason Merrill <jason@redhat.com>
* class.c (build_base_path): Tweak formatting.
2002-01-19 Nathan Sidwell <nathan@codesourcery.com> 2002-01-19 Nathan Sidwell <nathan@codesourcery.com>
Fix regression introduced with patch for c++/775 Fix regression introduced with patch for c++/775
...@@ -25,6 +29,7 @@ ...@@ -25,6 +29,7 @@
2002-01-10 Ira Ruben <ira@apple.com> 2002-01-10 Ira Ruben <ira@apple.com>
PR c++/907
* decl.c (start_method): Handle attrlist. * decl.c (start_method): Handle attrlist.
2002-01-10 Jakub Jelinek <jakub@redhat.com> 2002-01-10 Jakub Jelinek <jakub@redhat.com>
...@@ -40,7 +45,7 @@ ...@@ -40,7 +45,7 @@
2002-01-09 Graham Stott <grahams@redhat.com> 2002-01-09 Graham Stott <grahams@redhat.com>
* decl.h ( grokdeclarator): Wrap long line. * decl.h (grokdeclarator): Wrap long line.
* semantics.c (FINISH_COND): Uppercase macro paramaters and * semantics.c (FINISH_COND): Uppercase macro paramaters and
add parenthesis. add parenthesis.
...@@ -86,6 +91,7 @@ ...@@ -86,6 +91,7 @@
* decl2.c (coerce_new_type): Downgrade error for size_t mismatch * decl2.c (coerce_new_type): Downgrade error for size_t mismatch
to pedwarn. to pedwarn.
PR c++/3536
* method.c (make_thunk): If !flag_weak, give the thunk the * method.c (make_thunk): If !flag_weak, give the thunk the
function's linkage. function's linkage.
(use_thunk): Here, too. (use_thunk): Here, too.
......
...@@ -252,7 +252,7 @@ build_base_path (code, expr, binfo, nonnull) ...@@ -252,7 +252,7 @@ build_base_path (code, expr, binfo, nonnull)
int nonnull; int nonnull;
{ {
tree v_binfo = NULL_TREE; tree v_binfo = NULL_TREE;
tree t; tree d_binfo = NULL_TREE;
tree probe; tree probe;
tree offset; tree offset;
tree target_type; tree target_type;
...@@ -264,10 +264,12 @@ build_base_path (code, expr, binfo, nonnull) ...@@ -264,10 +264,12 @@ build_base_path (code, expr, binfo, nonnull)
if (expr == error_mark_node || binfo == error_mark_node || !binfo) if (expr == error_mark_node || binfo == error_mark_node || !binfo)
return error_mark_node; return error_mark_node;
for (probe = binfo; probe; for (probe = binfo; probe; probe = BINFO_INHERITANCE_CHAIN (probe))
t = probe, probe = BINFO_INHERITANCE_CHAIN (probe)) {
d_binfo = probe;
if (!v_binfo && TREE_VIA_VIRTUAL (probe)) if (!v_binfo && TREE_VIA_VIRTUAL (probe))
v_binfo = probe; v_binfo = probe;
}
probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr)); probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
if (want_pointer) if (want_pointer)
...@@ -276,13 +278,13 @@ build_base_path (code, expr, binfo, nonnull) ...@@ -276,13 +278,13 @@ build_base_path (code, expr, binfo, nonnull)
my_friendly_assert (code == MINUS_EXPR my_friendly_assert (code == MINUS_EXPR
? same_type_p (BINFO_TYPE (binfo), probe) ? same_type_p (BINFO_TYPE (binfo), probe)
: code == PLUS_EXPR : code == PLUS_EXPR
? same_type_p (BINFO_TYPE (t), probe) ? same_type_p (BINFO_TYPE (d_binfo), probe)
: false, 20010723); : false, 20010723);
if (code == MINUS_EXPR && v_binfo) if (code == MINUS_EXPR && v_binfo)
{ {
error ("cannot convert from base `%T' to derived type `%T' via virtual base `%T'", error ("cannot convert from base `%T' to derived type `%T' via virtual base `%T'",
BINFO_TYPE (binfo), BINFO_TYPE (t), BINFO_TYPE (v_binfo)); BINFO_TYPE (binfo), BINFO_TYPE (d_binfo), BINFO_TYPE (v_binfo));
return error_mark_node; return error_mark_node;
} }
...@@ -303,12 +305,12 @@ build_base_path (code, expr, binfo, nonnull) ...@@ -303,12 +305,12 @@ build_base_path (code, expr, binfo, nonnull)
if (v_binfo && !fixed_type_p) if (v_binfo && !fixed_type_p)
{ {
/* Going via virtual base V_BINFO. We need the static offset /* Going via virtual base V_BINFO. We need the static offset
from V_BINFO to BINFO, and the dynamic offset from T to from V_BINFO to BINFO, and the dynamic offset from D_BINFO to
V_BINFO. That offset is an entry in T's vtable. */ V_BINFO. That offset is an entry in D_BINFO's vtable. */
tree v_offset = build_vfield_ref (build_indirect_ref (expr, NULL), tree v_offset = build_vfield_ref (build_indirect_ref (expr, NULL),
TREE_TYPE (TREE_TYPE (expr))); TREE_TYPE (TREE_TYPE (expr)));
v_binfo = binfo_for_vbase (BINFO_TYPE (v_binfo), BINFO_TYPE (t)); v_binfo = binfo_for_vbase (BINFO_TYPE (v_binfo), BINFO_TYPE (d_binfo));
v_offset = build (PLUS_EXPR, TREE_TYPE (v_offset), v_offset = build (PLUS_EXPR, TREE_TYPE (v_offset),
v_offset, BINFO_VPTR_FIELD (v_binfo)); v_offset, BINFO_VPTR_FIELD (v_binfo));
...@@ -326,7 +328,7 @@ build_base_path (code, expr, binfo, nonnull) ...@@ -326,7 +328,7 @@ build_base_path (code, expr, binfo, nonnull)
offset = v_offset; offset = v_offset;
} }
target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (t); target_type = code == PLUS_EXPR ? BINFO_TYPE (binfo) : BINFO_TYPE (d_binfo);
target_type = cp_build_qualified_type target_type = cp_build_qualified_type
(target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr)))); (target_type, cp_type_quals (TREE_TYPE (TREE_TYPE (expr))));
......
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