diff options
author | Matt Austern <austern@apple.com> | 2003-03-20 21:14:30 +0000 |
---|---|---|
committer | Matt Austern <austern@gcc.gnu.org> | 2003-03-20 21:14:30 +0000 |
commit | a260bce67642765094ec0bbfa3687876c7a2f51c (patch) | |
tree | 4beefd450f4f5c3baa474b410f8a4e40a2189ca2 /gcc/cp/rtti.c | |
parent | d0940a55f800ad463e270ab8c86dfc53600a49a6 (diff) | |
download | gcc-a260bce67642765094ec0bbfa3687876c7a2f51c.zip gcc-a260bce67642765094ec0bbfa3687876c7a2f51c.tar.gz gcc-a260bce67642765094ec0bbfa3687876c7a2f51c.tar.bz2 |
cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray.
* cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray.
(unemitted_tinfo_decl_p): Remove.
(emit_tinfo_decl): Change declaration to remove unused parameter.
* decl2.c (finish_file): Change tinfo emission to loop through
unemitted_tinfo_decls array instead of looping through all decls.
* rtti.c (unemitted_tinfo_decl_p): Declare as static, remove
unused second parameter.
(init_rtti_processing): initialize unemitted_tinfo_decls varray.
(get_tinfo_decls): push new tinfo decl on unemitted_tinfo_decls.
(emit_tinfo_decl): remove unused second parameter, add assertion
that decl hasn't already been emitted.
From-SVN: r64621
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r-- | gcc/cp/rtti.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index eab85f7..a9a7cdb 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -73,6 +73,9 @@ Boston, MA 02111-1307, USA. */ /* The IDENTIFIER_NODE naming the real class. */ #define TINFO_REAL_NAME(NODE) TREE_PURPOSE (NODE) +/* A varray of all tinfo decls that haven't yet been emitted. */ +varray_type unemitted_tinfo_decls; + static tree build_headof PARAMS((tree)); static tree ifnonnull PARAMS((tree, tree)); static tree tinfo_name PARAMS((tree)); @@ -97,6 +100,7 @@ static tree get_pseudo_ti_init PARAMS ((tree, tree, bool *)); static tree get_pseudo_ti_desc PARAMS((tree)); static void create_tinfo_types PARAMS((void)); static bool typeinfo_in_lib_p (tree); +static bool unemitted_tinfo_decl_p PARAMS((tree)); static int doing_runtime = 0; @@ -122,6 +126,8 @@ init_rtti_processing (void) type_info_ptr_type = build_pointer_type (const_type_info_type); type_info_ref_type = build_reference_type (const_type_info_type); + VARRAY_TREE_INIT (unemitted_tinfo_decls, 10, "RTTI decls"); + create_tinfo_types (); } @@ -367,6 +373,10 @@ get_tinfo_decl (tree type) /* Remember the type it is for. */ TREE_TYPE (name) = type; + + /* Add decl to the global array of tinfo decls. */ + my_friendly_assert (unemitted_tinfo_decls != 0, 20030312); + VARRAY_PUSH_TREE (unemitted_tinfo_decls, d); } return d; @@ -1403,8 +1413,8 @@ emit_support_tinfos (void) /* Return true, iff T is a type_info variable which has not had a definition emitted for it. */ -bool -unemitted_tinfo_decl_p (tree t, void *data ATTRIBUTE_UNUSED) +static bool +unemitted_tinfo_decl_p (tree t) { if (/* It's a var decl */ TREE_CODE (t) == VAR_DECL @@ -1429,13 +1439,14 @@ unemitted_tinfo_decl_p (tree t, void *data ATTRIBUTE_UNUSED) generate the initializer. */ bool -emit_tinfo_decl (tree *decl_ptr, void *data ATTRIBUTE_UNUSED) +emit_tinfo_decl (tree decl) { - tree decl = *decl_ptr; tree type = TREE_TYPE (DECL_NAME (decl)); bool non_public; int in_library = typeinfo_in_lib_p (type); tree var_desc, var_init; + + my_friendly_assert (unemitted_tinfo_decl_p (decl), 20030307); import_export_tinfo (decl, type, in_library); if (DECL_REALLY_EXTERN (decl) || !DECL_NEEDED_P (decl)) |