summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PTHLexer.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-23 19:19:34 +0000
committerChris Lattner <sabre@nondot.org>2010-11-23 19:19:34 +0000
commit226efd356c6c98a4de2880e6090aa2f05b459fc5 (patch)
tree10f7d47ea7136c139ac252d3b9f7e0215c766b61 /clang/lib/Lex/PTHLexer.cpp
parente5cb2787667ffd67f831dac78abe8c3acd046f9e (diff)
downloadbcm5719-llvm-226efd356c6c98a4de2880e6090aa2f05b459fc5.tar.gz
bcm5719-llvm-226efd356c6c98a4de2880e6090aa2f05b459fc5.zip
rework the stat cache, pulling it out of FileManager.h into
its own header and giving it some more structure. No functionality change. llvm-svn: 120030
Diffstat (limited to 'clang/lib/Lex/PTHLexer.cpp')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index 08de3a80f95..0dd30f6d701 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/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));
}
OpenPOWER on IntegriCloud