[gimplefe][patch] The symbol table for declarations

Diego Novillo dnovillo@google.com
Wed Feb 29 15:13:00 GMT 2012

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!


More information about the Gcc-patches mailing list