aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.c
diff options
context:
space:
mode:
authorSami Wagiaalla <swagiaal@redhat.com>2010-03-15 17:29:36 +0000
committerSami Wagiaalla <swagiaal@redhat.com>2010-03-15 17:29:36 +0000
commit13387711b26dfd93e5b00e529df30f0132ec38fd (patch)
tree1ba99c3985dc63eea2ec15eb5d6df734b4197b95 /gdb/dwarf2read.c
parent6e31430b7070860436f93153ee1f8d832ca8b7ca (diff)
downloadgdb-13387711b26dfd93e5b00e529df30f0132ec38fd.zip
gdb-13387711b26dfd93e5b00e529df30f0132ec38fd.tar.gz
gdb-13387711b26dfd93e5b00e529df30f0132ec38fd.tar.bz2
2010-03-15 Sami Wagiaalla <swagiaal@redhat.com>
PR c++/7936: * cp-support.h: Added char *declaration element to using_direct data struct. (cp_add_using): Added char *declaration argument. (cp_add_using_directive): Ditto. (cp_lookup_symbol_imports): made extern. * cp-namespace.c: Updated with the above changes. * dwarf2read.c (read_import_statement): Ditto. (read_namespace): Ditto. (read_import_statement): Support import declarations. * cp-namespace.c (cp_lookup_symbol_imports): Check for imported declarations. Added support for 'declaration_only' search. (cp_lookup_symbol_namespace): Attempt to search for the name as is before consideration of imports. * symtab.c (lookup_symbol_aux_local): Added a 'declaration_only' search at every block level search. Now takes language argument. (lookup_symbol_aux): Updated. 2010-03-15 Sami Wagiaalla <swagiaal@redhat.com> * gdb.cp/shadow.exp: Removed kfail; test has been fix. * gdb.cp/nsusing.exp: Ditto.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r--gdb/dwarf2read.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 2d21edb..db3f396 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -3383,10 +3383,12 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_cu *imported_cu;
const char *imported_name;
const char *imported_name_prefix;
- char *import_alias;
-
+ const char *canonical_name;
+ const char *import_alias;
+ const char *imported_declaration = NULL;
const char *import_prefix;
- char *canonical_name;
+
+ char *temp;
import_attr = dwarf2_attr (die, DW_AT_import, cu);
if (import_attr == NULL)
@@ -3446,23 +3448,27 @@ read_import_statement (struct die_info *die, struct dwarf2_cu *cu)
to the name of the imported die. */
imported_name_prefix = determine_prefix (imported_die, imported_cu);
- if (strlen (imported_name_prefix) > 0)
+ if (imported_die->tag != DW_TAG_namespace)
{
- canonical_name = alloca (strlen (imported_name_prefix)
- + 2 + strlen (imported_name) + 1);
- strcpy (canonical_name, imported_name_prefix);
- strcat (canonical_name, "::");
- strcat (canonical_name, imported_name);
+ imported_declaration = imported_name;
+ canonical_name = imported_name_prefix;
}
- else
+ else if (strlen (imported_name_prefix) > 0)
{
- canonical_name = alloca (strlen (imported_name) + 1);
- strcpy (canonical_name, imported_name);
+ temp = alloca (strlen (imported_name_prefix)
+ + 2 + strlen (imported_name) + 1);
+ strcpy (temp, imported_name_prefix);
+ strcat (temp, "::");
+ strcat (temp, imported_name);
+ canonical_name = temp;
}
+ else
+ canonical_name = imported_name;
cp_add_using_directive (import_prefix,
canonical_name,
import_alias,
+ imported_declaration,
&cu->objfile->objfile_obstack);
}
@@ -5584,7 +5590,7 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu)
{
const char *previous_prefix = determine_prefix (die, cu);
cp_add_using_directive (previous_prefix, TYPE_NAME (type), NULL,
- &objfile->objfile_obstack);
+ NULL, &objfile->objfile_obstack);
}
}