Remove addrmap_create_mutable

This removes addrmap_create_mutable in favor of using 'new' at the
spots where the addrmap is created.
This commit is contained in:
Tom Tromey
2022-04-16 09:48:12 -06:00
parent 769520b7e5
commit 10cce2c441
5 changed files with 14 additions and 20 deletions

View File

@@ -406,12 +406,6 @@ addrmap_mutable::addrmap_mutable (struct obstack *obs)
}
struct addrmap *
addrmap_create_mutable (struct obstack *obstack)
{
return new (obstack) struct addrmap_mutable (obstack);
}
/* See addrmap.h. */
void
@@ -483,7 +477,8 @@ test_addrmap ()
/* Create mutable addrmap. */
struct obstack temp_obstack;
obstack_init (&temp_obstack);
struct addrmap *map = addrmap_create_mutable (&temp_obstack);
struct addrmap_mutable *map
= new (&temp_obstack) addrmap_mutable (&temp_obstack);
SELF_CHECK (map != nullptr);
/* Check initial state. */

View File

@@ -202,10 +202,6 @@ private:
};
/* Create a mutable address map which maps every address to NULL.
Allocate entries in OBSTACK. */
struct addrmap *addrmap_create_mutable (struct obstack *obstack);
/* Dump the addrmap to OUTFILE. If PAYLOAD is non-NULL, only dump any
components that map to PAYLOAD. (If PAYLOAD is NULL, the entire
map is dumped.) */

View File

@@ -419,7 +419,9 @@ buildsym_compunit::record_block_range (struct block *block,
m_pending_addrmap_interesting = true;
if (m_pending_addrmap == nullptr)
m_pending_addrmap = addrmap_create_mutable (&m_pending_addrmap_obstack);
m_pending_addrmap
= (new (&m_pending_addrmap_obstack) addrmap_mutable
(&m_pending_addrmap_obstack));
m_pending_addrmap->set_empty (start, end_inclusive, block);
}

View File

@@ -385,7 +385,7 @@ private:
/* The mutable address map for the compilation unit whose symbols
we're currently reading. The symtabs' shared blockvector will
point to a fixed copy of this. */
struct addrmap *m_pending_addrmap = nullptr;
struct addrmap_mutable *m_pending_addrmap = nullptr;
/* The obstack on which we allocate pending_addrmap.
If pending_addrmap is NULL, this is uninitialized; otherwise, it is

View File

@@ -2267,12 +2267,12 @@ create_addrmap_from_index (dwarf2_per_objfile *per_objfile,
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
struct gdbarch *gdbarch = objfile->arch ();
const gdb_byte *iter, *end;
struct addrmap *mutable_map;
struct addrmap_mutable *mutable_map;
CORE_ADDR baseaddr;
auto_obstack temp_obstack;
mutable_map = addrmap_create_mutable (&temp_obstack);
mutable_map = new (&temp_obstack) addrmap_mutable (&temp_obstack);
iter = index->address_table.data ();
end = iter + index->address_table.size ();
@@ -2496,7 +2496,8 @@ create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
auto_obstack temp_obstack;
addrmap *mutable_map = addrmap_create_mutable (&temp_obstack);
addrmap_mutable *mutable_map
= new (&temp_obstack) addrmap_mutable (&temp_obstack);
if (read_addrmap_from_aranges (per_objfile, section, mutable_map))
per_bfd->index_addrmap = mutable_map->create_fixed (&per_bfd->obstack);
@@ -6552,7 +6553,7 @@ public:
xcalloc, xfree)),
m_index (new cooked_index),
m_addrmap_storage (),
m_addrmap (addrmap_create_mutable (&m_addrmap_storage))
m_addrmap (new (&m_addrmap_storage) addrmap_mutable (&m_addrmap_storage))
{
}
@@ -6607,7 +6608,7 @@ public:
}
/* Return the mutable addrmap that is currently being created. */
addrmap *get_addrmap ()
addrmap_mutable *get_addrmap ()
{
return m_addrmap;
}
@@ -6639,7 +6640,7 @@ private:
/* Storage for the writeable addrmap. */
auto_obstack m_addrmap_storage;
/* A writeable addrmap being constructed by this scanner. */
addrmap *m_addrmap;
addrmap_mutable *m_addrmap;
};
/* An instance of this is created to index a CU. */
@@ -6655,7 +6656,7 @@ public:
m_per_cu (per_cu),
m_language (language),
m_obstack (),
m_die_range_map (addrmap_create_mutable (&m_obstack))
m_die_range_map (new (&m_obstack) addrmap_mutable (&m_obstack))
{
}