mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Restrict loading swiftmodule files to the builder's SDK
Serialize the canonical name of the SDK used when building a swiftmodule file and use it to ensure that the swiftmodule file is loaded only with the same SDK. The SDK name must be passed down from the frontend. This will report unsupported configurations like: - Installing roots between incompatible SDKs without deleting the swiftmodule files. - Having multiple targets in the same project using different SDKs. - Loading a swiftmodule created with a newer SDK (and stdlib) with an older SDK. All of these lead to hard to investigate deserialization failures and this change should detect them early, before reaching a deserialization failure. rdar://78048939
This commit is contained in:
@@ -58,6 +58,9 @@ class ModuleFileSharedCore {
|
||||
/// The target the module was built for.
|
||||
StringRef TargetTriple;
|
||||
|
||||
/// The canonical name of the SDK the module was built with.
|
||||
StringRef SDKName;
|
||||
|
||||
/// The name of the module interface this module was compiled from.
|
||||
///
|
||||
/// Empty if this module didn't come from an interface file.
|
||||
|
||||
Reference in New Issue
Block a user