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) {
|
void Lex(Token &Result) {
|
||||||
if (CurLexer)
|
if (CurLexer)
|
||||||
CurLexer->Lex(Result);
|
CurLexer->Lex(Result);
|
||||||
|
else if (CurPTHLexer)
|
||||||
|
CurPTHLexer->Lex(Result);
|
||||||
else if (CurTokenLexer)
|
else if (CurTokenLexer)
|
||||||
CurTokenLexer->Lex(Result);
|
CurTokenLexer->Lex(Result);
|
||||||
else
|
else
|
||||||
|
|
|
@ -115,8 +115,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
|
||||||
bool FoundNonSkipPortion,
|
bool FoundNonSkipPortion,
|
||||||
bool FoundElse) {
|
bool FoundElse) {
|
||||||
++NumSkipped;
|
++NumSkipped;
|
||||||
assert(CurTokenLexer == 0 && CurLexer &&
|
assert(CurTokenLexer == 0 && CurPPLexer && "Lexing a macro, not a file?");
|
||||||
"Lexing a macro, not a file?");
|
|
||||||
|
|
||||||
CurPPLexer->pushConditionalLevel(IfTokenLoc, /*isSkipping*/false,
|
CurPPLexer->pushConditionalLevel(IfTokenLoc, /*isSkipping*/false,
|
||||||
FoundNonSkipPortion, FoundElse);
|
FoundNonSkipPortion, FoundElse);
|
||||||
|
@ -126,7 +125,10 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc,
|
||||||
CurPPLexer->LexingRawMode = true;
|
CurPPLexer->LexingRawMode = true;
|
||||||
Token Tok;
|
Token Tok;
|
||||||
while (1) {
|
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 this is the end of the buffer, we have an error.
|
||||||
if (Tok.is(tok::eof)) {
|
if (Tok.is(tok::eof)) {
|
||||||
|
|
Loading…
Reference in New Issue