diff options
author | Gabriel Dos Reis <gdr@integrable-solutions.net> | 2003-09-30 11:56:25 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2003-09-30 11:56:25 +0000 |
commit | daafa301e4b0c0528558092b711e26d93223d2c0 (patch) | |
tree | 9daa86d6c77617d4dff5b975fe554e2b7aba9a12 | |
parent | 5fb1287933b10ce520a01e281854f4f8822af43a (diff) | |
download | gcc-daafa301e4b0c0528558092b711e26d93223d2c0.zip gcc-daafa301e4b0c0528558092b711e26d93223d2c0.tar.gz gcc-daafa301e4b0c0528558092b711e26d93223d2c0.tar.bz2 |
decl.c (pop_binding): Don't mess with nullifying binding->scope here.
* decl.c (pop_binding): Don't mess with nullifying binding->scope
here.
* name-lookup.c: Re-format.
(cxx_binding_free): Nullify binding->scope.
From-SVN: r71942
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 31 |
3 files changed, 33 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b0f2c9c..25f58b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2003-09-30 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * decl.c (pop_binding): Don't mess with nullifying binding->scope + here. + * name-lookup.c: Re-format. + (cxx_binding_free): Nullify binding->scope. + 2003-09-29 Jan Hubicka <jh@suse.cz> PR C++/12047 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d60bcb4..17c36b1 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1030,9 +1030,6 @@ pop_binding (tree id, tree decl) /* Add it to the free list. */ cxx_binding_free (binding); - - /* Clear the SCOPE so the garbage collector doesn't walk it. */ - binding->scope = NULL; } } diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 3e8e4eb..386fb20 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -32,12 +32,15 @@ Boston, MA 02111-1307, USA. */ /* Compute the chain index of a binding_entry given the HASH value of its name and the total COUNT of chains. COUNT is assumed to be a power of 2. */ + #define ENTRY_INDEX(HASH, COUNT) (((HASH) >> 3) & ((COUNT) - 1)) /* A free list of "binding_entry"s awaiting for re-use. */ + static GTY((deletable(""))) binding_entry free_binding_entry = NULL; /* Create a binding_entry object for (NAME, TYPE). */ + static inline binding_entry binding_entry_make (tree name, tree type) { @@ -59,6 +62,7 @@ binding_entry_make (tree name, tree type) } /* Put ENTRY back on the free list. */ + static inline void binding_entry_free (binding_entry entry) { @@ -82,6 +86,7 @@ struct binding_table_s GTY(()) }; /* Construct TABLE with an initial CHAIN_COUNT. */ + static inline void binding_table_construct (binding_table table, size_t chain_count) { @@ -91,15 +96,18 @@ binding_table_construct (binding_table table, size_t chain_count) (table->chain_count * sizeof (binding_entry)); } -/* Free TABLE by making its entries ready for reuse. */ +/* Make TABLE's entries ready for reuse. */ + void binding_table_free (binding_table table) { size_t i; + size_t count; + if (table == NULL) return; - for (i = 0; i < table->chain_count; ++i) + for (i = 0, count = table->chain_count; i < count; ++i) { binding_entry temp = table->chain[i]; while (temp != NULL) @@ -109,12 +117,13 @@ binding_table_free (binding_table table) entry->chain = NULL; binding_entry_free (entry); } - table->chain[i] = temp; + table->chain[i] = NULL; } table->entry_count = 0; } /* Allocate a table with CHAIN_COUNT, assumed to be a power of two. */ + binding_table binding_table_new (size_t chain_count) { @@ -125,6 +134,7 @@ binding_table_new (size_t chain_count) } /* Expand TABLE to twice its current chain_count. */ + static void binding_table_expand (binding_table table) { @@ -151,7 +161,8 @@ binding_table_expand (binding_table table) table->entry_count = old_entry_count; } -/* Insert a binding for NAME to TYPe into TABLE. */ +/* Insert a binding for NAME to TYPE into TABLE. */ + void binding_table_insert (binding_table table, tree name, tree type) { @@ -168,6 +179,7 @@ binding_table_insert (binding_table table, tree name, tree type) } /* Return the binding_entry, if any, that maps NAME. */ + binding_entry binding_table_find (binding_table table, tree name) { @@ -180,7 +192,8 @@ binding_table_find (binding_table table, tree name) return entry; } -/* Return the binding_entry, if any, that maps name to an anonymous type. */ +/* Return the binding_entry, if any, that maps NAME to an anonymous type. */ + tree binding_table_find_anon_type (binding_table table, tree name) { @@ -195,6 +208,7 @@ binding_table_find_anon_type (binding_table table, tree name) /* Return the binding_entry, if any, that has TYPE as target. If NAME is non-null, then set the domain and rehash that entry. */ + binding_entry binding_table_reverse_maybe_remap (binding_table table, tree type, tree name) { @@ -230,6 +244,7 @@ binding_table_reverse_maybe_remap (binding_table table, tree type, tree name) /* Remove from TABLE all entries that map to anonymous enums or class-types. */ + void binding_table_remove_anonymous_types (binding_table table) { @@ -254,6 +269,7 @@ binding_table_remove_anonymous_types (binding_table table) } /* Apply PROC -- with DATA -- to all entries in TABLE. */ + void binding_table_foreach (binding_table table, bt_foreach_proc proc, void *data) { @@ -270,9 +286,11 @@ binding_table_foreach (binding_table table, bt_foreach_proc proc, void *data) /* A free list of "cxx_binding"s, connected by their PREVIOUS. */ + static GTY((deletable (""))) cxx_binding *free_bindings; /* (GC)-allocate a binding object with VALUE and TYPE member initialized. */ + cxx_binding * cxx_binding_make (tree value, tree type) { @@ -293,9 +311,11 @@ cxx_binding_make (tree value, tree type) } /* Put BINDING back on the free list. */ + void cxx_binding_free (cxx_binding *binding) { + binding->scope = NULL; binding->previous = free_bindings; free_bindings = binding; } @@ -402,6 +422,7 @@ find_binding (cxx_scope *scope, cxx_binding *binding) } /* Return the binding for NAME in SCOPE, if any. Otherwise, return NULL. */ + cxx_binding * cxx_scope_find_binding_for_name (cxx_scope *scope, tree name) { |