From: Jakub Dupak Date: Tue, 17 Oct 2023 14:21:56 +0000 (+0200) Subject: gccrs: hir: Rename ComoundAssignment getters X-Git-Tag: basepoints/gcc-15~2068 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68397d0c9baa3d7c8f20e7d132bba8804a55bbc4;p=thirdparty%2Fgcc.git gccrs: hir: Rename ComoundAssignment getters Use more a consistent name. gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Rename method. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Rename method. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Rename method. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Rename method. * hir/rust-hir-dump.cc (Dump::visit): Rename method. * hir/tree/rust-hir-expr.h: Rename method. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Rename method. * typecheck/rust-tyty.h: Rename method. --- diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index b61b46aa6d74..acec57de1b53 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -184,8 +184,8 @@ void CompileExpr::visit (HIR::CompoundAssignmentExpr &expr) { auto op = expr.get_expr_type (); - auto lhs = CompileExpr::Compile (expr.get_left_expr ().get (), ctx); - auto rhs = CompileExpr::Compile (expr.get_right_expr ().get (), ctx); + auto lhs = CompileExpr::Compile (expr.get_lhs ().get (), ctx); + auto rhs = CompileExpr::Compile (expr.get_rhs ().get (), ctx); // this might be an operator overload situation lets check TyTy::FnType *fntype; @@ -198,8 +198,8 @@ CompileExpr::visit (HIR::CompoundAssignmentExpr &expr) expr.get_expr_type ()); auto compound_assignment = resolve_operator_overload (lang_item_type, expr, lhs, rhs, - expr.get_left_expr ().get (), - expr.get_right_expr ().get ()); + expr.get_lhs ().get (), + expr.get_rhs ().get ()); ctx->add_statement (compound_assignment); return; diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc index a6b4477f39a9..a4e18cc90020 100644 --- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc +++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc @@ -375,8 +375,8 @@ PrivacyReporter::visit (HIR::AssignmentExpr &expr) void PrivacyReporter::visit (HIR::CompoundAssignmentExpr &expr) { - expr.get_left_expr ()->accept_vis (*this); - expr.get_right_expr ()->accept_vis (*this); + expr.get_lhs ()->accept_vis (*this); + expr.get_rhs ()->accept_vis (*this); } void diff --git a/gcc/rust/checks/errors/rust-const-checker.cc b/gcc/rust/checks/errors/rust-const-checker.cc index cee5c75ff955..aaf8fc0c3f6b 100644 --- a/gcc/rust/checks/errors/rust-const-checker.cc +++ b/gcc/rust/checks/errors/rust-const-checker.cc @@ -214,8 +214,8 @@ ConstChecker::visit (AssignmentExpr &expr) void ConstChecker::visit (CompoundAssignmentExpr &expr) { - expr.get_left_expr ()->accept_vis (*this); - expr.get_right_expr ()->accept_vis (*this); + expr.get_lhs ()->accept_vis (*this); + expr.get_rhs ()->accept_vis (*this); } void diff --git a/gcc/rust/checks/errors/rust-unsafe-checker.cc b/gcc/rust/checks/errors/rust-unsafe-checker.cc index 2d106e3da1bb..4bad20b58d34 100644 --- a/gcc/rust/checks/errors/rust-unsafe-checker.cc +++ b/gcc/rust/checks/errors/rust-unsafe-checker.cc @@ -327,8 +327,8 @@ UnsafeChecker::visit (AssignmentExpr &expr) void UnsafeChecker::visit (CompoundAssignmentExpr &expr) { - expr.get_left_expr ()->accept_vis (*this); - expr.get_right_expr ()->accept_vis (*this); + expr.get_lhs ()->accept_vis (*this); + expr.get_rhs ()->accept_vis (*this); } void diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index 45729b946447..4ce8f334b094 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -983,7 +983,7 @@ Dump::visit (CompoundAssignmentExpr &e) begin ("CompoundAssignmentExpr"); do_operatorexpr (e); - visit_field ("right_expr", *e.get_right_expr ()); + visit_field ("right_expr", *e.get_rhs ()); std::string str; diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index 645e5db9abef..4c49d943317b 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -762,9 +762,9 @@ public: void accept_vis (HIRFullVisitor &vis) override; void accept_vis (HIRExpressionVisitor &vis) override; - std::unique_ptr &get_left_expr () { return main_or_left_expr; } + std::unique_ptr &get_lhs () { return main_or_left_expr; } - std::unique_ptr &get_right_expr () { return right_expr; } + std::unique_ptr &get_rhs () { return right_expr; } void visit_lhs (HIRFullVisitor &vis) { main_or_left_expr->accept_vis (vis); } void visit_rhs (HIRFullVisitor &vis) { right_expr->accept_vis (vis); } diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc index 7bcd87ec5555..9dbf657958d3 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc @@ -249,16 +249,14 @@ TypeCheckExpr::visit (HIR::CompoundAssignmentExpr &expr) { infered = TyTy::TupleType::get_unit_type (expr.get_mappings ().get_hirid ()); - auto lhs = TypeCheckExpr::Resolve (expr.get_left_expr ().get ()); - auto rhs = TypeCheckExpr::Resolve (expr.get_right_expr ().get ()); + auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ().get ()); + auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ().get ()); // we dont care about the result of the unify from a compound assignment // since this is a unit-type expr coercion_site (expr.get_mappings ().get_hirid (), - TyTy::TyWithLocation (lhs, - expr.get_left_expr ()->get_locus ()), - TyTy::TyWithLocation (rhs, - expr.get_right_expr ()->get_locus ()), + TyTy::TyWithLocation (lhs, expr.get_lhs ()->get_locus ()), + TyTy::TyWithLocation (rhs, expr.get_rhs ()->get_locus ()), expr.get_locus ()); auto lang_item_type diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h index 0858502c6cb7..8bfa83da8d8b 100644 --- a/gcc/rust/typecheck/rust-tyty.h +++ b/gcc/rust/typecheck/rust-tyty.h @@ -1012,6 +1012,8 @@ public: private: TyVar element_type; + // FIXME: I dont think this should be in tyty - tyty should already be const + // evaluated HIR::Expr &capacity_expr; };