mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Frontend] Load standard libarary in CompilerInstance::setup
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.
This commit is contained in:
@@ -218,13 +218,6 @@ bool ModuleInterfaceBuilder::buildSwiftModuleInternal(
|
||||
InputInfo.getPrimarySpecificPaths().SupplementaryOutputs;
|
||||
StringRef OutPath = OutputInfo.ModuleOutputPath;
|
||||
|
||||
// Bail out if we're going to use the standard library but can't load it. If
|
||||
// we don't do this before we try to build the interface, we could end up
|
||||
// trying to rebuild a broken standard library dozens of times due to
|
||||
// multiple calls to `ASTContext::getStdlibModule()`.
|
||||
if (SubInstance.loadStdlibIfNeeded())
|
||||
return std::make_error_code(std::errc::not_supported);
|
||||
|
||||
// Build the .swiftmodule; this is a _very_ abridged version of the logic
|
||||
// in performCompile in libFrontendTool, specialized, to just the one
|
||||
// module-serialization task we're trying to do here.
|
||||
|
||||
Reference in New Issue
Block a user