From f02f6f0ee3e05b958bcf67f00f4503671d67eccd Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 13 Jan 2009 22:05:50 +0000 Subject: PTH: Fix remaining cases where the spelling cache in the PTH file was being missed when it shouldn't. This shaves another 7% off PTH time for -Eonly on Cocoa.h git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62186 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Lex/PTHManager.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/clang/Lex/PTHManager.h') diff --git a/include/clang/Lex/PTHManager.h b/include/clang/Lex/PTHManager.h index eefe574a54..60beee3645 100644 --- a/include/clang/Lex/PTHManager.h +++ b/include/clang/Lex/PTHManager.h @@ -34,10 +34,10 @@ class PTHManager; class PTHSpellingSearch { PTHManager& PTHMgr; - const char* TableBeg; - const char* TableEnd; + const char* const TableBeg; + const char* const TableEnd; - unsigned SpellingsLeft; + const unsigned NumSpellings; const char* LinearItr; public: @@ -50,7 +50,7 @@ public: : PTHMgr(pm), TableBeg(tableBeg), TableEnd(tableBeg + numSpellings*SpellingEntrySize), - SpellingsLeft(numSpellings), + NumSpellings(numSpellings), LinearItr(tableBeg) {} }; @@ -101,8 +101,6 @@ class PTHManager { /// getSpellingAtPTHOffset - Used by PTHLexer classes to get the cached /// spelling for a token. unsigned getSpellingAtPTHOffset(unsigned PTHOffset, const char*& Buffer); - - unsigned getSpelling(unsigned FileID, unsigned fpos, const char *& Buffer); public: @@ -111,11 +109,13 @@ public: /// Create - This method creates PTHManager objects. The 'file' argument /// is the name of the PTH file. This method returns NULL upon failure. static PTHManager* Create(const std::string& file, Preprocessor& PP); - + /// 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(unsigned FileID, const FileEntry* FE); + PTHLexer* CreateLexer(unsigned FileID, const FileEntry* FE); + + unsigned getSpelling(unsigned FileID, unsigned fpos, const char *& Buffer); }; } // end namespace clang -- cgit v1.2.3