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:
Michael Gottesman
2014-04-11 01:44:38 +00:00
parent 60a52651e2
commit 0bc4f9c936
7 changed files with 64 additions and 16 deletions

View File

@@ -134,6 +134,13 @@ public:
/// \brief Remove all block arguments.
void dropAllArgs() { BBArgList.clear(); }
/// \brief Drops all uses that belong to this basic block.
void dropAllReferences() {
dropAllArgs();
for (SILInstruction &I : *this)
I.dropAllReferences();
}
//===--------------------------------------------------------------------===//
// Predecessors and Successors
//===--------------------------------------------------------------------===//