DWARF-5: .debug_names index consumer
[deliverable/binutils-gdb.git] / gdb / cp-namespace.c
index f27783ae5ac48c67d8a61b34dd5fca6f22cb8518..2a3ffefe0cb3fb25f7a7202309afda4838d35d25 100644 (file)
@@ -93,8 +93,9 @@ cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
                 anonymous namespace.  So add symbols in it to the
                 namespace given by the previous component if there is
                 one, or to the global namespace if there isn't.  */
+             std::vector<const char *> excludes;
              add_using_directive (&local_using_directives,
-                                  dest, src, NULL, NULL, NULL, 1,
+                                  dest, src, NULL, NULL, excludes, 1,
                                   &objfile->objfile_obstack);
            }
          /* The "+ 2" is for the "::".  */
@@ -337,15 +338,6 @@ cp_lookup_symbol_in_namespace (const char *the_namespace, const char *name,
   return sym;
 }
 
-/* Used for cleanups to reset the "searched" flag in case of an error.  */
-
-static void
-reset_directive_searched (void *data)
-{
-  struct using_direct *direct = (struct using_direct *) data;
-  direct->searched = 0;
-}
-
 /* Search for NAME by applying all import statements belonging to
    BLOCK which are applicable in SCOPE.  If DECLARATION_ONLY the
    search is restricted to using declarations.
@@ -387,7 +379,6 @@ cp_lookup_symbol_via_imports (const char *scope,
   struct block_symbol sym;
   int len;
   int directive_match;
-  struct cleanup *searched_cleanup;
 
   sym.symbol = NULL;
   sym.block = NULL;
@@ -424,9 +415,8 @@ cp_lookup_symbol_via_imports (const char *scope,
        {
          /* 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);
+         scoped_restore reset_directive_searched
+           = make_scoped_restore (&current->searched, 1);
 
          /* If there is an import of a single declaration, compare the
             imported declaration (after optional renaming by its alias)
@@ -445,9 +435,6 @@ cp_lookup_symbol_via_imports (const char *scope,
             search of this import is complete.  */
          if (declaration_only || sym.symbol != NULL || current->declaration)
            {
-             current->searched = 0;
-             discard_cleanups (searched_cleanup);
-
              if (sym.symbol != NULL)
                return sym;
 
@@ -459,10 +446,7 @@ cp_lookup_symbol_via_imports (const char *scope,
            if (strcmp (name, *excludep) == 0)
              break;
          if (*excludep)
-           {
-             discard_cleanups (searched_cleanup);
-             continue;
-           }
+           continue;
 
          if (current->alias != NULL
              && strcmp (name, current->alias) == 0)
@@ -483,8 +467,6 @@ cp_lookup_symbol_via_imports (const char *scope,
                                                  name, block,
                                                  domain, 1, 0, 0);
            }
-         current->searched = 0;
-         discard_cleanups (searched_cleanup);
 
          if (sym.symbol != NULL)
            return sym;
@@ -1067,7 +1049,7 @@ cp_lookup_transparent_type_loop (const char *name,
 
   full_name = (char *) alloca (scope_length + 2 + strlen (name) + 1);
   strncpy (full_name, scope, scope_length);
-  strncpy (full_name + scope_length, "::", 2);
+  memcpy (full_name + scope_length, "::", 2);
   strcpy (full_name + scope_length + 2, name);
 
   return basic_lookup_transparent_type (full_name);
@@ -1077,7 +1059,7 @@ cp_lookup_transparent_type_loop (const char *name,
    obsolete.  */
 
 static void
-maintenance_cplus_namespace (char *args, int from_tty)
+maintenance_cplus_namespace (const char *args, int from_tty)
 {
   printf_unfiltered (_("The `maint namespace' command was removed.\n"));
 }
This page took 0.024873 seconds and 4 git commands to generate.