aboutsummaryrefslogtreecommitdiff
path: root/gdb/cp-namespace.c
diff options
context:
space:
mode:
authorSami Wagiaalla <swagiaal@redhat.com>2009-06-23 17:46:52 +0000
committerSami Wagiaalla <swagiaal@redhat.com>2009-06-23 17:46:52 +0000
commit27aa8d6aa032b25160328cd92c78c4f8158fa0b7 (patch)
tree2b823b28f96ac6982967c72208f9ec1423306ce4 /gdb/cp-namespace.c
parentad068eabda988774e168b3f9b410306b40f5c191 (diff)
downloadgdb-27aa8d6aa032b25160328cd92c78c4f8158fa0b7.zip
gdb-27aa8d6aa032b25160328cd92c78c4f8158fa0b7.tar.gz
gdb-27aa8d6aa032b25160328cd92c78c4f8158fa0b7.tar.bz2
2009-06-23 Sami Wagiaalla <swagiaal@redhat.com>
* dwarf2read.c (process_die): Handle import statements (DW_TAG_imported_declaration, case DW_TAG_imported_module) (read_import_statement): New. (read_func_scope): Update using_directives to point to current context (read_lexical_block_scope): Ditto. * cp-support.h: Added prototype for cp_add_using. * cp-namespace.c: Removed local context_stack. (cp_initialize_namespace): Deleted. (cp_finalize_namespace): Deleted. (cp_add_using_directive): Use using_directives instead of using_list. (cp_add_using): No longer static. * buildsym.h: Created global using_direct variable. Created using_direct variable in context_stack. * buildsym.c (finish_block): Set using directives for the block under construction. (start_symtab): Removed call to cp_initialize_namespace(). (end_symtab): Removed call to cp_finalize_namespace(). (push_context): Save and reset using_directives. * block.c (block_using): Return using directives for given block instead of static block. 2009-06-23 Sami Wagiaalla <swagiaal@redhat.com> * gdb.cp/namespace-using.exp: New test. * gdb.cp/namespace-using.cc: New test.
Diffstat (limited to 'gdb/cp-namespace.c')
-rw-r--r--gdb/cp-namespace.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index c6c5617..f3b2194 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -30,15 +30,7 @@
#include "dictionary.h"
#include "command.h"
#include "frame.h"
-
-/* List of using directives that are active in the current file. */
-
-static struct using_direct *using_list;
-
-static struct using_direct *cp_add_using (const char *name,
- unsigned int inner_len,
- unsigned int outer_len,
- struct using_direct *next);
+#include "buildsym.h"
static struct using_direct *cp_copy_usings (struct using_direct *using,
struct obstack *obstack);
@@ -78,31 +70,6 @@ static struct symbol *lookup_possible_namespace_symbol (const char *name);
static void maintenance_cplus_namespace (char *args, int from_tty);
-/* Set up support for dealing with C++ namespace info in the current
- symtab. */
-
-void cp_initialize_namespace ()
-{
- using_list = NULL;
-}
-
-/* Add all the using directives we've gathered to the current symtab.
- STATIC_BLOCK should be the symtab's static block; OBSTACK is used
- for allocation. */
-
-void
-cp_finalize_namespace (struct block *static_block,
- struct obstack *obstack)
-{
- if (using_list != NULL)
- {
- block_set_using (static_block,
- cp_copy_usings (using_list, obstack),
- obstack);
- using_list = NULL;
- }
-}
-
/* Check to see if SYMBOL refers to an object contained within an
anonymous namespace; if so, add an appropriate using directive. */
@@ -170,7 +137,7 @@ cp_add_using_directive (const char *name, unsigned int outer_length,
/* Has it already been added? */
- for (current = using_list; current != NULL; current = current->next)
+ for (current = using_directives; current != NULL; current = current->next)
{
if ((strncmp (current->inner, name, inner_length) == 0)
&& (strlen (current->inner) == inner_length)
@@ -178,8 +145,8 @@ cp_add_using_directive (const char *name, unsigned int outer_length,
return;
}
- using_list = cp_add_using (name, inner_length, outer_length,
- using_list);
+ using_directives = cp_add_using (name, inner_length, outer_length,
+ using_directives);
}
/* Record the namespace that the function defined by SYMBOL was
@@ -237,7 +204,7 @@ cp_is_anonymous (const char *namespace)
using xmalloc. It copies the strings, so NAME can be a temporary
string. */
-static struct using_direct *
+struct using_direct *
cp_add_using (const char *name,
unsigned int inner_len,
unsigned int outer_len,