Add a bit to IdentifierInfo that acts as a simple predicate which
tells us whether Preprocessor::HandleIdentifier needs to be called.
Because this method is only rarely needed, this saves a call and a
bunch of random checks. This drops the time in HandleIdentifier
from 3.52ms to .98ms on cocoa.h on my machine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62675 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/TokenLexer.cpp b/lib/Lex/TokenLexer.cpp
index 82c4d92..c945843 100644
--- a/lib/Lex/TokenLexer.cpp
+++ b/lib/Lex/TokenLexer.cpp
@@ -326,8 +326,9 @@
}
// Handle recursive expansion!
- if (Tok.getIdentifierInfo() && !DisableMacroExpansion)
- return PP.HandleIdentifier(Tok);
+ if (Tok.getIdentifierInfo() && !DisableMacroExpansion &&
+ Tok.getIdentifierInfo()->isHandleIdentifierCase())
+ PP.HandleIdentifier(Tok);
// Otherwise, return a normal token.
}