From: Chris Lattner Date: Sat, 17 Jan 2009 08:06:50 +0000 (+0000) Subject: simplify PTHManager::CreateLexer X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f056d92e182cbe4f62c8d14102544dc38066dabc;p=clang simplify PTHManager::CreateLexer git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62424 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h index c4ecfd6ed1..67e3666758 100644 --- a/include/clang/Lex/PTHManager.h +++ b/include/clang/Lex/PTHManager.h @@ -128,7 +128,7 @@ public: /// CreateLexer - Return a PTHLexer that "lexes" the cached tokens for the /// specified file. This method returns NULL if no cached tokens exist. /// It is the responsibility of the caller to 'delete' the returned object. - PTHLexer *CreateLexer(FileID FID, const FileEntry *FE); + PTHLexer *CreateLexer(FileID FID); unsigned getSpelling(SourceLocation Loc, const char *&Buffer); private: diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp index 60d42386d7..f8c8636fcb 100644 --- a/lib/Lex/PPLexerChange.cpp +++ b/lib/Lex/PPLexerChange.cpp @@ -74,7 +74,7 @@ void Preprocessor::EnterSourceFile(FileID FID, const DirectoryLookup *CurDir) { MaxIncludeStackDepth = IncludeMacroStack.size(); if (PTH) { - if (PTHLexer *PL = PTH->CreateLexer(FID, SourceMgr.getFileEntryForID(FID))) + if (PTHLexer *PL = PTH->CreateLexer(FID)) return EnterSourceFileWithPTH(PL, CurDir); } EnterSourceFileWithLexer(new Lexer(FID, *this), CurDir); diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index fd7c367c70..12f8330b20 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -668,7 +668,8 @@ IdentifierInfo* PTHManager::get(const char *NameStart, const char *NameEnd) { } -PTHLexer* PTHManager::CreateLexer(FileID FID, const FileEntry* FE) { +PTHLexer *PTHManager::CreateLexer(FileID FID) { + const FileEntry *FE = PP->getSourceManager().getFileEntryForID(FID); if (!FE) return 0;