From cf3f2c49eaca66d0d2568ce7711b370fcf0f8bb0 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 13 Nov 2012 19:12:37 +0000 Subject: Revert r167801, "[preprocessor] When #including something that contributes no tokens at all,". This change broke External/Nurbs in LLVM test-suite. llvm-svn: 167858 --- clang/lib/Lex/Lexer.cpp | 22 ---------------------- clang/lib/Lex/PreprocessorLexer.cpp | 2 +- 2 files changed, 1 insertion(+), 23 deletions(-) (limited to 'clang/lib/Lex') diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 6917645ca4f..bf0883e12a2 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2594,14 +2594,8 @@ LexNextToken: // Read the PP instance variable into an automatic variable, because // LexEndOfFile will often delete 'this'. Preprocessor *PPCache = PP; - bool EnableIncludedEOFCache = EnableIncludedEOF; if (LexEndOfFile(Result, CurPtr-1)) // Retreat back into the file. return; // Got a token to return. - - if (EnableIncludedEOFCache) { - Result.setKind(tok::included_eof); - return; - } assert(PPCache && "Raw buffer::LexEndOfFile should return a token"); return PPCache->Lex(Result); } @@ -3239,21 +3233,5 @@ HandleDirective: } goto LexNextToken; // GCC isn't tail call eliminating. } - - if (PreprocessorLexer *PPLex = PP->getCurrentLexer()) { - // If we #include something that contributes no tokens at all, return with - // a tok::included_eof instead of recursively continuing lexing. - // This avoids a stack overflow with a sequence of many empty #includes. - PPLex->setEnableIncludedEOF(true); - PP->Lex(Result); - if (Result.isNot(tok::included_eof)) { - if (Result.isNot(tok::eof) && Result.isNot(tok::eod)) - PPLex->setEnableIncludedEOF(false); - return; - } - if (PP->isCurrentLexer(this)) - goto LexNextToken; - } - return PP->Lex(Result); } diff --git a/clang/lib/Lex/PreprocessorLexer.cpp b/clang/lib/Lex/PreprocessorLexer.cpp index 390d4c4523b..a64c84d6bbd 100644 --- a/clang/lib/Lex/PreprocessorLexer.cpp +++ b/clang/lib/Lex/PreprocessorLexer.cpp @@ -22,7 +22,7 @@ void PreprocessorLexer::anchor() { } PreprocessorLexer::PreprocessorLexer(Preprocessor *pp, FileID fid) : PP(pp), FID(fid), InitialNumSLocEntries(0), ParsingPreprocessorDirective(false), - ParsingFilename(false), LexingRawMode(false), EnableIncludedEOF(false) { + ParsingFilename(false), LexingRawMode(false) { if (pp) InitialNumSLocEntries = pp->getSourceManager().local_sloc_entry_size(); } -- cgit v1.2.3