This allows STL style iterator dereference.  It's the same
as gsi_stmt () or .phi ().

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        * gimple-iterator.h (gimple_stmt_iterator::operator*): Add.
        (gphi_iterator::operator*): Likewise.
---
 gcc/gimple-iterator.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index 38352aa95af..b709923f00d 100644
--- a/gcc/gimple-iterator.h
+++ b/gcc/gimple-iterator.h
@@ -24,6 +24,8 @@ along with GCC; see the file COPYING3.  If not see
 
 struct gimple_stmt_iterator
 {
+  gimple *operator * () const { return ptr; }
+
   /* Sequence node holding the current statement.  */
   gimple_seq_node ptr;
 
@@ -38,6 +40,8 @@ struct gimple_stmt_iterator
 /* Iterator over GIMPLE_PHI statements.  */
 struct gphi_iterator : public gimple_stmt_iterator
 {
+  gphi *operator * () const { return as_a <gphi *> (ptr); }
+
   gphi *phi () const
   {
     return as_a <gphi *> (ptr);
-- 
2.35.3

Reply via email to