diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-18 02:57:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-18 02:57:21 +0000 |
commit | 77ecb3a28f21496ecfdbb3d5f5b66b0d2abf48c9 (patch) | |
tree | e6a4c7c339ac4d518882d6574a03d686ce86adad /lib/Lex/PTHLexer.cpp | |
parent | 6f26dc91fd839f2054132145cdf18786ba187936 (diff) |
rearrange GetIdentifierInfo so that the fast path can be partially inlined into PTHLexer::Lex. This speeds up the user time of PTH -Eonly by another 2ms (4.4%)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PTHLexer.cpp')
-rw-r--r-- | lib/Lex/PTHLexer.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index a1d7f5735e..7df8e35986 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -596,15 +596,9 @@ PTHManager* PTHManager::Create(const std::string& file) { return new PTHManager(File.take(), FL.take(), IData, PerIDCache, SortedIdTable, NumIds); } - -IdentifierInfo* PTHManager::GetIdentifierInfo(unsigned persistentID) { - - // Check if the IdentifierInfo has already been resolved. - IdentifierInfo* II = PerIDCache[persistentID]; - if (II) return II; - +IdentifierInfo* PTHManager::LazilyCreateIdentifierInfo(unsigned PersistentID) { // Look in the PTH file for the string data for the IdentifierInfo object. - const unsigned char* TableEntry = IdDataTable + sizeof(uint32_t)*persistentID; + const unsigned char* TableEntry = IdDataTable + sizeof(uint32_t)*PersistentID; const unsigned char* IDData = (const unsigned char*)Buf->getBufferStart() + Read32(TableEntry); assert(IDData < (const unsigned char*)Buf->getBufferEnd()); @@ -614,10 +608,10 @@ IdentifierInfo* PTHManager::GetIdentifierInfo(unsigned persistentID) { Alloc.Allocate<std::pair<IdentifierInfo,const unsigned char*> >(); Mem->second = IDData; - II = new ((void*) Mem) IdentifierInfo(true); + IdentifierInfo *II = new ((void*) Mem) IdentifierInfo(true); // Store the new IdentifierInfo in the cache. - PerIDCache[persistentID] = II; + PerIDCache[PersistentID] = II; return II; } |