Add new variant part code
[deliverable/binutils-gdb.git] / gdb / language.c
index 6ab0ca323d20e2afa5a6f1ab2be56d60b8028779..769b3299793d95fa2ec655a623416deb0805f755 100644 (file)
@@ -1,6 +1,6 @@
 /* Multiple source language support for GDB.
 
-   Copyright (C) 1991-2019 Free Software Foundation, Inc.
+   Copyright (C) 1991-2020 Free Software Foundation, Inc.
 
    Contributed by the Department of Computer Science at the State University
    of New York at Buffalo.
@@ -500,19 +500,6 @@ language_str (enum language lang)
   return languages[lang]->la_name;
 }
 
-static void
-set_check (const char *ignore, int from_tty)
-{
-  printf_unfiltered (
-     "\"set check\" must be followed by the name of a check subcommand.\n");
-  help_list (setchecklist, "set check ", all_commands, gdb_stdout);
-}
-
-static void
-show_check (const char *ignore, int from_tty)
-{
-  cmd_show_list (showchecklist, from_tty, "");
-}
 \f
 
 /* Build and install the "set language LANG" command.  */
@@ -652,21 +639,23 @@ language_class_name_from_physname (const struct language_defn *lang,
   return NULL;
 }
 
-/* Return non-zero if TYPE should be passed (and returned) by
-   reference at the language level.  */
-int
+/* Return information about whether TYPE should be passed
+   (and returned) by reference at the language level.  */
+
+struct language_pass_by_ref_info
 language_pass_by_reference (struct type *type)
 {
   return current_language->la_pass_by_reference (type);
 }
 
-/* Return zero; by default, types are passed by value at the language
-   level.  The target ABI may pass or return some structs by reference
-   independent of this.  */
-int
+/* Return a default struct that provides pass-by-reference information
+   about the given TYPE.  Languages should update the default values
+   as appropriate.  */
+
+struct language_pass_by_ref_info
 default_pass_by_reference (struct type *type)
 {
-  return 0;
+  return {};
 }
 
 /* Return the default string containing the list of characters
@@ -697,14 +686,14 @@ default_symbol_name_matcher (const char *symbol_search_name,
                             const lookup_name_info &lookup_name,
                             completion_match_result *comp_match_res)
 {
-  const std::string &name = lookup_name.name ();
+  gdb::string_view name = lookup_name.name ();
   completion_match_for_lcd *match_for_lcd
     = (comp_match_res != NULL ? &comp_match_res->match_for_lcd : NULL);
   strncmp_iw_mode mode = (lookup_name.completion_mode ()
                          ? strncmp_iw_mode::NORMAL
                          : strncmp_iw_mode::MATCH_PARAMS);
 
-  if (strncmp_iw_with_mode (symbol_search_name, name.c_str (), name.size (),
+  if (strncmp_iw_with_mode (symbol_search_name, name.data (), name.size (),
                            mode, language_minimal, match_for_lcd) == 0)
     {
       if (comp_match_res != NULL)
@@ -790,14 +779,12 @@ unk_lang_print_type (struct type *type, const char *varstring,
 }
 
 static void
-unk_lang_val_print (struct type *type,
-                   int embedded_offset, CORE_ADDR address,
-                   struct ui_file *stream, int recurse,
-                   struct value *val,
-                   const struct value_print_options *options)
+unk_lang_value_print_inner (struct value *val,
+                           struct ui_file *stream, int recurse,
+                           const struct value_print_options *options)
 {
   error (_("internal error - unimplemented "
-          "function unk_lang_val_print called."));
+          "function unk_lang_value_print_inner called."));
 }
 
 static void
@@ -857,7 +844,7 @@ const struct language_defn unknown_language_defn =
   unk_lang_emit_char,
   unk_lang_print_type,         /* Print a type using appropriate syntax */
   default_print_typedef,       /* Print a typedef using appropriate syntax */
-  unk_lang_val_print,          /* Print a value using appropriate syntax */
+  unk_lang_value_print_inner,  /* la_value_print_inner */
   unk_lang_value_print,                /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   unk_lang_trampoline,         /* Language specific skip_trampoline */
@@ -908,7 +895,7 @@ const struct language_defn auto_language_defn =
   unk_lang_emit_char,
   unk_lang_print_type,         /* Print a type using appropriate syntax */
   default_print_typedef,       /* Print a typedef using appropriate syntax */
-  unk_lang_val_print,          /* Print a value using appropriate syntax */
+  unk_lang_value_print_inner,  /* la_value_print_inner */
   unk_lang_value_print,                /* Print a top-level value */
   default_read_var_value,      /* la_read_var_value */
   unk_lang_trampoline,         /* Language specific skip_trampoline */
@@ -1050,8 +1037,8 @@ language_alloc_type_symbol (enum language lang, struct type *type)
   gdbarch = TYPE_OWNER (type).gdbarch;
   symbol = new (gdbarch_obstack (gdbarch)) struct symbol ();
 
-  symbol->name = TYPE_NAME (type);
-  symbol->language = lang;
+  symbol->m_name = TYPE_NAME (type);
+  symbol->set_language (lang, nullptr);
   symbol->owner.arch = gdbarch;
   SYMBOL_OBJFILE_OWNED (symbol) = 0;
   SYMBOL_TYPE (symbol) = type;
@@ -1134,8 +1121,9 @@ language_lookup_primitive_type_as_symbol (const struct language_defn *la,
 
 /* Initialize the language routines.  */
 
+void _initialize_language ();
 void
-_initialize_language (void)
+_initialize_language ()
 {
   static const char *const type_or_range_names[]
     = { "on", "off", "warn", "auto", NULL };
@@ -1148,15 +1136,15 @@ _initialize_language (void)
 
   /* GDB commands for language specific stuff.  */
 
-  add_prefix_cmd ("check", no_class, set_check,
-                 _("Set the status of the type/range checker."),
-                 &setchecklist, "set check ", 0, &setlist);
+  add_basic_prefix_cmd ("check", no_class,
+                       _("Set the status of the type/range checker."),
+                       &setchecklist, "set check ", 0, &setlist);
   add_alias_cmd ("c", "check", no_class, 1, &setlist);
   add_alias_cmd ("ch", "check", no_class, 1, &setlist);
 
-  add_prefix_cmd ("check", no_class, show_check,
-                 _("Show the status of the type/range checker."),
-                 &showchecklist, "show check ", 0, &showlist);
+  add_show_prefix_cmd ("check", no_class,
+                      _("Show the status of the type/range checker."),
+                      &showchecklist, "show check ", 0, &showlist);
   add_alias_cmd ("c", "check", no_class, 1, &showlist);
   add_alias_cmd ("ch", "check", no_class, 1, &showlist);
 
This page took 0.02887 seconds and 4 git commands to generate.