Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

name resolution 2.0: Add base Resolver and TopLevel pass #2456

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

CohenArthur
Copy link
Member

  • name resolution 2.0: Add base for Resolver data structure
  • top-level: Add base TopLevel visitor

This commit adds a first simple Resolver data structure, which will
be used by all passes of the name resolution to store definitions and access
them. Namely, it contains a few instances of ForeverStack, for each
namespace we will be using.

The TopLevel pass takes care of collecting definitions, placing them
in the proper namespaces, and making them accessible for later resolution
passes like Early and Late. It is meant to be run in a fixed point
fashion, as import resolution, macro resolution and macro expansion
may generate multiple new definitions.

@CohenArthur
Copy link
Member Author

Noticed a couple issues already so putting it in draft, but reviews welcome!

@CohenArthur CohenArthur force-pushed the nr2.0-base-resolver branch 2 times, most recently from 9ab87c7 to fa8645b Compare July 31, 2023 11:39
@CohenArthur CohenArthur marked this pull request as ready for review July 31, 2023 13:28
Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CohenArthur CohenArthur force-pushed the nr2.0-base-resolver branch 2 times, most recently from 45e9d3d to 73ad6fa Compare July 31, 2023 14:19
This commit adds a first simple `NameResolutionContext` data structure, which will
be used by all passes of the name resolution to store definitions and access
them. Namely, it contains a few instances of `ForeverStack`, for each
namespace we will be using.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new object file.
	* resolve/rust-name-resolution-context.cc: New file.
	* resolve/rust-name-resolution-context.h: New file.
The `TopLevel` pass takes care of collecting definitions, placing them
in the proper namespaces, and making them accessible for later resolution
passes like `Early` and `Late`. It is meant to be run in a fixed point
fashion, as import resolution, macro resolution and macro expansion
may generate multiple new definitions.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new object file.
	* resolve/rust-toplevel-name-resolver-2.0.cc: New file.
	* resolve/rust-toplevel-name-resolver-2.0.h: New file.
This causes complaints by our GCC 4.8 builder.

gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx: assert() -> rust_assert()
@CohenArthur CohenArthur added this pull request to the merge queue Aug 1, 2023
Merged via the queue into Rust-GCC:master with commit 4f1838b Aug 1, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

2 participants