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:
@@ -123,6 +123,14 @@ public:
|
||||
/// Increase the reference count.
|
||||
void incrementRefCount() { RefCount++; }
|
||||
void decrementRefCount() { RefCount--; }
|
||||
|
||||
/// Drops all uses belonging to instructions in this function. The only valid
|
||||
/// operation performable on this object after this is called is called the
|
||||
/// destructor or deallocation.
|
||||
void dropAllReferences() {
|
||||
for (SILBasicBlock &BB : *this)
|
||||
BB.dropAllReferences();
|
||||
}
|
||||
|
||||
/// Returns the calling convention used by this entry point.
|
||||
AbstractCC getAbstractCC() const {
|
||||
@@ -281,7 +289,7 @@ public:
|
||||
SILFunction *provideInitialHead() const { return createSentinel(); }
|
||||
SILFunction *ensureHead(SILFunction*) const { return createSentinel(); }
|
||||
static void noteHead(SILFunction*, SILFunction*) {}
|
||||
static void deleteNode(SILFunction *V) {}
|
||||
static void deleteNode(SILFunction *V) { V->~SILFunction(); }
|
||||
|
||||
private:
|
||||
void createNode(const SILFunction &);
|
||||
|
||||
Reference in New Issue
Block a user