+2021-03-20 Tom Tromey <tom@tromey.com>
+
+ * psympriv.h (psymtab_discarder): Take psymtab_storage parameter.
+ (~psymtab_discarder, keep): Update.
+ <m_objfile>: Remove.
+ <m_partial_symtabs>: New member.
+ * dwarf2/read.c (dwarf2_build_psymtabs): Update.
+
2021-03-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_end_psymtab): Add partial_symtabs parameter.
/* This isn't really ideal: all the data we allocate on the
objfile's obstack is still uselessly kept around. However,
freeing it seems unsafe. */
- psymtab_discarder psymtabs (objfile);
+ psymtab_discarder psymtabs (objfile->partial_symtabs.get ());
dwarf2_build_psymtabs_hard (per_objfile);
psymtabs.keep ();
{
public:
- psymtab_discarder (struct objfile *objfile)
- : m_objfile (objfile),
- m_psymtab (objfile->partial_symtabs->psymtabs)
+ psymtab_discarder (psymtab_storage *partial_symtabs)
+ : m_partial_symtabs (partial_symtabs),
+ m_psymtab (partial_symtabs->psymtabs)
{
}
~psymtab_discarder ()
{
- if (m_objfile != NULL)
- m_objfile->partial_symtabs->discard_psymtabs_to (m_psymtab);
+ if (m_partial_symtabs != nullptr)
+ m_partial_symtabs->discard_psymtabs_to (m_psymtab);
}
/* Keep any partial symbol tables that were built. */
void keep ()
{
- m_objfile = NULL;
+ m_partial_symtabs = nullptr;
}
private:
- /* The objfile. If NULL this serves as a sentinel to indicate that
- the psymtabs should be kept. */
- struct objfile *m_objfile;
+ /* The partial symbol storage object. */
+ psymtab_storage *m_partial_symtabs;
/* How far back to free. */
struct partial_symtab *m_psymtab;
};