This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gimplefe][patch] The symbol table for declarations


On 24/02/12 01:03 , Sandeep Soni wrote:

+  name_token = gl_consume_expected_token (parser->lexer, CPP_NAME);
+  name = gl_token_as_text (name_token);
+
+  e = ggc_alloc_cleared_gimple_symtab_entry_def ();
+  e->id = get_identifier(name);
+  slot = htab_find_slot (gimple_symtab, e, NO_INSERT);
+  if (!slot)

Why not just use INSERT here? If the slot is empty, you can then test 'if (*slot == NULL)' (since the INSERT operation guarantees that 'slot' will be non-NULL.


Also, please factor this code to a helper function to abstract the hash table operations. We will later want to add a pure lookup routine and we may want to add symbols to the symbol table from other contexts.

The rest looks fine. Thanks for doing this!


Diego.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]