diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2022-10-03 12:56:30 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-02 10:02:34 -0500 |
commit | d246d904adf3e338c731c123219a8246281002e2 (patch) | |
tree | 7101189c695967d5cf6261358fc8b302f1758837 /gdb/gdbarch.h | |
parent | 9056c917b3e7a7d41c586087bdb8779197254d1e (diff) | |
download | gdb-d246d904adf3e338c731c123219a8246281002e2.zip gdb-d246d904adf3e338c731c123219a8246281002e2.tar.gz gdb-d246d904adf3e338c731c123219a8246281002e2.tar.bz2 |
gdb: add gdbarch_up
Add a gdbarch_up unique pointer type, that calls gdbarch_free on
deletion. This is used in the ROCm support patch at the end of this
series.
Change-Id: I4b808892d35d69a590ce83180f41afd91705b2c8
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/gdbarch.h')
-rw-r--r-- | gdb/gdbarch.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f4efd8c..f0399c2 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -306,6 +306,14 @@ extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, extern void gdbarch_free (struct gdbarch *); +struct gdbarch_deleter +{ + void operator() (gdbarch *arch) const + { gdbarch_free (arch); } +}; + +using gdbarch_up = std::unique_ptr<gdbarch, gdbarch_deleter>; + /* Get the obstack owned by ARCH. */ extern obstack *gdbarch_obstack (gdbarch *arch); |