forked from OSchip/llvm-project
Add hooks to use PTHLexer::Lex instead of Lexer::Lex when CurLexer is null.
Performance tests on Cocoa.h (using the regular Lexer) shows no performance difference. llvm-svn: 59479
This commit is contained in:
parent
e2c23daa14
commit
6b73291462
|
@ -330,6 +330,8 @@ public:
|
|||
void Lex(Token &Result) {
|
||||
if (CurLexer)
|
||||
CurLexer->Lex(Result);
|
||||
else if (CurPTHLexer)
|
||||
CurPTHLexer->Lex(Result);
|
||||
else if (CurTokenLexer)
|
||||
CurTokenLexer->Lex(Result);
|
||||
else
|
||||
|
|
|
@ -115,8 +115,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
|
|||
bool FoundNonSkipPortion,
|
||||
bool FoundElse) {
|
||||
++NumSkipped;
|
||||
assert(CurTokenLexer == 0 && CurLexer &&
|
||||
"Lexing a macro, not a file?");
|
||||
assert(CurTokenLexer == 0 && CurPPLexer && "Lexing a macro, not a file?");
|
||||
|
||||
CurPPLexer->pushConditionalLevel(IfTokenLoc, /*isSkipping*/false,
|
||||
FoundNonSkipPortion, FoundElse);
|
||||
|
@ -126,7 +125,10 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
|
|||
CurPPLexer->LexingRawMode = true;
|
||||
Token Tok;
|
||||
while (1) {
|
||||
CurLexer->Lex(Tok);
|
||||
if (CurLexer)
|
||||
CurLexer->Lex(Tok);
|
||||
else
|
||||
CurPTHLexer->Lex(Tok);
|
||||
|
||||
// If this is the end of the buffer, we have an error.
|
||||
if (Tok.is(tok::eof)) {
|
||||
|
|
Loading…
Reference in New Issue