On Wed, 2023-08-09 at 18:14 -0400, Lewis Hyatt wrote: > Add selftests for the new capabilities in input.cc related to source code > locations that are stored in memory rather than ordinary files. > > gcc/ChangeLog: > > * input.cc (temp_source_file::do_linemap_add): New function. > (line_table_case::line_table_case): Add GENERATED_DATA argument. > (line_table_test::line_table_test): Implement new M_GENERATED_DATA > argument. > (for_each_line_table_case): Optionally include generated data > locations in the set of cases. > (test_accessing_ordinary_linemaps): Test generated data locations. > (test_make_location_nonpure_range_endpoints): Likewise. > (test_line_offset_overflow): Likewise. > (input_cc_tests): Likewise. > * selftest.cc (named_temp_file::named_temp_file): Interpret a null > SUFFIX argument as a request to use in-memory data. > (named_temp_file::~named_temp_file): Support in-memory data. > (temp_source_file::temp_source_file): Likewise. > (temp_source_file::~temp_source_file): Likewise. > * selftest.h (struct line_map_ordinary): Foward declare. > (class named_temp_file): Add missing explicit to the constructor. > (class temp_source_file): Add new members to support in-memory data. > (class line_table_test): Likewise. > (for_each_line_table_case): Adjust prototype. > --- > gcc/input.cc | 81 +++++++++++++++++++++++++++++++++---------------- > gcc/selftest.cc | 53 +++++++++++++++++++++++++------- > gcc/selftest.h | 19 ++++++++++-- > 3 files changed, 113 insertions(+), 40 deletions(-) >
Thanks; looks good to me. Dave