-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Frontend] Load standard libarary in CompilerInstance::setup #40107
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 smoke test |
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.
Looks great, thank you! I'm not too familiar with a couple of the places this affects though, so I've tagged a couple of folks to take a look
a42c090
to
f9e0aae
Compare
@swift-ci Please smoke test |
case FrontendOptions::ActionType::ScanDependencies: | ||
requestedAction = Opts.RequestedAction; | ||
break; |
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.
@nkcsgexi @artemcm Does this look good to you?
Would you mind also double checking that there aren't other callers of CompilerInstance::setup
where we may need to change the requested action to avoid loading the stdlib? In particular I'm not too sure what frontend arguments are being fed for the other dependency scanning call-sites, are they guaranteed to use the dependency scanning action?
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.
This looks fine to me.
I also fully expect all dependency scanning call-sites to also have FrontendOptions::ActionType::ScanDependencies
.
case FrontendOptions::ActionType::ScanDependencies: | ||
requestedAction = Opts.RequestedAction; | ||
break; |
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.
This looks fine to me.
I also fully expect all dependency scanning call-sites to also have FrontendOptions::ActionType::ScanDependencies
.
f9e0aae
to
599b32e
Compare
@swift-ci Please smoke test |
Instead of checking that the stdlib can be loaded in a variety of places, check it when setting up the compiler instance. This required a couple more checks to avoid loading the stdlib in cases where it’s not needed. To be able to differentiate stdlib loading failures from other setup errors, make `CompilerInstance::setup` return an error message on failure via an inout parameter. Consume that error on the call side, replacing a previous, more generic error message, adding error handling where appropriate or ignoring the error message, depending on the context.
…piler invocation Explicitly specify the frontend action to make sure we aren’t loading thes stdlib if the performed action is syntactic only.
599b32e
to
22f67e8
Compare
@swift-ci Please smoke test |
Instead of checking that the stdlib can be loaded in a variety of places, check it when setting up the compiler instance. This required a couple more checks to avoid loading the stdlib in cases where it’s not needed.
To be able to differentiate stdlib loading failures from other setup errors, make
CompilerInstance::setup
return an error message on failure via an inout parameter. Consume that error on the call side, replacing a previous, more generic error message, adding error handling where appropriate or ignoring the error message, depending on the context.Was discussed in #39631 (comment)