diff options
author | Tom Tromey <tom@tromey.com> | 2019-01-02 08:03:13 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-01-02 16:40:11 -0700 |
commit | c55d06ec95961fadd9deeffae519ff0f20f237d3 (patch) | |
tree | d29af475537221052acb1202b40769ddf1491a9a /gdb/target-descriptions.h | |
parent | 3a6ae42d4e4ecfd2441cf9b978b2a54ad6767cb7 (diff) | |
download | binutils-gdb-c55d06ec95961fadd9deeffae519ff0f20f237d3.tar.gz |
Remove a cleanup from target-descriptions.c
This removes a cleanup from target-descriptions.c, by changing it to
use a unique_ptr instead. Note that a deletion adapter is used, even
though target_desc is allocated with new, to avoid moving target_desc
to target-descriptions.h.
gdb/ChangeLog
2019-01-02 Tom Tromey <tom@tromey.com>
* xml-tdesc.c (xml_cache): Hold a target_desc_up.
(tdesc_parse_xml): Remove cleanups.
* target-descriptions.h (make_cleanup_free_target_description):
Don't declare.
(target_desc_deleter): New struct.
(target_desc_up): New typedef.
* target-descriptions.c (target_desc_deleter::operator()): Rename
from free_target_description.
(make_cleanup_free_target_description): Remove.
Diffstat (limited to 'gdb/target-descriptions.h')
-rw-r--r-- | gdb/target-descriptions.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gdb/target-descriptions.h b/gdb/target-descriptions.h index 402bef56e0a..fe07d425a5f 100644 --- a/gdb/target-descriptions.h +++ b/gdb/target-descriptions.h @@ -199,9 +199,20 @@ struct type *tdesc_find_type (struct gdbarch *gdbarch, const char *id); int tdesc_register_in_reggroup_p (struct gdbarch *gdbarch, int regno, struct reggroup *reggroup); + +/* A deleter adapter for a target desc. */ + +struct target_desc_deleter +{ + void operator() (struct target_desc *desc) const; +}; + +/* A unique pointer specialization that holds a target_desc. */ + +typedef std::unique_ptr<target_desc, target_desc_deleter> target_desc_up; + /* Methods for constructing a target description. */ -struct cleanup *make_cleanup_free_target_description (struct target_desc *); void set_tdesc_architecture (struct target_desc *, const struct bfd_arch_info *); void set_tdesc_osabi (struct target_desc *, enum gdb_osabi osabi); |