aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-lang.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-05-01 21:51:15 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-02 13:53:10 +0100
commit1fb314aaa3142711e452e66c2dced781a4d1ef87 (patch)
treece4f8ed92b2c79139a274e51c53d782a3682fb05 /gdb/c-lang.c
parent48448202d7e607d7423c6186438099f442732a95 (diff)
downloadgdb-1fb314aaa3142711e452e66c2dced781a4d1ef87.zip
gdb-1fb314aaa3142711e452e66c2dced781a4d1ef87.tar.gz
gdb-1fb314aaa3142711e452e66c2dced781a4d1ef87.tar.bz2
gdb: Convert language la_language_arch_info field to a method
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.
Diffstat (limited to 'gdb/c-lang.c')
-rw-r--r--gdb/c-lang.c153
1 files changed, 86 insertions, 67 deletions
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 9efcf56..e82d058 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -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. */