From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 864 invoked by alias); 14 Oct 2009 18:54:24 -0000 Received: (qmail 854 invoked by uid 22791); 14 Oct 2009 18:54:23 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Oct 2009 18:54:19 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9EIsH3M032356 for ; Wed, 14 Oct 2009 14:54:17 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9EIsHo5022993; Wed, 14 Oct 2009 14:54:17 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n9EIsF2G012050; Wed, 14 Oct 2009 14:54:16 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 774EE37828F; Wed, 14 Oct 2009 12:54:15 -0600 (MDT) From: Tom Tromey To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] Add method overload resolution to expression parser References: <4A9D628B.1070300@redhat.com> <20091013212426.GA26169@caradoc.them.org> Reply-To: tromey@redhat.com Date: Wed, 14 Oct 2009 18:54:00 -0000 In-Reply-To: <20091013212426.GA26169@caradoc.them.org> (Daniel Jacobowitz's message of "Tue, 13 Oct 2009 17:24:26 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 X-SW-Source: 2009-10/txt/msg00311.txt.bz2 >>>>> "Daniel" == Daniel Jacobowitz writes: Keith> +static struct type * Keith> +make_params (int num_types, struct type **param_types) Keith> +{ [...] Keith> + make_cleanup (free_param_types, type); Keith> + return type; Keith> +} Daniel> And this is even more confusing... how does this cleanup eventually Daniel> get run? We shouldn't leak it back to the top level. And I suspect Daniel> that since nothing ever copies types, if this type makes it into the Daniel> value history we're going to have a problem. I think this can be addressed by changing the TYPE_INSTANCE case to deal with the cleanups. Daniel> I also wonder why TYPE_INSTANCE is necesary. All it seems to do is Daniel> construct the temporary type. Can't we do that in the parser, Daniel> instead, and use UNOP_CAST? My reading is that it has to do with the lifetime of a type. This implementation defers creation of the temporary function type to the point where it is used. IIUC, which I hope I do :-), this temporary type can't really leak out of the TYPE_INSTANCE code. That is, it is constructed and used to look up an actual function or method (which has its own type). If we used UNOP_CAST then we would have to make a long-lived temporary type, not only because the type would have to live at least from parsing through the end of the life of the parsed expression, but also because the result of the cast would have that temporary type, and thus it would be capturable. This would not be as big a deal if the type GC work were finished, but that is still pending. Tom