[cfe-commits] r38690 - /cfe/cfe/trunk/Lex/Preprocessor.cpp

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:23:51 PDT 2007


Author: sabre
Date: Wed Jul 11 11:23:50 2007
New Revision: 38690

URL: http://llvm.org/viewvc/llvm-project?rev=38690&view=rev
Log:
Only do an expensive walk over the entire identifier table if the diagnostic
that needs it is enabled.

Modified:
    cfe/cfe/trunk/Lex/Preprocessor.cpp

Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=38690&r1=38689&r2=38690&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:23:50 2007
@@ -991,8 +991,11 @@
   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





More information about the cfe-commits mailing list