public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] Optimize HIR::ReferencePattern
Date: Tue,  7 Feb 2023 17:53:59 +0000 (GMT)	[thread overview]
Message-ID: <20230207175359.3FB6D3858C62@sourceware.org> (raw)

https://gcc.gnu.org/g:595eacc9931b2e4cee22c052eca85059358a6961

commit 595eacc9931b2e4cee22c052eca85059358a6961
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Thu Feb 2 11:38:44 2023 -0500

    Optimize HIR::ReferencePattern
    
    gcc/rust/ChangeLog:
    
            * hir/tree/rust-hir-pattern.h
            (class ReferencePattern): Remove has_two_amps field.
            * hir/tree/rust-hir-full-test.cc
            (ReferencePattern::as_string): Remove usage of ReferencePattern::has_two_amps.
    
    Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

Diff:
---
 gcc/rust/hir/tree/rust-hir-full-test.cc |  5 -----
 gcc/rust/hir/tree/rust-hir-pattern.h    | 13 +++++--------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/gcc/rust/hir/tree/rust-hir-full-test.cc b/gcc/rust/hir/tree/rust-hir-full-test.cc
index a36e0f3d68a..cd09249ecd4 100644
--- a/gcc/rust/hir/tree/rust-hir-full-test.cc
+++ b/gcc/rust/hir/tree/rust-hir-full-test.cc
@@ -2583,11 +2583,6 @@ ReferencePattern::as_string () const
 {
   std::string str ("&");
 
-  if (has_two_amps)
-    {
-      str += "&";
-    }
-
   if (is_mut ())
     {
       str += "mut ";
diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-pattern.h
index d994e37c2a2..3eea4566291 100644
--- a/gcc/rust/hir/tree/rust-hir-pattern.h
+++ b/gcc/rust/hir/tree/rust-hir-pattern.h
@@ -424,7 +424,6 @@ protected:
 // HIR node for pattern based on dereferencing the pointers given
 class ReferencePattern : public Pattern
 {
-  bool has_two_amps;
   Mutability mut;
   std::unique_ptr<Pattern> pattern;
   Location locus;
@@ -435,16 +434,15 @@ public:
 
   ReferencePattern (Analysis::NodeMapping mappings,
 		    std::unique_ptr<Pattern> pattern, Mutability reference_mut,
-		    bool ref_has_two_amps, Location locus)
-    : has_two_amps (ref_has_two_amps), mut (reference_mut),
-      pattern (std::move (pattern)), locus (locus), mappings (mappings)
+		    Location locus)
+    : mut (reference_mut), pattern (std::move (pattern)), locus (locus),
+      mappings (mappings)
   {}
 
   // Copy constructor requires clone
   ReferencePattern (ReferencePattern const &other)
-    : has_two_amps (other.has_two_amps), mut (other.mut),
-      pattern (other.pattern->clone_pattern ()), locus (other.locus),
-      mappings (other.mappings)
+    : mut (other.mut), pattern (other.pattern->clone_pattern ()),
+      locus (other.locus), mappings (other.mappings)
   {}
 
   // Overload assignment operator to clone
@@ -452,7 +450,6 @@ public:
   {
     pattern = other.pattern->clone_pattern ();
     mut = other.mut;
-    has_two_amps = other.has_two_amps;
     locus = other.locus;
     mappings = other.mappings;

                 reply	other threads:[~2023-02-07 17:53 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=20230207175359.3FB6D3858C62@sourceware.org \
    --to=tschwinge@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).