aboutsummaryrefslogtreecommitdiff
path: root/lib/Basic/Diagnostic.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-31 22:04:05 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-31 22:04:05 +0000
commit4f5e21e24fb9e6ec473a13f83b5c9a2c41501a70 (patch)
tree9f120c36237ea7952616b01eb3f0dba564ea7b5c /lib/Basic/Diagnostic.cpp
parentc7a9cda0eb24762a3e9c892b1f4bdc6deb5de0a6 (diff)
Teach Diagnostic::setClient() to free the existing, owned
client. Fixes a libclang leak. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Diagnostic.cpp')
-rw-r--r--lib/Basic/Diagnostic.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 9a263c1d0b..31e33315cc 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -62,6 +62,13 @@ Diagnostic::~Diagnostic() {
delete Client;
}
+void Diagnostic::setClient(DiagnosticClient *client, bool ShouldOwnClient) {
+ if (OwnsDiagClient && Client)
+ delete Client;
+
+ Client = client;
+ OwnsDiagClient = ShouldOwnClient;
+}
void Diagnostic::pushMappings(SourceLocation Loc) {
DiagStateOnPushStack.push_back(GetCurDiagState());