diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-25 19:21:30 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-01-25 19:21:30 +0000 |
commit | 96efc79df5bb2d6ab2dd173849eaf38fc7b5f21c (patch) | |
tree | 962b6fe7d5abb7a169372f67b8c286c7b2e60f63 | |
parent | 1438e0b77542d4f6bec27f720f052cab487bb4fb (diff) | |
download | gcc-96efc79df5bb2d6ab2dd173849eaf38fc7b5f21c.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94225 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/class.c | 27 | ||||
-rw-r--r-- | gcc/cp/config-lang.in | 2 |
3 files changed, 28 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b9056d488c0..52a0ee6bb34 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +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> * cxx-pretty-print.c (pp_cxx_statement): Add prototype. Make static. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 87e7b397c0e..84db9e2169b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7063,6 +7063,8 @@ dfs_accumulate_vtbl_inits (tree binfo, return inits; } +static GTY(()) tree abort_fndecl_addr; + /* Construct the initializer for BINFO's virtual function table. BINFO 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 @@ -7212,16 +7214,24 @@ build_vtbl_initializer (tree binfo, /* You can't call an abstract virtual function; it's abstract. So, we replace these functions with __pure_virtual. */ 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); - if (!DECL_NAME (fn)) - finish_thunk (fn); + fn = abort_fndecl; + if (abort_fndecl_addr == NULL) + 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. */ @@ -7682,3 +7692,4 @@ cp_fold_obj_type_ref (tree ref, tree known_type) return build_address (fndecl); } +#include "gt-cp-class.h" diff --git a/gcc/cp/config-lang.in b/gcc/cp/config-lang.in index 563cfb4d1c0..7243f4d6ac9 100644 --- a/gcc/cp/config-lang.in +++ b/gcc/cp/config-lang.in @@ -34,4 +34,4 @@ stagestuff="g++\$(exeext) g++-cross\$(exeext) cc1plus\$(exeext)" 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" |