gdb/
[deliverable/binutils-gdb.git] / gdb / cp-namespace.c
index 68febcd8c42c5a07a575f237ac554b02f980d775..9f3a60803ba77e6ebd817d32ea073a708e37c35b 100644 (file)
@@ -53,7 +53,8 @@ static struct type *cp_lookup_transparent_type_loop (const char *name,
    anonymous namespace; if so, add an appropriate using directive.  */
 
 void
-cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
+cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
+                                 struct objfile *const objfile)
 {
   if (SYMBOL_DEMANGLED_NAME (symbol) != NULL)
     {
@@ -96,7 +97,7 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
                 namespace given by the previous component if there is
                 one, or to the global namespace if there isn't.  */
              cp_add_using_directive (dest, src, NULL, NULL, NULL,
-                                     &SYMBOL_SYMTAB (symbol)->objfile->objfile_obstack);
+                                     &objfile->objfile_obstack);
            }
          /* The "+ 2" is for the "::".  */
          previous_component = next_component + 2;
@@ -369,72 +370,72 @@ cp_lookup_symbol_imports (const char *scope,
          ancestors then it is applicable.  */
       if (directive_match && !current->searched)
        {
-       /* Mark this import as searched so that the recursive call
-           does not search it again.  */
-       current->searched = 1;
-       searched_cleanup = make_cleanup (reset_directive_searched,
-                                        current);
-
-       /* If there is an import of a single declaration, compare the
-          imported declaration (after optional renaming by its alias)
-          with the sought out name.  If there is a match pass
-          current->import_src as NAMESPACE to direct the search
-          towards the imported namespace.  */
-       if (current->declaration
-           && strcmp (name, current->alias
-                      ? current->alias : current->declaration) == 0)
-         sym = cp_lookup_symbol_in_namespace (current->import_src,
-                                              current->declaration,
-                                              block, domain);
-
-       /* If this is a DECLARATION_ONLY search or a symbol was found
-          or this import statement was an import declaration, the
-          search of this import is complete.  */
-        if (declaration_only || sym != NULL || current->declaration)
-          {
-            current->searched = 0;
-            discard_cleanups (searched_cleanup);
-
-            if (sym != NULL)
-              return sym;
-
-            continue;
-          }
-
-       /* Do not follow CURRENT if NAME matches its EXCLUDES.  */
-       for (excludep = current->excludes; *excludep; excludep++)
-         if (strcmp (name, *excludep) == 0)
-           break;
-       if (*excludep)
-         {
-           discard_cleanups (searched_cleanup);
-           continue;
-         }
-
-       if (current->alias != NULL
-           && strcmp (name, current->alias) == 0)
-         /* If the import is creating an alias and the alias matches
-            the sought name.  Pass current->import_src as the NAME to
-            direct the search towards the aliased namespace.  */
-         {
-           sym = cp_lookup_symbol_in_namespace (scope,
-                                                current->import_src,
+         /* Mark this import as searched so that the recursive call
+            does not search it again.  */
+         current->searched = 1;
+         searched_cleanup = make_cleanup (reset_directive_searched,
+                                          current);
+
+         /* If there is an import of a single declaration, compare the
+            imported declaration (after optional renaming by its alias)
+            with the sought out name.  If there is a match pass
+            current->import_src as NAMESPACE to direct the search
+            towards the imported namespace.  */
+         if (current->declaration
+             && strcmp (name, current->alias
+                        ? current->alias : current->declaration) == 0)
+           sym = cp_lookup_symbol_in_namespace (current->import_src,
+                                                current->declaration,
                                                 block, domain);
-         }
-       else if (current->alias == NULL)
-         {
-           /* If this import statement creates no alias, pass
-               current->inner as NAMESPACE to direct the search
-               towards the imported namespace.  */
-           sym = cp_lookup_symbol_imports (current->import_src,
-                                           name, block,
-                                           domain, 0, 0);
-         }
-       current->searched = 0;
-       discard_cleanups (searched_cleanup);
-
-       if (sym != NULL)
-         return sym;
+
+         /* If this is a DECLARATION_ONLY search or a symbol was found
+            or this import statement was an import declaration, the
+            search of this import is complete.  */
+         if (declaration_only || sym != NULL || current->declaration)
+           {
+             current->searched = 0;
+             discard_cleanups (searched_cleanup);
+
+             if (sym != NULL)
+               return sym;
+
+             continue;
+           }
+
+         /* Do not follow CURRENT if NAME matches its EXCLUDES.  */
+         for (excludep = current->excludes; *excludep; excludep++)
+           if (strcmp (name, *excludep) == 0)
+             break;
+         if (*excludep)
+           {
+             discard_cleanups (searched_cleanup);
+             continue;
+           }
+
+         if (current->alias != NULL
+             && strcmp (name, current->alias) == 0)
+           /* If the import is creating an alias and the alias matches
+              the sought name.  Pass current->import_src as the NAME to
+              direct the search towards the aliased namespace.  */
+           {
+             sym = cp_lookup_symbol_in_namespace (scope,
+                                                  current->import_src,
+                                                  block, domain);
+           }
+         else if (current->alias == NULL)
+           {
+             /* If this import statement creates no alias, pass
+                current->inner as NAMESPACE to direct the search
+                towards the imported namespace.  */
+             sym = cp_lookup_symbol_imports (current->import_src,
+                                             name, block,
+                                             domain, 0, 0);
+           }
+         current->searched = 0;
+         discard_cleanups (searched_cleanup);
+
+         if (sym != NULL)
+           return sym;
        }
     }
 
This page took 0.025059 seconds and 4 git commands to generate.