aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-08-22 15:40:25 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-30 12:36:45 +0100
commitcb3a12f3ee26de1f51d9c900d4056fc4bcf6974f (patch)
tree49cfe596eb3dfe251a95c5fe2ed3a60bc59649a0
parent1ee01fd1572b46324c72d2380bedc58dfddd469d (diff)
downloadgcc-cb3a12f3ee26de1f51d9c900d4056fc4bcf6974f.zip
gcc-cb3a12f3ee26de1f51d9c900d4056fc4bcf6974f.tar.gz
gcc-cb3a12f3ee26de1f51d9c900d4056fc4bcf6974f.tar.bz2
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.
-rw-r--r--gcc/rust/resolve/rust-name-resolution-context.cc4
-rw-r--r--gcc/rust/resolve/rust-name-resolution-context.h5
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-name-resolution-context.cc b/gcc/rust/resolve/rust-name-resolution-context.cc
index 82771cd..8bb7a9a 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<NodeId, DuplicateNameError>
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 6d14be3..d63ee33 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<Namespace::Types> types;
ForeverStack<Namespace::Macros> macros;
ForeverStack<Namespace::Labels> labels;
+
+ Analysis::Mappings &mappings;
};
} // namespace Resolver2_0