diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-09-21 11:05:21 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-09-21 11:05:21 -0400 |
commit | df86565b31bf12aab6fdceade49169bc6f378b13 (patch) | |
tree | 76d5944661919552ce4ea01ac49188e151d72fa7 /gdb/compile | |
parent | b6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02 (diff) | |
download | gdb-df86565b31bf12aab6fdceade49169bc6f378b13.zip gdb-df86565b31bf12aab6fdceade49169bc6f378b13.tar.gz gdb-df86565b31bf12aab6fdceade49169bc6f378b13.tar.bz2 |
gdb: remove TYPE_LENGTH
Remove the macro, replace all uses with calls to type::length.
Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
Diffstat (limited to 'gdb/compile')
-rw-r--r-- | gdb/compile/compile-c-support.c | 4 | ||||
-rw-r--r-- | gdb/compile/compile-c-types.c | 16 | ||||
-rw-r--r-- | gdb/compile/compile-cplus-types.c | 12 | ||||
-rw-r--r-- | gdb/compile/compile-object-load.c | 14 |
4 files changed, 23 insertions, 23 deletions
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c index 81356f0..19fcf00 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -252,7 +252,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, case TYPE_CODE_INT: { const char *mode - = c_get_mode_for_size (TYPE_LENGTH (regtype)); + = c_get_mode_for_size (regtype->length ()); if (mode != NULL) { @@ -275,7 +275,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, " __attribute__((__aligned__(" "__BIGGEST_ALIGNMENT__)))", regname.c_str (), - pulongest (TYPE_LENGTH (regtype))); + pulongest (regtype->length ())); } gdb_puts (";\n", stream); } diff --git a/gdb/compile/compile-c-types.c b/gdb/compile/compile-c-types.c index d92bd20..5cfbecc 100644 --- a/gdb/compile/compile-c-types.c +++ b/gdb/compile/compile-c-types.c @@ -110,7 +110,7 @@ convert_struct_or_union (compile_c_instance *context, struct type *type) field_type = context->convert_type (type->field (i).type ()); if (bitsize == 0) - bitsize = 8 * TYPE_LENGTH (type->field (i).type ()); + bitsize = 8 * type->field (i).type ()->length (); context->plugin ().build_add_field (result, type->field (i).name (), field_type, @@ -118,7 +118,7 @@ convert_struct_or_union (compile_c_instance *context, struct type *type) type->field (i).loc_bitpos ()); } - context->plugin ().finish_record_or_union (result, TYPE_LENGTH (type)); + context->plugin ().finish_record_or_union (result, type->length ()); return result; } @@ -131,7 +131,7 @@ convert_enum (compile_c_instance *context, struct type *type) int i; int_type = context->plugin ().int_type_v0 (type->is_unsigned (), - TYPE_LENGTH (type)); + type->length ()); result = context->plugin ().build_enum_type (int_type); for (i = 0; i < type->num_fields (); ++i) @@ -196,16 +196,16 @@ convert_int (compile_c_instance *context, struct type *type) { if (type->has_no_signedness ()) { - gdb_assert (TYPE_LENGTH (type) == 1); + gdb_assert (type->length () == 1); return context->plugin ().char_type (); } return context->plugin ().int_type (type->is_unsigned (), - TYPE_LENGTH (type), + type->length (), type->name ()); } else return context->plugin ().int_type_v0 (type->is_unsigned (), - TYPE_LENGTH (type)); + type->length ()); } /* Convert a floating-point type to its gcc representation. */ @@ -214,10 +214,10 @@ static gcc_type convert_float (compile_c_instance *context, struct type *type) { if (context->plugin ().version () >= GCC_C_FE_VERSION_1) - return context->plugin ().float_type (TYPE_LENGTH (type), + return context->plugin ().float_type (type->length (), type->name ()); else - return context->plugin ().float_type_v0 (TYPE_LENGTH (type)); + return context->plugin ().float_type_v0 (type->length ()); } /* Convert the 'void' type to its gcc representation. */ diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 6f666e2..245345d 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -648,7 +648,7 @@ compile_cplus_convert_struct_or_union_members | get_field_access_flag (type, i); if (bitsize == 0) - bitsize = 8 * TYPE_LENGTH (type->field (i).type ()); + bitsize = 8 * type->field (i).type ()->length (); instance->plugin ().build_field (field_name, field_type, field_flags, bitsize, @@ -891,7 +891,7 @@ compile_cplus_convert_struct_or_union (compile_cplus_instance *instance, compile_cplus_convert_struct_or_union_members (instance, type, result); /* All finished. */ - instance->plugin ().finish_class_type (name.get (), TYPE_LENGTH (type)); + instance->plugin ().finish_class_type (name.get (), type->length ()); /* Pop all scopes. */ instance->leave_scope (); @@ -926,7 +926,7 @@ compile_cplus_convert_enum (compile_cplus_instance *instance, struct type *type, gcc_type int_type = instance->plugin ().get_int_type (type->is_unsigned (), - TYPE_LENGTH (type), nullptr); + type->length (), nullptr); gcc_type result = instance->plugin ().start_enum_type (name.get (), int_type, GCC_CP_SYMBOL_ENUM | nested_access @@ -1012,12 +1012,12 @@ compile_cplus_convert_int (compile_cplus_instance *instance, struct type *type) { if (type->has_no_signedness ()) { - gdb_assert (TYPE_LENGTH (type) == 1); + gdb_assert (type->length () == 1); return instance->plugin ().get_char_type (); } return instance->plugin ().get_int_type - (type->is_unsigned (), TYPE_LENGTH (type), type->name ()); + (type->is_unsigned (), type->length (), type->name ()); } /* Convert a floating-point type to its gcc representation. */ @@ -1027,7 +1027,7 @@ compile_cplus_convert_float (compile_cplus_instance *instance, struct type *type) { return instance->plugin ().get_float_type - (TYPE_LENGTH (type), type->name ()); + (type->length (), type->name ()); } /* Convert the 'void' type to its gcc representation. */ diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index aede3bc..f3573cb 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -557,7 +557,7 @@ store_regs (struct type *regs_type, CORE_ADDR regs_base) ULONGEST reg_offset; struct type *reg_type = check_typedef (regs_type->field (fieldno).type ()); - ULONGEST reg_size = TYPE_LENGTH (reg_type); + ULONGEST reg_size = reg_type->length (); int regnum; struct value *regval; CORE_ADDR inferior_addr; @@ -806,15 +806,15 @@ compile_object_load (const compile_file_names &file_names, { /* Use read-only non-executable memory protection. */ regs_addr = gdbarch_infcall_mmap (target_gdbarch (), - TYPE_LENGTH (regs_type), + regs_type->length (), GDB_MMAP_PROT_READ); gdb_assert (regs_addr != 0); - setup_sections_data.munmap_list.add (regs_addr, TYPE_LENGTH (regs_type)); + setup_sections_data.munmap_list.add (regs_addr, regs_type->length ()); if (compile_debug) gdb_printf (gdb_stdlog, "allocated %s bytes at %s for registers\n", paddress (target_gdbarch (), - TYPE_LENGTH (regs_type)), + regs_type->length ()), paddress (target_gdbarch (), regs_addr)); store_regs (regs_type, regs_addr); } @@ -827,17 +827,17 @@ compile_object_load (const compile_file_names &file_names, return NULL; check_typedef (out_value_type); out_value_addr = gdbarch_infcall_mmap (target_gdbarch (), - TYPE_LENGTH (out_value_type), + out_value_type->length (), (GDB_MMAP_PROT_READ | GDB_MMAP_PROT_WRITE)); gdb_assert (out_value_addr != 0); setup_sections_data.munmap_list.add (out_value_addr, - TYPE_LENGTH (out_value_type)); + out_value_type->length ()); if (compile_debug) gdb_printf (gdb_stdlog, "allocated %s bytes at %s for printed value\n", paddress (target_gdbarch (), - TYPE_LENGTH (out_value_type)), + out_value_type->length ()), paddress (target_gdbarch (), out_value_addr)); } |