]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove ALL_OBJFILE_FILETABS
authorTom Tromey <tom@tromey.com>
Sat, 24 Nov 2018 16:51:44 +0000 (09:51 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 10 Jan 2019 01:28:15 +0000 (18:28 -0700)
This removes ALL_OBJFILE_FILETABS, replacing its uses with ranged for
loops.

gdb/ChangeLog
2019-01-09  Tom Tromey  <tom@tromey.com>

* symmisc.c (print_objfile_statistics, dump_objfile)
(maintenance_print_symbols): Use compunit_filetabs.
* source.c (forget_cached_source_info_for_objfile): Use
compunit_filetabs.
* objfiles.h (ALL_OBJFILE_FILETABS): Remove.
(ALL_FILETABS): Use compunit_filetabs.
* objfiles.c (objfile_relocate1): Use compunit_filetabs.
* coffread.c (coff_symtab_read): Use compunit_filetabs.

gdb/ChangeLog
gdb/coffread.c
gdb/objfiles.c
gdb/objfiles.h
gdb/source.c
gdb/symmisc.c

index eb6c3a833018736da541b965c910fedc99a379c6..d07f2c10fcc64ef74800d772bfb3a7626f5282cb 100644 (file)
@@ -1,3 +1,14 @@
+2019-01-09  Tom Tromey  <tom@tromey.com>
+
+       * symmisc.c (print_objfile_statistics, dump_objfile)
+       (maintenance_print_symbols): Use compunit_filetabs.
+       * source.c (forget_cached_source_info_for_objfile): Use
+       compunit_filetabs.
+       * objfiles.h (ALL_OBJFILE_FILETABS): Remove.
+       (ALL_FILETABS): Use compunit_filetabs.
+       * objfiles.c (objfile_relocate1): Use compunit_filetabs.
+       * coffread.c (coff_symtab_read): Use compunit_filetabs.
+
 2019-01-09  Tom Tromey  <tom@tromey.com>
 
        * symtab.h (ALL_COMPUNIT_FILETABS): Remove.
index 611febe8e583cd899fa99846b6ed4ff46aa113a4..4f05295712220461d647e01600dfab162e85378d 100644 (file)
@@ -1203,8 +1203,11 @@ coff_symtab_read (minimal_symbol_reader &reader,
   /* Patch up any opaque types (references to types that are not defined
      in the file where they are referenced, e.g. "struct foo *bar").  */
   {
-    ALL_OBJFILE_FILETABS (objfile, cu, s)
-      patch_opaque_types (s);
+    for (compunit_symtab *cu : objfile_compunits (objfile))
+      {
+       for (symtab *s : compunit_filetabs (cu))
+         patch_opaque_types (s);
+      }
   }
 
   coffread_objfile = NULL;
index 659998a565e52921d6d3e2a49e85df0d024428d1..75e041ece7fd5d8f33d92a16c833cd58dfda7b4e 100644 (file)
@@ -788,20 +788,23 @@ objfile_relocate1 (struct objfile *objfile,
 
   /* OK, get all the symtabs.  */
   {
-    ALL_OBJFILE_FILETABS (objfile, cust, s)
-    {
-      struct linetable *l;
+    for (compunit_symtab *cust : objfile_compunits (objfile))
+      {
+       for (symtab *s : compunit_filetabs (cust))
+         {
+           struct linetable *l;
 
-      /* First the line table.  */
-      l = SYMTAB_LINETABLE (s);
-      if (l)
-       {
-         for (int i = 0; i < l->nitems; ++i)
-           l->item[i].pc += ANOFFSET (delta,
-                                      COMPUNIT_BLOCK_LINE_SECTION
-                                        (cust));
-       }
-    }
+           /* First the line table.  */
+           l = SYMTAB_LINETABLE (s);
+           if (l)
+             {
+               for (int i = 0; i < l->nitems; ++i)
+                 l->item[i].pc += ANOFFSET (delta,
+                                            COMPUNIT_BLOCK_LINE_SECTION
+                                            (cust));
+             }
+         }
+      }
 
     for (compunit_symtab *cust : objfile_compunits (objfile))
       {
index d6a7064c5e26c7798387de6744b61fd8154ab8bc..33acb20e7a18d690c9b5a4813723478f5fea5f73 100644 (file)
@@ -612,12 +612,6 @@ public:
        (obj) != NULL;                              \
        (obj) = (obj)->next)
 
-/* Traverse all symtabs in one objfile.  */
-
-#define ALL_OBJFILE_FILETABS(objfile, cu, s) \
-  for (compunit_symtab *cu : objfile_compunits (objfile)) \
-    for (symtab *s : compunit_filetabs (cu))
-
 /* A range adapter that makes it possible to iterate over all
    compunits in one objfile.  */
 
@@ -714,9 +708,10 @@ private:
 /* Traverse all symtabs in all objfiles in the current symbol
    space.  */
 
-#define ALL_FILETABS(objfile, ps, s)           \
-  ALL_OBJFILES (objfile)                       \
-    ALL_OBJFILE_FILETABS (objfile, ps, s)
+#define ALL_FILETABS(objfile, ps, s)                                   \
+  ALL_OBJFILES (objfile)                                               \
+    for (compunit_symtab *ps : objfile_compunits (objfile))    \
+      for (symtab *s : compunit_filetabs (cu))
 
 #define ALL_OBJFILE_OSECTIONS(objfile, osect)  \
   for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
index ed0ff4c510fc5c90b73268b8301c8ec71c7a5afd..14dda01cb0164cf1644c5fd57c38decd381e6c82 100644 (file)
@@ -349,17 +349,20 @@ show_directories_command (struct ui_file *file, int from_tty,
 void
 forget_cached_source_info_for_objfile (struct objfile *objfile)
 {
-  ALL_OBJFILE_FILETABS (objfile, cu, s)
+  for (compunit_symtab *cu : objfile_compunits (objfile))
     {
-      if (s->line_charpos != NULL)
+      for (symtab *s : compunit_filetabs (cu))
        {
-         xfree (s->line_charpos);
-         s->line_charpos = NULL;
-       }
-      if (s->fullname != NULL)
-       {
-         xfree (s->fullname);
-         s->fullname = NULL;
+         if (s->line_charpos != NULL)
+           {
+             xfree (s->line_charpos);
+             s->line_charpos = NULL;
+           }
+         if (s->fullname != NULL)
+           {
+             xfree (s->fullname);
+             s->fullname = NULL;
+           }
        }
     }
 
index f067292f9dd485576ce72662520b401380d28a3c..23d232ca97dba91a0732d3ec11881b34e0c618d3 100644 (file)
@@ -107,11 +107,14 @@ print_objfile_statistics (void)
       if (objfile->sf)
        objfile->sf->qf->print_stats (objfile);
       i = linetables = 0;
-      ALL_OBJFILE_FILETABS (objfile, cu, s)
+      for (compunit_symtab *cu : objfile_compunits (objfile))
        {
-         i++;
-         if (SYMTAB_LINETABLE (s) != NULL)
-           linetables++;
+         for (symtab *s : compunit_filetabs (cu))
+           {
+             i++;
+             if (SYMTAB_LINETABLE (s) != NULL)
+               linetables++;
+           }
        }
       blockvectors = std::distance (objfile_compunits (objfile).begin (),
                                    objfile_compunits (objfile).end ());
@@ -157,16 +160,20 @@ dump_objfile (struct objfile *objfile)
   if (objfile->compunit_symtabs != NULL)
     {
       printf_filtered ("Symtabs:\n");
-      ALL_OBJFILE_FILETABS (objfile, cust, symtab)
+      for (compunit_symtab *cu : objfile_compunits (objfile))
        {
-         printf_filtered ("%s at ", symtab_to_filename_for_display (symtab));
-         gdb_print_host_address (symtab, gdb_stdout);
-         printf_filtered (", ");
-         if (SYMTAB_OBJFILE (symtab) != objfile)
+         for (symtab *symtab : compunit_filetabs (cu))
            {
-             printf_filtered ("NOT ON CHAIN!  ");
+             printf_filtered ("%s at ",
+                              symtab_to_filename_for_display (symtab));
+             gdb_print_host_address (symtab, gdb_stdout);
+             printf_filtered (", ");
+             if (SYMTAB_OBJFILE (symtab) != objfile)
+               {
+                 printf_filtered ("NOT ON CHAIN!  ");
+               }
+             wrap_here ("  ");
            }
-         wrap_here ("  ");
        }
       printf_filtered ("\n\n");
     }
@@ -477,21 +484,24 @@ maintenance_print_symbols (const char *args, int from_tty)
          if (!print_for_objfile)
            continue;
 
-         ALL_OBJFILE_FILETABS (objfile, cu, s)
+         for (compunit_symtab *cu : objfile_compunits (objfile))
            {
-             int print_for_source = 0;
-
-             QUIT;
-             if (source_arg != NULL)
+             for (symtab *s : compunit_filetabs (cu))
                {
-                 print_for_source
-                   = compare_filenames_for_search
-                       (symtab_to_filename_for_display (s), source_arg);
-                 found = 1;
+                 int print_for_source = 0;
+
+                 QUIT;
+                 if (source_arg != NULL)
+                   {
+                     print_for_source
+                       = compare_filenames_for_search
+                       (symtab_to_filename_for_display (s), source_arg);
+                     found = 1;
+                   }
+                 if (source_arg == NULL
+                     || print_for_source)
+                   dump_symtab (s, outfile);
                }
-             if (source_arg == NULL
-                 || print_for_source)
-               dump_symtab (s, outfile);
            }
        }