]> granicus.if.org Git - clang/commitdiff
AnalysisConsumer: Explicitly destroy the PathDiagnosticClient at the end of HandleTra...
authorTed Kremenek <kremenek@apple.com>
Fri, 13 Feb 2009 00:51:30 +0000 (00:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 13 Feb 2009 00:51:30 +0000 (00:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64422 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/AnalysisConsumer.cpp

index 73ce3f662587e6a35580d72b52871aa78cf778ff..a5c253c62d4e15d90073bbbb62fbd2c65d5787c0 100644 (file)
@@ -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) {