aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/CacheTokens.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-16 18:18:30 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-16 18:18:30 +0000
commit52e7108f51a4a9f4d6e84f33fb594d06e1d79560 (patch)
treeff52750d5e8ccf5cb5cc260f3afd5e13014ed9b6 /lib/Frontend/CacheTokens.cpp
parent5f04881eb025f61396d0555d8173730fe2759e0a (diff)
Add support for a chain of stat caches in the FileManager, rather than
only supporting a single stat cache. The immediate benefit of this change is that we can now generate a PCH/AST file when including another PCH file; in the future, the chain of stat caches will likely be useful with multiple levels of PCH files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84263 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CacheTokens.cpp')
-rw-r--r--lib/Frontend/CacheTokens.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp
index e7fc5660ad..169fd5ebf9 100644
--- a/lib/Frontend/CacheTokens.cpp
+++ b/lib/Frontend/CacheTokens.cpp
@@ -516,7 +516,7 @@ public:
~StatListener() {}
int stat(const char *path, struct stat *buf) {
- int result = ::stat(path, buf);
+ int result = StatSysCallCache::stat(path, buf);
if (result != 0) // Failed 'stat'.
PM.insert(path, PTHEntry());
@@ -553,7 +553,8 @@ void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) {
PTHWriter PW(*OS, PP);
// Install the 'stat' system call listener in the FileManager.
- PP.getFileManager().setStatCache(new StatListener(PW.getPM()));
+ StatListener *StatCache = new StatListener(PW.getPM());
+ PP.getFileManager().addStatCache(StatCache, /*AtBeginning=*/true);
// Lex through the entire file. This will populate SourceManager with
// all of the header information.
@@ -562,7 +563,7 @@ void clang::CacheTokens(Preprocessor &PP, llvm::raw_fd_ostream* OS) {
do { PP.Lex(Tok); } while (Tok.isNot(tok::eof));
// Generate the PTH file.
- PP.getFileManager().setStatCache(0);
+ PP.getFileManager().removeStatCache(StatCache);
PW.GeneratePTH(&MainFileName);
}