Commit 1b746b0f by Andrew Pinski Committed by Andrew Pinski

class.c (abort_fndecl_addr): New variable.

2005-01-25  Andrew Pinski  <pinskia@physics.uc.edu>

        * class.c (abort_fndecl_addr): New variable.
        (build_vtbl_initializer): If we have a pure virtual function
        share the abort function's address.
        Include gt-cp-class.h at the end.
        * config-lang.in (gtfiles): Add cp/class.c.

From-SVN: r94225
parent 60b5ee6b
2005-01-25 Andrew Pinski <pinskia@physics.uc.edu>
* class.c (abort_fndecl_addr): New variable.
(build_vtbl_initializer): If we have a pure virtual function
share the abort function's address.
Include gt-cp-class.h at the end.
* config-lang.in (gtfiles): Add cp/class.c.
2005-01-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de> 2005-01-25 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* cxx-pretty-print.c (pp_cxx_statement): Add prototype. Make static. * cxx-pretty-print.c (pp_cxx_statement): Add prototype. Make static.
......
...@@ -7063,6 +7063,8 @@ dfs_accumulate_vtbl_inits (tree binfo, ...@@ -7063,6 +7063,8 @@ dfs_accumulate_vtbl_inits (tree binfo,
return inits; return inits;
} }
static GTY(()) tree abort_fndecl_addr;
/* Construct the initializer for BINFO's virtual function table. BINFO /* Construct the initializer for BINFO's virtual function table. BINFO
is part of the hierarchy dominated by T. If we're building a is part of the hierarchy dominated by T. If we're building a
construction vtable, the ORIG_BINFO is the binfo we should use to construction vtable, the ORIG_BINFO is the binfo we should use to
...@@ -7212,16 +7214,24 @@ build_vtbl_initializer (tree binfo, ...@@ -7212,16 +7214,24 @@ build_vtbl_initializer (tree binfo,
/* You can't call an abstract virtual function; it's abstract. /* You can't call an abstract virtual function; it's abstract.
So, we replace these functions with __pure_virtual. */ So, we replace these functions with __pure_virtual. */
if (DECL_PURE_VIRTUAL_P (fn_original)) if (DECL_PURE_VIRTUAL_P (fn_original))
fn = abort_fndecl;
else if (!integer_zerop (delta) || vcall_index)
{ {
fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index); fn = abort_fndecl;
if (!DECL_NAME (fn)) if (abort_fndecl_addr == NULL)
finish_thunk (fn); abort_fndecl_addr = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
init = abort_fndecl_addr;
}
else
{
if (!integer_zerop (delta) || vcall_index)
{
fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index);
if (!DECL_NAME (fn))
finish_thunk (fn);
}
/* Take the address of the function, considering it to be of an
appropriate generic type. */
init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
} }
/* Take the address of the function, considering it to be of an
appropriate generic type. */
init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn);
} }
/* And add it to the chain of initializers. */ /* And add it to the chain of initializers. */
...@@ -7682,3 +7692,4 @@ cp_fold_obj_type_ref (tree ref, tree known_type) ...@@ -7682,3 +7692,4 @@ cp_fold_obj_type_ref (tree ref, tree known_type)
return build_address (fndecl); return build_address (fndecl);
} }
#include "gt-cp-class.h"
...@@ -34,4 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)" ...@@ -34,4 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)"
target_libs="target-libstdc++-v3 target-gperf" target_libs="target-libstdc++-v3 target-gperf"
gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c" gtfiles="\$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c \$(srcdir)/cp/class.c"
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