]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Parameterize cp_scan_for_anonymous_namespaces
authorTom Tromey <tom@tromey.com>
Tue, 22 May 2018 20:44:09 +0000 (14:44 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 20 Jul 2018 15:42:53 +0000 (09:42 -0600)
This changes cp_scan_for_anonymous_namespaces to use the
buildsym_compunit API, rather than the function-based API.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

* stabsread.c (define_symbol): Update.
* buildsym-legacy.h (get_buildsym_compunit): Declare.
* dwarf2read.c (new_symbol): Update.
* cp-support.h (cp_scan_for_anonymous_namespaces): Update.
* cp-namespace.c: Include buildsym.h.
(cp_scan_for_anonymous_namespaces): Add "compunit" parameter.
* buildsym-legacy.c (get_buildsym_compunit): New function.

gdb/ChangeLog
gdb/buildsym-legacy.c
gdb/buildsym-legacy.h
gdb/cp-namespace.c
gdb/cp-support.h
gdb/dwarf2read.c
gdb/stabsread.c

index 5b332d3b37c71112bc65ea6930b54df218d08f8a..4609965e3218b853ac72e564443ecefa507a1b43 100644 (file)
@@ -1,3 +1,13 @@
+2018-07-20  Tom Tromey  <tom@tromey.com>
+
+       * stabsread.c (define_symbol): Update.
+       * buildsym-legacy.h (get_buildsym_compunit): Declare.
+       * dwarf2read.c (new_symbol): Update.
+       * cp-support.h (cp_scan_for_anonymous_namespaces): Update.
+       * cp-namespace.c: Include buildsym.h.
+       (cp_scan_for_anonymous_namespaces): Add "compunit" parameter.
+       * buildsym-legacy.c (get_buildsym_compunit): New function.
+
 2018-07-20  Tom Tromey  <tom@tromey.com>
 
        * xcoffread.c: Include buildsym-legacy.h.
index e7eaf037a885536b5ed3cd2d0b7ba5f6d04d45aa..5ee663daee48c1641dee71e912705c5897eba394 100644 (file)
@@ -375,3 +375,12 @@ scoped_free_pendings::~scoped_free_pendings ()
 {
   free_buildsym_compunit ();
 }
+
+/* See buildsym-legacy.h.  */
+
+struct buildsym_compunit *
+get_buildsym_compunit ()
+{
+  gdb_assert (buildsym_compunit != nullptr);
+  return buildsym_compunit;
+}
index 78a5644687a33d87f9e3a6f5fc7b675bde6ec60e..191c34478bae21514ae298215d5d292c85788c2a 100644 (file)
@@ -207,4 +207,8 @@ extern struct pending **get_file_symbols ();
 
 extern struct pending **get_global_symbols ();
 
+/* Return the current buildsym_compunit.  */
+
+extern struct buildsym_compunit *get_buildsym_compunit ();
+
 #endif /* defined (LEGACY_BUILDSYM_H) */
index ef0c823cfa3baa87892c31d3bda776c0209c92f7..9ee2439b5ebaf5452e32056ffe6e6b309fa35f88 100644 (file)
@@ -29,7 +29,7 @@
 #include "dictionary.h"
 #include "command.h"
 #include "frame.h"
-#include "buildsym-legacy.h"
+#include "buildsym.h"
 #include "language.h"
 #include "namespace.h"
 #include <string>
@@ -50,7 +50,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 *const symbol,
+cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit,
+                                 const struct symbol *const symbol,
                                  struct objfile *const objfile)
 {
   if (SYMBOL_DEMANGLED_NAME (symbol) != NULL)
@@ -94,9 +95,9 @@ cp_scan_for_anonymous_namespaces (const struct symbol *const symbol,
                 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 (get_local_using_directives (),
-                                  dest, src, NULL, NULL, excludes, 1,
-                                  &objfile->objfile_obstack);
+             add_using_directive (compunit->get_local_using_directives (),
+                                  dest, src, NULL, NULL, excludes,
+                                  1, &objfile->objfile_obstack);
            }
          /* The "+ 2" is for the "::".  */
          previous_component = next_component + 2;
index e2460de5fb838c7e483f8c20a2ce937e76e6241d..4e269215950ae7b0f9c9004713abbbb6556f767d 100644 (file)
@@ -33,6 +33,7 @@
 
 struct symbol;
 struct block;
+struct buildsym_compunit;
 struct objfile;
 struct type;
 struct demangle_component;
@@ -132,7 +133,8 @@ extern symbol_name_matcher_ftype *cp_get_symbol_name_matcher
 
 extern int cp_is_in_anonymous (const char *symbol_name);
 
-extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol,
+extern void cp_scan_for_anonymous_namespaces (struct buildsym_compunit *,
+                                             const struct symbol *symbol,
                                              struct objfile *objfile);
 
 extern struct block_symbol cp_lookup_symbol_nonlocal
index a3740891b53c9cc7f0ec2da4d946b44c339e1f4c..02bcf656cdf557f212d1030019a7534556d9ddcb 100644 (file)
@@ -21476,7 +21476,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
         namespaces based on the demangled name.  */
       if (!cu->processing_has_namespace_info
          && cu->language == language_cplus)
-       cp_scan_for_anonymous_namespaces (sym, objfile);
+       cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym,
+                                         objfile);
     }
   return (sym);
 }
index 345cddd67eaa0930c342a39846f6361eecfeaee4..368293d24fe0551eabe60d810cd1fd53c4df6ff2 100644 (file)
@@ -753,7 +753,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
        SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile);
 
       if (SYMBOL_LANGUAGE (sym) == language_cplus)
-       cp_scan_for_anonymous_namespaces (sym, objfile);
+       cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym,
+                                         objfile);
 
     }
   p++;