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

Refactor the decl scope loop to consolidate modifier handling. #3463

Merged
merged 13 commits into from
Dec 8, 2023

Conversation

jonmeow
Copy link
Contributor

@jonmeow jonmeow commented Dec 6, 2023

Building on #3462, trying to make the flow easier to see, also making a little more use of macros for boilerplate modifier handling.

Specifically using these abbreviations:
* InitRepr: "initializing representation"
* ObjectRepr: "object representation"
* ValueRepr: "value representation"

As discussed in [#toolchain
discord](https://discord.com/channels/655572317891461132/655578254970716160/1182086098470572143)
and now documented in the [list of
abbreviations](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q).
toolchain/parse/handle_decl_scope_loop.cpp Show resolved Hide resolved
toolchain/parse/handle_decl_scope_loop.cpp Outdated Show resolved Hide resolved
toolchain/parse/handle_decl_scope_loop.cpp Outdated Show resolved Hide resolved
jonmeow and others added 9 commits December 6, 2023 15:49
Per their documentation, the `llvm::Initialize*` functions are only
supposed to be called by the main program, not by a library like
toolchain/codegen. Fixes a hang due to a data race in multithreaded
autoupdate.

Add a utility class `Carbon::InitLLVM` to do the common LLVM
initialization shared by all Carbon tools, optionally including
initializing the LLVM targets. Because the LLVM targets add a lot of
binary size, only initialize them for binaries that opt in by depending
on a new target `//common:all_llvm_targets`.

Also fix `//explorer:file_test` and `//explorer:file_test.trace` to
share a binary rather than linking an identical binary twice.

---------

Co-authored-by: Jon Ross-Perkins <[email protected]>
…nds of parse nodes that represent names. (carbon-language#3453)

Factor out common checking handling for the different kinds of
unqualified names
…arbon-language#3468)

The criteria being enforced is not correct since `final` and `default`
functions in interfaces have definitions.
Copy link
Contributor

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines 83 to 89
// `base` may be followed by:
// - a colon
// => assume it is an introducer, as in `extend base: BaseType;`.
// - a modifier or an introducer
// => assume it is a modifier, as in `base class`; which is handled
// by falling through to the next case.
// Anything else is an error.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this comment is out of date (at least the modifier part and "falling through")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cleaning up the comment.

toolchain/parse/handle_decl_scope_loop.cpp Outdated Show resolved Hide resolved
toolchain/parse/handle_decl_scope_loop.cpp Outdated Show resolved Hide resolved
toolchain/parse/handle_decl_scope_loop.cpp Outdated Show resolved Hide resolved
@jonmeow
Copy link
Contributor Author

jonmeow commented Dec 8, 2023

Thanks, I'd totally overlooked the ability to shift the while.

@jonmeow jonmeow added this pull request to the merge queue Dec 8, 2023
Merged via the queue into carbon-language:trunk with commit 2705a32 Dec 8, 2023
6 checks passed
@jonmeow jonmeow deleted the decl-loop-flow branch December 8, 2023 17:11
github-merge-queue bot pushed a commit that referenced this pull request Dec 8, 2023
…#3467)

Building on #3463. The PushState+PopState to construct a state feels
worth cleanup. The rest is just kind of making it easier to do without
adding another PushState overload.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants