Example #1
0
File: symtab.c Project: Roffi/gcc
symtab_node
symtab_get_node (const_tree decl)
{
  symtab_node *slot;
  struct symtab_node_base key;

#ifdef ENABLE_CHECKING
  /* Check that we are called for sane type of object - functions
     and static or external variables.  */
  gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
		       || (TREE_CODE (decl) == VAR_DECL
			   && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
			       || in_lto_p)));
#endif

  if (!symtab_hash)
    return NULL;

  key.decl = CONST_CAST2 (tree, const_tree, decl);

  slot = (symtab_node *) htab_find_slot (symtab_hash, &key,
					 NO_INSERT);

  if (slot)
    return *slot;
  return NULL;
}
Example #2
0
/* Return varpool node assigned to DECL without creating new one.  */
struct varpool_node *
varpool_get_node (const_tree decl)
{
  struct varpool_node key, **slot;

  gcc_assert (TREE_CODE (decl) == VAR_DECL
	      && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)));

  if (!varpool_hash)
    return NULL;
  key.decl = CONST_CAST2 (tree, const_tree, decl);
  slot = (struct varpool_node **)
    htab_find_slot (varpool_hash, &key, NO_INSERT);
  if (!slot)
    return NULL;
  return *slot;
}
Example #3
0
symtab_node
symtab_get_node (const_tree decl)
{
  symtab_node *slot;
  struct symtab_node_base key;

  gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL
		       || (TREE_CODE (decl) == VAR_DECL
			   && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
			       || in_lto_p)));

  if (!symtab_hash)
    return NULL;

  key.decl = CONST_CAST2 (tree, const_tree, decl);

  slot = (symtab_node *) htab_find_slot (symtab_hash, &key,
					 NO_INSERT);

  if (slot)
    return *slot;
  return NULL;
}