mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialization: restrict swiftmodules to distribution channels
There are scenarios where different compilers are distributed with compatible serialization format versions and the same tag. Distinguish swiftmodules in such a case by assigning them to different distribution channels. A compiler expecting a specific channel will only read swiftmodules from the same channel. The channels should be defined by downstream code as it is by definition vendor specific. For development, a no-channel compiler loads or defining the env var SWIFT_IGNORE_SWIFTMODULE_REVISION skips this new check. rdar://123731777
This commit is contained in:
@@ -834,6 +834,7 @@ void Serializer::writeBlockInfoBlock() {
|
||||
BLOCK_RECORD(control_block, TARGET);
|
||||
BLOCK_RECORD(control_block, SDK_NAME);
|
||||
BLOCK_RECORD(control_block, REVISION);
|
||||
BLOCK_RECORD(control_block, CHANNEL);
|
||||
BLOCK_RECORD(control_block, IS_OSSA);
|
||||
BLOCK_RECORD(control_block, ALLOWABLE_CLIENT_NAME);
|
||||
BLOCK_RECORD(control_block, HAS_NONCOPYABLE_GENERICS);
|
||||
@@ -982,6 +983,7 @@ void Serializer::writeHeader() {
|
||||
control_block::TargetLayout Target(Out);
|
||||
control_block::SDKNameLayout SDKName(Out);
|
||||
control_block::RevisionLayout Revision(Out);
|
||||
control_block::ChannelLayout Channel(Out);
|
||||
control_block::IsOSSALayout IsOSSA(Out);
|
||||
control_block::AllowableClientLayout Allowable(Out);
|
||||
control_block::HasNoncopyableGenerics HasNoncopyableGenerics(Out);
|
||||
@@ -1035,6 +1037,8 @@ void Serializer::writeHeader() {
|
||||
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
|
||||
Revision.emit(ScratchRecord, revision);
|
||||
|
||||
Channel.emit(ScratchRecord, version::getCurrentCompilerChannel());
|
||||
|
||||
IsOSSA.emit(ScratchRecord, Options.IsOSSA);
|
||||
|
||||
HasNoncopyableGenerics.emit(ScratchRecord,
|
||||
|
||||
Reference in New Issue
Block a user