From: Benjamin Kramer Date: Sun, 14 Feb 2016 13:18:06 +0000 (+0000) Subject: Don't leak the ASTUnit when done with testing. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c077371eb6feb59039ef906f7dc4c87a3ce4ba76;p=clang Don't leak the ASTUnit when done with testing. Found by lsan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260850 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/c-index-test/core_main.cpp b/tools/c-index-test/core_main.cpp index ce37b56256..c56d66f214 100644 --- a/tools/c-index-test/core_main.cpp +++ b/tools/c-index-test/core_main.cpp @@ -123,9 +123,8 @@ static bool printSourceSymbols(ArrayRef Args) { /*WrappedAction=*/nullptr); auto PCHContainerOps = std::make_shared(); - ASTUnit *Unit = - ASTUnit::LoadFromCompilerInvocationAction(CInvok.get(), PCHContainerOps, - Diags, IndexAction.get()); + std::unique_ptr Unit(ASTUnit::LoadFromCompilerInvocationAction( + CInvok.get(), PCHContainerOps, Diags, IndexAction.get())); if (!Unit) return true;