From: Keith Seitz <keiths@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH v6 06/11] Implement printing of rvalue reference types and values
Date: Fri, 10 Mar 2017 20:10:00 -0000 [thread overview]
Message-ID: <1489176286-27973-7-git-send-email-keiths@redhat.com> (raw)
In-Reply-To: <1489176286-27973-1-git-send-email-keiths@redhat.com>
This patch provides the ability to print out names of rvalue reference types
and values of those types. This is done in full similarity to regular
references, and as with them, we don't print out "const" suffix because all
rvalue references are const.
There are no changes to this patch from v5.
gdb/ChangeLog
PR gdb/14441
From Artemiy Volkov <artemiyv@acm.org>
* c-typeprint.c (c_print_type, c_type_print_varspec_prefix)
(c_type_print_modifier, c_type_print_varspec_suffix)
(c_type_print_base): Support printing rvalue reference types.
* c-valprint.c (c_val_print, c_value_print): Support printing
rvalue reference values.
---
gdb/ChangeLog | 10 ++++++++++
gdb/c-typeprint.c | 10 ++++++----
gdb/c-valprint.c | 4 ++--
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e7d5a6b..50fd34a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -2,6 +2,16 @@
PR gdb/14441
From Artemiy Volkov <artemiyv@acm.org>
+ * c-typeprint.c (c_print_type, c_type_print_varspec_prefix)
+ (c_type_print_modifier, c_type_print_varspec_suffix)
+ (c_type_print_base): Support printing rvalue reference types.
+ * c-valprint.c (c_val_print, c_value_print): Support printing
+ rvalue reference values.
+
+2017-MM-DD Keith Seitz <keiths@redhat.com>
+
+ PR gdb/14441
+ From Artemiy Volkov <artemiyv@acm.org>
* cp-name-parser.y (ptr_operator): Handle the '&&' token in
typename.
* cp-support.c (replace_typedefs): Handle
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index b97216e..9e197f5 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -110,7 +110,7 @@ c_print_type (struct type *type,
&& !TYPE_VECTOR (type))
|| code == TYPE_CODE_MEMBERPTR
|| code == TYPE_CODE_METHODPTR
- || code == TYPE_CODE_REF)))
+ || TYPE_IS_REFERENCE (type))))
fputs_filtered (" ", stream);
need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
@@ -347,9 +347,10 @@ c_type_print_varspec_prefix (struct type *type,
break;
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 1, 0, flags);
- fprintf_filtered (stream, "&");
+ fprintf_filtered (stream, TYPE_CODE(type) == TYPE_CODE_REF ? "&" : "&&");
c_type_print_modifier (type, stream, 1, need_post_space);
break;
@@ -416,8 +417,7 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
/* We don't print `const' qualifiers for references --- since all
operators affect the thing referenced, not the reference itself,
every reference is `const'. */
- if (TYPE_CONST (type)
- && TYPE_CODE (type) != TYPE_CODE_REF)
+ if (TYPE_CONST (type) && !TYPE_IS_REFERENCE (type))
{
if (need_pre_space)
fprintf_filtered (stream, " ");
@@ -728,6 +728,7 @@ c_type_print_varspec_suffix (struct type *type,
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
show, 1, 0, flags);
break;
@@ -896,6 +897,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
case TYPE_CODE_PTR:
case TYPE_CODE_MEMBERPTR:
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
case TYPE_CODE_METHODPTR:
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index d29b20e..ab1de5c 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -541,6 +541,7 @@ c_val_print (struct type *type,
break;
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_ENUM:
case TYPE_CODE_FLAGS:
case TYPE_CODE_FUNC:
@@ -587,8 +588,7 @@ c_value_print (struct value *val, struct ui_file *stream,
val_type = value_type (val);
type = check_typedef (val_type);
- if (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF)
+ if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
{
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway.
--
2.1.0
next prev parent reply other threads:[~2017-03-10 20:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 20:04 [PATCH v6 00/11] c++/14441: Rvalue reference support Keith Seitz
2017-03-10 20:04 ` [PATCH v6 01/11] Add definitions for rvalue reference types Keith Seitz
2017-03-10 20:05 ` [PATCH v6 03/11] Add ability to return rvalue reference values from value_ref Keith Seitz
2017-03-10 20:05 ` [PATCH v6 11/11] Add rvalue reference tests and NEWS entry Keith Seitz
2017-03-10 22:02 ` Eli Zaretskii
2017-03-14 18:14 ` Keith Seitz
2017-03-17 17:06 ` Keith Seitz
2017-03-17 18:51 ` Eli Zaretskii
2017-03-13 18:52 ` Pedro Alves
2017-03-14 18:15 ` Keith Seitz
2017-03-14 18:39 ` Pedro Alves
2017-04-04 11:10 ` Yao Qi
2017-03-10 20:05 ` [PATCH v6 02/11] Change {lookup,make}_reference_type API Keith Seitz
2017-03-10 20:10 ` [PATCH v6 05/11] Implement demangling for rvalue reference type names Keith Seitz
2017-03-10 20:10 ` [PATCH v6 08/11] Support rvalue references in the gdb python module (includes doc/) Keith Seitz
2017-03-10 22:04 ` Eli Zaretskii
2017-03-14 18:14 ` Keith Seitz
2017-03-17 17:06 ` Keith Seitz
2017-03-17 18:51 ` Eli Zaretskii
2017-03-10 20:10 ` [PATCH v6 04/11] Support rvalue reference type in parser Keith Seitz
2017-03-10 20:10 ` [PATCH v6 07/11] Support DW_TAG_rvalue_reference type Keith Seitz
2017-03-10 20:10 ` Keith Seitz [this message]
2017-03-10 20:12 ` [PATCH v6 09/11] Convert lvalue reference type check to general reference type check Keith Seitz
2017-03-10 20:14 ` [PATCH v6 10/11] Add rvalue references to overloading resolution Keith Seitz
2017-03-13 18:51 ` [PATCH v6 00/11] c++/14441: Rvalue reference support Pedro Alves
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=1489176286-27973-7-git-send-email-keiths@redhat.com \
--to=keiths@redhat.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