Move ptype/o printing code to typeprint.c
authorTom Tromey <tom@tromey.com>
Fri, 8 Jun 2018 18:43:47 +0000 (12:43 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 26 Jun 2018 20:53:17 +0000 (14:53 -0600)
commite0c547d14ae1d5c06b59178f4b1dd1f5e08b3feb
tree73fa0692198325dad0d96ddd3dae9ebd694df78c
parent30aa13067f70ba1d11c35d13be753118c457842c
Move ptype/o printing code to typeprint.c

This moves the hole-printing support code for ptype/o from
c-typeprint.c to be methods on print_offset_data.  This allows the
code to be used from non-C languages.

gdb/ChangeLog
2018-06-26  Tom Tromey  <tom@tromey.com>

* typeprint.h (struct print_offset_data) <update, finish,
maybe_print_hole>: New methods.
<indentation>: New constant.
* typeprint.c (print_offset_data::indentation): Define.
(print_offset_data::maybe_print_hole, print_offset_data::update)
(print_offset_data::finish): Move from c-typeprint.c and rename.
* c-typeprint.c (OFFSET_SPC_LEN): Remove.
(print_spaces_filtered_with_print_options): Update.
(c_print_type_union_field_offset, maybe_print_hole)
(c_print_type_struct_field_offset): Move to typeprint.c and
rename.
(c_type_print_base_struct_union): Update.
gdb/ChangeLog
gdb/c-typeprint.c
gdb/typeprint.c
gdb/typeprint.h