From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Avoid copying in lookup_name_info
Date: Tue, 31 Mar 2020 20:28:26 +0100 [thread overview]
Message-ID: <2f437216-b606-dc30-5775-478af47dbbaf@redhat.com> (raw)
In-Reply-To: <87a73wbaji.fsf@tromey.com>
On 3/31/20 8:15 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
>
> Pedro> And if we do that, do we have any case where we really need the
> Pedro> "std::string &&" overload?
>
> Tom> Indeed we don't seem to need this.
>
> Actually, I am wrong, there is a spot in ada-lang.c:
>
> lookup_name_info name1 (std::string ("<_ada_") + name + '>',
> symbol_name_match_type::FULL);
>
> What's concerning is that this compiles even without the && overload,
> presumably by just violating the lifetime requirement of lookup_name_info.
>
> So, I think leaving the && version in-place is best.
Alternatively, you could delete the && version, like:
lookup_name_info (std::string &&name, ......) = delete;
I think that would catch that case, making it fail to compile,
forcing us to write:
std::string str = std::string ("<_ada_") + name + '>';
lookup_name_info name1 (str, symbol_name_match_type::FULL);
I think I'd slightly prefer that for making lookup_name_info's
contract easier to grok, though I'll leave it to you.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2020-03-31 19:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 20:49 [PATCH 0/2] Avoid copying in name lookup Tom Tromey
2020-03-20 20:49 ` [PATCH 1/2] Avoid some copying in psymtab.c Tom Tromey
2020-03-31 17:46 ` Pedro Alves
2020-03-31 19:35 ` Tom Tromey
2020-03-20 20:49 ` [PATCH 2/2] Avoid copying in lookup_name_info Tom Tromey
2020-03-23 17:51 ` Christian Biesinger
2020-03-31 13:28 ` Tom Tromey
2020-03-31 18:18 ` Pedro Alves
2020-03-31 19:11 ` Tom Tromey
2020-03-31 19:15 ` Tom Tromey
2020-03-31 19:28 ` Pedro Alves [this message]
2020-03-31 19:35 ` Tom Tromey
2020-03-31 19:23 ` 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=2f437216-b606-dc30-5775-478af47dbbaf@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.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