diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-08-21 17:14:46 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:13 +0100 |
commit | 1ac4b59dee2ae094bee351d67bf15321b48499a3 (patch) | |
tree | 024afab1627800cd4624e39caca3e489c2e4b1a2 /gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h | |
parent | 57dc3ab97393f526afcc74fa6c82347f3f77402a (diff) | |
download | gcc-1ac4b59dee2ae094bee351d67bf15321b48499a3.zip gcc-1ac4b59dee2ae094bee351d67bf15321b48499a3.tar.gz gcc-1ac4b59dee2ae094bee351d67bf15321b48499a3.tar.bz2 |
gccrs: Loop on expansion if a new export has been defined
When a use statement requires a reexported item it cannot find it in
the same pass, an additional pass shall be performed. This means we need
to detect whether a new item has been reexported and resolve until the
end.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::Early): Add dirty
flag initialization.
(Early::go): Set dirty flag using top level resolver.
* resolve/rust-early-name-resolver-2.0.h: Add dirty flag.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::TopLevel):
Initialize dirty flag.
(TopLevel::insert_or_error_out): Set dirty flag on successful
namespace modification.
* resolve/rust-toplevel-name-resolver-2.0.h: Add dirty flag.
* rust-session-manager.cc (Session::expansion): Modify fixed point
condition to include name resolution modifications.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
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.h | 6 |
1 files changed, 6 insertions, 0 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 acb60d3..99ed653 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h @@ -43,6 +43,8 @@ public: void go (AST::Crate &crate); + bool is_dirty () { return dirty; } + // Each import will be transformed into an instance of `ImportKind`, a class // representing some of the data we need to resolve in the // `EarlyNameResolver`. Basically, for each `UseTree` that we see in @@ -129,6 +131,10 @@ public: Namespace ns); private: + // If a new export has been defined whilst visiting the visitor is considered + // dirty + bool dirty; + // FIXME: Do we move these to our mappings? std::unordered_map<NodeId, location_t> node_locations; |