diff options
-rw-r--r-- | include/clang/Lex/PTHLexer.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/clang/Lex/PTHLexer.h b/include/clang/Lex/PTHLexer.h index 7654a39653..34e0b8a9fb 100644 --- a/include/clang/Lex/PTHLexer.h +++ b/include/clang/Lex/PTHLexer.h @@ -76,8 +76,13 @@ public: /// tok::l_paren token, 0 if it is something else and 2 if there are no more /// tokens controlled by this lexer. unsigned isNextPPTokenLParen() { - return AtLastToken() ? 2 : GetToken().is(tok::l_paren); - } + // isNextPPTokenLParen is not on the hot path, and all we care about is + // whether or not we are at a token with kind tok::eof or tok::l_paren. + // Just read the first byte from the current token pointer to determine + // its kind. + tok::TokenKind x = (tok::TokenKind) (uint8_t) *CurPtr; + return x == tok::eof ? 2 : x == tok::l_paren; + } /// IndirectLex - An indirect call to 'Lex' that can be invoked via /// the PreprocessorLexer interface. |