From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id 748A43858292; Fri, 17 Jun 2022 09:23:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 748A43858292 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Eliminate copy_location_spec X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 40d97ee21fc3e39db73ee8f84b847a22f9d251cc X-Git-Newrev: 5c1ddcb69a01c3d4985ecffbbab126a4e8cd4e33 Message-Id: <20220617092325.748A43858292@sourceware.org> Date: Fri, 17 Jun 2022 09:23:25 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2022 09:23:25 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5c1ddcb69a01= c3d4985ecffbbab126a4e8cd4e33 commit 5c1ddcb69a01c3d4985ecffbbab126a4e8cd4e33 Author: Pedro Alves Date: Fri May 27 16:25:01 2022 +0100 Eliminate copy_location_spec =20 copy_location_spec is just a wrapper around location_spec::clone(), so remove it and call clone() directly. This simplifies users, as they no longer have to use std::unique_ptr::get(). =20 Change-Id: I8ce8658589460b98888283b306b315a5b8f73976 Diff: --- gdb/breakpoint.c | 10 +++++----- gdb/linespec.c | 3 +-- gdb/location.c | 8 -------- gdb/location.h | 4 ---- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 82937a3b78a..7e008ba87a4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8422,8 +8422,9 @@ create_breakpoints_sal (struct gdbarch *gdbarch, /* Note that 'location' can be NULL in the case of a plain 'break', without arguments. */ location_spec_up locspec - =3D (canonical->locspec !=3D NULL - ? copy_location_spec (canonical->locspec.get ()) : NULL); + =3D (canonical->locspec !=3D nullptr + ? canonical->locspec->clone () + : nullptr); gdb::unique_xmalloc_ptr filter_string (lsal.canonical !=3D NULL ? xstrdup (lsal.canonical) : NULL); =20 @@ -8924,7 +8925,7 @@ create_breakpoint (struct gdbarch *gdbarch, { std::unique_ptr b =3D new_breakpoint_from_type (gdbarch, type_wanted); - b->locspec =3D copy_location_spec (locspec); + b->locspec =3D locspec->clone (); =20 if (parse_extra) b->cond_string =3D NULL; @@ -12029,8 +12030,7 @@ strace_marker_create_breakpoints_sal (struct gdbarc= h *gdbarch, =20 for (size_t i =3D 0; i < lsal.sals.size (); i++) { - location_spec_up locspec - =3D copy_location_spec (canonical->locspec.get ()); + location_spec_up locspec =3D canonical->locspec->clone (); =20 std::unique_ptr tp (new tracepoint (gdbarch, diff --git a/gdb/linespec.c b/gdb/linespec.c index 063944bb9a1..f992477b1d6 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -3083,8 +3083,7 @@ location_spec_to_sals (linespec_parser *parser, { addr =3D linespec_expression_to_pc (&addr_string); if (PARSER_STATE (parser)->canonical !=3D NULL) - PARSER_STATE (parser)->canonical->locspec - =3D copy_location_spec (locspec); + PARSER_STATE (parser)->canonical->locspec =3D locspec->clone (); } else addr =3D addr_spec->address; diff --git a/gdb/location.c b/gdb/location.c index 4d0b60ff9c7..19b58ab4f5b 100644 --- a/gdb/location.c +++ b/gdb/location.c @@ -355,14 +355,6 @@ explicit_location_spec::to_linespec () const =20 /* See description in location.h. */ =20 -location_spec_up -copy_location_spec (const location_spec *src) -{ - return src->clone (); -} - -/* See description in location.h. */ - const char * location_spec_to_string (struct location_spec *locspec) { diff --git a/gdb/location.h b/gdb/location.h index 0a2f1799bc4..8275fa9c731 100644 --- a/gdb/location.h +++ b/gdb/location.h @@ -297,10 +297,6 @@ const explicit_location_spec * explicit_location_spec * as_explicit_location_spec (location_spec *locspec); =20 -/* Return a copy of the given SRC location spec. */ - -extern location_spec_up copy_location_spec (const location_spec *src); - /* Attempt to convert the input string in *ARGP into a location_spec. ARGP is advanced past any processed input. Always returns a non-nullptr location_spec unique pointer object.