From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/7] Eliminate copy_location_spec
Date: Fri, 27 May 2022 19:02:44 +0100 [thread overview]
Message-ID: <20220527180248.2990723-4-pedro@palves.net> (raw)
In-Reply-To: <20220527180248.2990723-1-pedro@palves.net>
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().
Change-Id: I8ce8658589460b98888283b306b315a5b8f73976
---
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 cdab60332ec..403b70067d7 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
- = (canonical->locspec != NULL
- ? copy_location_spec (canonical->locspec.get ()) : NULL);
+ = (canonical->locspec != nullptr
+ ? canonical->locspec->clone ()
+ : nullptr);
gdb::unique_xmalloc_ptr<char> filter_string
(lsal.canonical != NULL ? xstrdup (lsal.canonical) : NULL);
@@ -8924,7 +8925,7 @@ create_breakpoint (struct gdbarch *gdbarch,
{
std::unique_ptr <breakpoint> b = new_breakpoint_from_type (gdbarch,
type_wanted);
- b->locspec = copy_location_spec (locspec);
+ b->locspec = locspec->clone ();
if (parse_extra)
b->cond_string = NULL;
@@ -12029,8 +12030,7 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
for (size_t i = 0; i < lsal.sals.size (); i++)
{
- location_spec_up locspec
- = copy_location_spec (canonical->locspec.get ());
+ location_spec_up locspec = canonical->locspec->clone ();
std::unique_ptr<tracepoint> 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 = linespec_expression_to_pc (&addr_string);
if (PARSER_STATE (parser)->canonical != NULL)
- PARSER_STATE (parser)->canonical->locspec
- = copy_location_spec (locspec);
+ PARSER_STATE (parser)->canonical->locspec = locspec->clone ();
}
else
addr = 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
/* See description in location.h. */
-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 f7e560aa26a..f52469d770f 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);
-/* 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.
--
2.36.0
next prev parent reply other threads:[~2022-05-27 18:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 18:02 [PATCH 0/7] location -> location spec Pedro Alves
2022-05-27 18:02 ` [PATCH 1/7] event_location -> location_spec Pedro Alves
2022-05-28 10:08 ` Philippe Waroquiers
2022-05-30 15:02 ` Pedro Alves
2022-05-27 18:02 ` [PATCH 2/7] Eliminate the two-level data structures behind location_specs Pedro Alves
2022-05-30 15:09 ` Pedro Alves
2022-05-27 18:02 ` Pedro Alves [this message]
2022-05-27 18:02 ` [PATCH 4/7] Convert location_spec_empty_p to a method Pedro Alves
2022-05-27 18:02 ` [PATCH 5/7] Convert location_spec_type " Pedro Alves
2022-05-27 18:02 ` [PATCH 6/7] Convert location_spec_to_string " Pedro Alves
2022-05-27 18:02 ` [PATCH 7/7] Convert set_location_spec_string " Pedro Alves
2022-05-30 15:20 ` Pedro Alves
2022-06-15 19:47 ` [PATCH 0/7] location -> location spec Tom Tromey
2022-06-17 9:24 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220527180248.2990723-4-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).