From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 797423857406 for ; Thu, 29 Jul 2021 10:55:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 797423857406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 0297F30291A9; Thu, 29 Jul 2021 12:55:39 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 15C61413CD45; Thu, 29 Jul 2021 12:55:39 +0200 (CEST) Message-ID: <9c9db19145176d664a6e944c1ff7108ce61215ae.camel@klomp.org> Subject: Re: [PATCH] Pass pratt parsed token to expr parser functions to fix expr locus From: Mark Wielaard To: The Other Cc: gcc-rust@gcc.gnu.org Date: Thu, 29 Jul 2021 12:55:38 +0200 In-Reply-To: <01C0429E-15F9-45A7-B800-400EEBDF13CD@gmail.com> References: <20210728221342.77649-1-mark@klomp.org> <01C0429E-15F9-45A7-B800-400EEBDF13CD@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-rust@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: gcc-rust mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 10:55:43 -0000 Hi Joel, 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. >=20 > But isn=E2=80=99t it overkill to pass the token in instead of just the > location? You can avoid a fairly expensive shared_ptr copy by doing > so.=20 I hadn't even noticed it was a smart pointer. At least the abstraction works transparently. 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). 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