[committed,019/103] gccrs: ast: Add accept_vis() method to `GenericArg`

Message ID 20230221120230.596966-20-arthur.cohen@embecosm.com
State Unresolved
Headers
Series [committed,001/103] gccrs: Fix missing dead code analysis ICE on local enum definition |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Arthur Cohen Feb. 21, 2023, 12:01 p.m. UTC
  From: Arthur Cohen <arthur.cohen@embecosm.com>

gcc/rust/ChangeLog:

	* ast/rust-path.h: Add `accept_vis` method to `GenericArg` class.
---
 gcc/rust/ast/rust-path.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
  

Patch

diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index b12e4c2bafa..9683ad6ad68 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -207,6 +207,23 @@  public:
   Kind get_kind () const { return kind; }
   const Location &get_locus () const { return locus; }
 
+  void accept_vis (AST::ASTVisitor &visitor)
+  {
+    switch (get_kind ())
+      {
+      case Kind::Const:
+	get_expression ()->accept_vis (visitor);
+	break;
+      case Kind::Type:
+	get_type ()->accept_vis (visitor);
+	break;
+      case Kind::Either:
+	break;
+      case Kind::Error:
+	gcc_unreachable ();
+      }
+  }
+
   std::unique_ptr<Expr> &get_expression ()
   {
     rust_assert (kind == Kind::Const);