]> granicus.if.org Git - clang/commitdiff
[analyzer] Move the check for parser errors out of the loop over Decls.
authorAnna Zaks <ganna@apple.com>
Tue, 13 Mar 2012 19:31:47 +0000 (19:31 +0000)
committerAnna Zaks <ganna@apple.com>
Tue, 13 Mar 2012 19:31:47 +0000 (19:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152648 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

index 7fd26894f2421d9da3fd41a82efaf108af5609f8..54be4f7bcffefb426fbd6c2a83e82ec461fa0a62 100644 (file)
@@ -202,6 +202,11 @@ public:
 llvm::Timer* AnalysisConsumer::TUTotalTimer = 0;
 
 void AnalysisConsumer::HandleDeclContext(ASTContext &C, DeclContext *dc) {
+  // Don't run the actions if an error has occurred with parsing the file.
+  DiagnosticsEngine &Diags = PP.getDiagnostics();
+  if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred())
+    return;
+
   for (DeclContext::decl_iterator I = dc->decls_begin(), E = dc->decls_end();
        I != E; ++I) {
     HandleDeclContextDecl(C, *I);
@@ -386,11 +391,6 @@ void AnalysisConsumer::HandleCode(Decl *D, SetOfDecls *VisitedCallees) {
 
   DisplayFunction(D);
 
-  // Don't run the actions if an error has occurred with parsing the file.
-  DiagnosticsEngine &Diags = PP.getDiagnostics();
-  if (Diags.hasErrorOccurred() || Diags.hasFatalErrorOccurred())
-    return;
-
   // Don't run the actions on declarations in header files unless
   // otherwise specified.
   SourceManager &SM = Ctx->getSourceManager();