From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] Canonicalize conversion operators
Date: Wed, 18 Oct 2017 18:29:00 -0000 [thread overview]
Message-ID: <e0af77b3-14de-abcd-644c-7a3d7bde4750@redhat.com> (raw)
In-Reply-To: <9b6b1fae-ea57-f5ac-da59-59c7a94b236c@redhat.com>
On 10/18/2017 04:19 AM, Pedro Alves wrote:
>> @@ -1630,7 +1630,13 @@ oper: OPERATOR NEW
>>
>> c_print_type ($2, NULL, &buf, -1, 0,
>> &type_print_raw_options);
>> - $$ = operator_stoken (buf.c_str ());
>> +
>> + /* This also needs canonicalization. */
>> + std::string canon
>> + = " " + cp_canonicalize_string (buf.c_str ());
>> + if (canon.length () == 1)
>> + canon = " " + buf.string ();
>> + $$ = operator_stoken (canon.c_str ());
>
> The length() == 1 check gave me pause. It's checking that
> cp_canonicalize_string returned empty of course, but it
> wasn't super clear on a quick skim.
>
> I think you could write it like this, making that part clearer,
> and also saving a few string dups and copies:
>
> /* This also needs canonicalization. */
> std::string canon
> = cp_canonicalize_string (buf.c_str ());
> if (canon.empty ())
> canon = std::move (buf.string ());
> $$ = operator_stoken ((" " + canon).c_str ());
>
>
Yes, indeed. ISTR having something similar to that at one point, but I don't know why I changed it. [Maybe that was during the C++03/C++11 shake out?]
In any case, committed with that change.
Thank you for the review.
Keith
prev parent reply other threads:[~2017-10-18 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 22:12 Keith Seitz
2017-10-18 11:20 ` Pedro Alves
2017-10-18 18:29 ` Keith Seitz [this message]
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=e0af77b3-14de-abcd-644c-7a3d7bde4750@redhat.com \
--to=keiths@redhat.com \
--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).