diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-01-09 13:51:35 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 16:52:26 +0200 |
commit | 8c331e24575c0584be372a78bb0bbcca914d567c (patch) | |
tree | 18151cba46c42235bbb52555a6948c8d54d6e349 /gcc/rust/util/rust-hir-map.h | |
parent | 06ce1b34fc0f1098ed45f25d52c05a6d8586c2c7 (diff) | |
download | gcc-8c331e24575c0584be372a78bb0bbcca914d567c.zip gcc-8c331e24575c0584be372a78bb0bbcca914d567c.tar.gz gcc-8c331e24575c0584be372a78bb0bbcca914d567c.tar.bz2 |
gccrs: Add name resolution for on globbing use decl
This is the first part of the code required to enable globbing on use
declarations.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert names into their namespace.
(TopLevel::visit): Insert ast module.
(TopLevel::handle_use_dec): Resolve use declaration.
(TopLevel::handle_use_glob): Use globbing visitor.
(flatten_list): Use globbing path vector.
(flatten_glob): Likewise.
(flatten): Likewise.
(prefix_subpaths): Add a function to prefix subpath.
* resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor):
Add globbing visitor.
* util/rust-hir-map.cc (Mappings::insert_ast_module): Add function to
insert module in module hashmap.
(Mappings::lookup_ast_module): Add function to retrieve ast module.
* util/rust-hir-map.h: Add module map and getter/setter prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.h')
-rw-r--r-- | gcc/rust/util/rust-hir-map.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-hir-map.h b/gcc/rust/util/rust-hir-map.h index 927c012..92af067 100644 --- a/gcc/rust/util/rust-hir-map.h +++ b/gcc/rust/util/rust-hir-map.h @@ -328,6 +328,8 @@ public: void insert_visibility (NodeId id, Privacy::ModuleVisibility visibility); bool lookup_visibility (NodeId id, Privacy::ModuleVisibility &def); + void insert_ast_module (AST::Module *); + tl::optional<AST::Module *> lookup_ast_module (NodeId id); void insert_module_child (NodeId module, NodeId child); tl::optional<std::vector<NodeId> &> lookup_module_children (NodeId module); @@ -427,6 +429,7 @@ private: std::map<NodeId, std::vector<NodeId>> module_child_map; std::map<NodeId, std::vector<Resolver::CanonicalPath>> module_child_items; std::map<NodeId, NodeId> child_to_parent_module_map; + std::map<NodeId, AST::Module *> modules; // AST mappings std::map<NodeId, AST::Item *> ast_item_mappings; |