static void process_die (struct die_info *, struct dwarf2_cu *);
static const char *dwarf2_canonicalize_name (const char *, struct dwarf2_cu *,
- struct obstack *);
+ struct objfile *);
static const char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
if (package_name != NULL)
{
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
- const char *saved_package_name
- = obstack_strdup (&objfile->per_bfd->storage_obstack, package_name.get ());
+ const char *saved_package_name = objfile->intern (package_name.get ());
struct type *type = init_type (objfile, TYPE_CODE_MODULE, 0,
saved_package_name);
struct symbol *sym;
if (cu->language == language_cplus)
canonical_name
= dwarf2_canonicalize_name (intermediate_name.c_str (), cu,
- &objfile->per_bfd->storage_obstack);
+ objfile);
/* If we only computed INTERMEDIATE_NAME, or if
INTERMEDIATE_NAME is already canonical, then we need to
- copy it to the appropriate obstack. */
+ intern it. */
if (canonical_name == NULL || canonical_name == intermediate_name.c_str ())
- name = obstack_strdup (&objfile->per_bfd->storage_obstack,
- intermediate_name);
+ name = objfile->intern (intermediate_name);
else
name = canonical_name;
}
retval = canon;
if (need_copy)
- retval = obstack_strdup (&objfile->per_bfd->storage_obstack, retval);
+ retval = objfile->intern (retval);
return retval;
}
virtual_dwo_name.c_str ());
}
dwo_file = new struct dwo_file;
- dwo_file->dwo_name = obstack_strdup (&objfile->objfile_obstack,
- virtual_dwo_name);
+ dwo_file->dwo_name = objfile->intern (virtual_dwo_name);
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev = sections.abbrev;
dwo_file->sections.line = sections.line;
virtual_dwo_name.c_str ());
}
dwo_file = new struct dwo_file;
- dwo_file->dwo_name = obstack_strdup (&objfile->objfile_obstack,
- virtual_dwo_name);
+ dwo_file->dwo_name = objfile->intern (virtual_dwo_name);
dwo_file->comp_dir = comp_dir;
dwo_file->sections.abbrev =
create_dwp_v2_section (dwarf2_per_objfile, &dwp_file->sections.abbrev,
struct objfile *objfile = dwarf2_per_objfile->objfile;
name
- = dwarf2_canonicalize_name (DW_STRING (&attr), cu,
- &objfile->per_bfd->storage_obstack);
+ = dwarf2_canonicalize_name (DW_STRING (&attr), cu, objfile);
}
break;
}
if (actual_class_name != NULL)
{
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
- struct_pdi->name
- = obstack_strdup (&objfile->per_bfd->storage_obstack,
- actual_class_name.get ());
+ struct_pdi->name = objfile->intern (actual_class_name.get ());
}
break;
}
base = demangled.get ();
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
- name = obstack_strdup (&objfile->per_bfd->storage_obstack, base);
+ name = objfile->intern (base);
}
}
static const char *
dwarf2_canonicalize_name (const char *name, struct dwarf2_cu *cu,
- struct obstack *obstack)
+ struct objfile *objfile)
{
if (name && cu->language == language_cplus)
{
if (!canon_name.empty ())
{
if (canon_name != name)
- name = obstack_strdup (obstack, canon_name);
+ name = objfile->intern (canon_name);
}
}
const char *base;
- /* FIXME: we already did this for the partial symbol... */
- DW_STRING (attr)
- = obstack_strdup (&objfile->per_bfd->storage_obstack,
- demangled.get ());
+ DW_STRING (attr) = objfile->intern (demangled.get ());
DW_STRING_IS_CANONICAL (attr) = 1;
/* Strip any leading namespaces/classes, keep only the base name.
if (!DW_STRING_IS_CANONICAL (attr))
{
- DW_STRING (attr)
- = dwarf2_canonicalize_name (DW_STRING (attr), cu,
- &objfile->per_bfd->storage_obstack);
+ DW_STRING (attr) = dwarf2_canonicalize_name (DW_STRING (attr), cu,
+ objfile);
DW_STRING_IS_CANONICAL (attr) = 1;
}
return DW_STRING (attr);