From 8b31193aa9752ba60d63cedaba943370d76ce543 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 24 Nov 2018 09:58:20 -0700 Subject: Remove ALL_OBJFILES and ALL_FILETABS This removes the ALL_OBJFILES and ALL_FILETABS macros, replacing them with ranged for loops. gdb/ChangeLog 2019-01-09 Tom Tromey * symtab.c (find_line_symtab, info_sources_command) (make_source_files_completion_list): Use objfile_compunits. * source.c (select_source_symtab): Use objfile_compunits. * objfiles.h (struct objfile): Update comment. (ALL_OBJFILES): Remove. (ALL_FILETABS): Remove. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Use objfile_compunits. --- gdb/source.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'gdb/source.c') diff --git a/gdb/source.c b/gdb/source.c index 14dda01..abe4c6c 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -238,8 +238,6 @@ clear_current_source_symtab_and_line (void) void select_source_symtab (struct symtab *s) { - struct objfile *ofp; - if (s) { current_source_symtab = s; @@ -271,16 +269,22 @@ select_source_symtab (struct symtab *s) current_source_line = 1; - ALL_FILETABS (ofp, cu, symtab) + for (objfile *ofp : all_objfiles (current_program_space)) { - const char *name = symtab->filename; - int len = strlen (name); - - if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 - || strcmp (name, "<>") == 0))) + for (compunit_symtab *cu : objfile_compunits (ofp)) { - current_source_pspace = current_program_space; - current_source_symtab = symtab; + for (symtab *symtab : compunit_filetabs (cu)) + { + const char *name = symtab->filename; + int len = strlen (name); + + if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0 + || strcmp (name, "<>") == 0))) + { + current_source_pspace = current_program_space; + current_source_symtab = symtab; + } + } } } -- cgit v1.1