-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SILGen] Add SILDeclRef for main entry-point #37014
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
Conversation
@swift-ci please test |
@swift-ci please test source compatibility |
This will make it easier to store in a SILDeclRef.
This will be used to represent the entry-point for a main SourceFile.
Allow SILDeclRef to refer to the main program entry-point, which will either be for a main SourceFile, or a synthetic main such as an `@main` decl. Adjust the various SILDeclRef related functions to handle this new case, and change the emission to go through `emitFunctionDefinition`. This change will allow the entry-point for an `@main` decl (and eventually a main SourceFile) to be emitted on-demand from its symbol name.
Now that SILDeclRef can represent the main function, tweak TBDGen to refer to it.
6be88eb
to
9020c13
Compare
@swift-ci please test |
@swift-ci please test macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that we're using more of the built-in machinery in SILGen to emit this entrypoint. The changes here look good, in particular to TBDGen. I'm going to tag @eeckstein for a closer look at the SILDeclRef representation changes for which I have much less experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though it would be good if @slavapestov could also take a look.
@swift-ci please test |
Allow SILDeclRef to refer to the main program entry-point, which will either be for a main SourceFile, or a synthetic main such as an
@main
decl. Adjust the various SILDeclRef related functions to handle this new case, and change the emission to go throughemitFunctionDefinition
.This change will allow the entry-point for an
@main
decl (and eventually a main SourceFile) to be emitted on-demand from its symbol name.