@@ -2762,7 +2762,6 @@ ModuleDecl *ModuleFile::getModule(ImportPath::Module name,
2762
2762
return getContext ().getLoadedModule (name);
2763
2763
}
2764
2764
2765
-
2766
2765
// / Translate from the Serialization associativity enum values to the AST
2767
2766
// / strongly-typed enum.
2768
2767
// /
@@ -5280,6 +5279,11 @@ DeclDeserializer::readAvailable_DECL_ATTR(SmallVectorImpl<uint64_t> &scratch,
5280
5279
isPackageDescriptionVersionSpecific, isSPI, LIST_VER_TUPLE_PIECES (Introduced),
5281
5280
LIST_VER_TUPLE_PIECES (Deprecated), LIST_VER_TUPLE_PIECES (Obsoleted),
5282
5281
platform, renameDeclID, messageSize, renameSize);
5282
+
5283
+ // Hack: Filter the un-supported platforms from swiftmodule
5284
+ if (platform >= /* PlatformKind::visionOS*/ 13 ) {
5285
+ return nullptr ;
5286
+ }
5283
5287
5284
5288
ValueDecl *renameDecl = nullptr ;
5285
5289
if (renameDeclID) {
@@ -5513,6 +5517,7 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
5513
5517
5514
5518
case decls_block::Available_DECL_ATTR: {
5515
5519
Attr = readAvailable_DECL_ATTR (scratch, blobData);
5520
+ if (!Attr) skipAttr = true ;
5516
5521
break ;
5517
5522
}
5518
5523
@@ -5625,10 +5630,20 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
5625
5630
}
5626
5631
5627
5632
auto attr = readAvailable_DECL_ATTR (scratch, blobData);
5628
- availabilityAttrs.push_back (attr);
5633
+ if (attr) {
5634
+ availabilityAttrs.push_back (attr);
5635
+ }
5629
5636
restoreOffset2.cancel ();
5630
5637
--numAvailabilityAttrs;
5631
5638
}
5639
+
5640
+ // Hack: When deserialized from some un-supported @available attr decl, we should remove it
5641
+ // @available (iOS, macOS, visionOS) -> @available (iOS, macOS)
5642
+ if (availabilityAttrs.empty ()) {
5643
+ // If attr list is empty, then remove this attr
5644
+ skipAttr = true ;
5645
+ break ;
5646
+ }
5632
5647
5633
5648
auto specializedSig = MF.getGenericSignature (specializedSigID);
5634
5649
Attr = SpecializeAttr::create (ctx, exported != 0 , specializationKind,
0 commit comments