* [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
@ 2014-09-11 18:37 Siva Chandra
2014-09-29 6:01 ` Doug Evans
0 siblings, 1 reply; 6+ messages in thread
From: Siva Chandra @ 2014-09-11 18:37 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 602 bytes --]
Before this, a copy constructor declared as in the following snippet was
not being treated as a copy constructor.
class A
{
public:
A (A &); // OK.
A (const A &); // Not being treated as a copy constructor because of the
// 'const' qualifier.
};
gdb/ChangeLog:
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
[-- Attachment #2: fix_gnuv3_abi_fix1.txt --]
[-- Type: text/plain, Size: 1990 bytes --]
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 1326f85..0f5093d 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -568,7 +568,7 @@ address_space_int_to_name (struct gdbarch *gdbarch, int space_flag)
If STORAGE is non-NULL, create the new type instance there.
STORAGE must be in the same obstack as TYPE. */
-static struct type *
+struct type *
make_qualified_type (struct type *type, int new_flags,
struct type *storage)
{
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index bd1a0ab..80ed725 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1647,6 +1647,9 @@ extern int address_space_name_to_int (struct gdbarch *, char *);
extern const char *address_space_int_to_name (struct gdbarch *, int);
+extern struct type *make_qualified_type (struct type *type, int new_flags,
+ struct type *storage);
+
extern struct type *make_type_with_address_space (struct type *type,
int space_identifier);
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d5ed355..a79a6a9 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -1313,11 +1313,19 @@ 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;
+ int flags;
+
+ arg_target_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
+ flags = TYPE_INSTANCE_FLAGS (arg_target_type);
+
+ if (TYPE_CODE (arg_type) == TYPE_CODE_REF
+ && arg_target_type == make_qualified_type (type, flags, NULL))
+ return 1;
+ }
}
/* Even if all the constructors and destructors were artificial, one
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
2014-09-11 18:37 [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args Siva Chandra
@ 2014-09-29 6:01 ` Doug Evans
2014-09-29 21:11 ` Siva Chandra
0 siblings, 1 reply; 6+ messages in thread
From: Doug Evans @ 2014-09-29 6:01 UTC (permalink / raw)
To: Siva Chandra; +Cc: gdb-patches
On Thu, Sep 11, 2014 at 11:37 AM, Siva Chandra <sivachandra@google.com> wrote:
> Before this, a copy constructor declared as in the following snippet was
> not being treated as a copy constructor.
>
> class A
> {
> public:
> A (A &); // OK.
> A (const A &); // Not being treated as a copy constructor because of the
> // 'const' qualifier.
> };
>
> gdb/ChangeLog:
>
> 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) ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
2014-09-29 6:01 ` Doug Evans
@ 2014-09-29 21:11 ` Siva Chandra
2014-10-06 21:20 ` Siva Chandra
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Siva Chandra @ 2014-09-29 21:11 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
[-- 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
2014-09-29 21:11 ` Siva Chandra
@ 2014-10-06 21:20 ` Siva Chandra
2014-10-14 14:12 ` Siva Chandra
2014-10-14 21:03 ` Doug Evans
2 siblings, 0 replies; 6+ messages in thread
From: Siva Chandra @ 2014-10-06 21:20 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Mon, Sep 29, 2014 at 2:11 PM, Siva Chandra <sivachandra@google.com> wrote:
> 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.
Ping.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
2014-09-29 21:11 ` Siva Chandra
2014-10-06 21:20 ` Siva Chandra
@ 2014-10-14 14:12 ` Siva Chandra
2014-10-14 21:03 ` Doug Evans
2 siblings, 0 replies; 6+ messages in thread
From: Siva Chandra @ 2014-10-14 14:12 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Mon, Sep 29, 2014 at 2:11 PM, Siva Chandra <sivachandra@google.com> wrote:
> On Sun, Sep 28, 2014 at 11:01 PM, Doug Evans <dje@google.com> wrote:
>>> * 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.
Ping. Link: https://sourceware.org/ml/gdb-patches/2014-09/msg00854.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args
2014-09-29 21:11 ` Siva Chandra
2014-10-06 21:20 ` Siva Chandra
2014-10-14 14:12 ` Siva Chandra
@ 2014-10-14 21:03 ` Doug Evans
2 siblings, 0 replies; 6+ messages in thread
From: Doug Evans @ 2014-10-14 21:03 UTC (permalink / raw)
To: Siva Chandra; +Cc: gdb-patches
Siva Chandra writes:
> 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.
LGTM.
And yeah, the rest of the patch set is approved.
[Modulo the potential addition of a comment in 4/4.]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-14 21:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 18:37 [PATCH 2/4] PR c++/13403 and PR c++/15154: Fix gnuv3_pass_by_reference to lookup copy c-tors with qualified args Siva Chandra
2014-09-29 6:01 ` Doug Evans
2014-09-29 21:11 ` Siva Chandra
2014-10-06 21:20 ` Siva Chandra
2014-10-14 14:12 ` Siva Chandra
2014-10-14 21:03 ` Doug Evans
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).