diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2023-03-02 16:56:33 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:21:09 +0100 |
commit | eba557860627a8ce1bb37d1427469db99cb0c059 (patch) | |
tree | fd239df7d747eeb2a1a71d4f0b3241cf2a28c7e5 /gcc | |
parent | 664e19ac6c839b0984e74a9861169422e56d840c (diff) | |
download | gcc-eba557860627a8ce1bb37d1427469db99cb0c059.zip gcc-eba557860627a8ce1bb37d1427469db99cb0c059.tar.gz gcc-eba557860627a8ce1bb37d1427469db99cb0c059.tar.bz2 |
gccrs: enr: Fetch module items during early name resolution
This is important as public macros can be present in other modules,
which would otherwise not be loaded until the expansion phase
happening right after the early name resolution.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Move
unloaded module item loading to...
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): ...here.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/expand/rust-attribute-visitor.cc | 9 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-early-name-resolver.cc | 6 |
2 files changed, 6 insertions, 9 deletions
diff --git a/gcc/rust/expand/rust-attribute-visitor.cc b/gcc/rust/expand/rust-attribute-visitor.cc index 3b3bb3a..1365cb8 100644 --- a/gcc/rust/expand/rust-attribute-visitor.cc +++ b/gcc/rust/expand/rust-attribute-visitor.cc @@ -2148,15 +2148,6 @@ AttrVisitor::visit (AST::Module &module) } } - // Parse the module's items if they haven't been expanded and the file - // should be parsed (i.e isn't hidden behind an untrue or impossible cfg - // directive) - if (!module.is_marked_for_strip () - && module.get_kind () == AST::Module::ModuleKind::UNLOADED) - { - module.load_items (); - } - // strip items if required expand_pointer_allow_strip (module.get_items ()); } diff --git a/gcc/rust/resolve/rust-early-name-resolver.cc b/gcc/rust/resolve/rust-early-name-resolver.cc index c6cbdb0..1dfbff5 100644 --- a/gcc/rust/resolve/rust-early-name-resolver.cc +++ b/gcc/rust/resolve/rust-early-name-resolver.cc @@ -581,6 +581,12 @@ EarlyNameResolver::visit (AST::Method &method) void EarlyNameResolver::visit (AST::Module &module) { + // Parse the module's items if they haven't been expanded and the file + // should be parsed (i.e isn't hidden behind an untrue or impossible cfg + // directive) + if (module.get_kind () == AST::Module::UNLOADED) + module.load_items (); + scoped (module.get_node_id (), [&module, this] () { for (auto &item : module.get_items ()) item->accept_vis (*this); |