FreeBSD/contrib/gcc/cp/name-lookup.c
/* Unscoped lookup of a global: iterate over current namespaces,
   considering using-directives.  */
Unscoped lookup of a global: iterate over current namespaces,
considering using-directives.
Unscoped lookup of a global : iterate over current namespaces considering using - directives .
static tree
unqualified_namespace_lookup (tree name, int flags)
{
  tree initial = current_decl_namespace ();
  tree scope = initial;
  tree siter;
  struct cp_binding_level *level;
  tree val = NULL_TREE;
  timevar_push (TV_NAME_LOOKUP);
  for (; !val; scope = CP_DECL_CONTEXT (scope))
    {
      struct scope_binding binding = EMPTY_SCOPE_BINDING;
      cxx_binding *b =
	 cxx_scope_find_binding_for_name (NAMESPACE_LEVEL (scope), name);
      if (b)
	ambiguous_decl (&binding, b, flags);
      for (level = current_binding_level;
	   level->kind != sk_namespace;
	   level = level->level_chain)
	if (!lookup_using_namespace (name, &binding, level->using_directives,
				     scope, flags))
	  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
      siter = initial;
      while (1)
	{
	  if (!lookup_using_namespace (name, &binding,
				       DECL_NAMESPACE_USING (siter),
				       scope, flags))
	    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
	  if (siter == scope) break;
	  siter = CP_DECL_CONTEXT (siter);
	}
      val = binding.value;
      if (scope == global_namespace)
	break;
    }
  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, val);
}
static tree unqualified_namespace_lookup ( tree name , int flags ) { tree initial = current_decl_namespace ( ) ; tree scope = initial ; tree siter ; struct cp_binding_level * level ; tree val = NULL_TREE ; timevar_push ( TV_NAME_LOOKUP ) ; for ( ; ! val ; scope = CP_DECL_CONTEXT ( scope ) ) { struct scope_binding binding = EMPTY_SCOPE_BINDING ; cxx_binding * b = cxx_scope_find_binding_for_name ( NAMESPACE_LEVEL ( scope ) , name ) ; if ( b ) ambiguous_decl ( & binding , b , flags ) ; for ( level = current_binding_level ; level -> kind != sk_namespace ; level = level -> level_chain ) if ( ! lookup_using_namespace ( name , & binding , level -> using_directives , scope , flags ) ) POP_TIMEVAR_AND_RETURN ( TV_NAME_LOOKUP , error_mark_node ) ; siter = initial ; while ( 1 ) { if ( ! lookup_using_namespace ( name , & binding , DECL_NAMESPACE_USING ( siter ) , scope , flags ) ) POP_TIMEVAR_AND_RETURN ( TV_NAME_LOOKUP , error_mark_node ) ; if ( siter == scope ) break ; siter = CP_DECL_CONTEXT ( siter ) ; } val = binding . value ; if ( scope == global_namespace ) break ; } POP_TIMEVAR_AND_RETURN ( TV_NAME_LOOKUP , val ) ; }
Unscoped lookup of a global: iterate over current namespaces,
considering using-directives.
Unscoped lookup of a global : iterate over current namespaces considering using - directives .
/* LLVM LOCAL mainline */ /* Add all _DECLs seen through local using-directives.  */ /* Give up because of error.  */ /* Add all _DECLs seen through global using-directives.  */ /* XXX local and global using lists should work equally.  */ /* Give up because of error.  */