From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /qSADgV58V/beQAAWB0awg (envelope-from ) for ; Sun, 03 Jan 2021 02:57:57 -0500 Received: by simark.ca (Postfix, from userid 112) id 210AF1F0AA; Sun, 3 Jan 2021 02:57:57 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C988C1E965 for ; Sun, 3 Jan 2021 02:57:56 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C73F3857004; Sun, 3 Jan 2021 07:57:56 +0000 (GMT) Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id 14C7A3857004 for ; Sun, 3 Jan 2021 07:57:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 14C7A3857004 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=brobecker@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E834A1167C7; Sun, 3 Jan 2021 02:57:52 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id avl7aiCDGlya; Sun, 3 Jan 2021 02:57:52 -0500 (EST) Received: from float.home (localhost.localdomain [127.0.0.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 8AC441167BB; Sun, 3 Jan 2021 02:57:52 -0500 (EST) Received: by float.home (Postfix, from userid 1000) id A3D8EA1608; Sun, 3 Jan 2021 11:57:47 +0400 (+04) Date: Sun, 3 Jan 2021 11:57:47 +0400 From: Joel Brobecker To: Tom Tromey Subject: Re: [PATCH 169/203] Implement Ada resolution Message-ID: <20210103075747.GC363503@adacore.com> References: <20210101214723.1784144-1-tom@tromey.com> <20210101214723.1784144-170-tom@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210101214723.1784144-170-tom@tromey.com> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi Tom, Just a tiny question below... On Fri, Jan 01, 2021 at 02:46:49PM -0700, Tom Tromey wrote: > Ada has a parser post-pass that implements "resolution". This process > replaces some opcodes with function calls. For example, a "+" > operation might be replaced with a call to the appropriate overloaded > function. > > This differs from the approach taken for the same problem in C++. > However, in this series I chose not to try to make changes outside of > rewrite the expression data structure. So, resolution remains. > > The new approach to resolution is to introduce an interface class, > that some concrete operations implement. Then, the Ada code will use > this to resolve the expression tree. Because new-style expressions > are built as ordinary objects, and don't require rewriting the data > structure in place, in the new code this processing will be done in > the parser. By the end of the series, some special cases in this area > that exist only for Ada will be removed. > > gdb/ChangeLog > 2021-01-01 Tom Tromey > > * ada-lang.c (ada_var_value_operation::resolve) > (ada_funcall_operation::resolve): New methods. > * ada-exp.h (struct ada_resolvable): New. > (class ada_var_value_operation): Derive from ada_resolvable. > : New methods. > (class ada_funcall_operation): Derive from ada_resolvable. > : New method. > --- > gdb/ChangeLog | 10 ++++++++ > gdb/ada-exp.h | 38 ++++++++++++++++++++++++++++-- > gdb/ada-lang.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 109 insertions(+), 2 deletions(-) > > diff --git a/gdb/ada-exp.h b/gdb/ada-exp.h > index 287ed5cc62c..2c5696cab76 100644 > --- a/gdb/ada-exp.h > +++ b/gdb/ada-exp.h > @@ -304,9 +304,27 @@ class ada_unop_atr_operation > { return std::get<1> (m_storage); } > }; > > +/* The base class for Ada type resolution. Ada operations that want > + to participate in resolution implement this interface. */ > +struct ada_resolvable > +{ > + /* Resolve this object. EXP is the expression being resolved. > + DEPROCEDURE_P is true if de-proceduring is desired. What does it mean "de-proceduring is desired"? > + PARSE_COMPLETION and TRACKER are passed in from the parser > + context. CONTEXT_TYPE is the expected type of the expression, or > + nullptr if none is known. This method should return true if the > + operation should be replaced by a function call with this object > + as the callee. */ -- Joel