diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-10-21 18:02:48 -0400 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2025-02-03 10:46:41 +0000 |
commit | a4a3183322dc195b3f235618d28ddca3e320a5fa (patch) | |
tree | 6402d72c8c090990f0d278678a8189f3ce92c70a /gcc | |
parent | 4a053730c5c880984be1a7f8b6cfb19b62aa3331 (diff) | |
download | gcc-a4a3183322dc195b3f235618d28ddca3e320a5fa.zip gcc-a4a3183322dc195b3f235618d28ddca3e320a5fa.tar.gz gcc-a4a3183322dc195b3f235618d28ddca3e320a5fa.tar.bz2 |
nr2.0: Remove accidental copies of resolver
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc
(CompileExpr::generate_closure_function): Take
NameResolutionContext by reference instead of by value.
* backend/rust-compile-item.cc
(CompileItem::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::resolve): Likewise.
* checks/lints/rust-lint-marklive.cc
(MarkLive::find_ref_node_id): Likewise.
* typecheck/rust-hir-type-check-enumitem.cc
(TypeCheckEnumItem::visit): Likewise.
* typecheck/rust-hir-type-check-implitem.cc
(TypeCheckImplItem::visit): Likewise.
* typecheck/rust-hir-type-check-item.cc
(TypeCheckItem::visit): Likewise.
* typecheck/rust-hir-type-check-path.cc
(TypeCheckExpr::resolve_root_path): Likewise.
* typecheck/rust-hir-type-check-type.cc
(TypeCheckType::resolve_root_path): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.cc | 6 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 2 | ||||
-rw-r--r-- | gcc/rust/checks/lints/rust-lint-marklive.cc | 2 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-enumitem.cc | 8 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-implitem.cc | 2 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-item.cc | 10 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-path.cc | 2 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-hir-type-check-type.cc | 4 |
9 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 7938330..a72156b 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -2453,7 +2453,7 @@ CompileExpr::generate_closure_function (HIR::ClosureExpr &expr, auto body_mappings = function_body.get_mappings (); if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); auto candidate = nr_ctx.values.to_rib (body_mappings.get_nodeid ()); diff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc index 60159b6..2b6836a 100644 --- a/gcc/rust/backend/rust-compile-item.cc +++ b/gcc/rust/backend/rust-compile-item.cc @@ -52,7 +52,7 @@ CompileItem::visit (HIR::StaticItem &var) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path @@ -119,7 +119,7 @@ CompileItem::visit (HIR::ConstantItem &constant) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path @@ -192,7 +192,7 @@ CompileItem::visit (HIR::Function &function) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); auto path = nr_ctx.values.to_canonical_path ( diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index 07fa9b2..c862a81 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -212,7 +212,7 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, NodeId ref_node_id = UNKNOWN_NODEID; if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); auto resolved = nr_ctx.lookup (mappings.get_nodeid ()); diff --git a/gcc/rust/checks/lints/rust-lint-marklive.cc b/gcc/rust/checks/lints/rust-lint-marklive.cc index aacfc08..270d022 100644 --- a/gcc/rust/checks/lints/rust-lint-marklive.cc +++ b/gcc/rust/checks/lints/rust-lint-marklive.cc @@ -287,7 +287,7 @@ MarkLive::find_ref_node_id (NodeId ast_node_id, NodeId &ref_node_id) { if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); nr_ctx.lookup (ast_node_id).map ([&ref_node_id] (NodeId resolved) { diff --git a/gcc/rust/typecheck/rust-hir-type-check-enumitem.cc b/gcc/rust/typecheck/rust-hir-type-check-enumitem.cc index ac85075..527c8df 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-enumitem.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-enumitem.cc @@ -83,7 +83,7 @@ TypeCheckEnumItem::visit (HIR::EnumItem &item) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path @@ -127,7 +127,7 @@ TypeCheckEnumItem::visit (HIR::EnumItemDiscriminant &item) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path @@ -189,7 +189,7 @@ TypeCheckEnumItem::visit (HIR::EnumItemTuple &item) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path @@ -249,7 +249,7 @@ TypeCheckEnumItem::visit (HIR::EnumItemStruct &item) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path diff --git a/gcc/rust/typecheck/rust-hir-type-check-implitem.cc b/gcc/rust/typecheck/rust-hir-type-check-implitem.cc index ee2c6b7..31164c1 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-implitem.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-implitem.cc @@ -470,7 +470,7 @@ TypeCheckImplItem::visit (HIR::Function &function) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path = nr_ctx.values.to_canonical_path ( diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc index 17c331e..eeea9b4 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-item.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc @@ -200,7 +200,7 @@ TypeCheckItem::visit (HIR::TupleStruct &struct_decl) // FIXME: HACK: ARTHUR: Disgusting if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); path = nr_ctx.values @@ -280,7 +280,7 @@ TypeCheckItem::visit (HIR::StructStruct &struct_decl) // FIXME: HACK: ARTHUR: Disgusting if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); auto canonical_path = nr_ctx.types.to_canonical_path ( struct_decl.get_mappings ().get_nodeid ()); @@ -353,7 +353,7 @@ TypeCheckItem::visit (HIR::Enum &enum_decl) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path = nr_ctx.types.to_canonical_path ( @@ -416,7 +416,7 @@ TypeCheckItem::visit (HIR::Union &union_decl) if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); canonical_path = nr_ctx.types.to_canonical_path ( @@ -591,7 +591,7 @@ TypeCheckItem::visit (HIR::Function &function) // FIXME: HACK: ARTHUR: Disgusting if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); auto canonical_path = nr_ctx.values.to_canonical_path ( function.get_mappings ().get_nodeid ()); diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc index 5f05deb..a489490 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-path.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc @@ -270,7 +270,7 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset, if (flag_name_resolution_2_0) { - auto nr_ctx + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get ().resolver (); // assign the ref_node_id if we've found something diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc index e367c1b..55c5934 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc @@ -399,8 +399,8 @@ TypeCheckType::resolve_root_path (HIR::TypePath &path, size_t *offset, // FIXME: HACK: ARTHUR: Remove this if (flag_name_resolution_2_0) { - auto nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get () - .resolver (); + auto &nr_ctx = Resolver2_0::ImmutableNameResolutionContext::get () + .resolver (); // assign the ref_node_id if we've found something nr_ctx.lookup (path.get_mappings ().get_nodeid ()) |