aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-02-02 11:38:44 -0500
committerArthur Cohen <arthur.cohen@embecosm.com>2023-04-06 10:47:19 +0200
commit0e4bf6e7fc4219dbd05703db7759ac4c318978ad (patch)
tree8f00715370d22352a0dfa4a75adb7f5dc4e26e0e
parent95efd84db13b9ac2b27654e86d1cacefe0637415 (diff)
downloadgcc-0e4bf6e7fc4219dbd05703db7759ac4c318978ad.zip
gcc-0e4bf6e7fc4219dbd05703db7759ac4c318978ad.tar.gz
gcc-0e4bf6e7fc4219dbd05703db7759ac4c318978ad.tar.bz2
gccrs: 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>
-rw-r--r--gcc/rust/hir/tree/rust-hir-full-test.cc5
-rw-r--r--gcc/rust/hir/tree/rust-hir-pattern.h13
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 b6646d6..0ddb841 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 5243d78..83b041d 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;