[SIL] Unify default witness table entries with witness table entries.

SILWitnessTable::Entry already contains a superset of what was supported
by SILDefaultWitnessTable::Entry, the latter of which only had “no entry”
and “method” states. Make SILDefaultWitnessTable::Entry an alias for
SILWitnessTable::Entry, and unify all of the parsing/printing/
(de)serialization logic.
This commit is contained in:
Doug Gregor
2018-09-14 10:35:22 -07:00
parent 4f544f965a
commit 4ed973329a
16 changed files with 408 additions and 459 deletions

View File

@@ -535,16 +535,16 @@ SILModule::lookUpFunctionInDefaultWitnessTable(const ProtocolDecl *Protocol,
// Okay, we found the correct default witness table. Now look for the method.
for (auto &Entry : Ret->getEntries()) {
// Ignore dummy entries semitted for non-method requirements, as well as
// Ignore dummy entries emitted for non-method requirements, as well as
// requirements without default implementations.
if (!Entry.isValid())
if (!Entry.isValid() || Entry.getKind() != SILWitnessTable::Method)
continue;
// Check if this is the member we were looking for.
if (Entry.getRequirement() != Requirement)
if (Entry.getMethodWitness().Requirement != Requirement)
continue;
return std::make_pair(Entry.getWitness(), Ret);
return std::make_pair(Entry.getMethodWitness().Witness, Ret);
}
// This requirement doesn't have a default implementation.