aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-04-08 01:37:56 -0400
committerPhilip Herron <philip.herron@embecosm.com>2023-04-13 11:50:47 +0000
commit862ec75eaf907fdaf5eac5b467ebafb7f5bf2795 (patch)
tree47bf310eaae8a51761be6d294128992b177d9d3b /gcc/rust/backend
parentb0487d6731d5d901154396e1d804a671371ac2eb (diff)
downloadgcc-862ec75eaf907fdaf5eac5b467ebafb7f5bf2795.zip
gcc-862ec75eaf907fdaf5eac5b467ebafb7f5bf2795.tar.gz
gcc-862ec75eaf907fdaf5eac5b467ebafb7f5bf2795.tar.bz2
Unify HIR::ExprStmt derived class visiting
gcc/rust/ChangeLog: * backend/rust-compile-stmt.cc (CompileStmt::visit): Unify ExprStmtWith{,out}Block visitors. * backend/rust-compile-stmt.h (CompileStmt::visit): Likewise. * backend/rust-compile-item.h (CompileItem::visit): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h (Dump::visit): Likewise. * hir/tree/rust-hir-stmt.h (ExprStmt::accept_vis): Add. (ExprStmtWithoutBlock::accept_vis): Remove. (ExprStmtWithBlock::accept_vis): Remove. * hir/tree/rust-hir.cc (ExprStmt::accept_vis): Add. (ExprStmtWithoutBlock::accept_vis): Remove. (ExprStmtWithBlock::accept_vis): Remove. * hir/tree/rust-hir-visitor.h (HIRFullVisitor::visit): Likewise. (HIRFullVisitorBase::visit): Likewise. (HIRStmtVisitor::visit): Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h (ConstChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.h (UnsafeChecker::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h (PrivacyReporter::visit): Likewise. * checks/lints/rust-lint-marklive.h (MarkLive::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h (TypeCheckStmt::visit): Likewise. * typecheck/rust-tycheck-dump.h (TypeResolverDump::visit): Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-item.h3
-rw-r--r--gcc/rust/backend/rust-compile-stmt.cc8
-rw-r--r--gcc/rust/backend/rust-compile-stmt.h3
3 files changed, 3 insertions, 11 deletions
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h
index ae3fdf6..70efc15 100644
--- a/gcc/rust/backend/rust-compile-item.h
+++ b/gcc/rust/backend/rust-compile-item.h
@@ -68,8 +68,7 @@ public:
void visit (HIR::Trait &) override {}
void visit (HIR::EmptyStmt &) override {}
void visit (HIR::LetStmt &) override {}
- void visit (HIR::ExprStmtWithoutBlock &) override {}
- void visit (HIR::ExprStmtWithBlock &) override {}
+ void visit (HIR::ExprStmt &) override {}
protected:
CompileItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
diff --git a/gcc/rust/backend/rust-compile-stmt.cc b/gcc/rust/backend/rust-compile-stmt.cc
index 6bb4ead..5bb7b8d 100644
--- a/gcc/rust/backend/rust-compile-stmt.cc
+++ b/gcc/rust/backend/rust-compile-stmt.cc
@@ -36,13 +36,7 @@ CompileStmt::Compile (HIR::Stmt *stmt, Context *ctx)
}
void
-CompileStmt::visit (HIR::ExprStmtWithBlock &stmt)
-{
- translated = CompileExpr::Compile (stmt.get_expr (), ctx);
-}
-
-void
-CompileStmt::visit (HIR::ExprStmtWithoutBlock &stmt)
+CompileStmt::visit (HIR::ExprStmt &stmt)
{
translated = CompileExpr::Compile (stmt.get_expr (), ctx);
}
diff --git a/gcc/rust/backend/rust-compile-stmt.h b/gcc/rust/backend/rust-compile-stmt.h
index 1f06d54..498211d 100644
--- a/gcc/rust/backend/rust-compile-stmt.h
+++ b/gcc/rust/backend/rust-compile-stmt.h
@@ -29,8 +29,7 @@ class CompileStmt : private HIRCompileBase, protected HIR::HIRStmtVisitor
public:
static tree Compile (HIR::Stmt *stmt, Context *ctx);
- void visit (HIR::ExprStmtWithBlock &stmt) override;
- void visit (HIR::ExprStmtWithoutBlock &stmt) override;
+ void visit (HIR::ExprStmt &stmt) override;
void visit (HIR::LetStmt &stmt) override;
// Empty visit for unused Stmt HIR nodes.