From: Ted Kremenek Date: Tue, 23 Dec 2008 19:25:33 +0000 (+0000) Subject: Remove old PTH token-generation test harness. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6aa6ac4b394c67f3f2f6f8c88c17928370c74586;p=clang Remove old PTH token-generation test harness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61382 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index d25f4f4a56..0ecca3a8cc 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -74,7 +74,6 @@ void Preprocessor::EnterSourceFile(unsigned FileID, if (MaxIncludeStackDepth < IncludeMacroStack.size()) MaxIncludeStackDepth = IncludeMacroStack.size(); -#if 1 if (PTH) { PTHLexer* PL = PTH->CreateLexer(FileID, getSourceManager().getFileEntryForID(FileID)); @@ -87,76 +86,6 @@ void Preprocessor::EnterSourceFile(unsigned FileID, Lexer *TheLexer = new Lexer(SourceLocation::getFileLoc(FileID, 0), *this); EnterSourceFileWithLexer(TheLexer, CurDir); -#else - if (CurPPLexer || CurTokenLexer) - PushIncludeMacroStack(); - - CurDirLookup = CurDir; - SourceLocation Loc = SourceLocation::getFileLoc(FileID, 0); - CurPTHLexer.reset(new PTHLexer(*this, Loc)); - CurPPLexer = CurPTHLexer.get(); - - // Generate the tokens. - - const llvm::MemoryBuffer* B = getSourceManager().getBuffer(FileID); - - // Create a raw lexer. - Lexer L(SourceLocation::getFileLoc(FileID, 0), getLangOptions(), - B->getBufferStart(), B->getBufferEnd(), B); - - // Ignore whitespace. - L.SetKeepWhitespaceMode(false); - L.SetCommentRetentionState(false); - - // Lex the file, populating our data structures. - std::vector& Tokens = CurPTHLexer->getTokens(); - Token Tok; - - do { - L.LexFromRawLexer(Tok); - - if (Tok.is(tok::identifier)) { - Tok.setIdentifierInfo(LookUpIdentifierInfo(Tok)); - } - else if (Tok.is(tok::hash) && Tok.isAtStartOfLine()) { - // Special processing for #include. Store the '#' token and lex - // the next token. - Tokens.push_back(Tok); - L.LexFromRawLexer(Tok); - - // Did we see 'include'/'import'/'include_next'? - if (!Tok.is(tok::identifier)) - continue; - - IdentifierInfo* II = LookUpIdentifierInfo(Tok); - Tok.setIdentifierInfo(II); - tok::PPKeywordKind K = II->getPPKeywordID(); - - if (K == tok::pp_include || K == tok::pp_import || - K == tok::pp_include_next) { - - // Save the 'include' token. - Tokens.push_back(Tok); - - // Lex the next token as an include string. - L.ParsingPreprocessorDirective = true; - L.LexIncludeFilename(Tok); - L.ParsingPreprocessorDirective = false; - - if (Tok.is(tok::identifier)) - Tok.setIdentifierInfo(LookUpIdentifierInfo(Tok)); - } - } - } - while (Tokens.push_back(Tok), Tok.isNot(tok::eof)); - - // Notify the client, if desired, that we are in a new source file. - if (Callbacks) { - SrcMgr::CharacteristicKind FileType = - SourceMgr.getFileCharacteristic(CurPPLexer->getFileID()); - Callbacks->FileChanged(Loc, PPCallbacks::EnterFile, FileType); - } -#endif } /// EnterSourceFileWithLexer - Add a source file to the top of the include stack