public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8071] gccrs: hir: Rename ComoundAssignment getters
Date: Tue, 16 Jan 2024 18:16:07 +0000 (GMT)	[thread overview]
Message-ID: <20240116181607.C1EB0385C413@sourceware.org> (raw)

https://gcc.gnu.org/g:68397d0c9baa3d7c8f20e7d132bba8804a55bbc4

commit r14-8071-g68397d0c9baa3d7c8f20e7d132bba8804a55bbc4
Author: Jakub Dupak <dev@jakubdupak.com>
Date:   Tue Oct 17 16:21:56 2023 +0200

    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:
---
 gcc/rust/backend/rust-compile-expr.cc                   |  8 ++++----
 gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc |  4 ++--
 gcc/rust/checks/errors/rust-const-checker.cc            |  4 ++--
 gcc/rust/checks/errors/rust-unsafe-checker.cc           |  4 ++--
 gcc/rust/hir/rust-hir-dump.cc                           |  2 +-
 gcc/rust/hir/tree/rust-hir-expr.h                       |  4 ++--
 gcc/rust/typecheck/rust-hir-type-check-expr.cc          | 10 ++++------
 gcc/rust/typecheck/rust-tyty.h                          |  2 ++
 8 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index b61b46aa6d7..acec57de1b5 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 a6b4477f39a..a4e18cc9002 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 cee5c75ff95..aaf8fc0c3f6 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 2d106e3da1b..4bad20b58d3 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 45729b94644..4ce8f334b09 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 645e5db9abe..4c49d943317 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<Expr> &get_left_expr () { return main_or_left_expr; }
+  std::unique_ptr<Expr> &get_lhs () { return main_or_left_expr; }
 
-  std::unique_ptr<Expr> &get_right_expr () { return right_expr; }
+  std::unique_ptr<Expr> &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 7bcd87ec555..9dbf657958d 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 0858502c6cb..8bfa83da8d8 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;
 };

                 reply	other threads:[~2024-01-16 18:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116181607.C1EB0385C413@sourceware.org \
    --to=cohenarthur@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).