SIL: Generalize default witness tables now that defaulted witnesses don't have to go at the end

NFC until the new witness table instantiation mechanism is enabled.
This commit is contained in:
Slava Pestov
2018-03-27 16:21:59 -07:00
parent 0edce39a24
commit d1c6e1d24a
11 changed files with 18 additions and 105 deletions

View File

@@ -101,31 +101,6 @@ Identifier SILDefaultWitnessTable::getIdentifier() const {
return Mod.getASTContext().getIdentifier(name);
}
unsigned SILDefaultWitnessTable::getMinimumWitnessTableSize() const {
unsigned defaultEntries = 0;
unsigned minimumEntries = 0;
// Count the number of entries up to and including the last null entry.
// This is the number of witnesses that all conforming types must
// provide.
//
// Any witnesses after the last null entry all have defaults, and can
// be omitted from conformances; these are the resilient defaults.
//
// FIXME: Really this should look at availability instead.
for (auto entry : Entries) {
if (entry.isValid()) {
defaultEntries++;
} else {
minimumEntries++;
minimumEntries += defaultEntries;
defaultEntries = 0;
}
}
return minimumEntries;
}
SILDefaultWitnessTable::~SILDefaultWitnessTable() {
// Drop the reference count of witness functions referenced by this table.
for (auto entry : getEntries()) {