[analyzer] Move the check for parser errors out of the loop over Decls.

llvm-svn: 152648
This commit is contained in:
Anna Zaks 2012-03-13 19:31:47 +00:00
parent 3ffe746ca8
commit e756ce0c5d
1 changed files with 5 additions and 5 deletions

View 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();