From: Richard Biener Date: Tue, 18 Apr 2023 14:58:26 +0000 (+0200) Subject: Add operator* to gimple_stmt_iterator and gphi_iterator X-Git-Tag: basepoints/gcc-15~9996 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c39cdd9e654540f74cd2478019c40f1611554a44;p=thirdparty%2Fgcc.git Add operator* to gimple_stmt_iterator and gphi_iterator 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. --- diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h index 38352aa95af6..b709923f00df 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 (ptr); } + gphi *phi () const { return as_a (ptr);