diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-05-01 21:51:15 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-02 13:53:10 +0100 |
commit | 1fb314aaa3142711e452e66c2dced781a4d1ef87 (patch) | |
tree | ce4f8ed92b2c79139a274e51c53d782a3682fb05 /gdb/rust-lang.c | |
parent | 48448202d7e607d7423c6186438099f442732a95 (diff) | |
download | gdb-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/rust-lang.c')
-rw-r--r-- | gdb/rust-lang.c | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 3fdf566..dd8558a 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -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]; -} - /* 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. */ |