[cfe-commits] r64422 - /cfe/trunk/Driver/AnalysisConsumer.cpp

Ted Kremenek kremenek at apple.com
Thu Feb 12 16:51:30 PST 2009


Author: kremenek
Date: Thu Feb 12 18:51:30 2009
New Revision: 64422

URL: http://llvm.org/viewvc/llvm-project?rev=64422&view=rev
Log:
AnalysisConsumer: Explicitly destroy the PathDiagnosticClient at the end of HandleTranslationUnit to ensure that the client's destructor is called even with --disable-free.

Modified:
    cfe/trunk/Driver/AnalysisConsumer.cpp

Modified: cfe/trunk/Driver/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/AnalysisConsumer.cpp?rev=64422&r1=64421&r2=64422&view=diff

==============================================================================
--- cfe/trunk/Driver/AnalysisConsumer.cpp (original)
+++ cfe/trunk/Driver/AnalysisConsumer.cpp Thu Feb 12 18:51:30 2009
@@ -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) {





More information about the cfe-commits mailing list