mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Serialization: Remove code that became dead when PolymorphicFunctionType was removed
This commit is contained in:
@@ -490,9 +490,6 @@ private:
|
||||
|
||||
ParameterList *readParameterList();
|
||||
|
||||
GenericParamList *maybeGetOrReadGenericParams(serialization::DeclID contextID,
|
||||
DeclContext *DC);
|
||||
|
||||
/// Reads a generic param list from \c DeclTypeCursor.
|
||||
///
|
||||
/// If the record at the cursor is not a generic param list, returns null
|
||||
|
||||
@@ -783,25 +783,6 @@ ModuleFile::maybeReadSubstitution(llvm::BitstreamCursor &cursor,
|
||||
getContext().AllocateCopy(conformanceBuf)};
|
||||
}
|
||||
|
||||
GenericParamList *
|
||||
ModuleFile::maybeGetOrReadGenericParams(serialization::DeclID genericContextID,
|
||||
DeclContext *DC) {
|
||||
if (genericContextID) {
|
||||
Decl *genericContext = getDecl(genericContextID);
|
||||
assert(genericContext && "loading PolymorphicFunctionType before its decl");
|
||||
|
||||
if (auto fn = dyn_cast<AbstractFunctionDecl>(genericContext))
|
||||
return fn->getGenericParams();
|
||||
if (auto nominal = dyn_cast<NominalTypeDecl>(genericContext))
|
||||
return nominal->getGenericParams();
|
||||
if (auto ext = dyn_cast<ExtensionDecl>(genericContext))
|
||||
return ext->getGenericParams();
|
||||
llvm_unreachable("only functions and nominals can provide generic params");
|
||||
} else {
|
||||
return maybeReadGenericParams(DC);
|
||||
}
|
||||
}
|
||||
|
||||
GenericParamList *ModuleFile::maybeReadGenericParams(DeclContext *DC,
|
||||
GenericParamList *outerParams) {
|
||||
using namespace decls_block;
|
||||
@@ -821,7 +802,6 @@ GenericParamList *ModuleFile::maybeReadGenericParams(DeclContext *DC,
|
||||
return nullptr;
|
||||
|
||||
SmallVector<GenericTypeParamDecl *, 8> params;
|
||||
SmallVector<RequirementRepr, 8> requirements;
|
||||
|
||||
while (true) {
|
||||
lastRecordOffset.reset();
|
||||
|
||||
@@ -447,18 +447,6 @@ DeclID Serializer::addDeclRef(const Decl *D, bool forceSerialization) {
|
||||
isa<PrecedenceGroupDecl>(D)) &&
|
||||
"cannot cross-reference this decl");
|
||||
|
||||
// Record any generic parameters that come from this decl, so that we can use
|
||||
// the decl to refer to the parameters later.
|
||||
const GenericParamList *paramList = nullptr;
|
||||
if (auto fn = dyn_cast<AbstractFunctionDecl>(D))
|
||||
paramList = fn->getGenericParams();
|
||||
else if (auto nominal = dyn_cast<NominalTypeDecl>(D))
|
||||
paramList = nominal->getGenericParams();
|
||||
else if (auto ext = dyn_cast<ExtensionDecl>(D))
|
||||
paramList = ext->getGenericParams();
|
||||
if (paramList)
|
||||
GenericContexts[paramList] = D;
|
||||
|
||||
id = { ++LastDeclID, forceSerialization };
|
||||
DeclsAndTypesToWrite.push(D);
|
||||
return id.first;
|
||||
@@ -535,11 +523,6 @@ NormalConformanceID Serializer::addConformanceRef(
|
||||
return conformanceID;
|
||||
}
|
||||
|
||||
const Decl *Serializer::getGenericContext(const GenericParamList *paramList) {
|
||||
auto contextDecl = GenericContexts.lookup(paramList);
|
||||
return contextDecl;
|
||||
}
|
||||
|
||||
/// Record the name of a block.
|
||||
static void emitBlockID(llvm::BitstreamWriter &out, unsigned ID,
|
||||
StringRef name,
|
||||
|
||||
@@ -100,9 +100,6 @@ private:
|
||||
/// A map from local DeclContexts to their serialized IDs.
|
||||
llvm::DenseMap<const DeclContext*, DeclContextID> LocalDeclContextIDs;
|
||||
|
||||
/// A map from generic parameter lists to the decls they come from.
|
||||
llvm::DenseMap<const GenericParamList *, const Decl *> GenericContexts;
|
||||
|
||||
/// A map from generic environments to their serialized IDs.
|
||||
llvm::DenseMap<const GenericEnvironment *, GenericEnvironmentID>
|
||||
GenericEnvironmentIDs;
|
||||
@@ -120,10 +117,6 @@ public:
|
||||
/// table.
|
||||
using DeclTable = llvm::MapVector<Identifier, DeclTableData>;
|
||||
|
||||
/// Returns the declaration the given generic parameter list is associated
|
||||
/// with.
|
||||
const Decl *getGenericContext(const GenericParamList *paramList);
|
||||
|
||||
using ObjCMethodTableData = SmallVector<std::tuple<TypeID, bool, DeclID>, 4>;
|
||||
|
||||
// In-memory representation of what will eventually be an on-disk
|
||||
|
||||
Reference in New Issue
Block a user