Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/Serialization/Deserialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,6 @@ ModuleDecl *ModuleFile::getModule(ImportPath::Module name,
return getContext().getLoadedModule(name);
}


/// Translate from the Serialization associativity enum values to the AST
/// strongly-typed enum.
///
Expand Down Expand Up @@ -5280,6 +5279,11 @@ DeclDeserializer::readAvailable_DECL_ATTR(SmallVectorImpl<uint64_t> &scratch,
isPackageDescriptionVersionSpecific, isSPI, LIST_VER_TUPLE_PIECES(Introduced),
LIST_VER_TUPLE_PIECES(Deprecated), LIST_VER_TUPLE_PIECES(Obsoleted),
platform, renameDeclID, messageSize, renameSize);

// Hack: Filter the un-supported platforms from swiftmodule
if (platform >= /*PlatformKind::visionOS*/13) {
return nullptr;
}

ValueDecl *renameDecl = nullptr;
if (renameDeclID) {
Expand Down Expand Up @@ -5513,6 +5517,7 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {

case decls_block::Available_DECL_ATTR: {
Attr = readAvailable_DECL_ATTR(scratch, blobData);
if (!Attr) skipAttr = true;
break;
}

Expand Down Expand Up @@ -5625,10 +5630,20 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
}

auto attr = readAvailable_DECL_ATTR(scratch, blobData);
availabilityAttrs.push_back(attr);
if (attr) {
availabilityAttrs.push_back(attr);
}
restoreOffset2.cancel();
--numAvailabilityAttrs;
}

// Hack: When deserialized from some un-supported @available attr decl, we should remove it
// @available (iOS, macOS, visionOS) -> @available (iOS, macOS)
if (availabilityAttrs.empty()) {
// If attr list is empty, then remove this attr
skipAttr = true;
break;
}

auto specializedSig = MF.getGenericSignature(specializedSigID);
Attr = SpecializeAttr::create(ctx, exported != 0, specializationKind,
Expand Down