diff options
| author | Philip Herron <herron.philip@googlemail.com> | 2023-09-17 15:08:42 +0100 |
|---|---|---|
| committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:04:37 +0100 |
| commit | 95703bb75efc3ca0300b78ab9d3f4d544faad4b6 (patch) | |
| tree | 480bedb9746410f64d48c4f81550c82b758d0fa4 /gcc/rust/hir/tree | |
| parent | 0a99bfe15af01e15c07bb5003b54d351f64a5cde (diff) | |
| download | gcc-95703bb75efc3ca0300b78ab9d3f4d544faad4b6.zip gcc-95703bb75efc3ca0300b78ab9d3f4d544faad4b6.tar.gz gcc-95703bb75efc3ca0300b78ab9d3f4d544faad4b6.tar.bz2 | |
gccrs: Remove HIR::ForLoopExpr
This will end up getting desugared into a LoopExpr with a MatchExpr body.
gcc/rust/ChangeLog:
* backend/rust-compile-block.h: remove HIR::ForLoopExpr
* backend/rust-compile-expr.h: likewise
* checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): likewise
* checks/errors/privacy/rust-privacy-reporter.h: likewise
* checks/errors/rust-const-checker.cc (ConstChecker::visit): likewise
* checks/errors/rust-const-checker.h: likewise
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): likewise
* checks/errors/rust-unsafe-checker.h: likewise
* checks/lints/rust-lint-marklive.h: likewise
* hir/rust-ast-lower.cc (ASTLoweringExprWithBlock::visit): likewise
* hir/rust-hir-dump.cc (Dump::visit): likewise
* hir/rust-hir-dump.h: likewise
* hir/tree/rust-hir-expr.h (class ForLoopExpr): likewise
* hir/tree/rust-hir-full-decls.h (class ForLoopExpr): likewise
* hir/tree/rust-hir-visitor.h: likewise
* hir/tree/rust-hir.cc (ForLoopExpr::as_string): likewise
(ForLoopExpr::accept_vis): likewise
* typecheck/rust-hir-type-check-expr.h: likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/hir/tree')
| -rw-r--r-- | gcc/rust/hir/tree/rust-hir-expr.h | 67 | ||||
| -rw-r--r-- | gcc/rust/hir/tree/rust-hir-full-decls.h | 1 | ||||
| -rw-r--r-- | gcc/rust/hir/tree/rust-hir-visitor.h | 3 | ||||
| -rw-r--r-- | gcc/rust/hir/tree/rust-hir.cc | 36 |
4 files changed, 0 insertions, 107 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index f0e9a36..3bfadbf 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -3092,73 +3092,6 @@ protected: } }; -// For loop expression HIR node (iterator loop) -class ForLoopExpr : public BaseLoopExpr -{ - std::unique_ptr<Pattern> pattern; - std::unique_ptr<Expr> iterator_expr; - -public: - std::string as_string () const override; - - // Constructor with loop label - ForLoopExpr (Analysis::NodeMapping mappings, - std::unique_ptr<Pattern> loop_pattern, - std::unique_ptr<Expr> iterator_expr, - std::unique_ptr<BlockExpr> loop_body, location_t locus, - LoopLabel loop_label, - AST::AttrVec outer_attribs = AST::AttrVec ()) - : BaseLoopExpr (std::move (mappings), std::move (loop_body), locus, - std::move (loop_label), std::move (outer_attribs)), - pattern (std::move (loop_pattern)), - iterator_expr (std::move (iterator_expr)) - {} - - // Copy constructor with clone - ForLoopExpr (ForLoopExpr const &other) - : BaseLoopExpr (other), pattern (other.pattern->clone_pattern ()), - iterator_expr (other.iterator_expr->clone_expr ()) - {} - - // Overloaded assignment operator to clone - ForLoopExpr &operator= (ForLoopExpr const &other) - { - BaseLoopExpr::operator= (other); - pattern = other.pattern->clone_pattern (); - iterator_expr = other.iterator_expr->clone_expr (); - /*loop_block = other.loop_block->clone_block_expr(); - loop_label = other.loop_label; - outer_attrs = other.outer_attrs;*/ - - return *this; - } - - // move constructors - ForLoopExpr (ForLoopExpr &&other) = default; - ForLoopExpr &operator= (ForLoopExpr &&other) = default; - - void accept_vis (HIRFullVisitor &vis) override; - void accept_vis (HIRExpressionVisitor &vis) override; - - std::unique_ptr<Expr> &get_iterator_expr () { return iterator_expr; } - std::unique_ptr<Pattern> &get_pattern () { return pattern; }; - -protected: - /* Use covariance to implement clone function as returning this object rather - * than base */ - ForLoopExpr *clone_expr_impl () const override - { - return new ForLoopExpr (*this); - } - - /* Use covariance to implement clone function as returning this object rather - * than base */ - ForLoopExpr *clone_expr_with_block_impl () const override - { - return new ForLoopExpr (*this); - } -}; - // forward decl for IfExpr class IfLetExpr; diff --git a/gcc/rust/hir/tree/rust-hir-full-decls.h b/gcc/rust/hir/tree/rust-hir-full-decls.h index a260e7f..96293ce 100644 --- a/gcc/rust/hir/tree/rust-hir-full-decls.h +++ b/gcc/rust/hir/tree/rust-hir-full-decls.h @@ -111,7 +111,6 @@ class BaseLoopExpr; class LoopExpr; class WhileLoopExpr; class WhileLetLoopExpr; -class ForLoopExpr; class IfExpr; class IfExprConseqElse; class IfLetExpr; diff --git a/gcc/rust/hir/tree/rust-hir-visitor.h b/gcc/rust/hir/tree/rust-hir-visitor.h index 38c74f6..4e7a97b 100644 --- a/gcc/rust/hir/tree/rust-hir-visitor.h +++ b/gcc/rust/hir/tree/rust-hir-visitor.h @@ -78,7 +78,6 @@ public: virtual void visit (LoopExpr &expr) = 0; virtual void visit (WhileLoopExpr &expr) = 0; virtual void visit (WhileLetLoopExpr &expr) = 0; - virtual void visit (ForLoopExpr &expr) = 0; virtual void visit (IfExpr &expr) = 0; virtual void visit (IfExprConseqElse &expr) = 0; virtual void visit (IfLetExpr &expr) = 0; @@ -215,7 +214,6 @@ public: virtual void visit (LoopExpr &) override {} virtual void visit (WhileLoopExpr &) override {} virtual void visit (WhileLetLoopExpr &) override {} - virtual void visit (ForLoopExpr &) override {} virtual void visit (IfExpr &) override {} virtual void visit (IfExprConseqElse &) override {} virtual void visit (IfLetExpr &) override {} @@ -442,7 +440,6 @@ public: virtual void visit (LoopExpr &expr) = 0; virtual void visit (WhileLoopExpr &expr) = 0; virtual void visit (WhileLetLoopExpr &expr) = 0; - virtual void visit (ForLoopExpr &expr) = 0; virtual void visit (IfExpr &expr) = 0; virtual void visit (IfExprConseqElse &expr) = 0; virtual void visit (IfLetExpr &expr) = 0; diff --git a/gcc/rust/hir/tree/rust-hir.cc b/gcc/rust/hir/tree/rust-hir.cc index ac1ae63..a3d6e1e 100644 --- a/gcc/rust/hir/tree/rust-hir.cc +++ b/gcc/rust/hir/tree/rust-hir.cc @@ -2290,30 +2290,6 @@ GenericArgsBinding::as_string () const } std::string -ForLoopExpr::as_string () const -{ - std::string str ("ForLoopExpr: "); - - str += "\n Label: "; - if (!has_loop_label ()) - { - str += "none"; - } - else - { - str += loop_label.as_string (); - } - - str += "\n Pattern: " + pattern->as_string (); - - str += "\n Iterator expr: " + iterator_expr->as_string (); - - str += "\n Loop block: " + loop_block->as_string (); - - return str; -} - -std::string RangePattern::as_string () const { if (has_ellipsis_syntax) @@ -4093,12 +4069,6 @@ WhileLetLoopExpr::accept_vis (HIRFullVisitor &vis) } void -ForLoopExpr::accept_vis (HIRFullVisitor &vis) -{ - vis.visit (*this); -} - -void IfExpr::accept_vis (HIRFullVisitor &vis) { vis.visit (*this); @@ -4783,12 +4753,6 @@ RangePattern::accept_vis (HIRPatternVisitor &vis) } void -ForLoopExpr::accept_vis (HIRExpressionVisitor &vis) -{ - vis.visit (*this); -} - -void TypePath::accept_vis (HIRTypeVisitor &vis) { vis.visit (*this); |
