Skip to content

Commit 52f2cc3

Browse files
committed
Serialization: allow rebuilding modules from swiftinterface in release builds
There is some special logic for loading modules from under the resource-dir. In this case, if there's a swiftmodule next to the swiftinterface we refuse to rebuild the module from the swiftinterface. It was designed to catch misconfigurations, either locally if we forget to rebuild the stdlib from source or at deployement. It has been causing issues recently with LLDB and other tools. Let's keep this behavior only for the local scenario by limiting it to untagged compilers. This restriction aligns well with the strict compiler tag check for swiftmodule compatibility.
1 parent e4310d7 commit 52f2cc3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -820,15 +820,21 @@ class ModuleInterfaceLoaderImpl {
820820
return std::make_error_code(std::errc::not_supported);
821821
} else if (isInResourceDir(adjacentMod) &&
822822
loadMode == ModuleLoadingMode::PreferSerialized &&
823+
!version::isCurrentCompilerTagged() &&
823824
rebuildInfo.getOrInsertCandidateModule(adjacentMod).serializationStatus !=
824825
serialization::Status::SDKMismatch) {
825826
// Special-case here: If we're loading a .swiftmodule from the resource
826827
// dir adjacent to the compiler, defer to the serialized loader instead
827-
// of falling back. This is mainly to support development of Swift,
828+
// of falling back. This is to support local development of Swift,
828829
// where one might change the module format version but forget to
829830
// recompile the standard library. If that happens, don't fall back
830-
// and silently recompile the standard library -- instead, error like
831-
// we used to.
831+
// and silently recompile the standard library, raise an error
832+
// instead.
833+
//
834+
// This logic is disabled for tagged compilers, so distributed
835+
// compilers should ignore this restriction and rebuild all modules
836+
// from a swiftinterface when required.
837+
//
832838
// Still accept modules built with a different SDK, allowing the use
833839
// of one toolchain against a different SDK.
834840
LLVM_DEBUG(llvm::dbgs() << "Found out-of-date module in the "

0 commit comments

Comments
 (0)