+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.
{
free_buildsym_compunit ();
}
+
+/* See buildsym-legacy.h. */
+
+struct buildsym_compunit *
+get_buildsym_compunit ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return buildsym_compunit;
+}
extern struct pending **get_global_symbols ();
+/* Return the current buildsym_compunit. */
+
+extern struct buildsym_compunit *get_buildsym_compunit ();
+
#endif /* defined (LEGACY_BUILDSYM_H) */
#include "dictionary.h"
#include "command.h"
#include "frame.h"
-#include "buildsym-legacy.h"
+#include "buildsym.h"
#include "language.h"
#include "namespace.h"
#include <string>
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)
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;
struct symbol;
struct block;
+struct buildsym_compunit;
struct objfile;
struct type;
struct demangle_component;
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
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);
}
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++;