mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[swift-ide-test] Bail out when a module couldn't be loaded (#15563)
The importer in particular depends on the stdlib and the Foundation overlay being successfully loaded, so if anything /can't/ be loaded we have to assume that trying to walk a module's decls will result in a crash. rdar://problem/37540394
This commit is contained in:
@@ -1490,11 +1490,18 @@ static ModuleDecl *getModuleByFullName(ASTContext &Context, StringRef ModuleName
|
||||
AccessPath.push_back(
|
||||
{ Context.getIdentifier(SubModuleName), SourceLoc() });
|
||||
}
|
||||
return Context.getModule(AccessPath);
|
||||
ModuleDecl *Result = Context.getModule(AccessPath);
|
||||
if (!Result || Result->failedToLoad())
|
||||
return nullptr;
|
||||
return Result;
|
||||
}
|
||||
|
||||
static ModuleDecl *getModuleByFullName(ASTContext &Context, Identifier ModuleName) {
|
||||
return Context.getModule(std::make_pair(ModuleName, SourceLoc()));
|
||||
ModuleDecl *Result = Context.getModule(std::make_pair(ModuleName,
|
||||
SourceLoc()));
|
||||
if (!Result || Result->failedToLoad())
|
||||
return nullptr;
|
||||
return Result;
|
||||
}
|
||||
|
||||
static int doPrintAST(const CompilerInvocation &InitInvok,
|
||||
|
||||
Reference in New Issue
Block a user