+/* Helper function to look up NESTED_NAME in CONTAINER_TYPE and in DOMAIN
+ and within the context of BLOCK.
+ NESTED_NAME may have scope ("::").
+ CONTAINER_TYPE needn't have been "check_typedef'd" yet.
+ CONCATENATED_NAME is the fully scoped spelling of NESTED_NAME, it is
+ passed as an argument so that callers can control how space for it is
+ allocated.
+ If BASIC_LOOKUP is non-zero then perform a basic lookup of
+ CONCATENATED_NAME. See cp_basic_lookup_symbol for details.
+ If IS_IN_ANONYMOUS is non-zero then CONCATENATED_NAME is in an anonymous
+ namespace. */
+
+static struct block_symbol
+cp_lookup_nested_symbol_1 (struct type *container_type,
+ const char *nested_name,
+ const char *concatenated_name,
+ const struct block *block,
+ const domain_enum domain,
+ int basic_lookup, int is_in_anonymous)
+{
+ struct block_symbol sym;
+
+ /* NOTE: carlton/2003-11-10: We don't treat C++ class members
+ of classes like, say, data or function members. Instead,
+ they're just represented by symbols whose names are
+ qualified by the name of the surrounding class. This is
+ just like members of namespaces; in particular,
+ cp_basic_lookup_symbol works when looking them up. */
+
+ if (basic_lookup)
+ {
+ sym = cp_basic_lookup_symbol (concatenated_name, block, domain,
+ is_in_anonymous);
+ if (sym.symbol != NULL)
+ return sym;
+ }
+
+ /* Now search all static file-level symbols. We have to do this for things
+ like typedefs in the class. We do not try to guess any imported
+ namespace as even the fully specified namespace search is already not
+ C++ compliant and more assumptions could make it too magic. */
+
+ /* First search in this symtab, what we want is possibly there. */
+ sym = lookup_symbol_in_static_block (concatenated_name, block, domain);
+ if (sym.symbol != NULL)
+ return sym;
+
+ /* Nope. We now have to search all static blocks in all objfiles,
+ even if block != NULL, because there's no guarantees as to which
+ symtab the symbol we want is in. Except for symbols defined in
+ anonymous namespaces should be treated as local to a single file,
+ which we just searched. */
+ if (!is_in_anonymous)
+ {
+ sym = lookup_static_symbol (concatenated_name, domain);
+ if (sym.symbol != NULL)
+ return sym;
+ }
+
+ /* If this is a class with baseclasses, search them next. */
+ container_type = check_typedef (container_type);
+ if (TYPE_N_BASECLASSES (container_type) > 0)
+ {
+ sym = find_symbol_in_baseclass (container_type, nested_name, block,
+ domain, is_in_anonymous);
+ if (sym.symbol != NULL)
+ return sym;
+ }
+
+ return null_block_symbol;
+}
+