From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31730 invoked by alias); 14 Sep 2017 16:43:18 -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 31719 invoked by uid 89); 14 Sep 2017 16:43:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Sep 2017 16:43:17 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D8CBC047B70; Thu, 14 Sep 2017 16:43:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5D8CBC047B70 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85FE95D9C7; Thu, 14 Sep 2017 16:43:15 +0000 (UTC) Subject: Re: [PATCH] Make dwarf_expr_context::stack an std::vector To: Simon Marchi References: <1505404760-11844-1-git-send-email-simon.marchi@ericsson.com> <4470557a-be38-3188-9076-2b70cc253b7a@redhat.com> <5027066a221a87007aa58fe495973258@polymtl.ca> Cc: Simon Marchi , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <28eeef72-abba-68e1-8eb3-effd6b0ab627@redhat.com> Date: Thu, 14 Sep 2017 16:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <5027066a221a87007aa58fe495973258@polymtl.ca> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-09/txt/msg00390.txt.bz2 On 09/14/2017 05:31 PM, Simon Marchi wrote: >> A couple nits and this is fine with me. >> >>> /* True if the piece is in memory and is known to be on the >>> program's stack. >>> @@ -114,7 +118,7 @@ struct dwarf_stack_value >>> struct dwarf_expr_context >>> { >>> dwarf_expr_context (); >>> - virtual ~dwarf_expr_context (); >>> + virtual ~dwarf_expr_context () = default; >> >> Couldn't we just remove the dtor? > > I thought that this was necessary because there are subclasses that > might have destructors. But now that I think about it more, I suppose > it would only be relevant if we destroyed instances of subclasses > through pointers to dwarf_expr_context? All the instances of these > classes are static. I actually didn't realize _this_ was the base class. :-P But yeah, if we never want to delete via base pointer, the dtor could be non-virtual, and in which case it should be made protected, to ensure that really no code outside subclasses tries to call it directly. (And in that case, you'd still use =default;) Really not a big deal, I'm fine with what you had. > >>> >>> void push_address (CORE_ADDR value, bool in_stack_memory); >>> void eval (const gdb_byte *addr, size_t len); >>> @@ -123,11 +127,7 @@ struct dwarf_expr_context >>> bool fetch_in_stack_memory (int n); >>> >>> /* The stack of values, allocated with xmalloc. */ >> >> "xmalloc" reference is stale. > > Ok. > Thanks, Pedro Alves