Skip to content

Commit 415b6d1

Browse files
committed
Register a Deleter for the Global TypeChecker Harder This Time
My first go at this merely called the destructor. It did not free the memory allocation associated with the instance.
1 parent 9931aab commit 415b6d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Sema/TypeChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ TypeChecker &TypeChecker::createForContext(ASTContext &ctx) {
5656
"Cannot install more than one instance of the global type checker!");
5757
auto *TC = new TypeChecker(ctx);
5858
ctx.installGlobalTypeChecker(TC);
59-
ctx.addDestructorCleanup(TC);
59+
ctx.addCleanup([=](){ delete TC; });
6060
return *ctx.getLegacyGlobalTypeChecker();
6161
}
6262

0 commit comments

Comments
 (0)