diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-23 19:19:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-23 19:19:34 +0000 |
commit | 10e286aa8d39fb51a21412850265d9dae74613ee (patch) | |
tree | 94ef75b4f0ebc54bbbf60c7e7c17fee034a99492 /lib/Lex/PTHLexer.cpp | |
parent | 6c6feaca2b1f006e4aaed60c784fe876b63f56d2 (diff) |
rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure. No
functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PTHLexer.cpp')
-rw-r--r-- | lib/Lex/PTHLexer.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index 08de3a80f9..0dd30f6d70 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -13,6 +13,7 @@ #include "clang/Basic/TokenKinds.h" #include "clang/Basic/FileManager.h" +#include "clang/Basic/FileSystemStatCache.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/OnDiskHashTable.h" #include "clang/Lex/LexDiagnostic.h" @@ -667,7 +668,7 @@ public: } }; -class PTHStatCache : public StatSysCallCache { +class PTHStatCache : public FileSystemStatCache { typedef OnDiskChainedHashTable<PTHStatLookupTrait> CacheTy; CacheTy Cache; @@ -678,29 +679,29 @@ public: ~PTHStatCache() {} - int stat(const char *path, struct stat *buf) { + LookupResult getStat(const char *Path, struct stat &StatBuf) { // Do the lookup for the file's data in the PTH file. - CacheTy::iterator I = Cache.find(path); + CacheTy::iterator I = Cache.find(Path); // If we don't get a hit in the PTH file just forward to 'stat'. if (I == Cache.end()) - return StatSysCallCache::stat(path, buf); + return statChained(Path, StatBuf); - const PTHStatData& Data = *I; + const PTHStatData &Data = *I; if (!Data.hasStat) - return 1; + return CacheHitMissing; - buf->st_ino = Data.ino; - buf->st_dev = Data.dev; - buf->st_mtime = Data.mtime; - buf->st_mode = Data.mode; - buf->st_size = Data.size; - return 0; + StatBuf.st_ino = Data.ino; + StatBuf.st_dev = Data.dev; + StatBuf.st_mtime = Data.mtime; + StatBuf.st_mode = Data.mode; + StatBuf.st_size = Data.size; + return CacheHitExists; } }; } // end anonymous namespace -StatSysCallCache *PTHManager::createStatCache() { +FileSystemStatCache *PTHManager::createStatCache() { return new PTHStatCache(*((PTHFileLookup*) FileLookup)); } |