Skip to content

Fix TODO by removing unneeded ShouldSerializeAll parameters. #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2015
Merged
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
24 changes: 8 additions & 16 deletions lib/Serialization/SerializeSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ namespace {
<< " for layout " << Layout::Code << "\n");
}

// TODO: this is not required anymore. Remove it.
bool ShouldSerializeAll;

/// Helper function to update ListOfValues for MethodInst. Format:
/// Attr, SILDeclRef (DeclID, Kind, uncurryLevel, IsObjC), and an operand.
void handleMethodInst(const MethodInst *MI, SILValue operand,
Expand Down Expand Up @@ -205,8 +202,8 @@ namespace {

public:
SILSerializer(Serializer &S, ASTContext &Ctx,
llvm::BitstreamWriter &Out, bool serializeAll)
: S(S), Ctx(Ctx), Out(Out), ShouldSerializeAll(serializeAll) {}
llvm::BitstreamWriter &Out)
: S(S), Ctx(Ctx), Out(Out) {}

void writeSILModule(const SILModule *SILMod);
};
Expand Down Expand Up @@ -1697,28 +1694,23 @@ void SILSerializer::writeSILBlock(const SILModule *SILMod) {
// FIXME: Resilience: could write out vtable for fragile classes.
const DeclContext *assocDC = SILMod->getAssociatedContext();
for (const SILVTable &vt : SILMod->getVTables()) {
if (ShouldSerializeAll &&
vt.getClass()->isChildContextOf(assocDC))
if (vt.getClass()->isChildContextOf(assocDC))
writeSILVTable(vt);
}

// Write out WitnessTables. For now, write out only if EnableSerializeAll.
// Write out WitnessTables.
for (const SILWitnessTable &wt : SILMod->getWitnessTables()) {
if (ShouldSerializeAll &&
wt.getConformance()->getDeclContext()->isChildContextOf(assocDC))
if (wt.getConformance()->getDeclContext()->isChildContextOf(assocDC))
writeSILWitnessTable(wt);
}

// Go through all the SILFunctions in SILMod and write out any
// mandatory function bodies.
for (const SILFunction &F : *SILMod) {
if (shouldEmitFunctionBody(F) || ShouldSerializeAll)
if (shouldEmitFunctionBody(F))
writeSILFunction(F);
}

if (ShouldSerializeAll)
return;

// Now write function declarations for every function we've
// emitted a reference to without emitting a function body for.
for (const SILFunction &F : *SILMod) {
Expand All @@ -1732,10 +1724,10 @@ void SILSerializer::writeSILModule(const SILModule *SILMod) {
writeIndexTables();
}

void Serializer::writeSIL(const SILModule *SILMod, bool serializeAllSIL) {
void Serializer::writeSIL(const SILModule *SILMod) {
if (!SILMod)
return;

SILSerializer SILSer(*this, M->getASTContext(), Out, serializeAllSIL);
SILSerializer SILSer(*this, M->getASTContext(), Out);
SILSer.writeSILModule(SILMod);
}