From patchwork Fri Mar 10 20:04:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 19512 Received: (qmail 79190 invoked by alias); 10 Mar 2017 20:04:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 79127 invoked by uid 89); 10 Mar 2017 20:04:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:gdbtypes.h, gdbtypesh, gdbtypes.h X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Mar 2017 20:04:47 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 761363DBC2 for ; Fri, 10 Mar 2017 20:04:48 +0000 (UTC) Received: from valrhona.uglyboxes.com (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2AK4lWu029240 for ; Fri, 10 Mar 2017 15:04:48 -0500 From: Keith Seitz To: gdb-patches@sourceware.org Subject: [PATCH v6 01/11] Add definitions for rvalue reference types Date: Fri, 10 Mar 2017 12:04:36 -0800 Message-Id: <1489176286-27973-2-git-send-email-keiths@redhat.com> In-Reply-To: <1489176286-27973-1-git-send-email-keiths@redhat.com> References: <1489176286-27973-1-git-send-email-keiths@redhat.com> X-IsSubscribed: yes This patch introduces preliminal definitions regarding C++11 rvalue references to the gdb type system. In addition to an enum type_code entry, a field in struct type and an accessor macro for that which are created similarly to the lvalue references counterparts, we also introduce a TYPE_REFERENCE convenience macro used to check for both kinds of references simultaneously as they are equivalent in many contexts. There are no changes to this patch from v5. gdb/Changelog PR gdb/14441 From Artemiy Volkov * gdbtypes.h (enum type_code) : New constant. (TYPE_IS_REFERENCE): New macro. (struct type): Add rvalue_reference_type field. (TYPE_RVALUE_REFERENCE_TYPE): New macro. --- gdb/ChangeLog | 9 +++++++++ gdb/gdbtypes.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e4c4432..7f2e2e5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2017-MM-DD Keith Seitz + + PR gdb/14441 + From Artemiy Volkov + * gdbtypes.h (enum type_code) : New constant. + (TYPE_IS_REFERENCE): New macro. + (struct type): Add rvalue_reference_type field. + (TYPE_RVALUE_REFERENCE_TYPE): New macro. + 2017-03-10 Keith Seitz PR c++/8218 diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index e094ece..7d107fa 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -160,6 +160,8 @@ enum type_code TYPE_CODE_REF, /**< C++ Reference types */ + TYPE_CODE_RVALUE_REF, /**< C++ rvalue reference types */ + TYPE_CODE_CHAR, /**< *real* character type */ /* * Boolean type. 0 is false, 1 is true, and other values are @@ -335,6 +337,11 @@ enum type_instance_flag_value #define TYPE_ATOMIC(t) \ (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_ATOMIC) +/* * True if this type represents either an lvalue or lvalue reference type. */ + +#define TYPE_IS_REFERENCE(t) \ + (TYPE_CODE (t) == TYPE_CODE_REF || TYPE_CODE (t) == TYPE_CODE_RVALUE_REF) + /* * Instruction-space delimited type. This is for Harvard architectures which have separate instruction and data address spaces (and perhaps others). @@ -740,6 +747,10 @@ struct type struct type *reference_type; + /* * A C++ rvalue reference type added in C++11. */ + + struct type *rvalue_reference_type; + /* * Variant chain. This points to a type that differs from this one only in qualifiers and length. Currently, the possible qualifiers are const, volatile, code-space, data-space, and @@ -1196,6 +1207,7 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type +#define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type #define TYPE_CHAIN(thistype) (thistype)->chain /* * Note that if thistype is a TYPEDEF type, you have to call check_typedef. But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,