From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71217 invoked by alias); 30 Nov 2017 03:29:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 71207 invoked by uid 89); 30 Nov 2017 03:29:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL,BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Nov 2017 03:29:07 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway33.websitewelcome.com (Postfix) with ESMTP id F38B286C1CB for ; Wed, 29 Nov 2017 21:29:05 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id KFX7etCvUHEImKFX7euHkC; Wed, 29 Nov 2017 21:29:05 -0600 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:45250 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eKFX7-002UJD-PF; Wed, 29 Nov 2017 21:29:05 -0600 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , Subject: Re: [RFA] C++-ify parser_state References: <20171126174047.23943-1-tom@tromey.com> <82650820-b9f1-c45f-2243-89b47ec00e59@ericsson.com> Date: Thu, 30 Nov 2017 03:29:00 -0000 In-Reply-To: <82650820-b9f1-c45f-2243-89b47ec00e59@ericsson.com> (Simon Marchi's message of "Mon, 27 Nov 2017 11:40:52 -0500") Message-ID: <878teov3zz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eKFX7-002UJD-PF X-Source-Sender: 71-218-90-63.hlrn.qwest.net (bapiya) [71.218.90.63]:45250 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2017-11/txt/msg00819.txt.bz2 >>>>> "Simon" == Simon Marchi writes: >> + /* Ensure that we don't free it in the destructor. */ >> + expout = nullptr; >> + return result; Simon> If expout was an expression_up, we could just std::move it here, and Simon> wouldn't need an explicit destructor. I thought that looked somewhat difficult due to the use of xrealloc when growing the expression. Really, of course, the whole expression structure needs to be redone. That's a big task though. >> - lang->la_post_parser (&ps.expout, void_context_p); >> + lang->la_post_parser (&result, void_context_p); Simon> Passing a pointer or reference to the unique_ptr would allow Simon> the implementations of la_post_parser to modify it directly, Simon> and avoid the .release ().release (). I'll look into it. The realloc thing may be an issue here as well. >> p.saved_arg = *arg; >> p.arg = *arg; >> p.arg_type = atype; >> - p.gdbarch = gdbarch; >> - p.inside_paren_p = 0; Simon> Why not pass the other arguments to the constructor (*arg and atype)? Yeah, this one I'll do for sure. Tom