public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Siva Chandra <sivachandra@google.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
Date: Mon, 29 Sep 2014 21:11:00 -0000	[thread overview]
Message-ID: <CAGyQ6gxdno4x2dxQ==-d3A4UxRGJjE18y-xPAdLWqxA06cgQhw@mail.gmail.com> (raw)
In-Reply-To: <CADPb22RoEi+AKN+==ZcK-K8MR80gvVje7iaHT7ThMQJ9ibmKWA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 901 bytes --]

On Sun, Sep 28, 2014 at 11:01 PM, Doug Evans <dje@google.com> wrote:
>> 2014-09-11  Siva Chandra Reddy  <sivachandra@google.com>
>>
>>         PR c++/13403
>>         PR c++/15154
>>         * gdbtypes.c (make_qualified_type): Make non-static.
>>         * gdbtypes.h (make_qualified_type): Declare.
>>         * gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy
>>         constructors with qualified args

> Can you use class_types_same_p here (instead of comparing with the
> result of make_qualified_type) ?

Yes, I made this change now. The patch is attached.

I am assuming that the other patches in this series are approved
modulo making the test regexes more specific.

 gdb/ChangeLog:

2014-09-29  Siva Chandra Reddy  <sivachandra@google.com>

        PR c++/13403
        PR c++/15154
        * gnu-v3-abi.c (gnuv3_pass_by_reference): Lookup copy constructors
        with qualified args.

[-- Attachment #2: fix_gnuv3_abi_fix1_v2.txt --]
[-- Type: text/plain, Size: 962 bytes --]

diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d5ed355..043c30f 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1313,11 +1313,17 @@ gnuv3_pass_by_reference (struct type *type)
 
 	/* If this method takes two arguments, and the second argument is
 	   a reference to this class, then it is a copy constructor.  */
-	if (TYPE_NFIELDS (fieldtype) == 2
-	    && TYPE_CODE (TYPE_FIELD_TYPE (fieldtype, 1)) == TYPE_CODE_REF
-	    && check_typedef (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (fieldtype,
-								 1))) == type)
-	  return 1;
+	if (TYPE_NFIELDS (fieldtype) == 2)
+	  {
+	    struct type *arg_type = TYPE_FIELD_TYPE (fieldtype, 1);
+	    struct type *arg_target_type;
+
+	    arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+
+	    if (TYPE_CODE (arg_type) == TYPE_CODE_REF
+		&& class_types_same_p (arg_target_type, type))
+	      return 1;
+	  }
       }
 
   /* Even if all the constructors and destructors were artificial, one

  reply	other threads:[~2014-09-29 21:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 18:37 Siva Chandra
2014-09-29  6:01 ` Doug Evans
2014-09-29 21:11   ` Siva Chandra [this message]
2014-10-06 21:20     ` Siva Chandra
2014-10-14 14:12     ` Siva Chandra
2014-10-14 21:03     ` Doug Evans

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='CAGyQ6gxdno4x2dxQ==-d3A4UxRGJjE18y-xPAdLWqxA06cgQhw@mail.gmail.com' \
    --to=sivachandra@google.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).