[7/8] Move compile_instance to compile.c
Commit Message
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(-)
@@ -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. */
@@ -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
@@ -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__))