From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7138 invoked by alias); 19 Jan 2016 18:54:17 -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 7061 invoked by uid 89); 19 Jan 2016 18:54:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=operators, 1127, sk:type_co X-HELO: mail-lf0-f68.google.com Received: from mail-lf0-f68.google.com (HELO mail-lf0-f68.google.com) (209.85.215.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 19 Jan 2016 18:54:12 +0000 Received: by mail-lf0-f68.google.com with SMTP id t141so15735299lfd.3 for ; Tue, 19 Jan 2016 10:54:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=sd+YeX19JNQ2DYntcsB3Y8KkDVWAvHSnB+i3Ac3K/0s=; b=fpyEN+H3FJwn9PV8ACZpgmsnK5/rWpVvDWOISdvJ3vyBxp4tTqn5udt6JiQ5qJJ/GF hyvE7nxC4wQNyARsvVAScAKU2mjDKHISdy51aSkyWUmG+SK8xy9Y8GbfgpGFtzi7DxwX CVCYblgC+dljUzNsRxyhQ4psBgML5Nh5I4mA8o3H8aSocEm54xlBQND6h9364DMHUogG me26mjIZfpUoqYL+iaRbJHvH1MkzUqlux+qsJZ+LMhJRYWayY9nuDtEJRxhjbd1nRBgA JIYa7liF8Q9j1yVb7HH9ubfJtQKRA+d7gD1vSWkY2H1+DkJJ09Pa7DGBONpm5kf60YEx qCiQ== X-Gm-Message-State: ALoCoQlgxcgoUWC5NigG0rXvq7OAJTHEBAoZFrTyTfKB1p5NUkyjW/fM0qIPGK0kB9Z6+UFw0K2yvvIswdWToZN5uRHJ/pULeA== X-Received: by 10.25.64.9 with SMTP id n9mr11565645lfa.13.1453229649605; Tue, 19 Jan 2016 10:54:09 -0800 (PST) Received: from arch.smware.local ([37.204.1.155]) by smtp.gmail.com with ESMTPSA id p66sm4247278lfe.42.2016.01.19.10.54.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jan 2016 10:54:08 -0800 (PST) From: Artemiy Volkov To: gdb-patches@sourceware.org Cc: palves@redhat.com, Artemiy Volkov Subject: [PATCH v2 06/11] [PR gdb/14441] gdb: print: implement correct printing of rvalue reference types and values Date: Tue, 19 Jan 2016 18:54:00 -0000 Message-Id: <1453229609-20159-7-git-send-email-artemiyv@acm.org> In-Reply-To: <1453229609-20159-1-git-send-email-artemiyv@acm.org> References: <1450661481-31178-1-git-send-email-artemiyv@acm.org> <1453229609-20159-1-git-send-email-artemiyv@acm.org> X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00451.txt.bz2 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. ./ChangeLog: 2016-01-19 Artemiy Volkov * gdb/c-typeprint.c (c_print_type): Support printing rvalue reference types. (c_type_print_varspec_prefix): Likewise. (c_type_print_modifier): Likewise. (c_type_print_varspec_suffix): Likewise. (c_type_print_base): Likewise. * gdb/c-valprint.c (c_val_print): Support printing rvalue reference values. (c_value_print): Likewise. --- gdb/c-typeprint.c | 10 ++++++---- gdb/c-valprint.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 762c027..67129ad 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -112,7 +112,7 @@ c_print_type (struct type *type, && !TYPE_VECTOR (type)) || code == TYPE_CODE_MEMBERPTR || code == TYPE_CODE_METHODPTR - || code == TYPE_CODE_REF))) + || TYPE_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, @@ -341,9 +341,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; @@ -409,8 +410,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_REFERENCE (type)) { if (need_pre_space) fprintf_filtered (stream, " "); @@ -725,6 +725,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; @@ -892,6 +893,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 e210e99..116686f 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -538,6 +538,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, break; case TYPE_CODE_REF: + case TYPE_CODE_RVALUE_REF: case TYPE_CODE_ENUM: case TYPE_CODE_FLAGS: case TYPE_CODE_FUNC: @@ -583,8 +584,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_REFERENCE (type)) { /* Hack: remove (char *) for char strings. Their type is indicated by the quoted string anyway. -- 2.7.0