struct attribute *import_attr;
struct die_info *imported_die;
const char *imported_name;
+ const char *imported_name_prefix;
+ const char *import_prefix;
+ char *canonical_name;
import_attr = dwarf2_attr (die, DW_AT_import, cu);
if (import_attr == NULL)
/* FIXME: dwarf2_name (die); for the local name after import. */
- using_directives = cp_add_using (imported_name, strlen (imported_name), 0,
- using_directives);
+ /* Figure out where the statement is being imported to. */
+ import_prefix = determine_prefix (die, cu);
+
+ /* Figure out what the scope of the imported die is and prepend it
+ to the name of the imported die. */
+ imported_name_prefix = determine_prefix (imported_die, cu);
+
+ if (strlen (imported_name_prefix) > 0)
+ {
+ 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);
+ }
+ else
+ {
+ canonical_name = alloca (strlen (imported_name) + 1);
+ strcpy (canonical_name, imported_name);
+ }
+
+ using_directives = cp_add_using (import_prefix,canonical_name, using_directives);
}
static void
arrays with unspecified length. */
if (die->child == NULL)
{
- index_type = builtin_type_int32;
+ index_type = objfile_type (objfile)->builtin_int;
range_type = create_range_type (NULL, index_type, 0, -1);
type = create_array_type (NULL, element_type, range_type);
return set_die_type (die, type, cu);
if (is_anonymous)
{
const char *previous_prefix = determine_prefix (die, cu);
- cp_add_using_directive (TYPE_NAME (type),
- strlen (previous_prefix),
- strlen (TYPE_NAME (type)));
+ cp_add_using_directive (previous_prefix, TYPE_NAME (type));
}
}
}
}
- index_type = builtin_type_int32;
+ index_type = objfile_type (objfile)->builtin_int;
range_type = create_range_type (NULL, index_type, 1, length);
char_type = language_string_char_type (cu->language_defn, gdbarch);
type = create_string_type (NULL, char_type, range_type);
struct attribute *attr;
type = die_type (die, cu);
- ftype = make_function_type (type, (struct type **) 0, cu->objfile);
+ ftype = lookup_function_type (type);
/* All functions in C++, Pascal and Java have prototypes. */
attr = dwarf2_attr (die, DW_AT_prototyped, cu);
new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
- struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct symbol *sym = NULL;
char *name;
struct attribute *attr = NULL;
to something sensible. */
if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
SYMBOL_TYPE (sym)
- = builtin_type (gdbarch)->nodebug_data_symbol;
+ = objfile_type (objfile)->nodebug_data_symbol;
attr = dwarf2_attr (die, DW_AT_const_value, cu);
if (attr)
static struct type *
die_type (struct die_info *die, struct dwarf2_cu *cu)
{
- struct gdbarch *gdbarch = get_objfile_arch (cu->objfile);
struct type *type;
struct attribute *type_attr;
struct die_info *type_die;
if (!type_attr)
{
/* A missing DW_AT_type represents a void type. */
- return builtin_type (gdbarch)->builtin_void;
+ return objfile_type (cu->objfile)->builtin_void;
}
else
type_die = follow_die_ref (die, type_attr, &cu);