Rename common to gdbsupport
[deliverable/binutils-gdb.git] / gdb / compile / compile-c.h
index cff2aef906e49eed9a37ad959c3be4f37d04dd4f..4b65d46d5c6fb1113d3fd492c3cc3676d7436c1d 100644 (file)
@@ -1,5 +1,5 @@
 /* Header file for GDB compile C-language support.
-   Copyright (C) 2014-2018 Free Software Foundation, Inc.
+   Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef GDB_COMPILE_C_H
-#define GDB_COMPILE_C_H
+#ifndef COMPILE_COMPILE_C_H
+#define COMPILE_COMPILE_C_H
 
-#include "common/enum-flags.h"
-#include "hashtab.h"
+#include "gdbsupport/enum-flags.h"
+#include "gcc-c-plugin.h"
 
 /* enum-flags wrapper.  */
 
@@ -35,23 +35,31 @@ extern gcc_c_symbol_address_function gcc_symbol_address;
 /* A subclass of compile_instance that is specific to the C front
    end.  */
 
-struct compile_c_instance
+class compile_c_instance : public compile_instance
 {
-  /* Base class.  Note that the base class vtable actually points to a
-     gcc_c_fe_vtable.  */
-  struct compile_instance base;
+public:
+  explicit compile_c_instance (struct gcc_c_context *gcc_c)
+    : compile_instance (&gcc_c->base, m_default_cflags),
+      m_plugin (gcc_c)
+  {
+    m_plugin.set_callbacks (gcc_convert_symbol, gcc_symbol_address, this);
+  }
 
-  /* Map from gdb types to gcc types.  */
-  htab_t type_map;
+  /* Convert a gdb type, TYPE, to a GCC type.
 
-  /* Map from gdb symbols to gcc error messages to emit.  */
-  htab_t symbol_err_map;
-};
+     The new GCC type is returned.  */
+  gcc_type convert_type (struct type *type);
+
+  /* Return a handle for the GCC plug-in.  */
+  gcc_c_plugin &plugin () { return m_plugin; }
 
-/* A helper macro that takes a compile_c_instance and returns its
-   corresponding gcc_c_context.  */
+private:
+  /* Default compiler flags for C.  */
+  static const char *m_default_cflags;
 
-#define C_CTX(I) ((struct gcc_c_context *) ((I)->base.fe))
+  /* The GCC plug-in.  */
+  gcc_c_plugin m_plugin;
+};
 
 /* Emit code to compute the address for all the local variables in
    scope at PC in BLOCK.  Returns a malloc'd vector, indexed by gdb
@@ -60,8 +68,8 @@ struct compile_c_instance
 
 extern gdb::unique_xmalloc_ptr<unsigned char>
   generate_c_for_variable_locations
-     (struct compile_c_instance *compiler,
-      string_file &stream,
+     (compile_instance *compiler,
+      string_file *stream,
       struct gdbarch *gdbarch,
       const struct block *block,
       CORE_ADDR pc);
@@ -78,4 +86,10 @@ extern const char *c_get_mode_for_size (int size);
 struct dynamic_prop;
 extern std::string c_get_range_decl_name (const struct dynamic_prop *prop);
 
-#endif /* GDB_COMPILE_C_H  */
+/* Compute the name of the pointer representing a local symbol's
+   address.  */
+
+extern gdb::unique_xmalloc_ptr<char>
+  c_symbol_substitution_name (struct symbol *sym);
+
+#endif /* COMPILE_COMPILE_C_H */
This page took 0.025573 seconds and 4 git commands to generate.