libcc1: use foreach
authorTom Tromey <tom@tromey.com>
Tue, 4 May 2021 21:26:58 +0000 (15:26 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 5 May 2021 06:06:17 +0000 (00:06 -0600)
This changes libcc1 to ues foreach in a couple of spots.

libcc1

* libcp1plugin.cc (plugin_context::mark): Use foreach.
* libcc1plugin.cc (plugin_context::mark): Use foreach.

libcc1/libcc1plugin.cc
libcc1/libcp1plugin.cc

index 65e7482..2a75fab 100644 (file)
@@ -235,17 +235,14 @@ plugin_context::plugin_context (int fd)
 void
 plugin_context::mark ()
 {
-  for (hash_table<decl_addr_hasher>::iterator it = address_map.begin ();
-       it != address_map.end ();
-       ++it)
+  for (const auto &item : address_map)
     {
-      ggc_mark ((*it)->decl);
-      ggc_mark ((*it)->address);
+      ggc_mark (item->decl);
+      ggc_mark (item->address);
     }
 
-  for (hash_table< nofree_ptr_hash<tree_node> >::iterator
-        it = preserved.begin (); it != preserved.end (); ++it)
-    ggc_mark (&*it);
+  for (const auto &item : preserved)
+    ggc_mark (&item);
 }
 
 static void
index 1fc8e26..3cbad5c 100644 (file)
@@ -225,17 +225,14 @@ plugin_context::plugin_context (int fd)
 void
 plugin_context::mark ()
 {
-  for (hash_table<decl_addr_hasher>::iterator it = address_map.begin ();
-       it != address_map.end ();
-       ++it)
+  for (const auto &item : address_map)
     {
-      ggc_mark ((*it)->decl);
-      ggc_mark ((*it)->address);
+      ggc_mark (item->decl);
+      ggc_mark (item->address);
     }
 
-  for (hash_table< nofree_ptr_hash<tree_node> >::iterator
-        it = preserved.begin (); it != preserved.end (); ++it)
-    ggc_mark (&*it);
+  for (const auto &item : preserved)
+    ggc_mark (&item);
 }
 
 static void