[committed 18/88] gccrs: Added missing GroupedPattern visitors for code generation

arthur.cohen@embecosm.com arthur.cohen@embecosm.com
Wed Apr 5 14:03:02 GMT 2023


From: Owen Avery <powerboat9.gamer@gmail.com>

gcc/rust/ChangeLog:

	* backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Add proper
	visitor.
	(CompilePatternBindings::visit): Likewise.
	* backend/rust-compile-pattern.h: Declare them.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
---
 gcc/rust/backend/rust-compile-pattern.cc | 12 ++++++++++++
 gcc/rust/backend/rust-compile-pattern.h  |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc
index fc70d4ba58d..9218b815dd8 100644
--- a/gcc/rust/backend/rust-compile-pattern.cc
+++ b/gcc/rust/backend/rust-compile-pattern.cc
@@ -161,6 +161,12 @@ CompilePatternCaseLabelExpr::visit (HIR::RangePattern &pattern)
   case_label_expr = build_case_label (lower, upper, associated_case_label);
 }
 
+void
+CompilePatternCaseLabelExpr::visit (HIR::GroupedPattern &pattern)
+{
+  pattern.get_item ()->accept_vis (*this);
+}
+
 // setup the bindings
 
 void
@@ -329,5 +335,11 @@ CompilePatternBindings::visit (HIR::StructPattern &pattern)
     }
 }
 
+void
+CompilePatternBindings::visit (HIR::GroupedPattern &pattern)
+{
+  pattern.get_item ()->accept_vis (*this);
+}
+
 } // namespace Compile
 } // namespace Rust
diff --git a/gcc/rust/backend/rust-compile-pattern.h b/gcc/rust/backend/rust-compile-pattern.h
index 22812a45405..43334affca7 100644
--- a/gcc/rust/backend/rust-compile-pattern.h
+++ b/gcc/rust/backend/rust-compile-pattern.h
@@ -38,9 +38,9 @@ public:
   void visit (HIR::TupleStructPattern &pattern) override;
   void visit (HIR::WildcardPattern &pattern) override;
   void visit (HIR::RangePattern &pattern) override;
+  void visit (HIR::GroupedPattern &pattern) override;
 
   // Empty visit for unused Pattern HIR nodes.
-  void visit (HIR::GroupedPattern &) override {}
   void visit (HIR::IdentifierPattern &) override {}
   void visit (HIR::LiteralPattern &) override;
   void visit (HIR::QualifiedPathInExpression &) override {}
@@ -70,9 +70,9 @@ public:
 
   void visit (HIR::StructPattern &pattern) override;
   void visit (HIR::TupleStructPattern &pattern) override;
+  void visit (HIR::GroupedPattern &) override;
 
   // Empty visit for unused Pattern HIR nodes.
-  void visit (HIR::GroupedPattern &) override {}
   void visit (HIR::IdentifierPattern &) override {}
   void visit (HIR::LiteralPattern &) override {}
   void visit (HIR::PathInExpression &) override {}
-- 
2.40.0



More information about the Gcc-rust mailing list