summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-11-18 01:04:47 +0000
committerTed Kremenek <kremenek@apple.com>2008-11-18 01:04:47 +0000
commit6b73291462da9526782eef0ebab14b5499c7f285 (patch)
treead6ab0bfcfd5fb25a745ad7d6b6d23a3def399d0 /clang/lib/Lex
parente2c23daa1468196d6161ed923d634288cf17227b (diff)
downloadbcm5719-llvm-6b73291462da9526782eef0ebab14b5499c7f285.tar.gz
bcm5719-llvm-6b73291462da9526782eef0ebab14b5499c7f285.zip
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
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 22178739867..69a3efe287c 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -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)) {
OpenPOWER on IntegriCloud