From: Arthur Cohen Date: Tue, 22 Aug 2023 13:40:25 +0000 (+0200) Subject: gccrs: nr2.0: Store mappings in NameResolutionContext X-Git-Tag: basepoints/gcc-15~1579 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb3a12f3ee26de1f51d9c900d4056fc4bcf6974f;p=thirdparty%2Fgcc.git gccrs: nr2.0: Store mappings in NameResolutionContext gcc/rust/ChangeLog: * resolve/rust-name-resolution-context.h: Store a reference to the mappings. * resolve/rust-name-resolution-context.cc (NameResolutionContext::NameResolutionContext): Likewise. --- diff --git a/gcc/rust/resolve/rust-name-resolution-context.cc b/gcc/rust/resolve/rust-name-resolution-context.cc index 82771cdd923e..8bb7a9a15c10 100644 --- a/gcc/rust/resolve/rust-name-resolution-context.cc +++ b/gcc/rust/resolve/rust-name-resolution-context.cc @@ -21,6 +21,10 @@ namespace Rust { namespace Resolver2_0 { +NameResolutionContext::NameResolutionContext () + : mappings (*Analysis::Mappings::get ()) +{} + tl::expected NameResolutionContext::insert (Identifier name, NodeId id, Namespace ns) { diff --git a/gcc/rust/resolve/rust-name-resolution-context.h b/gcc/rust/resolve/rust-name-resolution-context.h index 6d14be35986a..d63ee33378b8 100644 --- a/gcc/rust/resolve/rust-name-resolution-context.h +++ b/gcc/rust/resolve/rust-name-resolution-context.h @@ -21,6 +21,7 @@ #include "optional.h" #include "rust-forever-stack.h" +#include "rust-hir-map.h" namespace Rust { namespace Resolver2_0 { @@ -136,6 +137,8 @@ correct class NameResolutionContext { public: + NameResolutionContext (); + /** * Insert a new value in the current rib. * @@ -174,6 +177,8 @@ public: ForeverStack types; ForeverStack macros; ForeverStack labels; + + Analysis::Mappings &mappings; }; } // namespace Resolver2_0