Skip to content

Commit 091532d

Browse files
committed
Add a destructor to OwnershipRAUWHelper.
It's supposed to cleanup its context whenever it's invalidated. This just makes sure the cleanup happens even if it transformation is never performed.
1 parent 58a2501 commit 091532d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/swift/SILOptimizer/Utils/OwnershipOptUtils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ class OwnershipRAUWHelper {
123123
public:
124124
OwnershipRAUWHelper() : ctx(nullptr) {}
125125

126+
~OwnershipRAUWHelper() { if (ctx) ctx->clear(); }
127+
126128
/// Return an instance of this class if we can perform the specific RAUW
127129
/// operation ignoring if the types line up. Returns None otherwise.
128130
///
@@ -164,7 +166,6 @@ class OwnershipRAUWHelper {
164166
SILValue newValue);
165167

166168
void invalidate() {
167-
ctx->clear();
168169
ctx = nullptr;
169170
}
170171
};

0 commit comments

Comments
 (0)