Skip to content

Commit

Permalink
Serialization: Remove some unused code
Browse files Browse the repository at this point in the history
Previous refactorings introducing GenericEnvironment left
behind some lint.
  • Loading branch information
slavapestov committed Oct 13, 2016
1 parent 5ab94a6 commit 092a931
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
13 changes: 6 additions & 7 deletions include/swift/Serialization/ModuleFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const uint16_t VERSION_MAJOR = 0;
/// in source control, you should also update the comment to briefly
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
const uint16_t VERSION_MINOR = 274; // Last change: SIL generic environment sugar
const uint16_t VERSION_MINOR = 275; // Last change: remove some unused bits

using DeclID = PointerEmbeddedInt<unsigned, 31>;
using DeclIDField = BCFixed<31>;
Expand Down Expand Up @@ -769,12 +769,11 @@ namespace decls_block {

using GenericTypeParamDeclLayout = BCRecordLayout<
GENERIC_TYPE_PARAM_DECL,
IdentifierIDField, // name
DeclContextIDField,// context decl
BCFixed<1>, // implicit flag
BCVBR<4>, // depth
BCVBR<4>, // index
BCArray<TypeIDField> // inherited types
IdentifierIDField, // name
DeclContextIDField, // context decl
BCFixed<1>, // implicit flag
BCVBR<4>, // depth
BCVBR<4> // index
>;

using AssociatedTypeDeclLayout = BCRecordLayout<
Expand Down
10 changes: 1 addition & 9 deletions lib/Serialization/Deserialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2240,14 +2240,12 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
bool isImplicit;
unsigned depth;
unsigned index;
ArrayRef<uint64_t> rawInheritedIDs;

decls_block::GenericTypeParamDeclLayout::readRecord(scratch, nameID,
contextID,
isImplicit,
depth,
index,
rawInheritedIDs);
index);

auto DC = ForcedContext ? *ForcedContext : getDeclContext(contextID);

Expand All @@ -2264,12 +2262,6 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
if (isImplicit)
genericParam->setImplicit();

auto inherited = ctx.Allocate<TypeLoc>(rawInheritedIDs.size());
for_each(inherited, rawInheritedIDs, [this](TypeLoc &loc, uint64_t rawID) {
loc.setType(getType(rawID));
});
genericParam->setInherited(inherited);
genericParam->setCheckedInheritanceClause();
break;
}

Expand Down
7 changes: 0 additions & 7 deletions lib/Serialization/SILFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ namespace sil_block {
SIL_DEFAULT_WITNESS_TABLE,
SIL_DEFAULT_WITNESS_TABLE_ENTRY,
SIL_DEFAULT_WITNESS_TABLE_NO_ENTRY,
SIL_GENERIC_OUTER_PARAMS,
SIL_INST_WITNESS_METHOD,
SIL_SPECIALIZE_ATTR,

Expand All @@ -154,7 +153,6 @@ namespace sil_block {
= decls_block::SPECIALIZED_PROTOCOL_CONFORMANCE,
INHERITED_PROTOCOL_CONFORMANCE
= decls_block::INHERITED_PROTOCOL_CONFORMANCE,
GENERIC_PARAM_LIST = decls_block::GENERIC_PARAM_LIST,
GENERIC_PARAM = decls_block::GENERIC_PARAM,
GENERIC_REQUIREMENT = decls_block::GENERIC_REQUIREMENT,
};
Expand Down Expand Up @@ -385,11 +383,6 @@ namespace sil_block {
TypeIDField // Result type
>;

using SILGenericOuterParamsLayout = BCRecordLayout<
SIL_GENERIC_OUTER_PARAMS,
DeclIDField // The decl id of the outer param if any.
>;

using SILInstWitnessMethodLayout = BCRecordLayout<
SIL_INST_WITNESS_METHOD,
TypeIDField, // result type
Expand Down
8 changes: 1 addition & 7 deletions lib/Serialization/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ void Serializer::writeBlockInfoBlock() {
BLOCK_RECORD(sil_block, SIL_DEFAULT_WITNESS_TABLE);
BLOCK_RECORD(sil_block, SIL_DEFAULT_WITNESS_TABLE_ENTRY);
BLOCK_RECORD(sil_block, SIL_DEFAULT_WITNESS_TABLE_NO_ENTRY);
BLOCK_RECORD(sil_block, SIL_GENERIC_OUTER_PARAMS);
BLOCK_RECORD(sil_block, SIL_INST_WITNESS_METHOD);
BLOCK_RECORD(sil_block, SIL_SPECIALIZE_ATTR);

Expand Down Expand Up @@ -2213,18 +2212,13 @@ void Serializer::writeDecl(const Decl *D) {

auto contextID = addDeclContextRef(genericParam->getDeclContext());

SmallVector<TypeID, 4> inheritedTypes;
for (auto inherited : genericParam->getInherited())
inheritedTypes.push_back(addTypeRef(inherited.getType()));

unsigned abbrCode = DeclTypeAbbrCodes[GenericTypeParamDeclLayout::Code];
GenericTypeParamDeclLayout::emitRecord(Out, ScratchRecord, abbrCode,
addIdentifierRef(genericParam->getName()),
contextID,
genericParam->isImplicit(),
genericParam->getDepth(),
genericParam->getIndex(),
inheritedTypes);
genericParam->getIndex());
break;
}

Expand Down
1 change: 0 additions & 1 deletion lib/Serialization/SerializeSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,6 @@ void SILSerializer::writeSILBlock(const SILModule *SILMod) {
registerSILAbbr<DefaultWitnessTableLayout>();
registerSILAbbr<DefaultWitnessTableEntryLayout>();
registerSILAbbr<DefaultWitnessTableNoEntryLayout>();
registerSILAbbr<SILGenericOuterParamsLayout>();

registerSILAbbr<SILInstCastLayout>();
registerSILAbbr<SILInstWitnessMethodLayout>();
Expand Down

0 comments on commit 092a931

Please sign in to comment.