From: Keith Seitz <keiths@redhat.com>
To: Artemiy Volkov <artemiyv@acm.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 08/11] [PR gdb/14441] gdb: convert lvalue reference type check to general reference type check
Date: Fri, 19 Feb 2016 19:01:00 -0000 [thread overview]
Message-ID: <56C7666D.9000700@redhat.com> (raw)
In-Reply-To: <1453229609-20159-9-git-send-email-artemiyv@acm.org>
On 01/19/2016 10:53 AM, Artemiy Volkov wrote:
> In almost all contexts (except for overload resolution rules and expression
> semantics), lvalue and rvalue references are equivalent. That means that in
> all but these cases we can replace a TYPE_CODE_REF check to TYPE_REFERENCE
> check. This patch does exactly that.
>
This is largely a mechanical change, but I do have a few nits to point
out. See below.
May I also bring to your attention that any subsequent patch submissions
keep purely mechanical substitutions (like the majority of this patch)
separate from anything more substantial. This patch contains some
non-mechanical changes, such as cleanups (valops.c:value_cast) and
additional handling for TYPE_CODE_RVALUE_REF in a handful of places.
As a reviewer (and it may just be that I'm not very versed at it), I
find it easy to lose these in a sea of mechanical changes.
> 2016-01-19 Artemiy Volkov <artemiyv@acm.org>
>
> * gdb/aarch64-tdep.c (aarch64_type_align): Change TYPE_CODE_REF
> check to TYPE_REFERENCE check.
> (aarch64_extract_return_value): Likewise.
> (aarch64_store_return_value): Likewise.
> * gdb/amd64-tdep.c (amd64_classify): Likewise.
[big snip]
We are now encouraging/permitting developers to use the phrase "Update
all callers." or "All callers updated." with large, mechanical changes
like this.
> diff --git a/gdb/eval.c b/gdb/eval.c
> index 729f473..443a08c 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -2509,7 +2509,7 @@ evaluate_subexp_standard (struct type *expect_type,
> {
> type = check_typedef (value_type (arg1));
> if (TYPE_CODE (type) == TYPE_CODE_PTR
> - || TYPE_CODE (type) == TYPE_CODE_REF
> + || TYPE_REFERENCE (type)
> /* In C you can dereference an array to get the 1st elt. */
> || TYPE_CODE (type) == TYPE_CODE_ARRAY
> )
Superfluous whitespace change?
> @@ -2787,9 +2787,9 @@ evaluate_subexp_standard (struct type *expect_type,
> {
> struct type *type = value_type (result);
>
> - if (TYPE_CODE (check_typedef (type)) != TYPE_CODE_REF)
> + if (!TYPE_REFERENCE (type))
> {
> - type = lookup_lvalue_reference_type (type);
> + type = lookup_lvalue_reference_type (type);
> result = allocate_value (type);
> }
> }
Same here?
> diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
> index 058b77d..fd17d3c 100644
> --- a/gdb/gdbtypes.c
> +++ b/gdb/gdbtypes.c
> @@ -3475,10 +3475,11 @@ rank_one_type (struct type *parm, struct type *arg, struct value *value)
>
> /* See through references, since we can almost make non-references
> references. */
> - if (TYPE_CODE (arg) == TYPE_CODE_REF)
> +
Superfluous whitespace.
> + if (TYPE_REFERENCE (arg))
> return (sum_ranks (rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL),
> REFERENCE_CONVERSION_BADNESS));
> - if (TYPE_CODE (parm) == TYPE_CODE_REF)
> + if (TYPE_REFERENCE (parm))
> return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL),
> REFERENCE_CONVERSION_BADNESS));
> if (overload_debug)
> diff --git a/gdb/valops.c b/gdb/valops.c
> index cc01689..b4f9ba5 100644
> --- a/gdb/valops.c
> +++ b/gdb/valops.c
> @@ -360,24 +360,20 @@ value_cast (struct type *type, struct value *arg2)
> if (value_type (arg2) == type)
> return arg2;
>
> - code1 = TYPE_CODE (check_typedef (type));
> -
> /* Check if we are casting struct reference to struct reference. */
> - if (code1 == TYPE_CODE_REF)
> + if (TYPE_REFERENCE (check_typedef (type)))
> {
> /* We dereference type; then we recurse and finally
> we generate value of the given reference. Nothing wrong with
> that. */
> struct type *t1 = check_typedef (type);
> struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1));
> - struct value *val = value_cast (dereftype, arg2);
> + struct value *val = value_cast (dereftype, arg2);
>
> return value_ref (val, TYPE_CODE (t1));
> }
>
> - code2 = TYPE_CODE (check_typedef (value_type (arg2)));
> -
> - if (code2 == TYPE_CODE_REF)
> + if (TYPE_REFERENCE (check_typedef (value_type (arg2))))
> /* We deref the value and then do the cast. */
> return value_cast (type, coerce_ref (arg2));
>
A bunch of cleanups like this would normally be considered a separate
change. I'm not going to ask anything, but be aware that the final
reviewer may call this out.
> @@ -1729,14 +1725,12 @@ typecmp (int staticp, int varargs, int nargs,
> char *>, and properly access map["hello"], because the
> argument to [] will be a reference to a pointer to a char,
> and the argument will be a pointer to a char. */
> - while (TYPE_CODE(tt1) == TYPE_CODE_REF
> - || TYPE_CODE (tt1) == TYPE_CODE_PTR)
> - {
> + while (TYPE_REFERENCE(tt1) || TYPE_CODE (tt1) == TYPE_CODE_PTR) {
> tt1 = check_typedef( TYPE_TARGET_TYPE(tt1) );
> }
> while (TYPE_CODE(tt2) == TYPE_CODE_ARRAY
> || TYPE_CODE(tt2) == TYPE_CODE_PTR
> - || TYPE_CODE(tt2) == TYPE_CODE_REF)
> + || TYPE_REFERENCE(tt2))
> {
> tt2 = check_typedef (TYPE_TARGET_TYPE(tt2));
> }
Formatting errors. I realize you probably just did a text replace, but
since you've touched a handful of the places where there were errors,
please fix those instances. "TYPE_REFERENCE (". You do not need to fix
the other formatting errors here. Just the two lines you changed.
Keith
next prev parent reply other threads:[~2016-02-19 19:01 UTC|newest]
Thread overview: 109+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-20 22:35 [PATCH 00/11] [PR gdb/14441] Support C++0x rvalue references in gdb Artemiy Volkov
2015-12-20 22:35 ` [PATCH 05/11] [PR gdb/14441] gdb: demangle: implement demangling for rvalue reference typenames Artemiy Volkov
2015-12-30 19:17 ` Pedro Alves
2015-12-20 22:35 ` [PATCH 07/11] [PR gdb/14441] gdb: dwarf2read: support DW_AT_rvalue_reference type Artemiy Volkov
2015-12-20 22:35 ` [PATCH 06/11] [PR gdb/14441] gdb: print: implement correct printing of rvalue reference types and values Artemiy Volkov
2015-12-20 22:35 ` [PATCH 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type Artemiy Volkov
2015-12-20 22:35 ` [PATCH 02/11] [PR gdb/14441] gdb: gdbtypes: change {lookup,make}_reference_type() API Artemiy Volkov
2015-12-20 22:35 ` [PATCH 03/11] [PR gdb/14441] gdb: valops: add ability to return rvalue reference values from value_ref() Artemiy Volkov
2015-12-20 22:35 ` [PATCH 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests Artemiy Volkov
2015-12-20 22:35 ` [PATCH 09/11] [PR gdb/14441] gdb: gdbtypes: add rvalue references to overloading resolution Artemiy Volkov
2015-12-20 22:35 ` [PATCH 10/11] [PR gdb/14441] gdb: python: support rvalue references in the gdb module Artemiy Volkov
2015-12-20 22:35 ` [PATCH 08/11] [PR gdb/14441] gdb: convert lvalue reference type check to general reference type check Artemiy Volkov
2015-12-20 22:35 ` [PATCH 04/11] [PR gdb/14441] gdb: parse: support rvalue reference type Artemiy Volkov
2015-12-28 21:09 ` [PATCH 00/11] [PR gdb/14441] Support C++0x rvalue references in gdb Artemiy Volkov
2016-01-20 9:42 ` Yao Qi
2016-01-19 18:54 ` [PATCH v2 " Artemiy Volkov
2016-01-19 18:54 ` [PATCH v2 03/11] [PR gdb/14441] gdb: valops: add ability to return rvalue reference values from value_ref() Artemiy Volkov
2016-02-19 18:52 ` Keith Seitz
2016-01-19 18:54 ` [PATCH v2 05/11] [PR gdb/14441] gdb: demangle: implement demangling for rvalue reference typenames Artemiy Volkov
2016-02-19 18:54 ` Keith Seitz
2016-01-19 18:54 ` [PATCH v2 06/11] [PR gdb/14441] gdb: print: implement correct printing of rvalue reference types and values Artemiy Volkov
2016-02-19 18:56 ` Keith Seitz
2016-01-19 18:54 ` [PATCH v2 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type Artemiy Volkov
2016-02-19 18:49 ` Keith Seitz
2016-02-23 7:04 ` Artemiy Volkov
2016-02-25 1:22 ` Keith Seitz
2016-02-25 1:32 ` Artemiy Volkov
2016-02-25 1:41 ` Keith Seitz
2016-02-25 1:45 ` Artemiy Volkov
2016-01-19 18:54 ` [PATCH v2 04/11] [PR gdb/14441] gdb: parse: support " Artemiy Volkov
2016-02-19 18:53 ` Keith Seitz
2016-01-19 18:54 ` [PATCH v2 02/11] [PR gdb/14441] gdb: gdbtypes: change {lookup,make}_reference_type() API Artemiy Volkov
2016-02-19 18:50 ` Keith Seitz
2016-01-19 18:55 ` [PATCH v2 09/11] [PR gdb/14441] gdb: gdbtypes: add rvalue references to overloading resolution Artemiy Volkov
2016-02-19 19:46 ` Keith Seitz
2016-01-19 18:55 ` [PATCH v2 07/11] [PR gdb/14441] gdb: dwarf2read: support DW_AT_rvalue_reference type Artemiy Volkov
2016-02-19 18:57 ` Keith Seitz
2016-01-19 18:55 ` [PATCH v2 08/11] [PR gdb/14441] gdb: convert lvalue reference type check to general reference type check Artemiy Volkov
2016-02-19 19:01 ` Keith Seitz [this message]
2016-02-26 5:08 ` Artemiy Volkov
2016-01-19 18:55 ` [PATCH v2 10/11] [PR gdb/14441] gdb: python: support rvalue references in the gdb module Artemiy Volkov
2016-02-19 19:48 ` Keith Seitz
2016-01-19 18:55 ` [PATCH v2 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests Artemiy Volkov
2016-02-19 20:05 ` Keith Seitz
2016-02-19 18:49 ` [PATCH v2 00/11] [PR gdb/14441] Support C++0x rvalue references in gdb Keith Seitz
2016-02-23 6:04 ` Artemiy Volkov
2016-03-05 3:20 ` [PATCH v3 " Artemiy Volkov
2016-03-05 3:20 ` [PATCH v3 05/11] [PR gdb/14441] gdb: demangle: implement demangling for rvalue reference typenames Artemiy Volkov
2016-03-16 22:25 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 02/11] [PR gdb/14441] gdb: gdbtypes: change {lookup,make}_reference_type() API Artemiy Volkov
2016-03-16 22:19 ` Keith Seitz
2016-03-20 12:10 ` Artemiy Volkov
2016-03-05 3:20 ` [PATCH v3 04/11] [PR gdb/14441] gdb: parse: support rvalue reference type Artemiy Volkov
2016-03-16 22:23 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 07/11] [PR gdb/14441] gdb: dwarf2read: support DW_AT_rvalue_reference type Artemiy Volkov
2016-03-16 22:28 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 10/11] [PR gdb/14441] gdb: gdbtypes: add rvalue references to overloading resolution Artemiy Volkov
2016-03-16 22:45 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests Artemiy Volkov
2016-03-16 22:48 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 09/11] [PR gdb/14441] gdb: convert lvalue reference type check to general reference type check Artemiy Volkov
2016-03-16 22:41 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type Artemiy Volkov
2016-03-16 22:08 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 08/11] [PR gdb/14441] gdb: python: support rvalue references in the gdb module Artemiy Volkov
2016-03-16 22:32 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 03/11] [PR gdb/14441] gdb: valops: add ability to return rvalue reference values from value_ref() Artemiy Volkov
2016-03-16 22:22 ` Keith Seitz
2016-03-05 3:20 ` [PATCH v3 06/11] [PR gdb/14441] gdb: print: implement correct printing of rvalue reference types and values Artemiy Volkov
2016-03-16 22:26 ` Keith Seitz
2016-03-21 21:02 ` [PATCH v4 00/11] [PR gdb/14441] Support C++0x rvalue references in gdb Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 08/11] [PR gdb/14441] gdb: python: support rvalue references in the gdb module Artemiy Volkov
2016-03-31 20:35 ` Keith Seitz
2016-04-02 8:28 ` Artemiy Volkov
2016-04-02 8:45 ` Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 02/11] [PR gdb/14441] gdb: gdbtypes: change {lookup,make}_reference_type() API Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 03/11] [PR gdb/14441] gdb: valops: add ability to return rvalue reference values from value_ref() Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 04/11] [PR gdb/14441] gdb: parse: support rvalue reference type Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 07/11] [PR gdb/14441] gdb: dwarf2read: support DW_TAG_rvalue_reference type Artemiy Volkov
2016-03-21 21:02 ` [PATCH v4 06/11] [PR gdb/14441] gdb: print: implement correct printing of rvalue reference types and values Artemiy Volkov
2016-03-21 21:03 ` [PATCH v4 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests Artemiy Volkov
2016-03-21 21:03 ` [PATCH v4 09/11] [PR gdb/14441] gdb: convert lvalue reference type check to general reference type check Artemiy Volkov
2016-03-31 20:37 ` Keith Seitz
2016-04-02 8:42 ` Artemiy Volkov
2016-03-21 21:03 ` [PATCH v4 05/11] [PR gdb/14441] gdb: demangle: implement demangling for rvalue reference typenames Artemiy Volkov
2016-03-21 21:15 ` [PATCH v4 10/11] [PR gdb/14441] gdb: gdbtypes: add rvalue references to overloading resolution Artemiy Volkov
2016-03-31 20:35 ` [PATCH v4 00/11] [PR gdb/14441] Support C++0x rvalue references in gdb Keith Seitz
2016-04-02 8:48 ` Artemiy Volkov
2016-04-05 18:23 ` Pedro Alves
2016-04-06 8:31 ` Artemiy Volkov
2016-04-12 11:49 ` Pedro Alves
2016-04-19 15:51 ` Artemiy Volkov
2016-04-22 11:31 ` Pedro Alves
2016-06-06 19:22 ` [PATCH v5 00/11] [PR gdb/14441] Support C++11 " Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 03/11] [PR gdb/14441] gdb: valops: add ability to return rvalue reference values from value_ref() Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 09/11] [PR gdb/14441] gdb: convert lvalue reference type check to general reference type check Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 08/11] [PR gdb/14441] gdb: python: support rvalue references in the gdb module Artemiy Volkov
2016-06-20 19:07 ` Pedro Alves
2016-06-06 19:23 ` [PATCH v5 11/11] [PR gdb/14441] gdb: testsuite: add rvalue reference tests Artemiy Volkov
2016-06-20 19:04 ` Pedro Alves
2016-06-06 19:23 ` [PATCH v5 04/11] [PR gdb/14441] gdb: parse: support rvalue reference type Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 07/11] [PR gdb/14441] gdb: dwarf2read: support DW_TAG_rvalue_reference type Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 01/11] [PR gdb/14441] gdb: gdbtypes: add definitions for rvalue reference type Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 06/11] [PR gdb/14441] gdb: print: implement correct printing of rvalue reference types and values Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 05/11] [PR gdb/14441] gdb: demangle: implement demangling for rvalue reference typenames Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 02/11] [PR gdb/14441] gdb: gdbtypes: change {lookup,make}_reference_type() API Artemiy Volkov
2016-06-06 19:23 ` [PATCH v5 10/11] [PR gdb/14441] gdb: gdbtypes: add rvalue references to overloading resolution Artemiy Volkov
2016-06-19 15:08 ` [PATCH v5 00/11] [PR gdb/14441] Support C++11 rvalue references in gdb Artemiy Volkov
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=56C7666D.9000700@redhat.com \
--to=keiths@redhat.com \
--cc=artemiyv@acm.org \
--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).