]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add operator* to gimple_stmt_iterator and gphi_iterator
authorRichard Biener <rguenther@suse.de>
Tue, 18 Apr 2023 14:58:26 +0000 (16:58 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 21 Apr 2023 13:53:21 +0000 (15:53 +0200)
This allows STL style iterator dereference.  It's the same
as gsi_stmt () or .phi ().

* gimple-iterator.h (gimple_stmt_iterator::operator*): Add.
(gphi_iterator::operator*): Likewise.

gcc/gimple-iterator.h

index 38352aa95af62dc68b312477c113a91579b8cd9b..b709923f00dfa1bbe1486fc3fad53147e67c7ccc 100644 (file)
@@ -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);