From: Simon Marchi <simon.marchi@polymtl.ca>
To: Lancelot SIX <lsix@lancelotsix.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Add a const version of gdb_argv:as_array_view
Date: Fri, 29 Oct 2021 22:03:19 -0400 [thread overview]
Message-ID: <c7fe4a74-d0c1-1a3f-7b61-9652f91a8ff8@polymtl.ca> (raw)
In-Reply-To: <20211020200525.122108-2-lsix@lancelotsix.com>
On 2021-10-20 16:05, Lancelot SIX via Gdb-patches wrote:
> This commit adds a const versions for the gdb_argv::get and the
> gdb_argv::as_array_view methods. Those methods will be used in the
> following patch.
> ---
> gdb/utils.h | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/gdb/utils.h b/gdb/utils.h
> index f05e6627dca..6f3a70213a4 100644
> --- a/gdb/utils.h
> +++ b/gdb/utils.h
> @@ -195,6 +195,11 @@ class gdb_argv
> return m_argv;
> }
>
> + const char * const * get () const
> + {
> + return m_argv;
> + }
> +
> /* Return the underlying array, transferring ownership to the
> caller. */
>
> @@ -227,6 +232,11 @@ class gdb_argv
> return gdb::array_view<char *> (this->get (), this->count ());
> }
>
> + gdb::array_view<const char * const> as_array_view () const
> + {
> + return gdb::array_view<const char * const> (this->get (), this->count ());
> + }
> +
> /* Append arguments to this array. */
> void append (gdb_argv &&other)
> {
>
It might not be the goal of this particular patch, but operator[] could
also gain a const version. And then many callers could be constified,
from:
gdb_argv argv (args);
to
const gdb_argv argv (args);
But the patch LGTM as-is, that's more for future work.
Simon
next prev parent reply other threads:[~2021-10-30 2:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-20 20:05 [PATCH 0/2] Improve constraints on gdb::array_view::array_view Lancelot SIX
2021-10-20 20:05 ` [PATCH 1/2] Add a const version of gdb_argv:as_array_view Lancelot SIX
2021-10-30 2:03 ` Simon Marchi [this message]
2021-10-20 20:05 ` [PATCH 2/2] Improve gdb::array_view ctor from contiguous containers Lancelot SIX
2021-10-30 2:09 ` Simon Marchi
2021-11-02 14:10 ` Tom Tromey
2021-11-02 16:00 ` Pedro Alves
2021-11-02 22:51 ` Lancelot SIX
2021-11-03 22:20 ` [PATCH v2 " Lancelot SIX
2021-11-04 13:04 ` Pedro Alves
2021-11-08 23:02 ` Lancelot SIX
2021-11-09 17:52 ` [PATCH] gdb::array_view slicing/container selftest - test std::array too (Re: [PATCH v2 2/2] Improve gdb::array_view ctor from contiguous containers) Pedro Alves
2021-11-09 21:58 ` Lancelot SIX
2021-11-09 22:48 ` 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=c7fe4a74-d0c1-1a3f-7b61-9652f91a8ff8@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.com \
/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).