mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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:
@@ -197,8 +197,9 @@ public:
|
||||
}
|
||||
|
||||
int extractAPI() {
|
||||
if (Instance.setup(Invocation)) {
|
||||
llvm::outs() << "Failed to setup compiler instance\n";
|
||||
std::string InstanceSetupError;
|
||||
if (Instance.setup(Invocation, InstanceSetupError)) {
|
||||
llvm::outs() << InstanceSetupError << '\n';
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user