From: Ted Kremenek Date: Fri, 13 Feb 2009 00:51:30 +0000 (+0000) Subject: AnalysisConsumer: Explicitly destroy the PathDiagnosticClient at the end of HandleTra... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d53a53b81fcdf84346a4ac772d101423c9f5a41;p=clang 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 --- 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(*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(*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) {