gccrs: early-name-resolver: Add simple macro name resolution
commit522197469179e786e59202a40f2adf9dd95c8ddd
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 11 Oct 2022 09:12:50 +0000 (11 11:12 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:33 +0000 (21 12:36 +0100)
tree15ad092a7c98a6ee9676277013f45eb145a43276
parent2f1035fc91ce1b9dd6e08d47befefff6b2b878db
gccrs: early-name-resolver: Add simple macro name resolution

This name resolver performs the same macro name resolution as what was
previously done by the AttrVisitor visitor and macro expander.

It also resolves macro expressions in builtin-macros properly, as well
as expanded AST nodes when necessary.

gcc/rust/ChangeLog:

* Make-lang.in: Compile early name resolver.
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Move macro
name resolution.
* expand/rust-macro-builtins.cc (try_expand_macro_expression): Run ENR
when recursively expanding macros.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): No longer
perform name resolution in `expand_invoc`.
* expand/rust-macro-expand.h (struct MacroExpander): Keep ENR within
MacroExpander.
* rust-session-manager.cc (Session::expansion): Run ENR.
* resolve/rust-early-name-resolver.cc: New file.
* resolve/rust-early-name-resolver.h: New file.
gcc/rust/Make-lang.in
gcc/rust/expand/rust-attribute-visitor.cc
gcc/rust/expand/rust-macro-builtins.cc
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/expand/rust-macro-expand.h
gcc/rust/resolve/rust-early-name-resolver.cc [new file with mode: 0644]
gcc/rust/resolve/rust-early-name-resolver.h [new file with mode: 0644]
gcc/rust/rust-session-manager.cc