From: Simon Marchi Date: Mon, 3 Oct 2022 16:56:30 +0000 (-0400) Subject: gdb: add gdbarch_up X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d246d904adf3e338c731c123219a8246281002e2;p=binutils-gdb.git 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 --- diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index f4efd8c0bc7..f0399c2fa88 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; + /* Get the obstack owned by ARCH. */ extern obstack *gdbarch_obstack (gdbarch *arch);