From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99733 invoked by alias); 26 Mar 2018 15:13:53 -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 99103 invoked by uid 89); 26 Mar 2018 15:13:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=held X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Mar 2018 15:13:51 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2AE6C4068051; Mon, 26 Mar 2018 15:13:50 +0000 (UTC) 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 8A1612029296; Mon, 26 Mar 2018 15:13:49 +0000 (UTC) Subject: Re: [RFA] C++-ify typedef hash To: Tom Tromey , gdb-patches@sourceware.org References: <20180315215858.15647-1-tom@tromey.com> From: Pedro Alves Message-ID: <6ace14da-cf07-4dd4-47a6-037c921eb129@redhat.com> Date: Mon, 26 Mar 2018 15:13:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180315215858.15647-1-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-03/txt/msg00531.txt.bz2 Hi Tom, Just a few remarks below. On 03/15/2018 09:58 PM, Tom Tromey wrote: > > /* Iteratively try the type pretty-printers specified by PRINTERS > @@ -463,8 +458,7 @@ apply_ext_lang_type_printers (struct ext_lang_type_printers *printers, > /* Call this after pretty-printing a type to release all memory held > by PRINTERS. */ At least this comment should be updated -- there's no "PRINTERS" parameter any longer. > > -void > -free_ext_lang_type_printers (struct ext_lang_type_printers *printers) > +ext_lang_type_printers::~ext_lang_type_printers () > { - of the contained objects. */ > + > +class typedef_hash_table > +{ > +public: > + > + /* Create a new typedef-lookup hash table. */ > + typedef_hash_table (); > + > + ~typedef_hash_table (); > + > + /* Copy a typedef hash. */ > + typedef_hash_table (const typedef_hash_table *); This method's prototype gave me pause -- is there a reason this isn't a regular copy ctor? > > -void add_template_parameters (struct typedef_hash_table *, struct type *); > + typedef_hash_table &operator= (const typedef_hash_table &) = delete; > > -struct typedef_hash_table *create_typedef_hash (void); > + /* Add typedefs from T to the hash table TABLE. */ > + void recursively_update (struct type *); > > -void free_typedef_hash (struct typedef_hash_table *); > + /* Add template parameters from T to the typedef hash TABLE. */ > + void add_template_parameters (struct type *t); > > -struct cleanup *make_cleanup_free_typedef_hash (struct typedef_hash_table *); > + /* Look up the type T in the typedef hash table FLAGS. If T But FLAGS isn't a hash table, right? The original comment said: /* Look up the type T in the typedef hash table in with FLAGS. ^^^^^^^ I wonder whether that was a typo for "within". Maybe this could say something about local/global too. Thanks, Pedro Alves