mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Allow rebuilding modules from the resource dir on SDK mismatch
Modules loaded from the resource dir are not usually rebuilt from the swiftinterface as it would indicate a configuration problem. Lift that behavior for SDK mismatch and still rebuild them. This use case applies when a toolchain is used with a different SDK than the one use to build the modules in the toolchain. rdar://106101760
This commit is contained in:
@@ -790,7 +790,9 @@ class ModuleInterfaceLoaderImpl {
|
||||
UsableModulePath = adjacentMod;
|
||||
return std::make_error_code(std::errc::not_supported);
|
||||
} else if (isInResourceDir(adjacentMod) &&
|
||||
loadMode == ModuleLoadingMode::PreferSerialized) {
|
||||
loadMode == ModuleLoadingMode::PreferSerialized &&
|
||||
rebuildInfo.getOrInsertCandidateModule(adjacentMod).serializationStatus !=
|
||||
serialization::Status::SDKMismatch) {
|
||||
// Special-case here: If we're loading a .swiftmodule from the resource
|
||||
// dir adjacent to the compiler, defer to the serialized loader instead
|
||||
// of falling back. This is mainly to support development of Swift,
|
||||
@@ -798,6 +800,8 @@ class ModuleInterfaceLoaderImpl {
|
||||
// recompile the standard library. If that happens, don't fall back
|
||||
// and silently recompile the standard library -- instead, error like
|
||||
// we used to.
|
||||
// Still accept modules built with a different SDK, allowing the use
|
||||
// of one toolchain against a different SDK.
|
||||
LLVM_DEBUG(llvm::dbgs() << "Found out-of-date module in the "
|
||||
"resource-dir at "
|
||||
<< adjacentMod
|
||||
|
||||
Reference in New Issue
Block a user