From patchwork Thu May 3 18:41:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Seitz X-Patchwork-Id: 27092 Received: (qmail 15252 invoked by alias); 3 May 2018 18:50:10 -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 15230 invoked by uid 89); 3 May 2018 18:50:09 -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, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=forwards, reserving 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; Thu, 03 May 2018 18:50:08 +0000 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC4F13005168 for ; Thu, 3 May 2018 18:41:56 +0000 (UTC) Received: from theo.uglyboxes.com (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id B07ED30012B8 for ; Thu, 3 May 2018 18:41:56 +0000 (UTC) From: Keith Seitz To: gdb-patches@sourceware.org Subject: [PATCH 7/8] Move compile_instance to compile.c Date: Thu, 3 May 2018 11:41:52 -0700 Message-Id: <20180503184153.31183-8-keiths@redhat.com> In-Reply-To: <20180503184153.31183-1-keiths@redhat.com> References: <20180503184153.31183-1-keiths@redhat.com> X-IsSubscribed: yes This simple patch moves any code related to compile_instance into compile.c, reserving compile-c-* files strictly for C language support. gdb/ChangeLog: * compile/compile-c-symbols.c (compile_instance::insert_symbol_error) (compile_instance::error_symbol_once): Move to compile.c. * compile/compile-c-types.c (compile_instance::insert_type): Move to ... * compile/compile.c: Here. --- gdb/compile/compile-c-symbols.c | 30 --------------------------- gdb/compile/compile-c-types.c | 20 ------------------ gdb/compile/compile.c | 45 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 0b74e4b4cd..61ef5e378e 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -31,36 +31,6 @@ #include "gdbtypes.h" #include "dwarf2loc.h" - - -/* See compile-internal.h. */ - -void -compile_instance::insert_symbol_error (const struct symbol *sym, - std::string text) -{ - symbol_err_map_t::iterator pos = m_symbol_err_map.find (sym); - - if (pos == m_symbol_err_map.end ()) - m_symbol_err_map.insert (std::make_pair (sym, text)); -} - -/* See compile-internal.h. */ - -void -compile_instance::error_symbol_once (const struct symbol *sym) -{ - symbol_err_map_t::iterator pos = m_symbol_err_map.find (sym); - if (pos == m_symbol_err_map.end () || pos->second.length () == 0) - return; - - std::string message (pos->second); - pos->second.clear (); - ::error (_("%s"), message.c_str ()); -} - - - /* Compute the name of the pointer representing a local symbol's address. */ diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index 1ad6c2a4da..f5f99e4062 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -24,26 +24,6 @@ #include "compile-c.h" #include "objfiles.h" -/* See compile-internal.h. */ - -void -compile_instance::insert_type (struct type *type, gcc_type gcc_type) -{ - type_map_t::iterator pos = m_type_map.find (type); - - if (pos != m_type_map.end ()) - { - /* The type might have already been inserted in order to handle - recursive types. */ - if (pos->second != gcc_type) - error (_("Unexpected type id from GCC, check for recent " - "enough GCC.")); - } - else - m_type_map.insert (std::make_pair (type, gcc_type)); - -} - /* Convert a pointer type to its gcc representation. */ static gcc_type diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c index c965f575fd..3d8a93907d 100644 --- a/gdb/compile/compile.c +++ b/gdb/compile/compile.c @@ -661,6 +661,51 @@ compile_register_name_demangle (struct gdbarch *gdbarch, error (_("Cannot find gdbarch register \"%s\"."), regname); } +/* See compile-internal.h. */ + +void +compile_instance::insert_type (struct type *type, gcc_type gcc_type) +{ + type_map_t::iterator pos = m_type_map.find (type); + + if (pos != m_type_map.end ()) + { + /* The type might have already been inserted in order to handle + recursive types. */ + if (pos->second != gcc_type) + error (_("Unexpected type id from GCC, check for recent " + "enough GCC.")); + } + else + m_type_map.insert (std::make_pair (type, gcc_type)); +} + +/* See compile-internal.h. */ + +void +compile_instance::insert_symbol_error (const struct symbol *sym, + std::string text) +{ + symbol_err_map_t::iterator pos = m_symbol_err_map.find (sym); + + if (pos == m_symbol_err_map.end ()) + m_symbol_err_map.insert (std::make_pair (sym, text)); +} + +/* See compile-internal.h. */ + +void +compile_instance::error_symbol_once (const struct symbol *sym) +{ + symbol_err_map_t::iterator pos = m_symbol_err_map.find (sym); + if (pos == m_symbol_err_map.end () || pos->second.length () == 0) + return; + + std::string message (pos->second); + pos->second.clear (); + ::error (_("%s"), message.c_str ()); +} + /* Forwards to the plug-in. */ #define FORWARD(OP,...) (m_gcc_fe->ops->OP (m_gcc_fe, ##__VA_ARGS__))