From: "Tankut Baris Aktemur (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@sourceware.org>,
Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [review v2] infcall, c++: collect more pass-by-reference information
Date: Mon, 09 Dec 2019 17:55:00 -0000 [thread overview]
Message-ID: <20191209175455.D844C20AF6@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1571406803000.Ic05bd98a962d07ec3c1ad041f709687eabda3bb9@gnutoolchain-gerrit.osci.io>
Tankut Baris Aktemur has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/137
......................................................................
Patch Set 2:
(3 comments)
| --- gdb/gnu-v3-abi.c
| +++ gdb/gnu-v3-abi.c
| @@ -1233,0 +1312,23 @@ is_copy_or_move_constructor_type (struct type *class_type,
| + if (!(class_types_same_p (target, class_type)))
| + return false;
| +
| + /* ...and if any of the remaining arguments don't have a default value
| + then this is not a copy or move constructor, but just a
| + constructor. */
| + for (int i = 2; i < TYPE_NFIELDS (method_type); i++)
| + {
| + arg_type = TYPE_FIELD_TYPE (method_type, i);
| + /* FIXME taktemur/2019-04-23: As of this date, neither
| + clang++-7.0.0 nor g++-8.2.0 produce a DW_AT_default_value
| + attribute. GDB is also not set to read this attribute, yet.
| + Hence, we immediately return false if there are more than
| + 2 parameters. */
PS1, Line 1325:
Added: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42959
(The ticket was opened by you :)
| + return false;
| + }
| +
| + return true;
| +}
| +
| +/* Return true if METHOD_TYPE is a copy ctor type for CLASS_TYPE. */
| +
| +static bool
...
| @@ -1272,9 +1409,14 @@ gnuv3_pass_by_reference (struct type *type)
| See c++98 section 12.8 Copying class objects [class.copy]. */
| if (gnuv3_dynamic_class (type))
| - {
| - info.trivially_copyable = false;
| - return info;
| - }
| -
| + is_dynamic = true;
| +
| + /* FIXME taktemur/2019-04-23: What if there are multiple copy ctors?
PS1, Line 1413:
Following the recent overload resolution fixes, this now works. The
`language_pass_by_ref_info` that was defined at
https://gnutoolchain-gerrit.osci.io/r/c/binutils-
gdb/+/136/2/gdb/language.h#146
is also simplified -- no need to carry the copy-ctor and dtor function
names anymore.
The call to overload resolution happens inside infrun.c, as part of
this patch:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/141
| + E.g.:
| + class C {
| + public:
| + C (C &c) { ... }
| + C (const C &c) { ... }
| + };
| + */
| for (fieldnum = 0; fieldnum < TYPE_NFN_FIELDS (type); fieldnum++)
| for (fieldelem = 0; fieldelem < TYPE_FN_FIELDLIST_LENGTH (type, fieldnum);
...
| @@ -1335,7 +1486,18 @@ gnuv3_pass_by_reference (struct type *type)
| about recursive loops here, since we are only looking at members
| of complete class type. Also ignore any static members. */
| for (fieldnum = 0; fieldnum < TYPE_NFIELDS (type); fieldnum++)
| if (!field_is_static (&TYPE_FIELD (type, fieldnum)))
| {
| + struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum);
| +
| + /* For arrays, make the decision based on the element type. */
| + if (TYPE_CODE (field_type) == TYPE_CODE_ARRAY)
| + field_type = field_type->main_type->target_type;
PS1, Line 1495:
Done
| +
| struct language_pass_by_ref_info field_info
| - = gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum));
| + = gnuv3_pass_by_reference (field_type);
| +
| + if (!field_info.copy_constructible)
| + info.copy_constructible = false;
| + if (!field_info.destructible)
| + info.destructible = false;
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic05bd98a962d07ec3c1ad041f709687eabda3bb9
Gerrit-Change-Number: 137
Gerrit-PatchSet: 2
Gerrit-Owner: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Mon, 09 Dec 2019 17:54:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Comment-In-Reply-To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Gerrit-MessageType: comment
next prev parent reply other threads:[~2019-12-09 17:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 13:53 [review] " Tankut Baris Aktemur (Code Review)
2019-10-18 14:08 ` Tankut Baris Aktemur (Code Review)
2019-10-29 22:13 ` Tom Tromey (Code Review)
2019-11-12 15:22 ` Tankut Baris Aktemur (Code Review)
2019-12-09 17:45 ` [review v2] " Tankut Baris Aktemur (Code Review)
2019-12-09 17:55 ` Tankut Baris Aktemur (Code Review) [this message]
2019-12-13 21:33 ` Tom Tromey (Code Review)
2019-12-20 16:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:53 ` Sourceware to Gerrit sync (Code Review)
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=20191209175455.D844C20AF6@gnutoolchain-gerrit.osci.io \
--to=gerrit@gnutoolchain-gerrit.osci.io \
--cc=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=gnutoolchain-gerrit@osci.io \
--cc=tromey@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).