mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
Don't use virtual destructor in addrmap
The addrmap polymorphism is sort of "phony" in that there isn't really code in the tree that can be presented with either type. I haven't tried to fix this (though perhaps I may); but meanwhile it's handy for the next patch if addrmap_fixed has a trivial destructor. This patch achieves this by making the addrmap destructor non-virtual, and also making it protected so that objects of any of these types cannot be destroyed when only the base class is known.
This commit is contained in:
@@ -44,8 +44,6 @@ using addrmap_foreach_const_fn
|
|||||||
/* The base class for addrmaps. */
|
/* The base class for addrmaps. */
|
||||||
struct addrmap
|
struct addrmap
|
||||||
{
|
{
|
||||||
virtual ~addrmap () = default;
|
|
||||||
|
|
||||||
/* Return the object associated with ADDR in MAP. */
|
/* Return the object associated with ADDR in MAP. */
|
||||||
const void *find (CORE_ADDR addr) const
|
const void *find (CORE_ADDR addr) const
|
||||||
{ return this->do_find (addr); }
|
{ return this->do_find (addr); }
|
||||||
@@ -68,6 +66,9 @@ struct addrmap
|
|||||||
{ return this->do_foreach (fn); }
|
{ return this->do_foreach (fn); }
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
~addrmap () = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Worker for find, implemented by sub-classes. */
|
/* Worker for find, implemented by sub-classes. */
|
||||||
virtual void *do_find (CORE_ADDR addr) const = 0;
|
virtual void *do_find (CORE_ADDR addr) const = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user