summaryrefslogtreecommitdiff
path: root/Driver
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-13 00:51:30 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-13 00:51:30 +0000
commit4d53a53b81fcdf84346a4ac772d101423c9f5a41 (patch)
tree5c6435e5d39d59d02b1ff9c777f50773317323b0 /Driver
parent867924dbeca06870573fd58d620032da6994b223 (diff)
downloadclang-4d53a53b81fcdf84346a4ac772d101423c9f5a41.tar.gz
AnalysisConsumer: Explicitly destroy the PathDiagnosticClient at the end of HandleTranslationUnit to ensure that the client's destructor is called even with --disable-free.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver')
-rw-r--r--Driver/AnalysisConsumer.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index 73ce3f6625..a5c253c62d 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -355,14 +355,15 @@ void AnalysisConsumer::HandleTranslationUnit(TranslationUnit& TU) {
(*I)(mgr);
}
- if (ObjCImplementationActions.empty())
- return;
-
- for (TranslationUnit::iterator I = TU.begin(), E = TU.end(); I!=E; ++I) {
-
- if (ObjCImplementationDecl* ID = dyn_cast<ObjCImplementationDecl>(*I))
- HandleCode(ID, 0, ObjCImplementationActions);
- }
+ if (!ObjCImplementationActions.empty())
+ for (TranslationUnit::iterator I = TU.begin(), E = TU.end(); I!=E; ++I)
+ if (ObjCImplementationDecl* ID = dyn_cast<ObjCImplementationDecl>(*I))
+ HandleCode(ID, 0, ObjCImplementationActions);
+
+ // Delete the PathDiagnosticClient here just in case the AnalysisConsumer
+ // object doesn't get released. This will cause any side-effects in the
+ // destructor of the PathDiagnosticClient to get executed.
+ PD.reset();
}
void AnalysisConsumer::HandleCode(Decl* D, Stmt* Body, Actions& actions) {