mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Have VTables and WitnessTables bump the reference counts of SILFunctions.
Fixes <rdar://problem/15725600>. Swift SVN r11666
This commit is contained in:
@@ -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--;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user