public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] remove unused mark assignment to decl
@ 2022-06-29 10:27 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-29 10:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:2f2c41a3ebea5905c91dc5cccbb55fb3ba36c537
commit 2f2c41a3ebea5905c91dc5cccbb55fb3ba36c537
Author: Philip Herron <philip.herron@embecosm.com>
Date: Mon Jun 27 13:24:26 2022 +0100
remove unused mark assignment to decl
Diff:
---
gcc/rust/resolve/rust-ast-resolve-item.cc | 31 -----------------------------
gcc/rust/resolve/rust-ast-resolve-stmt.h | 11 ----------
gcc/rust/resolve/rust-ast-verify-assignee.h | 2 --
gcc/rust/resolve/rust-name-resolver.cc | 20 -------------------
gcc/rust/resolve/rust-name-resolver.h | 4 ----
5 files changed, 68 deletions(-)
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 5a21d570d83..1ec99d64090 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -85,11 +85,6 @@ ResolveTraitItems::visit (AST::TraitItemFunc &func)
{
ResolveType::go (param.get_type ().get (), param.get_node_id ());
PatternDeclaration::go (param.get_pattern ().get ());
-
- // the mutability checker needs to verify for immutable decls the number
- // of assignments are <1. This marks an implicit assignment
- resolver->mark_assignment_to_decl (
- param.get_pattern ()->get_pattern_node_id (), param.get_node_id ());
}
if (function.has_where_clause ())
@@ -148,20 +143,12 @@ ResolveTraitItems::visit (AST::TraitItemMethod &func)
ResolveType::go (&self_type_path, self_param.get_node_id ());
PatternDeclaration::go (&self_pattern);
- resolver->mark_assignment_to_decl (self_pattern.get_node_id (),
- self_pattern.get_node_id ());
-
// we make a new scope so the names of parameters are resolved and shadowed
// correctly
for (auto ¶m : function.get_function_params ())
{
ResolveType::go (param.get_type ().get (), param.get_node_id ());
PatternDeclaration::go (param.get_pattern ().get ());
-
- // the mutability checker needs to verify for immutable decls the number
- // of assignments are <1. This marks an implicit assignment
- resolver->mark_assignment_to_decl (
- param.get_pattern ()->get_pattern_node_id (), param.get_node_id ());
}
if (function.has_where_clause ())
@@ -193,8 +180,6 @@ ResolveTraitItems::visit (AST::TraitItemConst &constant)
// the mutability checker needs to verify for immutable decls the number
// of assignments are <1. This marks an implicit assignment
resolver->mark_decl_mutability (constant.get_node_id (), false);
- resolver->mark_assignment_to_decl (constant.get_node_id (),
- constant.get_node_id ());
}
ResolveItem::ResolveItem (const CanonicalPath &prefix,
@@ -500,10 +485,6 @@ ResolveItem::visit (AST::StaticItem &var)
ResolveType::go (var.get_type ().get (), var.get_node_id ());
ResolveExpr::go (var.get_expr ().get (), path, cpath);
-
- // the mutability checker needs to verify for immutable decls the number
- // of assignments are <1. This marks an implicit assignment
- resolver->mark_assignment_to_decl (var.get_node_id (), var.get_node_id ());
}
void
@@ -523,8 +504,6 @@ ResolveItem::visit (AST::ConstantItem &constant)
// the mutability checker needs to verify for immutable decls the number
// of assignments are <1. This marks an implicit assignment
resolver->mark_decl_mutability (constant.get_node_id (), false);
- resolver->mark_assignment_to_decl (constant.get_node_id (),
- constant.get_node_id ());
}
void
@@ -570,8 +549,6 @@ ResolveItem::visit (AST::Function &function)
// the mutability checker needs to verify for immutable decls the number
// of assignments are <1. This marks an implicit assignment
- resolver->mark_assignment_to_decl (
- param.get_pattern ()->get_pattern_node_id (), param.get_node_id ());
}
// resolve the function body
@@ -716,20 +693,12 @@ ResolveItem::visit (AST::Method &method)
ResolveType::go (&self_type_path, self_param.get_node_id ());
PatternDeclaration::go (&self_pattern);
- resolver->mark_assignment_to_decl (self_pattern.get_node_id (),
- self_pattern.get_node_id ());
-
// we make a new scope so the names of parameters are resolved and shadowed
// correctly
for (auto ¶m : method.get_function_params ())
{
ResolveType::go (param.get_type ().get (), param.get_node_id ());
PatternDeclaration::go (param.get_pattern ().get ());
-
- // the mutability checker needs to verify for immutable decls the number
- // of assignments are <1. This marks an implicit assignment
- resolver->mark_assignment_to_decl (
- param.get_pattern ()->get_pattern_node_id (), param.get_node_id ());
}
// resolve any where clause items
diff --git a/gcc/rust/resolve/rust-ast-resolve-stmt.h b/gcc/rust/resolve/rust-ast-resolve-stmt.h
index 9fdb090dd25..81172d5b2bd 100644
--- a/gcc/rust/resolve/rust-ast-resolve-stmt.h
+++ b/gcc/rust/resolve/rust-ast-resolve-stmt.h
@@ -76,8 +76,6 @@ public:
// the mutability checker needs to verify for immutable decls the number
// of assignments are <1. This marks an implicit assignment
resolver->mark_decl_mutability (constant.get_node_id (), false);
- resolver->mark_assignment_to_decl (constant.get_node_id (),
- constant.get_node_id ());
}
void visit (AST::LetStmt &stmt) override
@@ -86,10 +84,6 @@ public:
{
ResolveExpr::go (stmt.get_init_expr ().get (), prefix,
canonical_prefix);
-
- // mark the assignment
- resolver->mark_assignment_to_decl (
- stmt.get_pattern ()->get_pattern_node_id (), stmt.get_node_id ());
}
PatternDeclaration::go (stmt.get_pattern ().get ());
@@ -378,11 +372,6 @@ public:
{
ResolveType::go (param.get_type ().get (), param.get_node_id ());
PatternDeclaration::go (param.get_pattern ().get ());
-
- // the mutability checker needs to verify for immutable decls the number
- // of assignments are <1. This marks an implicit assignment
- resolver->mark_assignment_to_decl (
- param.get_pattern ()->get_pattern_node_id (), param.get_node_id ());
}
// resolve the function body
diff --git a/gcc/rust/resolve/rust-ast-verify-assignee.h b/gcc/rust/resolve/rust-ast-verify-assignee.h
index 9c1c1a18c6a..74551cb014d 100644
--- a/gcc/rust/resolve/rust-ast-verify-assignee.h
+++ b/gcc/rust/resolve/rust-ast-verify-assignee.h
@@ -63,8 +63,6 @@ public:
return;
ok = true;
- // mark the assignment to the name
- // resolver->mark_assignment_to_decl (resolved_node, parent);
}
void visit (AST::DereferenceExpr &expr) override
diff --git a/gcc/rust/resolve/rust-name-resolver.cc b/gcc/rust/resolve/rust-name-resolver.cc
index fcf71907166..0ef6f5319f5 100644
--- a/gcc/rust/resolve/rust-name-resolver.cc
+++ b/gcc/rust/resolve/rust-name-resolver.cc
@@ -497,25 +497,5 @@ Resolver::decl_is_mutable (NodeId id) const
return it->second;
}
-void
-Resolver::mark_assignment_to_decl (NodeId id, NodeId assignment)
-{
- auto it = assignment_to_decl.find (id);
- if (it == assignment_to_decl.end ())
- assignment_to_decl[id] = {};
-
- assignment_to_decl[id].insert (assignment);
-}
-
-size_t
-Resolver::get_num_assignments_to_decl (NodeId id) const
-{
- auto it = assignment_to_decl.find (id);
- if (it == assignment_to_decl.end ())
- return 0;
-
- return it->second.size ();
-}
-
} // namespace Resolver
} // namespace Rust
diff --git a/gcc/rust/resolve/rust-name-resolver.h b/gcc/rust/resolve/rust-name-resolver.h
index 6b611b28977..ad785e11a68 100644
--- a/gcc/rust/resolve/rust-name-resolver.h
+++ b/gcc/rust/resolve/rust-name-resolver.h
@@ -126,8 +126,6 @@ public:
void mark_decl_mutability (NodeId id, bool mut);
bool decl_is_mutable (NodeId id) const;
- void mark_assignment_to_decl (NodeId id, NodeId assignment);
- size_t get_num_assignments_to_decl (NodeId id) const;
// proxy for scoping
Scope &get_name_scope () { return name_scope; }
@@ -207,8 +205,6 @@ private:
// map of resolved names mutability flag
std::map<NodeId, bool> decl_mutability;
- // map of resolved names and set of assignments to the decl
- std::map<NodeId, std::set<NodeId>> assignment_to_decl;
// keep track of the current module scope ids
std::vector<NodeId> current_module_stack;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-29 10:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 10:27 [gcc/devel/rust/master] remove unused mark assignment to decl Thomas Schwinge
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).