diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2023-08-04 11:11:13 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 13:12:17 +0200 |
commit | c3b40bc6db988e248ce535e5a27cb60f5e180e23 (patch) | |
tree | 239b9e8de8f8504e4fed758359a75db37459b88b /gcc/rust/rust-session-manager.cc | |
parent | 9bf8024bbe8675a67eafee671ee34fc4f9e289df (diff) | |
download | gcc-c3b40bc6db988e248ce535e5a27cb60f5e180e23.zip gcc-c3b40bc6db988e248ce535e5a27cb60f5e180e23.tar.gz gcc-c3b40bc6db988e248ce535e5a27cb60f5e180e23.tar.bz2 |
gccrs: sesh: Add late name resolution 2.0
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::compile_crate): Create name resolution
context for Session::expansion and subsequent name resolution passes.
(Session::expansion): Take name resolution context as a parameter
instead.
* rust-session-manager.h (Session::expansion): Fix declaration.
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r-- | gcc/rust/rust-session-manager.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index ea99d01..40adeb2 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -42,6 +42,7 @@ #include "rust-early-name-resolver.h" #include "rust-name-resolution-context.h" #include "rust-early-name-resolver-2.0.h" +#include "rust-late-name-resolver-2.0.h" #include "rust-cfg-strip.h" #include "rust-expand-visitor.h" #include "rust-unicode.h" @@ -591,8 +592,10 @@ Session::compile_crate (const char *filename) if (last_step == CompileOptions::CompileStep::Expansion) return; + auto name_resolution_ctx = Resolver2_0::NameResolutionContext (); // expansion pipeline stage - expansion (parsed_crate); + + expansion (parsed_crate, name_resolution_ctx); rust_debug ("\033[0;31mSUCCESSFULLY FINISHED EXPANSION \033[0m"); if (options.dump_option_enabled (CompileOptions::EXPANSION_DUMP)) { @@ -617,7 +620,10 @@ Session::compile_crate (const char *filename) return; // resolution pipeline stage - Resolver::NameResolution::Resolve (parsed_crate); + if (flag_name_resolution_2_0) + Resolver2_0::Late (name_resolution_ctx).go (parsed_crate); + else + Resolver::NameResolution::Resolve (parsed_crate); if (options.dump_option_enabled (CompileOptions::RESOLUTION_DUMP)) { @@ -881,7 +887,7 @@ Session::injection (AST::Crate &crate) } void -Session::expansion (AST::Crate &crate) +Session::expansion (AST::Crate &crate, Resolver2_0::NameResolutionContext &ctx) { rust_debug ("started expansion"); @@ -908,8 +914,6 @@ Session::expansion (AST::Crate &crate) if (saw_errors ()) break; - auto ctx = Resolver2_0::NameResolutionContext (); - if (flag_name_resolution_2_0) { Resolver2_0::Early early (ctx); |