SIL: Have VTables and WitnessTables bump the reference counts of SILFunctions.

Fixes <rdar://problem/15725600>.

Swift SVN r11666
This commit is contained in:
Joe Groff
2013-12-27 05:59:19 +00:00
parent a9f9440544
commit c76548916e
5 changed files with 63 additions and 10 deletions

View File

@@ -52,3 +52,21 @@ SILVTable::getImplementation(SILModule &M, SILDeclRef method) const {
return nullptr;
}
SILVTable::SILVTable(ClassDecl *c, ArrayRef<Pair> entries)
: Class(c), NumEntries(entries.size())
{
memcpy(Entries, entries.begin(), sizeof(Pair) * NumEntries);
// Bump the reference count of functions referenced by this table.
for (auto entry : getEntries()) {
entry.second->RefCount++;
}
}
SILVTable::~SILVTable() {
// Drop the reference count of functions referenced by this table.
for (auto entry : getEntries()) {
entry.second->RefCount--;
}
}