From: Anna Zaks Date: Tue, 13 Mar 2012 19:31:47 +0000 (+0000) Subject: [analyzer] Move the check for parser errors out of the loop over Decls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6ee44dd2923fb7dac699c4bbfeded34a8604d3a;p=clang [analyzer] Move the check for parser errors out of the loop over Decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152648 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index 7fd26894f2..54be4f7bcf 100644 --- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -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();