From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26837 invoked by alias); 23 Jul 2010 23:37:34 -0000 Received: (qmail 26825 invoked by uid 22791); 23 Jul 2010 23:37:33 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Fri, 23 Jul 2010 23:37:28 +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 o6NNbQn4008597 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 23 Jul 2010 19:37:26 -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 o6NNbQ5c014728; Fri, 23 Jul 2010 19:37:26 -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 o6NNbPpq013774; Fri, 23 Jul 2010 19:37:25 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 573173797F4; Fri, 23 Jul 2010 17:37:25 -0600 (MDT) From: Tom Tromey To: sami wagiaalla Cc: gdb-patches@sourceware.org Subject: Re: [patch] smart pointer support References: <4C45C78A.9080904@redhat.com> Date: Fri, 23 Jul 2010 23:37:00 -0000 In-Reply-To: <4C45C78A.9080904@redhat.com> (sami wagiaalla's message of "Tue, 20 Jul 2010 11:58:02 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (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: 2010-07/txt/msg00378.txt.bz2 >>>>> "Sami" == sami wagiaalla writes: Sami> The '->' operator can be overloaded in C++ and when overloaded it Sami> forwards the function call or member reference to the return Sami> type. Thanks for working on this. Sami> + /* For C++ check to see if the operator '->' has been overloaded. Sami> + If the operator has been overloaded replace arg2 with the value Sami> + returned by the custom operator and continue evaluation. */ Sami> + if (exp->language_defn->la_language == language_cplus) Sami> + { Sami> + struct type *arg_type = value_type (arg2); Sami> + if (arg_type && TYPE_CODE (arg_type) == TYPE_CODE_STRUCT) I think if you are going to use value_x_unop, you ought to use unop_user_defined_p as well. Maybe that means changes to unop_user_defined_p. Also, I think you will need a while loop here. operator-> might itself return an object that has an operator->. There should be a test case for this as well. I was wondering if the STRUCTOP_PTR / STRUCTOP_STRUCT conflation in the method case could cause problems. Maybe a new test would be good, just to make that clear. The "." case should not cause the operator to be used -- or at least, "." on a struct, gdb supports "." on a pointer as an extension, I'm not sure what we should do there. Otherwise, looking good. Tom