summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
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
commit7a964ad4cebdc20e358b682ff9a992c8df9441f6 (patch)
tree20964840dc172a979851346cdd34c849ce0f5fa2 /clang/lib/Basic
parenta2867c7741c01dda3521789ed714977cfc4f309f (diff)
downloadbcm5719-llvm-7a964ad4cebdc20e358b682ff9a992c8df9441f6.tar.gz
bcm5719-llvm-7a964ad4cebdc20e358b682ff9a992c8df9441f6.zip
Teach Diagnostic::setClient() to free the existing, owned
client. Fixes a libclang leak. llvm-svn: 124614
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 9a263c1d0bc..31e33315cce 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud