From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 26977384F00C for ; Thu, 29 Jul 2021 15:19:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 26977384F00C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: junpY3FAEwPsVXMSr51p7wS6fz11yKqmy2lnO9NOcWxm5awEq4KfpqJZ6H+p01Sh+wGQIwQBZN sKhVS5GT/1TorB7PAM/jcfnVaRQLcoqQYdxa4B9Wc5sngKPuXUmIJWXtxYW8byvaTHF+oqLu4v 6/tWdMmtIS1SLuNSSrsYbKWxvknSUc00NCBT5pqCSNEJWWwSffDCTakLjLn7PDLvSPwYitQ6i9 FhpwhSK7xBdiMDJB38vX70sfCJSLWYVV5MxeL3D3fhzAQzVAcSgKtiTGlmX4Pvg+/nbYisyMak Vwt48tZEsjFi1MD7PL0p79Nz X-IronPort-AV: E=Sophos;i="5.84,278,1620720000"; d="scan'208";a="64052089" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 29 Jul 2021 07:18:59 -0800 IronPort-SDR: G4UxCJNpixAWjptpuP6wFcaJ/6bULkKYk1Jewejndk5pvQTXPGoJTwh/X/JsA9furT4M12zN76 xIbS4/5WyjzCAfwTKRegoW3cl+ZRsQrDiykF0gHdNbg0kbpyfyO78z+JVyQdT3eLBJ+kGKf9NT jI8V9wf/zUa/BF/jAMKP+iQRLlhIneehzIDPjzM73umNbPQX6WE4xiXAdqdy0FvVYGG5R/su6J oBiR9/yYVGpBshWXbDtWDQ/SxWqp8UTivEbuf8JaN1HU2v3VxXpTa4f2ykJO7DFVGhq7U3u3su tQQ= From: Thomas Schwinge To: Mark Wielaard , CC: Subject: Re: [PATCH] Pass pratt parsed token to expr parser functions to fix expr locus In-Reply-To: <9c9db19145176d664a6e944c1ff7108ce61215ae.camel@klomp.org> References: <20210728221342.77649-1-mark@klomp.org> <01C0429E-15F9-45A7-B800-400EEBDF13CD@gmail.com> <9c9db19145176d664a6e944c1ff7108ce61215ae.camel@klomp.org> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Thu, 29 Jul 2021 17:18:50 +0200 Message-ID: <87r1fh9mhx.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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 15:19:03 -0000 Hi! On 2021-07-29T12:55:38+0200, Mark Wielaard 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=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. > > 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=C3=BC=C3=9Fe 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=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955