diff options
author | Chris Lattner <sabre@nondot.org> | 2010-11-23 20:05:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-11-23 20:05:15 +0000 |
commit | d6f611198089b78e32d3a15fe8bc986204aee1aa (patch) | |
tree | d6395cf05d36ad6d8d5bba6a418b0f8396e00928 /lib | |
parent | 11aa4b03b054cb9d3c201bba5632241145865e29 (diff) |
simplify the cache miss handling code, eliminating CacheMissing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120038 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Basic/FileSystemStatCache.cpp | 7 | ||||
-rw-r--r-- | lib/Frontend/CacheTokens.cpp | 11 | ||||
-rw-r--r-- | lib/Lex/PTHLexer.cpp | 5 | ||||
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 2 |
4 files changed, 7 insertions, 18 deletions
diff --git a/lib/Basic/FileSystemStatCache.cpp b/lib/Basic/FileSystemStatCache.cpp index 738af41a9e..26e9d2f150 100644 --- a/lib/Basic/FileSystemStatCache.cpp +++ b/lib/Basic/FileSystemStatCache.cpp @@ -19,16 +19,11 @@ MemorizeStatCalls::LookupResult MemorizeStatCalls::getStat(const char *Path, struct stat &StatBuf) { LookupResult Result = statChained(Path, StatBuf); - // If the chained cache didn't know anything about the file, do the stat now - // so we can record the result. - if (Result == CacheMiss) - Result = ::stat(Path, &StatBuf) ? CacheHitMissing : CacheHitExists; - // Do not cache failed stats, it is easy to construct common inconsistent // situations if we do, and they are not important for PCH performance (which // currently only needs the stats to construct the initial FileManager // entries). - if (Result == CacheHitMissing) + if (Result == CacheMissing) return Result; // Cache file 'stat' results and directories with absolutely paths. diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index 94bee6b868..2a7af8a8c3 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -518,14 +518,9 @@ public: ~StatListener() {} LookupResult getStat(const char *Path, struct stat &StatBuf) { - LookupResult Result = FileSystemStatCache::statChained(Path, StatBuf); - - // If the chained cache didn't know anything about the file, do the stat now - // so we can record the result. - if (Result == CacheMiss) - Result = ::stat(Path, &StatBuf) ? CacheHitMissing : CacheHitExists; - - if (Result == CacheHitMissing) // Failed 'stat'. + LookupResult Result = statChained(Path, StatBuf); + + if (Result == CacheMissing) // Failed 'stat'. PM.insert(PTHEntryKeyVariant(Path), PTHEntry()); else if (S_ISDIR(StatBuf.st_mode)) { // Only cache directories with absolute paths. diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp index 0dd30f6d70..ed068675fe 100644 --- a/lib/Lex/PTHLexer.cpp +++ b/lib/Lex/PTHLexer.cpp @@ -26,7 +26,6 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/MemoryBuffer.h" -#include <sys/stat.h> using namespace clang; using namespace clang::io; @@ -690,14 +689,14 @@ public: const PTHStatData &Data = *I; if (!Data.hasStat) - return CacheHitMissing; + return CacheMissing; 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; + return CacheExists; } }; } // end anonymous namespace diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 0c0e4fffc0..dc719a1f93 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -1092,7 +1092,7 @@ public: StatBuf.st_mtime = Data.mtime; StatBuf.st_mode = Data.mode; StatBuf.st_size = Data.size; - return CacheHitExists; + return CacheExists; } }; } // end anonymous namespace |