File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -790,14 +790,18 @@ class ModuleInterfaceLoaderImpl {
790
790
UsableModulePath = adjacentMod;
791
791
return std::make_error_code (std::errc::not_supported);
792
792
} else if (isInResourceDir (adjacentMod) &&
793
- loadMode == ModuleLoadingMode::PreferSerialized) {
793
+ loadMode == ModuleLoadingMode::PreferSerialized &&
794
+ rebuildInfo.getOrInsertCandidateModule (adjacentMod).serializationStatus !=
795
+ serialization::Status::SDKMismatch) {
794
796
// Special-case here: If we're loading a .swiftmodule from the resource
795
797
// dir adjacent to the compiler, defer to the serialized loader instead
796
798
// of falling back. This is mainly to support development of Swift,
797
799
// where one might change the module format version but forget to
798
800
// recompile the standard library. If that happens, don't fall back
799
801
// and silently recompile the standard library -- instead, error like
800
802
// we used to.
803
+ // Still accept modules built with a different SDK, allowing the use
804
+ // of one toolchain against a different SDK.
801
805
LLVM_DEBUG (llvm::dbgs () << " Found out-of-date module in the "
802
806
" resource-dir at "
803
807
<< adjacentMod
Original file line number Diff line number Diff line change @@ -544,7 +544,7 @@ ValidationInfo serialization::validateSerializedAST(
544
544
requiresOSSAModules, requiresRevisionMatch,
545
545
requiredSDK,
546
546
extendedInfo, localObfuscator);
547
- if (result.status == Status::Malformed )
547
+ if (result.status != Status::Valid )
548
548
return result;
549
549
} else if ((dependencies || searchPaths) &&
550
550
result.status == Status::Valid &&
Original file line number Diff line number Diff line change 34
34
// RUN: -Rmodule-interface-rebuild 2>&1 | %FileCheck %s -check-prefix=CHECK-AvsB-REBUILD
35
35
// CHECK-AvsB-REBUILD: remark: rebuilding module 'Lib' from interface
36
36
37
+ /// Modules loaded from the resource dir are not usually rebuilt from
38
+ /// the swiftinterface as it would indicate a configuration problem.
39
+ /// Lift that behavior for SDK mismatch and still rebuild them.
40
+ // RUN: %empty-directory(%t/cache)
41
+ // RUN: %target-swift-frontend -emit-module %t/Lib.swift \
42
+ // RUN: -swift-version 5 -enable-library-evolution \
43
+ // RUN: -target-sdk-name A -parse-stdlib -module-cache-path %t/cache \
44
+ // RUN: -o %t/build -emit-module-interface-path %t/build/Lib.swiftinterface
45
+ // RUN: env SWIFT_DEBUG_FORCE_SWIFTMODULE_PER_SDK=true \
46
+ // RUN: %target-swift-frontend -typecheck %t/Client.swift \
47
+ // RUN: -target-sdk-name B -resource-dir %t/build -I %t/build \
48
+ // RUN: -parse-stdlib -module-cache-path %t/cache \
49
+ // RUN: -Rmodule-interface-rebuild 2>&1 | %FileCheck %s -check-prefix=CHECK-AvsB-REBUILD
50
+
37
51
// BEGIN Lib.swift
38
52
public func foo( ) { }
39
53
You can’t perform that action at this time.
0 commit comments