From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55814 invoked by alias); 9 Dec 2019 17:55:00 -0000 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 Received: (qmail 55758 invoked by uid 89); 9 Dec 2019 17:55:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT autolearn=ham version=3.3.1 spammy=12729 X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2019 17:54:59 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 5BF4F20422; Mon, 9 Dec 2019 12:54:57 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 0100F20308; Mon, 9 Dec 2019 12:54:55 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id D844C20AF6; Mon, 9 Dec 2019 12:54:55 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Mon, 09 Dec 2019 17:55:00 -0000 From: "Tankut Baris Aktemur (Code Review)" To: gdb-patches@sourceware.org Cc: Tom Tromey , Andrew Burgess Auto-Submitted: auto-generated X-Gerrit-MessageType: comment Subject: [review v2] infcall, c++: collect more pass-by-reference information X-Gerrit-Change-Id: Ic05bd98a962d07ec3c1ad041f709687eabda3bb9 X-Gerrit-Change-Number: 137 X-Gerrit-ChangeURL: X-Gerrit-Commit: de7fab6975e286681ece7acac4efb624990e8132 In-Reply-To: References: X-Gerrit-Comment-Date: Mon, 9 Dec 2019 12:54:55 -0500 Reply-To: gnutoolchain-gerrit@osci.io MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Content-Type: text/plain; charset=UTF-8 Message-Id: <20191209175455.D844C20AF6@gnutoolchain-gerrit.osci.io> X-SW-Source: 2019-12/txt/msg00351.txt.bz2 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 Gerrit-Reviewer: Andrew Burgess Gerrit-Reviewer: Tankut Baris Aktemur Gerrit-Reviewer: Tom Tromey Gerrit-Comment-Date: Mon, 09 Dec 2019 17:54:55 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: Tom Tromey Comment-In-Reply-To: Tankut Baris Aktemur Gerrit-MessageType: comment