aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-06-27 13:24:26 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-06-27 13:24:26 +0100
commit2f2c41a3ebea5905c91dc5cccbb55fb3ba36c537 (patch)
treec120d921d6032f4a479c773ebe3911864f91e319 /gcc
parent1ea95c3548ce17a4a3604dfc5e2e6661750e5a85 (diff)
downloadgcc-2f2c41a3ebea5905c91dc5cccbb55fb3ba36c537.zip
gcc-2f2c41a3ebea5905c91dc5cccbb55fb3ba36c537.tar.gz
gcc-2f2c41a3ebea5905c91dc5cccbb55fb3ba36c537.tar.bz2
remove unused mark assignment to decl
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-item.cc31
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-stmt.h11
-rw-r--r--gcc/rust/resolve/rust-ast-verify-assignee.h2
-rw-r--r--gcc/rust/resolve/rust-name-resolver.cc20
-rw-r--r--gcc/rust/resolve/rust-name-resolver.h4
5 files changed, 0 insertions, 68 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 5a21d57..1ec99d6 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 &param : 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 &param : 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 9fdb090..81172d5 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 9c1c1a1..74551cb 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 fcf7190..0ef6f53 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 6b611b2..ad785e1 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;