aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-04-04 17:07:54 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-19 15:32:12 +0100
commit333a4cbff7ef62208647c234af12caa35271b59c (patch)
treedf096abd47cc2b4612162f15ecd16e8eec2fa925 /gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
parent2f743673232dc87b85e802ea5256a36bb1988172 (diff)
downloadgcc-333a4cbff7ef62208647c234af12caa35271b59c.zip
gcc-333a4cbff7ef62208647c234af12caa35271b59c.tar.gz
gcc-333a4cbff7ef62208647c234af12caa35271b59c.tar.bz2
gccrs: imports: Add FinalizeImports class
gcc/rust/ChangeLog: * Make-lang.in: Add new object file. * ast/rust-item.h: Constify method. * resolve/rust-early-name-resolver-2.0.cc (Early::go): Call into the imports finalizer. (Early::resolve_glob_import): Remove old resolution. (Early::resolve_rebind_import): Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go): New function. (GlobbingVisitor::visit): Likewise. (TopLevel::visit): Do not call into handle_use_* functions anymore. * resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor): New. * resolve/rust-finalize-imports-2.0.cc: New file. * resolve/rust-finalize-imports-2.0.h: New file.
Diffstat (limited to 'gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h')
-rw-r--r--gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h25
1 files changed, 1 insertions, 24 deletions
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
index 77dd522..7b505cb 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
@@ -29,29 +29,6 @@
namespace Rust {
namespace Resolver2_0 {
-class GlobbingVisitor : public AST::DefaultASTVisitor
-{
- using AST::DefaultASTVisitor::visit;
-
-public:
- GlobbingVisitor (NameResolutionContext &ctx) : ctx (ctx) {}
-
- void go (AST::Module *module);
- void visit (AST::Module &module) override;
- void visit (AST::MacroRulesDefinition &macro) override;
- void visit (AST::Function &function) override;
- void visit (AST::StaticItem &static_item) override;
- void visit (AST::StructStruct &struct_item) override;
- void visit (AST::TupleStruct &tuple_struct) override;
- void visit (AST::Enum &enum_item) override;
- void visit (AST::Union &union_item) override;
- void visit (AST::ConstantItem &const_item) override;
- void visit (AST::ExternCrate &crate) override;
- void visit (AST::UseDeclaration &use) override;
-
-private:
- NameResolutionContext &ctx;
-};
/**
* The `TopLevel` visitor takes care of collecting all the definitions in a
* crate, and inserting them into the proper namespaces. These definitions can
@@ -123,7 +100,6 @@ public:
return std::move (imports_to_resolve);
}
-private:
/**
* Insert a new definition or error out if a definition with the same name was
* already present in the same namespace in the same scope.
@@ -140,6 +116,7 @@ private:
const location_t &locus, const NodeId &id,
Namespace ns);
+private:
// FIXME: Do we move these to our mappings?
std::unordered_map<NodeId, location_t> node_locations;