Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: sami wagiaalla <swagiaal@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] smart pointer support
Date: Fri, 23 Jul 2010 23:37:00 -0000	[thread overview]
Message-ID: <m339v922iy.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4C45C78A.9080904@redhat.com> (sami wagiaalla's message of "Tue,	20 Jul 2010 11:58:02 -0400")

>>>>> "Sami" == sami wagiaalla <swagiaal@redhat.com> 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


  reply	other threads:[~2010-07-23 23:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20 15:58 sami wagiaalla
2010-07-23 23:37 ` Tom Tromey [this message]
2010-08-05 18:46   ` sami wagiaalla
2010-08-05 22:57     ` Ulrich Weigand
2010-08-06 16:23       ` sami wagiaalla
2010-08-06 16:48         ` Ulrich Weigand
2010-08-06 17:29           ` Tom Tromey
2010-08-08 15:01             ` Ulrich Weigand
2010-08-06 21:33           ` sami wagiaalla
2010-08-06 22:20             ` Tom Tromey
2010-08-09 15:59               ` sami wagiaalla
2010-08-09 17:35                 ` Tom Tromey
2010-08-09 18:04                   ` sami wagiaalla
2010-08-09 18:23                     ` Jan Kratochvil
2010-08-16 20:31                       ` sami wagiaalla
2010-08-16 20:59                         ` Pedro Alves
2010-08-17 16:16                           ` sami wagiaalla
2010-08-17 17:15                             ` Tom Tromey
2010-10-19 20:55                               ` sami wagiaalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m339v922iy.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=swagiaal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox