File tree Expand file tree Collapse file tree 3 files changed +21
-16
lines changed Expand file tree Collapse file tree 3 files changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -334,6 +334,12 @@ static ValidationInfo validateControlBlock(
334334 LLVM_FALLTHROUGH;
335335 case 3 :
336336 result.shortVersion = blobData.slice (0 , scratch[2 ]);
337+
338+ // If the format version doesn't match, give up after also getting the
339+ // compiler version. This provides better diagnostics.
340+ if (result.status != Status::Valid)
341+ return result;
342+
337343 LLVM_FALLTHROUGH;
338344 case 2 :
339345 case 1 :
Original file line number Diff line number Diff line change @@ -58,8 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5858// / describe what change you made. The content of this comment isn't important;
5959// / it just ensures a conflict if two people change the module format.
6060// / Don't worry about adhering to the 80-column limit for this line.
61- const uint16_t SWIFTMODULE_VERSION_MINOR =
62- 875 ; // Add package field to SerializedKind_t
61+ const uint16_t SWIFTMODULE_VERSION_MINOR = 876 ; // Reorder control block enum
6362
6463// / A standard hash seed used for all string hashes in a serialized module.
6564// /
@@ -862,11 +861,11 @@ namespace control_block {
862861 MODULE_NAME,
863862 TARGET,
864863 SDK_NAME,
865- SDK_VERSION,
866864 REVISION,
867- CHANNEL,
868865 IS_OSSA,
869866 ALLOWABLE_CLIENT_NAME,
867+ CHANNEL,
868+ SDK_VERSION,
870869 };
871870
872871 using MetadataLayout = BCRecordLayout<
@@ -897,21 +896,11 @@ namespace control_block {
897896 BCBlob
898897 >;
899898
900- using SDKVersionLayout = BCRecordLayout<
901- SDK_VERSION,
902- BCBlob
903- >;
904-
905899 using RevisionLayout = BCRecordLayout<
906900 REVISION,
907901 BCBlob
908902 >;
909903
910- using ChannelLayout = BCRecordLayout<
911- CHANNEL,
912- BCBlob
913- >;
914-
915904 using IsOSSALayout = BCRecordLayout<
916905 IS_OSSA,
917906 BCFixed<1 >
@@ -921,6 +910,16 @@ namespace control_block {
921910 ALLOWABLE_CLIENT_NAME,
922911 BCBlob
923912 >;
913+
914+ using ChannelLayout = BCRecordLayout<
915+ CHANNEL,
916+ BCBlob
917+ >;
918+
919+ using SDKVersionLayout = BCRecordLayout<
920+ SDK_VERSION,
921+ BCBlob
922+ >;
924923}
925924
926925// / The record types within the options block (a sub-block of the control
Original file line number Diff line number Diff line change @@ -834,11 +834,11 @@ void Serializer::writeBlockInfoBlock() {
834834 BLOCK_RECORD (control_block, MODULE_NAME);
835835 BLOCK_RECORD (control_block, TARGET);
836836 BLOCK_RECORD (control_block, SDK_NAME);
837- BLOCK_RECORD (control_block, SDK_VERSION);
838837 BLOCK_RECORD (control_block, REVISION);
839- BLOCK_RECORD (control_block, CHANNEL);
840838 BLOCK_RECORD (control_block, IS_OSSA);
841839 BLOCK_RECORD (control_block, ALLOWABLE_CLIENT_NAME);
840+ BLOCK_RECORD (control_block, CHANNEL);
841+ BLOCK_RECORD (control_block, SDK_VERSION);
842842
843843 BLOCK (OPTIONS_BLOCK);
844844 BLOCK_RECORD (options_block, SDK_PATH);
You can’t perform that action at this time.
0 commit comments