@@ -2762,7 +2762,6 @@ ModuleDecl *ModuleFile::getModule(ImportPath::Module name,
27622762 return getContext ().getLoadedModule (name);
27632763}
27642764
2765-
27662765// / Translate from the Serialization associativity enum values to the AST
27672766// / strongly-typed enum.
27682767// /
@@ -5280,6 +5279,11 @@ DeclDeserializer::readAvailable_DECL_ATTR(SmallVectorImpl<uint64_t> &scratch,
52805279 isPackageDescriptionVersionSpecific, isSPI, LIST_VER_TUPLE_PIECES (Introduced),
52815280 LIST_VER_TUPLE_PIECES (Deprecated), LIST_VER_TUPLE_PIECES (Obsoleted),
52825281 platform, renameDeclID, messageSize, renameSize);
5282+
5283+ // Hack: Filter the un-supported platforms from swiftmodule
5284+ if (platform >= /* PlatformKind::visionOS*/ 13 ) {
5285+ return nullptr ;
5286+ }
52835287
52845288 ValueDecl *renameDecl = nullptr ;
52855289 if (renameDeclID) {
@@ -5513,6 +5517,7 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
55135517
55145518 case decls_block::Available_DECL_ATTR: {
55155519 Attr = readAvailable_DECL_ATTR (scratch, blobData);
5520+ if (!Attr) skipAttr = true ;
55165521 break ;
55175522 }
55185523
@@ -5625,10 +5630,20 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
56255630 }
56265631
56275632 auto attr = readAvailable_DECL_ATTR (scratch, blobData);
5628- availabilityAttrs.push_back (attr);
5633+ if (attr) {
5634+ availabilityAttrs.push_back (attr);
5635+ }
56295636 restoreOffset2.cancel ();
56305637 --numAvailabilityAttrs;
56315638 }
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+ }
56325647
56335648 auto specializedSig = MF.getGenericSignature (specializedSigID);
56345649 Attr = SpecializeAttr::create (ctx, exported != 0 , specializationKind,
0 commit comments