gdb/testsuite/tui: Always dump_screen when asked
[deliverable/binutils-gdb.git] / gdb / compile / compile-c-types.c
index bfc6ccf1bb26ad2bcd7e399b0c33747d93dc306d..95bb537a87c101275c1b31536b91b7d798a4a153 100644 (file)
@@ -1,6 +1,6 @@
 /* Convert types from GDB to GCC
 
-   Copyright (C) 2014-2018 Free Software Foundation, Inc.
+   Copyright (C) 2014-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "compile-c.h"
 #include "objfiles.h"
 
-/* An object that maps a gdb type to a gcc type.  */
-
-struct type_map_instance
-{
-  /* The gdb type.  */
-
-  struct type *type;
-
-  /* The corresponding gcc type handle.  */
-
-  gcc_type gcc_type_handle;
-};
-
-/* Hash a type_map_instance.  */
-
-static hashval_t
-hash_type_map_instance (const void *p)
-{
-  const struct type_map_instance *inst = (const struct type_map_instance *) p;
-
-  return htab_hash_pointer (inst->type);
-}
-
-/* Check two type_map_instance objects for equality.  */
-
-static int
-eq_type_map_instance (const void *a, const void *b)
-{
-  const struct type_map_instance *insta = (const struct type_map_instance *) a;
-  const struct type_map_instance *instb = (const struct type_map_instance *) b;
-
-  return insta->type == instb->type;
-}
-
-/* Constructor for compile_instance.  */
-
-compile_instance::compile_instance (struct gcc_base_context *gcc_fe,
-                                   const char *options)
-  : m_gcc_fe (gcc_fe), m_gcc_target_options (options),
-    m_symbol_err_map (NULL)
-{
-  m_type_map = htab_create_alloc (10, hash_type_map_instance,
-                                 eq_type_map_instance,
-                                 xfree, xcalloc, xfree);
-}
-
-\f
-
-/* See compile-internal.h.  */
-
-bool
-compile_instance::get_cached_type (struct type *type, gcc_type &ret) const
-{
-  struct type_map_instance inst, *found;
-
-  inst.type = type;
-  found = (struct type_map_instance *) htab_find (m_type_map, &inst);
-  if (found != NULL)
-    {
-      ret = found->gcc_type_handle;
-      return true;
-    }
-
-  return false;
-}
-
-/* See compile-internal.h.  */
-
-void
-compile_instance::insert_type (struct type *type, gcc_type gcc_type)
-{
-  struct type_map_instance inst, *add;
-  void **slot;
-
-  inst.type = type;
-  inst.gcc_type_handle = gcc_type;
-  slot = htab_find_slot (m_type_map, &inst, INSERT);
-
-  add = (struct type_map_instance *) *slot;
-  /* The type might have already been inserted in order to handle
-     recursive types.  */
-  if (add != NULL && add->gcc_type_handle != gcc_type)
-    error (_("Unexpected type id from GCC, check you use recent enough GCC."));
-
-  if (add == NULL)
-    {
-      add = XNEW (struct type_map_instance);
-      *add = inst;
-      *slot = add;
-    }
-}
-
 /* Convert a pointer type to its gcc representation.  */
 
 static gcc_type
@@ -445,7 +353,7 @@ compile_c_instance::convert_type (struct type *type)
   type = check_typedef (type);
 
   gcc_type result;
-  if (get_cached_type (type, result))
+  if (get_cached_type (type, &result))
     return result;
 
   result = convert_type_basic (this, type);
This page took 0.02575 seconds and 4 git commands to generate.