From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1337 invoked by alias); 9 Nov 2009 22:22:32 -0000 Received: (qmail 1328 invoked by uid 22791); 9 Nov 2009 22:22:31 -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; Mon, 09 Nov 2009 22:22:27 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA9MMP8b012547 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Nov 2009 17:22:25 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA9MMOO2021858; Mon, 9 Nov 2009 17:22:25 -0500 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 nA9MMOuG003883; Mon, 9 Nov 2009 17:22:24 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id BBC0F37815E; Mon, 9 Nov 2009 15:22:23 -0700 (MST) 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> <4AF88FD4.2010303@redhat.com> Reply-To: tromey@redhat.com Date: Mon, 09 Nov 2009 22:22:00 -0000 In-Reply-To: <4AF88FD4.2010303@redhat.com> (Keith Seitz's message of "Mon, 09 Nov 2009 13:55:32 -0800") 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-11/txt/msg00196.txt.bz2 >>>>> "Keith" == Keith Seitz writes: Keith> I've attached an updated patch which I think addresses most of the Keith> serious concerns. Thanks. Keith> +exp : exp '(' nonempty_typelist ')' const_or_volatile Keith> + { int i; Keith> + write_exp_elt_opcode (TYPE_INSTANCE); Keith> + write_exp_elt_longcst ((LONGEST) $3[0]); Keith> + for (i = 0; i < $3[0]; ++i) Keith> + write_exp_elt_type ($3[i + 1]); Keith> + write_exp_elt_longcst((LONGEST) $3[0]); This is ok, because c-exp.y already does this, but the ivec/tvec overloading still seems weird to me. Keith> + case TYPE_INSTANCE: Keith> + nargs = longest_to_int (exp->elts[pc + 1].longconst); Keith> + arg_types = (struct type **) alloca (nargs * sizeof (struct type *)); Keith> + for (ix = 0; ix < nargs; ++ix) Keith> + arg_types[ix] = exp->elts[pc + 1 + ix + 1].type; Keith> + Keith> + expect_type = make_params (nargs, arg_types); Keith> + *(pos) += 3 + nargs; Keith> + arg1 = evaluate_subexp_standard (expect_type, exp, pos, noside); Keith> + xfree (TYPE_FIELDS (expect_type)); Keith> + xfree (TYPE_MAIN_TYPE (expect_type)); Keith> + xfree (expect_type); These frees should be done with cleanups, in case evaluate_subexp_standard throws an exception. I think free_param_types was ok, it was just that the cleanup was made in a surprising place (make_params) and not run at the "right point" (just before the end of the TYPE_INSTANCE case). This is ok with that change. Thanks. Tom