]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nr2.0: Do not resolve modules this run if they are unloaded
authorArthur Cohen <arthur.cohen@embecosm.com>
Fri, 4 Apr 2025 12:18:33 +0000 (14:18 +0200)
committerCohenArthur <arthur.cohen@embecosm.com>
Mon, 14 Apr 2025 07:40:11 +0000 (07:40 +0000)
Instead, mark the visitor as dirty and wait for the next round of the fixed point to take care of
them. This avoids issues with module items being loaded while not being stripped yet.

gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Return if module
is unloaded.

gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc

index 2c0cc660601bb1946404bfda2e3b663b11070b68..e276d65323e3d64d1eb88a0acc1b83e2dc617ef9 100644 (file)
@@ -113,7 +113,17 @@ TopLevel::visit (AST::Module &module)
   // This was copied from the old early resolver method
   // 'accumulate_escaped_macros'
   if (module.get_kind () == AST::Module::UNLOADED)
-    module.load_items ();
+    {
+      module.load_items ();
+
+      // If the module was previously unloaded, then we don't want to visit it
+      // this time around as the CfgStrip hasn't run on its inner items yet.
+      // Skip it for now, mark the visitor as dirty and try again
+
+      dirty = true;
+
+      return;
+    }
 
   DefaultResolver::visit (module);