public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-143] Add operator* to gimple_stmt_iterator and gphi_iterator
@ 2023-04-21 13:53 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-04-21 13:53 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c39cdd9e654540f74cd2478019c40f1611554a44
commit r14-143-gc39cdd9e654540f74cd2478019c40f1611554a44
Author: Richard Biener <rguenther@suse.de>
Date: Tue Apr 18 16:58:26 2023 +0200
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:
---
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-21 13:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21 13:53 [gcc r14-143] Add operator* to gimple_stmt_iterator and gphi_iterator Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).