[gcc r14-7889] gccrs: session-manager: Run name resolution 2.0 if the option is present

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 18:04:45 GMT 2024


https://gcc.gnu.org/g:301e59b864ba32b6e69b906a11352863983c2572

commit r14-7889-g301e59b864ba32b6e69b906a11352863983c2572
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Fri Jun 23 16:35:47 2023 +0200

    gccrs: session-manager: Run name resolution 2.0 if the option is present
    
    gcc/rust/ChangeLog:
    
            * rust-session-manager.cc
            (Session::expansion): Use new `Early` name resolution 2.0 pass

Diff:
---
 gcc/rust/rust-session-manager.cc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 3461198be95..401133c14dc 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -40,6 +40,8 @@
 #include "rust-extern-crate.h"
 #include "rust-attributes.h"
 #include "rust-early-name-resolver.h"
+#include "rust-name-resolution-context.h"
+#include "rust-early-name-resolver-2.0.h"
 #include "rust-cfg-strip.h"
 #include "rust-expand-visitor.h"
 #include "rust-unicode.h"
@@ -605,6 +607,7 @@ Session::compile_crate (const char *filename)
 
   // resolution pipeline stage
   Resolver::NameResolution::Resolve (parsed_crate);
+
   if (options.dump_option_enabled (CompileOptions::RESOLUTION_DUMP))
     {
       // TODO: what do I dump here? resolved names? AST with resolved names?
@@ -876,7 +879,14 @@ Session::expansion (AST::Crate &crate)
   while (!fixed_point_reached && iterations < cfg.recursion_limit)
     {
       CfgStrip ().go (crate);
-      Resolver::EarlyNameResolver ().go (crate);
+
+      auto ctx = Resolver2_0::NameResolutionContext ();
+
+      if (flag_name_resolution_2_0)
+	Resolver2_0::Early (ctx).go (crate);
+      else
+	Resolver::EarlyNameResolver ().go (crate);
+
       ExpandVisitor (expander).go (crate);
 
       fixed_point_reached = !expander.has_changed ();


More information about the Gcc-cvs mailing list