From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 6DA433858C2D; Thu, 2 Feb 2023 15:08:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DA433858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675350532; bh=aAyngvGPwxpcoL0hS/LH/KMGXzNQp6WJt+Y8qFhaH84=; h=From:To:Subject:Date:From; b=lerODbZSLczVyKFUkXTFptJACRJAalIhr7KGUCsV20qzEnEk8uALDtJ3Ug+38kq23 NgvAKcZLZxEBvzzvrPxtKakNik/ansdNIrVgjM0G6H/xYB1nLzwnXHo7INjHBhRGWt Ds5iooUEmN/FLS6uVL056h1gJ0M1j2BKwwAtZYnY= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: add gdbarch_up X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 9056c917b3e7a7d41c586087bdb8779197254d1e X-Git-Newrev: d246d904adf3e338c731c123219a8246281002e2 Message-Id: <20230202150852.6DA433858C2D@sourceware.org> Date: Thu, 2 Feb 2023 15:08:52 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd246d904adf3= e338c731c123219a8246281002e2 commit d246d904adf3e338c731c123219a8246281002e2 Author: Simon Marchi Date: Mon Oct 3 12:56:30 2022 -0400 gdb: add gdbarch_up =20 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. =20 Change-Id: I4b808892d35d69a590ce83180f41afd91705b2c8 Approved-By: Andrew Burgess Diff: --- gdb/gdbarch.h | 8 ++++++++ 1 file changed, 8 insertions(+) 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 gdb= arch_info *info, =20 extern void gdbarch_free (struct gdbarch *); =20 +struct gdbarch_deleter +{ + void operator() (gdbarch *arch) const + { gdbarch_free (arch); } +}; + +using gdbarch_up =3D std::unique_ptr; + /* Get the obstack owned by ARCH. */ =20 extern obstack *gdbarch_obstack (gdbarch *arch);