Only do an expensive walk over the entire identifier table if the diagnostic

that needs it is enabled.

llvm-svn: 38690
This commit is contained in:
Chris Lattner 2006-07-10 06:16:26 +00:00
parent d0a96ba38a
commit 03f83485bd
1 changed files with 5 additions and 2 deletions

View File

@ -991,8 +991,11 @@ void Preprocessor::HandleEndOfFile(LexerToken &Result, bool isEndOfMacro) {
delete CurLexer;
CurLexer = 0;
// This is the end of the top-level file.
Identifiers.VisitIdentifiers(UnusedIdentifierReporter(*this));
// This is the end of the top-level file. If the diag::pp_macro_not_used
// diagnostic is enabled, walk all of the identifiers, looking for macros that
// have not been used.
if (Diags.getDiagnosticLevel(diag::pp_macro_not_used) != Diagnostic::Ignored)
Identifiers.VisitIdentifiers(UnusedIdentifierReporter(*this));
}
/// HandleEndOfMacro - This callback is invoked when the lexer hits the end of