Add ATTRIBUTE_UNUSED_RESULT to scoped_mmap
[deliverable/binutils-gdb.git] / gdb / progspace.h
index abc53973b6fb733d75c4e32d49fc6c8928149f79..039f55517305f797909d817c6c0500ff6602f541 100644 (file)
 #define PROGSPACE_H
 
 #include "target.h"
-#include "vec.h"
+#include "common/vec.h"
 #include "gdb_bfd.h"
-#include "gdb_vecs.h"
+#include "common/gdb_vecs.h"
 #include "registry.h"
+#include "common/next-iterator.h"
+#include "common/safe-iterator.h"
 
 struct target_ops;
 struct bfd;
@@ -148,6 +150,22 @@ struct program_space
     return objfiles_range (objfiles_head);
   }
 
+  typedef next_adapter<struct objfile,
+                      basic_safe_iterator<next_iterator<objfile>>>
+    objfiles_safe_range;
+
+  /* An iterable object that can be used to iterate over all objfiles.
+     The basic use is in a foreach, like:
+
+     for (objfile *objf : pspace->objfiles_safe ()) { ... }
+
+     This variant uses a basic_safe_iterator so that objfiles can be
+     deleted during iteration.  */
+  objfiles_safe_range objfiles_safe ()
+  {
+    return objfiles_safe_range (objfiles_head);
+  }
+
   /* Pointer to next in linked list.  */
   struct program_space *next = NULL;
 
This page took 0.024677 seconds and 4 git commands to generate.