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 73ce3f6..a5c253c 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -355,14 +355,15 @@
       (*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) {