mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Call SILFunction destructor when we cleanup functions so that if the function contains a function_ref, the function referenced by the function_ref has its refcount properly decrement.
Otherwise a function_ref which was supposed to be deallocated would keep functions alive. rdar://16287331 Swift SVN r16192
This commit is contained in:
@@ -91,6 +91,15 @@ SILModule::SILModule(Module *SwiftModule)
|
||||
}
|
||||
|
||||
SILModule::~SILModule() {
|
||||
// Drop everything functions in this module reference.
|
||||
//
|
||||
// This is necessary since the functions may reference each other. We don't
|
||||
// need to worry about sil_witness_tables since witness tables reference each
|
||||
// other via protocol conformances and sil_vtables don't reference each other
|
||||
// at all.
|
||||
for (SILFunction &F : *this)
|
||||
F.dropAllReferences();
|
||||
|
||||
delete (SILTypeListUniquingType*)TypeListUniquing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user