ASTUnit: Don't clone the new DiagnosticConsumer, causing it to get leaked.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index e32fa63..7aa9603 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -643,8 +643,10 @@
DiagnosticConsumer *Client = 0;
if (CaptureDiagnostics)
Client = new StoredDiagnosticConsumer(AST.StoredDiagnostics);
- Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgEnd- ArgBegin,
- ArgBegin, Client);
+ Diags = CompilerInstance::createDiagnostics(DiagOpts, ArgEnd-ArgBegin,
+ ArgBegin, Client,
+ /*ShouldOwnClient=*/true,
+ /*ShouldCloneClient=*/false);
} else if (CaptureDiagnostics) {
Diags->setClient(new StoredDiagnosticConsumer(AST.StoredDiagnostics));
}