gdb: Convert language la_language_arch_info field to a method
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 1 May 2020 20:51:15 +0000 (21:51 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 2 Jun 2020 12:53:10 +0000 (13:53 +0100)
This commit changes the language_data::la_language_arch_info function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_arch_info): Delete function, move
implementation to...
(ada_language::language_arch_info): ...here, a new member
function.
(ada_language_data): Delete la_language_arch_info.
* c-lang.c (c_language_data): Likewise.
(c_language::language_arch_info): New member function.
(cplus_language_arch_info): Delete function, move
implementation to...
(cplus_language::language_arch_info): ...here, a new member
function.
(cplus_language_data): Delete la_language_arch_info.
(asm_language_data): Likewise.
(asm_language::language_arch_info): New member function.
(minimal_language_data): Delete la_language_arch_info.
(minimal_language::language_arch_info): New member function.
* d-lang.c (d_language_arch_info): Delete function, move
implementation to...
(d_language::language_arch_info): ...here, a new member
function.
(d_language_data): Delete la_language_arch_info.
* f-lang.c (f_language_arch_info): Delete function, move
implementation to...
(f_language::language_arch_info): ...here, a new member
function.
(f_language_data): Delete la_language_arch_info.
* go-lang.c (go_language_arch_info): Delete function, move
implementation to...
(go_language::language_arch_info): ...here, a new member
function.
(go_language_data): Delete la_language_arch_info.
* language.c (unknown_language_data): Likewise.
(unknown_language::language_arch_info): New member function.
(auto_language_data): Delete la_language_arch_info.
(auto_language::language_arch_info): New member function.
(language_gdbarch_post_init): Update call to
la_language_arch_info.
* language.h (language_data): Delete la_language_arch_info
function pointer.
(language_defn::language_arch_info): New function.
* m2-lang.c (m2_language_arch_info): Delete function, move
implementation to...
(m2_language::language_arch_info): ...here, a new member
function.
(m2_language_data): Delete la_language_arch_info.
* objc-lang.c (objc_language_arch_info): Delete function, move
implementation to...
(objc_language::language_arch_info): ...here, a new member
function.
(objc_language_data): Delete la_language_arch_info.
* opencl-lang.c (opencl_language_arch_info): Delete function, move
implementation to...
(opencl_language::language_arch_info): ...here, a new member
function.
(opencl_language_data): Delete la_language_arch_info.
* p-lang.c (pascal_language_arch_info): Delete function, move
implementation to...
(pascal_language::language_arch_info): ...here, a new member
function.
(pascal_language_data): Delete la_language_arch_info.
* rust-lang.c (rust_language_arch_info): Delete function, move
implementation to...
(rust_language::language_arch_info): ...here, a new member
function.
(rust_language_data): Delete la_language_arch_info.

13 files changed:
gdb/ChangeLog
gdb/ada-lang.c
gdb/c-lang.c
gdb/d-lang.c
gdb/f-lang.c
gdb/go-lang.c
gdb/language.c
gdb/language.h
gdb/m2-lang.c
gdb/objc-lang.c
gdb/opencl-lang.c
gdb/p-lang.c
gdb/rust-lang.c

index 1dcd649879f51343e9e971b398fd746beeaddb14..4a0dbd1c3d32ca0bf0241711c2b7cd590ad53ff3 100644 (file)
@@ -1,3 +1,71 @@
+2020-06-02  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * ada-lang.c (ada_language_arch_info): Delete function, move
+       implementation to...
+       (ada_language::language_arch_info): ...here, a new member
+       function.
+       (ada_language_data): Delete la_language_arch_info.
+       * c-lang.c (c_language_data): Likewise.
+       (c_language::language_arch_info): New member function.
+       (cplus_language_arch_info): Delete function, move
+       implementation to...
+       (cplus_language::language_arch_info): ...here, a new member
+       function.
+       (cplus_language_data): Delete la_language_arch_info.
+       (asm_language_data): Likewise.
+       (asm_language::language_arch_info): New member function.
+       (minimal_language_data): Delete la_language_arch_info.
+       (minimal_language::language_arch_info): New member function.
+       * d-lang.c (d_language_arch_info): Delete function, move
+       implementation to...
+       (d_language::language_arch_info): ...here, a new member
+       function.
+       (d_language_data): Delete la_language_arch_info.
+       * f-lang.c (f_language_arch_info): Delete function, move
+       implementation to...
+       (f_language::language_arch_info): ...here, a new member
+       function.
+       (f_language_data): Delete la_language_arch_info.
+       * go-lang.c (go_language_arch_info): Delete function, move
+       implementation to...
+       (go_language::language_arch_info): ...here, a new member
+       function.
+       (go_language_data): Delete la_language_arch_info.
+       * language.c (unknown_language_data): Likewise.
+       (unknown_language::language_arch_info): New member function.
+       (auto_language_data): Delete la_language_arch_info.
+       (auto_language::language_arch_info): New member function.
+       (language_gdbarch_post_init): Update call to
+       la_language_arch_info.
+       * language.h (language_data): Delete la_language_arch_info
+       function pointer.
+       (language_defn::language_arch_info): New function.
+       * m2-lang.c (m2_language_arch_info): Delete function, move
+       implementation to...
+       (m2_language::language_arch_info): ...here, a new member
+       function.
+       (m2_language_data): Delete la_language_arch_info.
+       * objc-lang.c (objc_language_arch_info): Delete function, move
+       implementation to...
+       (objc_language::language_arch_info): ...here, a new member
+       function.
+       (objc_language_data): Delete la_language_arch_info.
+       * opencl-lang.c (opencl_language_arch_info): Delete function, move
+       implementation to...
+       (opencl_language::language_arch_info): ...here, a new member
+       function.
+       (opencl_language_data): Delete la_language_arch_info.
+       * p-lang.c (pascal_language_arch_info): Delete function, move
+       implementation to...
+       (pascal_language::language_arch_info): ...here, a new member
+       function.
+       (pascal_language_data): Delete la_language_arch_info.
+       * rust-lang.c (rust_language_arch_info): Delete function, move
+       implementation to...
+       (rust_language::language_arch_info): ...here, a new member
+       function.
+       (rust_language_data): Delete la_language_arch_info.
+
 2020-06-02  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * ada-lang.c (ada_language_data): Delete la_pass_by_reference
index 654447984e5f400111d004be510106ca47ff54a8..a1cd04b015c4e4a6d6f008e55feb5495d973f1b4 100644 (file)
@@ -215,9 +215,6 @@ static int ada_resolve_function (struct block_symbol *, int,
 
 static int ada_is_direct_array_type (struct type *);
 
-static void ada_language_arch_info (struct gdbarch *,
-                                   struct language_arch_info *);
-
 static struct value *ada_index_struct_field (int, struct value *, int,
                                             struct type *);
 
@@ -13783,70 +13780,6 @@ enum ada_primitive_types {
   nr_ada_primitive_types
 };
 
-static void
-ada_language_arch_info (struct gdbarch *gdbarch,
-                       struct language_arch_info *lai)
-{
-  const struct builtin_type *builtin = builtin_type (gdbarch);
-
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_ada_primitive_types + 1,
-                             struct type *);
-
-  lai->primitive_type_vector [ada_primitive_type_int]
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
-                        0, "integer");
-  lai->primitive_type_vector [ada_primitive_type_long]
-    = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
-                        0, "long_integer");
-  lai->primitive_type_vector [ada_primitive_type_short]
-    = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
-                        0, "short_integer");
-  lai->string_char_type
-    = lai->primitive_type_vector [ada_primitive_type_char]
-    = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "character");
-  lai->primitive_type_vector [ada_primitive_type_float]
-    = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
-                      "float", gdbarch_float_format (gdbarch));
-  lai->primitive_type_vector [ada_primitive_type_double]
-    = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
-                      "long_float", gdbarch_double_format (gdbarch));
-  lai->primitive_type_vector [ada_primitive_type_long_long]
-    = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
-                        0, "long_long_integer");
-  lai->primitive_type_vector [ada_primitive_type_long_double]
-    = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
-                      "long_long_float", gdbarch_long_double_format (gdbarch));
-  lai->primitive_type_vector [ada_primitive_type_natural]
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
-                        0, "natural");
-  lai->primitive_type_vector [ada_primitive_type_positive]
-    = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
-                        0, "positive");
-  lai->primitive_type_vector [ada_primitive_type_void]
-    = builtin->builtin_void;
-
-  lai->primitive_type_vector [ada_primitive_type_system_address]
-    = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
-                                     "void"));
-  lai->primitive_type_vector [ada_primitive_type_system_address]
-    ->set_name ("system__address");
-
-  /* Create the equivalent of the System.Storage_Elements.Storage_Offset
-     type.  This is a signed integral type whose size is the same as
-     the size of addresses.  */
-  {
-    unsigned int addr_length = TYPE_LENGTH
-      (lai->primitive_type_vector [ada_primitive_type_system_address]);
-
-    lai->primitive_type_vector [ada_primitive_type_storage_offset]
-      = arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0,
-                          "storage_offset");
-  }
-
-  lai->bool_type_symbol = NULL;
-  lai->bool_type_default = builtin->builtin_bool;
-}
 \f
                                /* Language vector */
 
@@ -14065,7 +13998,6 @@ extern const struct language_data ada_language_data =
   1,                            /* String lower bound */
   ada_get_gdb_completer_word_break_characters,
   ada_collect_symbol_completion_matches,
-  ada_language_arch_info,
   ada_watch_location_expression,
   ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
   ada_iterate_over_symbols,
@@ -14118,6 +14050,71 @@ public:
        function to work.  */
     return language_defn::read_var_value (var, var_block, frame);
   }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_type *builtin = builtin_type (gdbarch);
+
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_ada_primitive_types + 1,
+                               struct type *);
+
+    lai->primitive_type_vector [ada_primitive_type_int]
+      = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+                          0, "integer");
+    lai->primitive_type_vector [ada_primitive_type_long]
+      = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch),
+                          0, "long_integer");
+    lai->primitive_type_vector [ada_primitive_type_short]
+      = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch),
+                          0, "short_integer");
+    lai->string_char_type
+      = lai->primitive_type_vector [ada_primitive_type_char]
+      = arch_character_type (gdbarch, TARGET_CHAR_BIT, 0, "character");
+    lai->primitive_type_vector [ada_primitive_type_float]
+      = arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
+                        "float", gdbarch_float_format (gdbarch));
+    lai->primitive_type_vector [ada_primitive_type_double]
+      = arch_float_type (gdbarch, gdbarch_double_bit (gdbarch),
+                        "long_float", gdbarch_double_format (gdbarch));
+    lai->primitive_type_vector [ada_primitive_type_long_long]
+      = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch),
+                          0, "long_long_integer");
+    lai->primitive_type_vector [ada_primitive_type_long_double]
+      = arch_float_type (gdbarch, gdbarch_long_double_bit (gdbarch),
+                        "long_long_float", gdbarch_long_double_format (gdbarch));
+    lai->primitive_type_vector [ada_primitive_type_natural]
+      = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+                          0, "natural");
+    lai->primitive_type_vector [ada_primitive_type_positive]
+      = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
+                          0, "positive");
+    lai->primitive_type_vector [ada_primitive_type_void]
+      = builtin->builtin_void;
+
+    lai->primitive_type_vector [ada_primitive_type_system_address]
+      = lookup_pointer_type (arch_type (gdbarch, TYPE_CODE_VOID, TARGET_CHAR_BIT,
+                                       "void"));
+    lai->primitive_type_vector [ada_primitive_type_system_address]
+      ->set_name ("system__address");
+
+    /* Create the equivalent of the System.Storage_Elements.Storage_Offset
+       type.  This is a signed integral type whose size is the same as
+       the size of addresses.  */
+    {
+      unsigned int addr_length = TYPE_LENGTH
+       (lai->primitive_type_vector [ada_primitive_type_system_address]);
+
+      lai->primitive_type_vector [ada_primitive_type_storage_offset]
+       = arch_integer_type (gdbarch, addr_length * HOST_CHAR_BIT, 0,
+                            "storage_offset");
+    }
+
+    lai->bool_type_symbol = NULL;
+    lai->bool_type_default = builtin->builtin_bool;
+  }
 };
 
 /* Single instance of the Ada language class.  */
index 9efcf56d7049ff132a46df59e3c838451107c938..e82d058777ed9ff2a15f1ff167feb278c7a96bd0 100644 (file)
@@ -921,7 +921,6 @@ extern const struct language_data c_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  c_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -941,6 +940,13 @@ public:
   c_language ()
     : language_defn (language_c, c_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    c_language_arch_info (gdbarch, lai);
+  }
 };
 
 /* Single instance of the C language class.  */
@@ -975,69 +981,6 @@ enum cplus_primitive_types {
   nr_cplus_primitive_types
 };
 
-static void
-cplus_language_arch_info (struct gdbarch *gdbarch,
-                         struct language_arch_info *lai)
-{
-  const struct builtin_type *builtin = builtin_type (gdbarch);
-
-  lai->string_char_type = builtin->builtin_char;
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
-                             struct type *);
-  lai->primitive_type_vector [cplus_primitive_type_int]
-    = builtin->builtin_int;
-  lai->primitive_type_vector [cplus_primitive_type_long]
-    = builtin->builtin_long;
-  lai->primitive_type_vector [cplus_primitive_type_short]
-    = builtin->builtin_short;
-  lai->primitive_type_vector [cplus_primitive_type_char]
-    = builtin->builtin_char;
-  lai->primitive_type_vector [cplus_primitive_type_float]
-    = builtin->builtin_float;
-  lai->primitive_type_vector [cplus_primitive_type_double]
-    = builtin->builtin_double;
-  lai->primitive_type_vector [cplus_primitive_type_void]
-    = builtin->builtin_void;
-  lai->primitive_type_vector [cplus_primitive_type_long_long]
-    = builtin->builtin_long_long;
-  lai->primitive_type_vector [cplus_primitive_type_signed_char]
-    = builtin->builtin_signed_char;
-  lai->primitive_type_vector [cplus_primitive_type_unsigned_char]
-    = builtin->builtin_unsigned_char;
-  lai->primitive_type_vector [cplus_primitive_type_unsigned_short]
-    = builtin->builtin_unsigned_short;
-  lai->primitive_type_vector [cplus_primitive_type_unsigned_int]
-    = builtin->builtin_unsigned_int;
-  lai->primitive_type_vector [cplus_primitive_type_unsigned_long]
-    = builtin->builtin_unsigned_long;
-  lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long]
-    = builtin->builtin_unsigned_long_long;
-  lai->primitive_type_vector [cplus_primitive_type_long_double]
-    = builtin->builtin_long_double;
-  lai->primitive_type_vector [cplus_primitive_type_complex]
-    = builtin->builtin_complex;
-  lai->primitive_type_vector [cplus_primitive_type_double_complex]
-    = builtin->builtin_double_complex;
-  lai->primitive_type_vector [cplus_primitive_type_bool]
-    = builtin->builtin_bool;
-  lai->primitive_type_vector [cplus_primitive_type_decfloat]
-    = builtin->builtin_decfloat;
-  lai->primitive_type_vector [cplus_primitive_type_decdouble]
-    = builtin->builtin_decdouble;
-  lai->primitive_type_vector [cplus_primitive_type_declong]
-    = builtin->builtin_declong;
-  lai->primitive_type_vector [cplus_primitive_type_char16_t]
-    = builtin->builtin_char16;
-  lai->primitive_type_vector [cplus_primitive_type_char32_t]
-    = builtin->builtin_char32;
-  lai->primitive_type_vector [cplus_primitive_type_wchar_t]
-    = builtin->builtin_wchar;
-
-  lai->bool_type_symbol = "bool";
-  lai->bool_type_default = builtin->builtin_bool;
-}
-
 static const char *cplus_extensions[] =
 {
   ".C", ".cc", ".cp", ".cpp", ".cxx", ".c++", NULL
@@ -1079,7 +1022,6 @@ extern const struct language_data cplus_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  cplus_language_arch_info,
   c_watch_location_expression,
   cp_get_symbol_name_matcher,
   iterate_over_symbols,
@@ -1107,6 +1049,69 @@ public:
   {
     return cp_pass_by_reference (type);
   }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_type *builtin = builtin_type (gdbarch);
+
+    lai->string_char_type = builtin->builtin_char;
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_cplus_primitive_types + 1,
+                               struct type *);
+    lai->primitive_type_vector [cplus_primitive_type_int]
+      = builtin->builtin_int;
+    lai->primitive_type_vector [cplus_primitive_type_long]
+      = builtin->builtin_long;
+    lai->primitive_type_vector [cplus_primitive_type_short]
+      = builtin->builtin_short;
+    lai->primitive_type_vector [cplus_primitive_type_char]
+      = builtin->builtin_char;
+    lai->primitive_type_vector [cplus_primitive_type_float]
+      = builtin->builtin_float;
+    lai->primitive_type_vector [cplus_primitive_type_double]
+      = builtin->builtin_double;
+    lai->primitive_type_vector [cplus_primitive_type_void]
+      = builtin->builtin_void;
+    lai->primitive_type_vector [cplus_primitive_type_long_long]
+      = builtin->builtin_long_long;
+    lai->primitive_type_vector [cplus_primitive_type_signed_char]
+      = builtin->builtin_signed_char;
+    lai->primitive_type_vector [cplus_primitive_type_unsigned_char]
+      = builtin->builtin_unsigned_char;
+    lai->primitive_type_vector [cplus_primitive_type_unsigned_short]
+      = builtin->builtin_unsigned_short;
+    lai->primitive_type_vector [cplus_primitive_type_unsigned_int]
+      = builtin->builtin_unsigned_int;
+    lai->primitive_type_vector [cplus_primitive_type_unsigned_long]
+      = builtin->builtin_unsigned_long;
+    lai->primitive_type_vector [cplus_primitive_type_unsigned_long_long]
+      = builtin->builtin_unsigned_long_long;
+    lai->primitive_type_vector [cplus_primitive_type_long_double]
+      = builtin->builtin_long_double;
+    lai->primitive_type_vector [cplus_primitive_type_complex]
+      = builtin->builtin_complex;
+    lai->primitive_type_vector [cplus_primitive_type_double_complex]
+      = builtin->builtin_double_complex;
+    lai->primitive_type_vector [cplus_primitive_type_bool]
+      = builtin->builtin_bool;
+    lai->primitive_type_vector [cplus_primitive_type_decfloat]
+      = builtin->builtin_decfloat;
+    lai->primitive_type_vector [cplus_primitive_type_decdouble]
+      = builtin->builtin_decdouble;
+    lai->primitive_type_vector [cplus_primitive_type_declong]
+      = builtin->builtin_declong;
+    lai->primitive_type_vector [cplus_primitive_type_char16_t]
+      = builtin->builtin_char16;
+    lai->primitive_type_vector [cplus_primitive_type_char32_t]
+      = builtin->builtin_char32;
+    lai->primitive_type_vector [cplus_primitive_type_wchar_t]
+      = builtin->builtin_wchar;
+
+    lai->bool_type_symbol = "bool";
+    lai->bool_type_default = builtin->builtin_bool;
+  }
 };
 
 /* The single instance of the C++ language class.  */
@@ -1154,7 +1159,6 @@ extern const struct language_data asm_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  c_language_arch_info,                /* FIXME: la_language_arch_info.  */
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -1174,6 +1178,15 @@ public:
   asm_language ()
     : language_defn (language_asm, asm_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.
+
+     FIXME: Should this have its own arch info method?  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    c_language_arch_info (gdbarch, lai);
+  }
 };
 
 /* The single instance of the ASM language class.  */
@@ -1218,7 +1231,6 @@ extern const struct language_data minimal_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  c_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -1238,6 +1250,13 @@ public:
   minimal_language ()
     : language_defn (language_minimal, minimal_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    c_language_arch_info (gdbarch, lai);
+  }
 };
 
 /* The single instance of the minimal language class.  */
index 28864420bad260a8efc61084a309657b2c924d53..778d77313c9d30263af5ae453dc163acb6b8f19e 100644 (file)
@@ -133,73 +133,6 @@ enum d_primitive_types {
   nr_d_primitive_types
 };
 
-/* Implements the la_language_arch_info language_defn routine
-   for language D.  */
-
-static void
-d_language_arch_info (struct gdbarch *gdbarch,
-                     struct language_arch_info *lai)
-{
-  const struct builtin_d_type *builtin = builtin_d_type (gdbarch);
-
-  lai->string_char_type = builtin->builtin_char;
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_d_primitive_types + 1,
-                             struct type *);
-
-  lai->primitive_type_vector [d_primitive_type_void]
-    = builtin->builtin_void;
-  lai->primitive_type_vector [d_primitive_type_bool]
-    = builtin->builtin_bool;
-  lai->primitive_type_vector [d_primitive_type_byte]
-    = builtin->builtin_byte;
-  lai->primitive_type_vector [d_primitive_type_ubyte]
-    = builtin->builtin_ubyte;
-  lai->primitive_type_vector [d_primitive_type_short]
-    = builtin->builtin_short;
-  lai->primitive_type_vector [d_primitive_type_ushort]
-    = builtin->builtin_ushort;
-  lai->primitive_type_vector [d_primitive_type_int]
-    = builtin->builtin_int;
-  lai->primitive_type_vector [d_primitive_type_uint]
-    = builtin->builtin_uint;
-  lai->primitive_type_vector [d_primitive_type_long]
-    = builtin->builtin_long;
-  lai->primitive_type_vector [d_primitive_type_ulong]
-    = builtin->builtin_ulong;
-  lai->primitive_type_vector [d_primitive_type_cent]
-    = builtin->builtin_cent;
-  lai->primitive_type_vector [d_primitive_type_ucent]
-    = builtin->builtin_ucent;
-  lai->primitive_type_vector [d_primitive_type_float]
-    = builtin->builtin_float;
-  lai->primitive_type_vector [d_primitive_type_double]
-    = builtin->builtin_double;
-  lai->primitive_type_vector [d_primitive_type_real]
-    = builtin->builtin_real;
-  lai->primitive_type_vector [d_primitive_type_ifloat]
-    = builtin->builtin_ifloat;
-  lai->primitive_type_vector [d_primitive_type_idouble]
-    = builtin->builtin_idouble;
-  lai->primitive_type_vector [d_primitive_type_ireal]
-    = builtin->builtin_ireal;
-  lai->primitive_type_vector [d_primitive_type_cfloat]
-    = builtin->builtin_cfloat;
-  lai->primitive_type_vector [d_primitive_type_cdouble]
-    = builtin->builtin_cdouble;
-  lai->primitive_type_vector [d_primitive_type_creal]
-    = builtin->builtin_creal;
-  lai->primitive_type_vector [d_primitive_type_char]
-    = builtin->builtin_char;
-  lai->primitive_type_vector [d_primitive_type_wchar]
-    = builtin->builtin_wchar;
-  lai->primitive_type_vector [d_primitive_type_dchar]
-    = builtin->builtin_dchar;
-
-  lai->bool_type_symbol = "bool";
-  lai->bool_type_default = builtin->builtin_bool;
-}
-
 static const char *d_extensions[] =
 {
   ".d", NULL
@@ -242,7 +175,6 @@ extern const struct language_data d_language_data =
   0,                           /* String lower bound.  */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  d_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -262,6 +194,70 @@ public:
   d_language ()
     : language_defn (language_d, d_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_d_type *builtin = builtin_d_type (gdbarch);
+
+    lai->string_char_type = builtin->builtin_char;
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_d_primitive_types + 1,
+                               struct type *);
+
+    lai->primitive_type_vector [d_primitive_type_void]
+      = builtin->builtin_void;
+    lai->primitive_type_vector [d_primitive_type_bool]
+      = builtin->builtin_bool;
+    lai->primitive_type_vector [d_primitive_type_byte]
+      = builtin->builtin_byte;
+    lai->primitive_type_vector [d_primitive_type_ubyte]
+      = builtin->builtin_ubyte;
+    lai->primitive_type_vector [d_primitive_type_short]
+      = builtin->builtin_short;
+    lai->primitive_type_vector [d_primitive_type_ushort]
+      = builtin->builtin_ushort;
+    lai->primitive_type_vector [d_primitive_type_int]
+      = builtin->builtin_int;
+    lai->primitive_type_vector [d_primitive_type_uint]
+      = builtin->builtin_uint;
+    lai->primitive_type_vector [d_primitive_type_long]
+      = builtin->builtin_long;
+    lai->primitive_type_vector [d_primitive_type_ulong]
+      = builtin->builtin_ulong;
+    lai->primitive_type_vector [d_primitive_type_cent]
+      = builtin->builtin_cent;
+    lai->primitive_type_vector [d_primitive_type_ucent]
+      = builtin->builtin_ucent;
+    lai->primitive_type_vector [d_primitive_type_float]
+      = builtin->builtin_float;
+    lai->primitive_type_vector [d_primitive_type_double]
+      = builtin->builtin_double;
+    lai->primitive_type_vector [d_primitive_type_real]
+      = builtin->builtin_real;
+    lai->primitive_type_vector [d_primitive_type_ifloat]
+      = builtin->builtin_ifloat;
+    lai->primitive_type_vector [d_primitive_type_idouble]
+      = builtin->builtin_idouble;
+    lai->primitive_type_vector [d_primitive_type_ireal]
+      = builtin->builtin_ireal;
+    lai->primitive_type_vector [d_primitive_type_cfloat]
+      = builtin->builtin_cfloat;
+    lai->primitive_type_vector [d_primitive_type_cdouble]
+      = builtin->builtin_cdouble;
+    lai->primitive_type_vector [d_primitive_type_creal]
+      = builtin->builtin_creal;
+    lai->primitive_type_vector [d_primitive_type_char]
+      = builtin->builtin_char;
+    lai->primitive_type_vector [d_primitive_type_wchar]
+      = builtin->builtin_wchar;
+    lai->primitive_type_vector [d_primitive_type_dchar]
+      = builtin->builtin_dchar;
+
+    lai->bool_type_symbol = "bool";
+    lai->bool_type_default = builtin->builtin_bool;
+  }
 };
 
 /* Single instance of the D language class.  */
index 78959b1ec57f50bc8ba8ba4411f24d4409330921..1eeb5070deec1e2bf586f1b389d9657b1e8d016e 100644 (file)
@@ -165,44 +165,6 @@ enum f_primitive_types {
   nr_f_primitive_types
 };
 
-static void
-f_language_arch_info (struct gdbarch *gdbarch,
-                     struct language_arch_info *lai)
-{
-  const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
-
-  lai->string_char_type = builtin->builtin_character;
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_f_primitive_types + 1,
-                              struct type *);
-
-  lai->primitive_type_vector [f_primitive_type_character]
-    = builtin->builtin_character;
-  lai->primitive_type_vector [f_primitive_type_logical]
-    = builtin->builtin_logical;
-  lai->primitive_type_vector [f_primitive_type_logical_s1]
-    = builtin->builtin_logical_s1;
-  lai->primitive_type_vector [f_primitive_type_logical_s2]
-    = builtin->builtin_logical_s2;
-  lai->primitive_type_vector [f_primitive_type_logical_s8]
-    = builtin->builtin_logical_s8;
-  lai->primitive_type_vector [f_primitive_type_real]
-    = builtin->builtin_real;
-  lai->primitive_type_vector [f_primitive_type_real_s8]
-    = builtin->builtin_real_s8;
-  lai->primitive_type_vector [f_primitive_type_real_s16]
-    = builtin->builtin_real_s16;
-  lai->primitive_type_vector [f_primitive_type_complex_s8]
-    = builtin->builtin_complex_s8;
-  lai->primitive_type_vector [f_primitive_type_complex_s16]
-    = builtin->builtin_complex_s16;
-  lai->primitive_type_vector [f_primitive_type_void]
-    = builtin->builtin_void;
-
-  lai->bool_type_symbol = "logical";
-  lai->bool_type_default = builtin->builtin_logical_s2;
-}
-
 /* Remove the modules separator :: from the default break list.  */
 
 static const char *
@@ -670,7 +632,6 @@ extern const struct language_data f_language_data =
   1,                           /* String lower bound */
   f_word_break_characters,
   f_collect_symbol_completion_matches,
-  f_language_arch_info,
   c_watch_location_expression,
   cp_get_symbol_name_matcher,  /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -690,6 +651,44 @@ public:
   f_language ()
     : language_defn (language_fortran, f_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_f_type *builtin = builtin_f_type (gdbarch);
+
+    lai->string_char_type = builtin->builtin_character;
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_f_primitive_types + 1,
+                               struct type *);
+
+    lai->primitive_type_vector [f_primitive_type_character]
+      = builtin->builtin_character;
+    lai->primitive_type_vector [f_primitive_type_logical]
+      = builtin->builtin_logical;
+    lai->primitive_type_vector [f_primitive_type_logical_s1]
+      = builtin->builtin_logical_s1;
+    lai->primitive_type_vector [f_primitive_type_logical_s2]
+      = builtin->builtin_logical_s2;
+    lai->primitive_type_vector [f_primitive_type_logical_s8]
+      = builtin->builtin_logical_s8;
+    lai->primitive_type_vector [f_primitive_type_real]
+      = builtin->builtin_real;
+    lai->primitive_type_vector [f_primitive_type_real_s8]
+      = builtin->builtin_real_s8;
+    lai->primitive_type_vector [f_primitive_type_real_s16]
+      = builtin->builtin_real_s16;
+    lai->primitive_type_vector [f_primitive_type_complex_s8]
+      = builtin->builtin_complex_s8;
+    lai->primitive_type_vector [f_primitive_type_complex_s16]
+      = builtin->builtin_complex_s16;
+    lai->primitive_type_vector [f_primitive_type_void]
+      = builtin->builtin_void;
+
+    lai->bool_type_symbol = "logical";
+    lai->bool_type_default = builtin->builtin_logical_s2;
+  }
 };
 
 /* Single instance of the Fortran language class.  */
index 2d17ea0c405d7b389a8ee65f735cde94c4af9004..7340a334e66dc387d54c05ac77f3ba5fef107eee 100644 (file)
@@ -523,59 +523,6 @@ enum go_primitive_types {
   nr_go_primitive_types
 };
 
-static void
-go_language_arch_info (struct gdbarch *gdbarch,
-                      struct language_arch_info *lai)
-{
-  const struct builtin_go_type *builtin = builtin_go_type (gdbarch);
-
-  lai->string_char_type = builtin->builtin_char;
-
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_go_primitive_types + 1,
-                             struct type *);
-
-  lai->primitive_type_vector [go_primitive_type_void]
-    = builtin->builtin_void;
-  lai->primitive_type_vector [go_primitive_type_char]
-    = builtin->builtin_char;
-  lai->primitive_type_vector [go_primitive_type_bool]
-    = builtin->builtin_bool;
-  lai->primitive_type_vector [go_primitive_type_int]
-    = builtin->builtin_int;
-  lai->primitive_type_vector [go_primitive_type_uint]
-    = builtin->builtin_uint;
-  lai->primitive_type_vector [go_primitive_type_uintptr]
-    = builtin->builtin_uintptr;
-  lai->primitive_type_vector [go_primitive_type_int8]
-    = builtin->builtin_int8;
-  lai->primitive_type_vector [go_primitive_type_int16]
-    = builtin->builtin_int16;
-  lai->primitive_type_vector [go_primitive_type_int32]
-    = builtin->builtin_int32;
-  lai->primitive_type_vector [go_primitive_type_int64]
-    = builtin->builtin_int64;
-  lai->primitive_type_vector [go_primitive_type_uint8]
-    = builtin->builtin_uint8;
-  lai->primitive_type_vector [go_primitive_type_uint16]
-    = builtin->builtin_uint16;
-  lai->primitive_type_vector [go_primitive_type_uint32]
-    = builtin->builtin_uint32;
-  lai->primitive_type_vector [go_primitive_type_uint64]
-    = builtin->builtin_uint64;
-  lai->primitive_type_vector [go_primitive_type_float32]
-    = builtin->builtin_float32;
-  lai->primitive_type_vector [go_primitive_type_float64]
-    = builtin->builtin_float64;
-  lai->primitive_type_vector [go_primitive_type_complex64]
-    = builtin->builtin_complex64;
-  lai->primitive_type_vector [go_primitive_type_complex128]
-    = builtin->builtin_complex128;
-
-  lai->bool_type_symbol = "bool";
-  lai->bool_type_default = builtin->builtin_bool;
-}
-
 /* Constant data that describes the Go language.  */
 
 extern const struct language_data go_language_data =
@@ -613,7 +560,6 @@ extern const struct language_data go_language_data =
   0,                           /* String lower bound.  */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  go_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -633,6 +579,59 @@ public:
   go_language ()
     : language_defn (language_go, go_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_go_type *builtin = builtin_go_type (gdbarch);
+
+    lai->string_char_type = builtin->builtin_char;
+
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_go_primitive_types + 1,
+                               struct type *);
+
+    lai->primitive_type_vector [go_primitive_type_void]
+      = builtin->builtin_void;
+    lai->primitive_type_vector [go_primitive_type_char]
+      = builtin->builtin_char;
+    lai->primitive_type_vector [go_primitive_type_bool]
+      = builtin->builtin_bool;
+    lai->primitive_type_vector [go_primitive_type_int]
+      = builtin->builtin_int;
+    lai->primitive_type_vector [go_primitive_type_uint]
+      = builtin->builtin_uint;
+    lai->primitive_type_vector [go_primitive_type_uintptr]
+      = builtin->builtin_uintptr;
+    lai->primitive_type_vector [go_primitive_type_int8]
+      = builtin->builtin_int8;
+    lai->primitive_type_vector [go_primitive_type_int16]
+      = builtin->builtin_int16;
+    lai->primitive_type_vector [go_primitive_type_int32]
+      = builtin->builtin_int32;
+    lai->primitive_type_vector [go_primitive_type_int64]
+      = builtin->builtin_int64;
+    lai->primitive_type_vector [go_primitive_type_uint8]
+      = builtin->builtin_uint8;
+    lai->primitive_type_vector [go_primitive_type_uint16]
+      = builtin->builtin_uint16;
+    lai->primitive_type_vector [go_primitive_type_uint32]
+      = builtin->builtin_uint32;
+    lai->primitive_type_vector [go_primitive_type_uint64]
+      = builtin->builtin_uint64;
+    lai->primitive_type_vector [go_primitive_type_float32]
+      = builtin->builtin_float32;
+    lai->primitive_type_vector [go_primitive_type_float64]
+      = builtin->builtin_float64;
+    lai->primitive_type_vector [go_primitive_type_complex64]
+      = builtin->builtin_complex64;
+    lai->primitive_type_vector [go_primitive_type_complex128]
+      = builtin->builtin_complex128;
+
+    lai->bool_type_symbol = "bool";
+    lai->bool_type_default = builtin->builtin_bool;
+  }
 };
 
 /* Single instance of the Go language class.  */
index da99806413bec7bb07b8ecfdcc253d1dc7178b03..bc714ba85bd32cfa73a918f54d42cdfb2f467b9c 100644 (file)
@@ -837,7 +837,6 @@ extern const struct language_data unknown_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  unknown_language_arch_info,  /* la_language_arch_info.  */
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -857,6 +856,13 @@ public:
   unknown_language ()
     : language_defn (language_unknown, unknown_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    unknown_language_arch_info (gdbarch, lai);
+  }
 };
 
 /* Single instance of the unknown language class.  */
@@ -899,7 +905,6 @@ extern const struct language_data auto_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  unknown_language_arch_info,  /* la_language_arch_info.  */
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -919,6 +924,13 @@ public:
   auto_language ()
     : language_defn (language_auto, auto_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    unknown_language_arch_info (gdbarch, lai);
+  }
 };
 
 /* Single instance of the fake "auto" language.  */
@@ -944,11 +956,11 @@ language_gdbarch_post_init (struct gdbarch *gdbarch)
 
   l = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct language_gdbarch);
   for (const auto &lang : language_defn::languages)
-    if (lang != NULL && lang->la_language_arch_info != NULL)
-      {
-       lang->la_language_arch_info (gdbarch,
-                                    l->arch_info + lang->la_language);
-      }
+    {
+      gdb_assert (lang != nullptr);
+      lang->language_arch_info (gdbarch,
+                               l->arch_info + lang->la_language);
+    }
 
   return l;
 }
index cc0d0ffab832c6ca3edb0177a1196544f7913b37..4cf16c11540f88b9abba11f64703b2849399ea9f 100644 (file)
@@ -368,10 +368,6 @@ struct language_data
        const char *word,
        enum type_code code);
 
-    /* The per-architecture (OS/ABI) language information.  */
-    void (*la_language_arch_info) (struct gdbarch *,
-                                  struct language_arch_info *);
-
     /* Return an expression that can be used for a location
        watchpoint.  TYPE is a pointer type that points to the memory
        to watch, and ADDR is the address of the watched memory.  */
@@ -503,6 +499,11 @@ struct language_defn : language_data
     return {};
   }
 
+  /* The per-architecture (OS/ABI) language information.  */
+
+  virtual void language_arch_info (struct gdbarch *,
+                                  struct language_arch_info *) const = 0;
+
   /* List of all known languages.  */
   static const struct language_defn *languages[nr_languages];
 };
index ddc63a795222cb99427a9c57f7b39c51b4712bc4..16738e1b7e96d884efcb8fa8d02a1dbc5fd2aba5 100644 (file)
@@ -339,32 +339,6 @@ enum m2_primitive_types {
   nr_m2_primitive_types
 };
 
-static void
-m2_language_arch_info (struct gdbarch *gdbarch,
-                      struct language_arch_info *lai)
-{
-  const struct builtin_m2_type *builtin = builtin_m2_type (gdbarch);
-
-  lai->string_char_type = builtin->builtin_char;
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_m2_primitive_types + 1,
-                              struct type *);
-
-  lai->primitive_type_vector [m2_primitive_type_char]
-    = builtin->builtin_char;
-  lai->primitive_type_vector [m2_primitive_type_int]
-    = builtin->builtin_int;
-  lai->primitive_type_vector [m2_primitive_type_card]
-    = builtin->builtin_card;
-  lai->primitive_type_vector [m2_primitive_type_real]
-    = builtin->builtin_real;
-  lai->primitive_type_vector [m2_primitive_type_bool]
-    = builtin->builtin_bool;
-
-  lai->bool_type_symbol = "BOOLEAN";
-  lai->bool_type_default = builtin->builtin_bool;
-}
-
 const struct exp_descriptor exp_descriptor_modula2 = 
 {
   print_subexp_standard,
@@ -411,7 +385,6 @@ extern const struct language_data m2_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  m2_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -431,6 +404,32 @@ public:
   m2_language ()
     : language_defn (language_m2, m2_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_m2_type *builtin = builtin_m2_type (gdbarch);
+
+    lai->string_char_type = builtin->builtin_char;
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_m2_primitive_types + 1,
+                               struct type *);
+
+    lai->primitive_type_vector [m2_primitive_type_char]
+      = builtin->builtin_char;
+    lai->primitive_type_vector [m2_primitive_type_int]
+      = builtin->builtin_int;
+    lai->primitive_type_vector [m2_primitive_type_card]
+      = builtin->builtin_card;
+    lai->primitive_type_vector [m2_primitive_type_real]
+      = builtin->builtin_real;
+    lai->primitive_type_vector [m2_primitive_type_bool]
+      = builtin->builtin_bool;
+
+    lai->bool_type_symbol = "BOOLEAN";
+    lai->bool_type_default = builtin->builtin_bool;
+  }
 };
 
 /* Single instance of the M2 language.  */
index cf5b91b3388580fad27768ccf557db5cfd86d891..87e5e681ec432ffb6797c6561f654f706defc10f 100644 (file)
@@ -400,7 +400,6 @@ extern const struct language_data objc_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  c_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -420,6 +419,13 @@ public:
   objc_language ()
     : language_defn (language_objc, objc_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    c_language_arch_info (gdbarch, lai);
+  }
 };
 
 /* Single instance of the class representing the Objective-C language.  */
index d7476f7d285a10ddbd9d7556838be0601dfce1d7..e8e5e8e04e33c75e183da7a4eabb7933f0b0edb3 100644 (file)
@@ -1015,23 +1015,6 @@ opencl_print_type (struct type *type, const char *varstring,
   c_print_type (type, varstring, stream, show, level, flags); 
 }
 
-static void
-opencl_language_arch_info (struct gdbarch *gdbarch,
-                          struct language_arch_info *lai)
-{
-  struct type **types = builtin_opencl_type (gdbarch);
-
-  /* Copy primitive types vector from gdbarch.  */
-  lai->primitive_type_vector = types;
-
-  /* Type of elements of strings.  */
-  lai->string_char_type = types [opencl_primitive_type_char];
-
-  /* Specifies the return type of logical and relational operations.  */
-  lai->bool_type_symbol = "int";
-  lai->bool_type_default = types [opencl_primitive_type_int];
-}
-
 const struct exp_descriptor exp_descriptor_opencl =
 {
   print_subexp_standard,
@@ -1077,7 +1060,6 @@ extern const struct language_data opencl_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  opencl_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -1097,6 +1079,23 @@ public:
   opencl_language ()
     : language_defn (language_opencl, opencl_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    struct type **types = builtin_opencl_type (gdbarch);
+
+    /* Copy primitive types vector from gdbarch.  */
+    lai->primitive_type_vector = types;
+
+    /* Type of elements of strings.  */
+    lai->string_char_type = types [opencl_primitive_type_char];
+
+    /* Specifies the return type of logical and relational operations.  */
+    lai->bool_type_symbol = "int";
+    lai->bool_type_default = types [opencl_primitive_type_int];
+  }
 };
 
 /* Single instance of the OpenCL language class.  */
index 4a668b1727858c9432636b6a547b60678035ee11..4c13867446b3a05e139e6f881ac36768523ee4ca 100644 (file)
@@ -375,55 +375,6 @@ enum pascal_primitive_types {
   nr_pascal_primitive_types
 };
 
-static void
-pascal_language_arch_info (struct gdbarch *gdbarch,
-                          struct language_arch_info *lai)
-{
-  const struct builtin_type *builtin = builtin_type (gdbarch);
-
-  lai->string_char_type = builtin->builtin_char;
-  lai->primitive_type_vector
-    = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_pascal_primitive_types + 1,
-                              struct type *);
-  lai->primitive_type_vector [pascal_primitive_type_int]
-    = builtin->builtin_int;
-  lai->primitive_type_vector [pascal_primitive_type_long]
-    = builtin->builtin_long;
-  lai->primitive_type_vector [pascal_primitive_type_short]
-    = builtin->builtin_short;
-  lai->primitive_type_vector [pascal_primitive_type_char]
-    = builtin->builtin_char;
-  lai->primitive_type_vector [pascal_primitive_type_float]
-    = builtin->builtin_float;
-  lai->primitive_type_vector [pascal_primitive_type_double]
-    = builtin->builtin_double;
-  lai->primitive_type_vector [pascal_primitive_type_void]
-    = builtin->builtin_void;
-  lai->primitive_type_vector [pascal_primitive_type_long_long]
-    = builtin->builtin_long_long;
-  lai->primitive_type_vector [pascal_primitive_type_signed_char]
-    = builtin->builtin_signed_char;
-  lai->primitive_type_vector [pascal_primitive_type_unsigned_char]
-    = builtin->builtin_unsigned_char;
-  lai->primitive_type_vector [pascal_primitive_type_unsigned_short]
-    = builtin->builtin_unsigned_short;
-  lai->primitive_type_vector [pascal_primitive_type_unsigned_int]
-    = builtin->builtin_unsigned_int;
-  lai->primitive_type_vector [pascal_primitive_type_unsigned_long]
-    = builtin->builtin_unsigned_long;
-  lai->primitive_type_vector [pascal_primitive_type_unsigned_long_long]
-    = builtin->builtin_unsigned_long_long;
-  lai->primitive_type_vector [pascal_primitive_type_long_double]
-    = builtin->builtin_long_double;
-  lai->primitive_type_vector [pascal_primitive_type_complex]
-    = builtin->builtin_complex;
-  lai->primitive_type_vector [pascal_primitive_type_double_complex]
-    = builtin->builtin_double_complex;
-
-  lai->bool_type_symbol = "boolean";
-  lai->bool_type_default = builtin->builtin_bool;
-}
-
 static const char *p_extensions[] =
 {
   ".pas", ".p", ".pp", NULL
@@ -464,7 +415,6 @@ extern const struct language_data pascal_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  pascal_language_arch_info,
   c_watch_location_expression,
   NULL,                                /* la_compare_symbol_for_completion */
   iterate_over_symbols,
@@ -484,6 +434,55 @@ public:
   pascal_language ()
     : language_defn (language_pascal, pascal_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_type *builtin = builtin_type (gdbarch);
+
+    lai->string_char_type = builtin->builtin_char;
+    lai->primitive_type_vector
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_pascal_primitive_types + 1,
+                              struct type *);
+    lai->primitive_type_vector [pascal_primitive_type_int]
+      = builtin->builtin_int;
+    lai->primitive_type_vector [pascal_primitive_type_long]
+      = builtin->builtin_long;
+    lai->primitive_type_vector [pascal_primitive_type_short]
+      = builtin->builtin_short;
+    lai->primitive_type_vector [pascal_primitive_type_char]
+      = builtin->builtin_char;
+    lai->primitive_type_vector [pascal_primitive_type_float]
+      = builtin->builtin_float;
+    lai->primitive_type_vector [pascal_primitive_type_double]
+      = builtin->builtin_double;
+    lai->primitive_type_vector [pascal_primitive_type_void]
+      = builtin->builtin_void;
+    lai->primitive_type_vector [pascal_primitive_type_long_long]
+      = builtin->builtin_long_long;
+    lai->primitive_type_vector [pascal_primitive_type_signed_char]
+      = builtin->builtin_signed_char;
+    lai->primitive_type_vector [pascal_primitive_type_unsigned_char]
+      = builtin->builtin_unsigned_char;
+    lai->primitive_type_vector [pascal_primitive_type_unsigned_short]
+      = builtin->builtin_unsigned_short;
+    lai->primitive_type_vector [pascal_primitive_type_unsigned_int]
+      = builtin->builtin_unsigned_int;
+    lai->primitive_type_vector [pascal_primitive_type_unsigned_long]
+      = builtin->builtin_unsigned_long;
+    lai->primitive_type_vector [pascal_primitive_type_unsigned_long_long]
+      = builtin->builtin_unsigned_long_long;
+    lai->primitive_type_vector [pascal_primitive_type_long_double]
+      = builtin->builtin_long_double;
+    lai->primitive_type_vector [pascal_primitive_type_complex]
+      = builtin->builtin_complex;
+    lai->primitive_type_vector [pascal_primitive_type_double_complex]
+      = builtin->builtin_double_complex;
+
+    lai->bool_type_symbol = "boolean";
+    lai->bool_type_default = builtin->builtin_bool;
+  }
 };
 
 /* Single instance of the Pascal language class.  */
index 3fdf566736109debc88e76a53da9ddb5c043e799..dd8558a3fc8a883f4d2c5892c1ed0da59370a30a 100644 (file)
@@ -1066,51 +1066,6 @@ enum rust_primitive_types
   nr_rust_primitive_types
 };
 
-/* la_language_arch_info implementation for Rust.  */
-
-static void
-rust_language_arch_info (struct gdbarch *gdbarch,
-                        struct language_arch_info *lai)
-{
-  const struct builtin_type *builtin = builtin_type (gdbarch);
-  struct type *tem;
-  struct type **types;
-  unsigned int length;
-
-  types = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_rust_primitive_types + 1,
-                                 struct type *);
-
-  types[rust_primitive_bool] = arch_boolean_type (gdbarch, 8, 1, "bool");
-  types[rust_primitive_char] = arch_character_type (gdbarch, 32, 1, "char");
-  types[rust_primitive_i8] = arch_integer_type (gdbarch, 8, 0, "i8");
-  types[rust_primitive_u8] = arch_integer_type (gdbarch, 8, 1, "u8");
-  types[rust_primitive_i16] = arch_integer_type (gdbarch, 16, 0, "i16");
-  types[rust_primitive_u16] = arch_integer_type (gdbarch, 16, 1, "u16");
-  types[rust_primitive_i32] = arch_integer_type (gdbarch, 32, 0, "i32");
-  types[rust_primitive_u32] = arch_integer_type (gdbarch, 32, 1, "u32");
-  types[rust_primitive_i64] = arch_integer_type (gdbarch, 64, 0, "i64");
-  types[rust_primitive_u64] = arch_integer_type (gdbarch, 64, 1, "u64");
-
-  length = 8 * TYPE_LENGTH (builtin->builtin_data_ptr);
-  types[rust_primitive_isize] = arch_integer_type (gdbarch, length, 0, "isize");
-  types[rust_primitive_usize] = arch_integer_type (gdbarch, length, 1, "usize");
-
-  types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32",
-                                              floatformats_ieee_single);
-  types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64",
-                                              floatformats_ieee_double);
-
-  types[rust_primitive_unit] = arch_integer_type (gdbarch, 0, 1, "()");
-
-  tem = make_cv_type (1, 0, types[rust_primitive_u8], NULL);
-  types[rust_primitive_str] = rust_slice_type ("&str", tem,
-                                              types[rust_primitive_usize]);
-
-  lai->primitive_type_vector = types;
-  lai->bool_type_default = types[rust_primitive_bool];
-  lai->string_char_type = types[rust_primitive_u8];
-}
-
 \f
 
 /* A helper for rust_evaluate_subexp that handles OP_FUNCALL.  */
@@ -2137,7 +2092,6 @@ extern const struct language_data rust_language_data =
   0,                           /* String lower bound */
   default_word_break_characters,
   default_collect_symbol_completion_matches,
-  rust_language_arch_info,
   rust_watch_location_expression,
   NULL,                                /* la_get_symbol_name_matcher */
   iterate_over_symbols,
@@ -2157,6 +2111,47 @@ public:
   rust_language ()
     : language_defn (language_rust, rust_language_data)
   { /* Nothing.  */ }
+
+  /* See language.h.  */
+  void language_arch_info (struct gdbarch *gdbarch,
+                          struct language_arch_info *lai) const override
+  {
+    const struct builtin_type *builtin = builtin_type (gdbarch);
+
+    struct type **types
+      = GDBARCH_OBSTACK_CALLOC (gdbarch, nr_rust_primitive_types + 1,
+                               struct type *);
+
+    types[rust_primitive_bool] = arch_boolean_type (gdbarch, 8, 1, "bool");
+    types[rust_primitive_char] = arch_character_type (gdbarch, 32, 1, "char");
+    types[rust_primitive_i8] = arch_integer_type (gdbarch, 8, 0, "i8");
+    types[rust_primitive_u8] = arch_integer_type (gdbarch, 8, 1, "u8");
+    types[rust_primitive_i16] = arch_integer_type (gdbarch, 16, 0, "i16");
+    types[rust_primitive_u16] = arch_integer_type (gdbarch, 16, 1, "u16");
+    types[rust_primitive_i32] = arch_integer_type (gdbarch, 32, 0, "i32");
+    types[rust_primitive_u32] = arch_integer_type (gdbarch, 32, 1, "u32");
+    types[rust_primitive_i64] = arch_integer_type (gdbarch, 64, 0, "i64");
+    types[rust_primitive_u64] = arch_integer_type (gdbarch, 64, 1, "u64");
+
+    unsigned int length = 8 * TYPE_LENGTH (builtin->builtin_data_ptr);
+    types[rust_primitive_isize] = arch_integer_type (gdbarch, length, 0, "isize");
+    types[rust_primitive_usize] = arch_integer_type (gdbarch, length, 1, "usize");
+
+    types[rust_primitive_f32] = arch_float_type (gdbarch, 32, "f32",
+                                                floatformats_ieee_single);
+    types[rust_primitive_f64] = arch_float_type (gdbarch, 64, "f64",
+                                                floatformats_ieee_double);
+
+    types[rust_primitive_unit] = arch_integer_type (gdbarch, 0, 1, "()");
+
+    struct type *tem = make_cv_type (1, 0, types[rust_primitive_u8], NULL);
+    types[rust_primitive_str] = rust_slice_type ("&str", tem,
+                                                types[rust_primitive_usize]);
+
+    lai->primitive_type_vector = types;
+    lai->bool_type_default = types[rust_primitive_bool];
+    lai->string_char_type = types[rust_primitive_u8];
+  }
 };
 
 /* Single instance of the Rust language class.  */