diff mbox series

[v2,12/21] libcc1: use foreach

Message ID 20210428010119.806184-13-tom@tromey.com
State New
Headers show
Series C++11-based improvements for libcc1 | expand

Commit Message

Tom Tromey April 28, 2021, 1:01 a.m. UTC
This changes libcc1 to ues foreach in a couple of spots.

libcc1/ChangeLog
2021-04-27  Tom Tromey  <tom@tromey.com>

	* libcp1plugin.cc (plugin_context::mark): Use foreach.
	* libcc1plugin.cc (plugin_context::mark): Use foreach.
---
 libcc1/ChangeLog       |  5 +++++
 libcc1/libcc1plugin.cc | 13 +++++--------
 libcc1/libcp1plugin.cc | 13 +++++--------
 3 files changed, 15 insertions(+), 16 deletions(-)

Comments

Jeff Law April 28, 2021, 4:04 p.m. UTC | #1
On 4/27/2021 7:01 PM, Tom Tromey wrote:
> This changes libcc1 to ues foreach in a couple of spots.
>
> libcc1/ChangeLog
> 2021-04-27  Tom Tromey  <tom@tromey.com>
>
> 	* libcp1plugin.cc (plugin_context::mark): Use foreach.
> 	* libcc1plugin.cc (plugin_context::mark): Use foreach.

OK

jeff
diff mbox series

Patch

diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
index 65e748258f40..2a75faba7652 100644
--- a/libcc1/libcc1plugin.cc
+++ b/libcc1/libcc1plugin.cc
@@ -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
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 1fc8e269f075..3cbad5c6f021 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -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