Skip to content

Commit eeab114

Browse files
committed
[Frontend] Always allow loading the adjacent module for the stdlib
1 parent d2983bf commit eeab114

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ class ModuleInterfaceLoaderImpl {
675675
std::pair<std::string, std::string> getCompiledModuleCandidates() {
676676
std::pair<std::string, std::string> result;
677677
// Should we attempt to load a swiftmodule adjacent to the swiftinterface?
678-
bool shouldLoadAdjacentModule = !ctx.IgnoreAdjacentModules;
678+
bool shouldLoadAdjacentModule = !ctx.IgnoreAdjacentModules ||
679+
moduleName == STDLIB_NAME;
679680

680681
// Don't use the adjacent swiftmodule for frameworks from the public
681682
// Frameworks folder of the SDK.

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "swift/Basic/SourceManager.h"
2424
#include "swift/Basic/Version.h"
2525
#include "swift/Option/Options.h"
26+
#include "swift/Strings.h"
2627

2728
#include "llvm/Option/OptTable.h"
2829
#include "llvm/Option/ArgList.h"
@@ -445,7 +446,7 @@ std::error_code ImplicitSerializedModuleLoader::findModuleFilesInDirectory(
445446
"Module and Module Doc buffer must both be initialized or NULL");
446447

447448
if (LoadMode == ModuleLoadingMode::OnlyInterface ||
448-
Ctx.IgnoreAdjacentModules)
449+
(Ctx.IgnoreAdjacentModules && ModuleID.Item.str() != STDLIB_NAME))
449450
return std::make_error_code(std::errc::not_supported);
450451

451452
auto ModuleErr = openModuleFile(ModuleID, BaseName, ModuleBuffer);

0 commit comments

Comments
 (0)