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.
This commit is contained in:
Sami Wagiaalla
2009-06-23 17:46:52 +00:00
parent ad068eabda
commit 27aa8d6aa0
10 changed files with 256 additions and 63 deletions

View File

@@ -206,25 +206,16 @@ block_set_scope (struct block *block, const char *scope,
BLOCK_NAMESPACE (block)->scope = scope;
}
/* This returns the first using directives associated to BLOCK, if
/* This returns the using directives list associated with BLOCK, if
any. */
/* FIXME: carlton/2003-04-23: This uses the fact that we currently
only have using directives in static blocks, because we only
generate using directives from anonymous namespaces. Eventually,
when we support using directives everywhere, we'll want to replace
this by some iterator functions. */
struct using_direct *
block_using (const struct block *block)
{
const struct block *static_block = block_static_block (block);
if (static_block == NULL
|| BLOCK_NAMESPACE (static_block) == NULL)
if (block == NULL || BLOCK_NAMESPACE (block) == NULL)
return NULL;
else
return BLOCK_NAMESPACE (static_block)->using;
return BLOCK_NAMESPACE (block)->using;
}
/* Set BLOCK's using member to USING; if needed, allocate memory via