]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: nr2.0: Store mappings in NameResolutionContext
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 22 Aug 2023 13:40:25 +0000 (15:40 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:45 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* resolve/rust-name-resolution-context.h: Store a reference to the
mappings.
* resolve/rust-name-resolution-context.cc
(NameResolutionContext::NameResolutionContext): Likewise.

gcc/rust/resolve/rust-name-resolution-context.cc
gcc/rust/resolve/rust-name-resolution-context.h

index 82771cdd923e43c8c2518416bb472b732d03d6d2..8bb7a9a15c10b6e4e23cfacb88a7de87d9522f63 100644 (file)
 namespace Rust {
 namespace Resolver2_0 {
 
+NameResolutionContext::NameResolutionContext ()
+  : mappings (*Analysis::Mappings::get ())
+{}
+
 tl::expected<NodeId, DuplicateNameError>
 NameResolutionContext::insert (Identifier name, NodeId id, Namespace ns)
 {
index 6d14be35986ae2e4c3cbcd1defd844bebfc05140..d63ee33378b8325e5ab82bb007f45c97fa945b18 100644 (file)
@@ -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<Namespace::Types> types;
   ForeverStack<Namespace::Macros> macros;
   ForeverStack<Namespace::Labels> labels;
+
+  Analysis::Mappings &mappings;
 };
 
 } // namespace Resolver2_0