From patchwork Fri Nov 17 19:25:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 24330 Received: (qmail 48019 invoked by alias); 17 Nov 2017 19:26:03 -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 47959 invoked by uid 89); 17 Nov 2017 19:26:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, KB_WAM_FROM_NAME_SINGLEWORD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.189) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Nov 2017 19:25:59 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway32.websitewelcome.com (Postfix) with ESMTP id A8B0C2A3DB2 for ; Fri, 17 Nov 2017 13:25:49 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id FmGrecpFZ5b6TFmGrep3zJ; Fri, 17 Nov 2017 13:25:49 -0600 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:56172 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eFmGr-001NLF-9f; Fri, 17 Nov 2017 13:25:49 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 2/3] Make template_symbol derive from symbol Date: Fri, 17 Nov 2017 12:25:46 -0700 Message-Id: <20171117192547.3515-3-tom@tromey.com> In-Reply-To: <20171117192547.3515-1-tom@tromey.com> References: <20171117192547.3515-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eFmGr-001NLF-9f X-Source-Sender: 71-218-90-63.hlrn.qwest.net (pokyo.Home) [71.218.90.63]:56172 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes This changes template_symbol to derive from symbol, which seems a bit cleaner; and also more consistent with rust_vtable_symbol. 2017-11-17 Tom Tromey * dwarf2read.c (read_func_scope): Update. * symtab.h (struct template_symbol): Derive from symbol. : Remove. --- gdb/ChangeLog | 6 ++++++ gdb/dwarf2read.c | 2 +- gdb/symtab.c | 2 +- gdb/symtab.h | 11 +++-------- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c4d0457..1551654 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2017-11-17 Tom Tromey + * dwarf2read.c (read_func_scope): Update. + * symtab.h (struct template_symbol): Derive from symbol. + : Remove. + +2017-11-17 Tom Tromey + * symtab.h (struct symbol) : New member. (struct rust_vtable_symbol): New. (find_symbol_at_address): Declare. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8283345..86b6996 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -12263,7 +12263,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) || child_die->tag == DW_TAG_template_value_param) { templ_func = allocate_template_symbol (objfile); - templ_func->base.is_cplus_template_function = 1; + templ_func->is_cplus_template_function = 1; break; } } diff --git a/gdb/symtab.c b/gdb/symtab.c index 38bc713..3d59367 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5800,7 +5800,7 @@ allocate_template_symbol (struct objfile *objfile) struct template_symbol *result; result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol); - initialize_objfile_symbol_1 (&result->base); + initialize_objfile_symbol_1 (result); return result; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 0845ae8..6ecce81 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1166,16 +1166,11 @@ extern struct symtab *symbol_symtab (const struct symbol *symbol); extern void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab); /* An instance of this type is used to represent a C++ template - function. It includes a "struct symbol" as a kind of base class; - users downcast to "struct template_symbol *" when needed. A symbol - is really of this type iff SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is - true. */ + function. A symbol is really of this type iff + SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION is true. */ -struct template_symbol +struct template_symbol : public symbol { - /* The base class. */ - struct symbol base; - /* The number of template arguments. */ int n_template_arguments;