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  <tom@tromey.com>

	* 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.
This commit is contained in:
Tom Tromey
2018-11-24 09:58:20 -07:00
parent d5da8b3c0d
commit 8b31193aa9
5 changed files with 111 additions and 92 deletions

View File

@ -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, "<<C++-namespaces>>") == 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, "<<C++-namespaces>>") == 0)))
{
current_source_pspace = current_program_space;
current_source_symtab = symtab;
}
}
}
}