public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Mark Wielaard <mark@klomp.org>, <simplytheother@gmail.com>
Cc: <gcc-rust@gcc.gnu.org>
Subject: Re: [PATCH] Pass pratt parsed token to expr parser functions to fix expr locus
Date: Thu, 29 Jul 2021 17:18:50 +0200	[thread overview]
Message-ID: <87r1fh9mhx.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <9c9db19145176d664a6e944c1ff7108ce61215ae.camel@klomp.org>

Hi!

On 2021-07-29T12:55:38+0200, Mark Wielaard <mark@klomp.org> wrote:
> On Thu, 2021-07-29 at 09:25 +0800, The Other via Gcc-rust wrote:
>> I think the core idea of this patch (fixing locations) is very
>> important and useful.

Agreed.

>> But isn’t it overkill to pass the token in instead of just the
>> location? You can avoid a fairly expensive shared_ptr copy by doing
>> so.
>
> I hadn't even noticed it was a smart pointer. At least the abstraction
> works transparently.

Wouldn't 'const_TokenPtr &pratt_parsed_token' work, passing a C++
reference?  (Or am I missing some C++ "detail"; I haven't looked
carefully.)

> My idea was that the code might want to double
> check/assert it was the correct token (as it does in the case the
> parser function is called directly and it has to consume the first
> token itself).

That also makes sense to me.  (Defensive programming; verify input data
to be what you expect to see.)


Grüße
 Thomas


> But yes, things might be even simpler by passing the location directly.
> I'll try to rewrite the code tonight to pass a location and see how
> that looks.
>
> Thanks,
>
> Mark
> --
> Gcc-rust mailing list
> Gcc-rust@gcc.gnu.org
> https://gcc.gnu.org/mailman/listinfo/gcc-rust
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  reply	other threads:[~2021-07-29 15:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 22:13 Mark Wielaard
2021-07-29  1:25 ` The Other
2021-07-29 10:55   ` Mark Wielaard
2021-07-29 15:18     ` Thomas Schwinge [this message]
2021-07-30  1:03       ` Mark Wielaard
2021-08-05 19:37         ` Mark Wielaard
2021-08-06 15:23           ` Philip Herron
2021-08-07  1:01             ` Mark Wielaard
2021-08-08 11:53               ` Philip Herron
2021-08-09 14:24               ` Mark Wielaard

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=87r1fh9mhx.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-rust@gcc.gnu.org \
    --cc=mark@klomp.org \
    --cc=simplytheother@gmail.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).