Add compunits range adapter to objfile
[deliverable/binutils-gdb.git] / gdb / objfiles.h
index eca46e59f8af00fa12a96146e2ec39651dd8a83e..2cf61957ec1d1a3b534c0acbce71f045a24a653b 100644 (file)
@@ -301,6 +301,15 @@ struct objfile
     partial_symtabs.reset (new psymtab_storage ());
   }
 
+  typedef next_adapter<struct compunit_symtab> compunits_range;
+
+  /* A range adapter that makes it possible to iterate over all
+     compunits in one objfile.  */
+
+  compunits_range compunits ()
+  {
+    return compunits_range (compunit_symtabs);
+  }
 
   /* All struct objfile's are chained together by their next pointers.
      The program space field "objfiles"  (frequently referenced via
@@ -553,41 +562,6 @@ extern void default_iterate_over_objfiles_in_search_order
    void *cb_data, struct objfile *current_objfile);
 \f
 
-/* An iterarable object that can be used to iterate over all
-   objfiles.  The basic use is in a foreach, like:
-
-   for (objfile *objf : all_objfiles_safe (pspace)) { ... }
-
-   This variant uses a basic_safe_iterator so that objfiles can be
-   deleted during iteration.  */
-
-class all_objfiles_safe
-  : public next_adapter<struct objfile,
-                       basic_safe_iterator<next_iterator<objfile>>>
-{
-public:
-
-  explicit all_objfiles_safe (struct program_space *pspace)
-    : next_adapter<struct objfile,
-                  basic_safe_iterator<next_iterator<objfile>>>
-        (pspace->objfiles_head)
-  {
-  }
-};
-
-/* A range adapter that makes it possible to iterate over all
-   compunits in one objfile.  */
-
-class objfile_compunits : public next_adapter<struct compunit_symtab>
-{
-public:
-
-  explicit objfile_compunits (struct objfile *objfile)
-    : next_adapter<struct compunit_symtab> (objfile->compunit_symtabs)
-  {
-  }
-};
-
 /* A range adapter that makes it possible to iterate over all
    minimal symbols of an objfile.  */
 
This page took 0.025319 seconds and 4 git commands to generate.