summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic
diff options
context:
space:
mode:
authorAxel Naumann <Axel.Naumann@cern.ch>2012-07-10 16:50:27 +0000
committerAxel Naumann <Axel.Naumann@cern.ch>2012-07-10 16:50:27 +0000
commitb307400326c4f8bc11c99308f52fb0ed3b5bdfae (patch)
tree117e090bb8cb2f49dc918d192fd295be829cef16 /clang/lib/Basic
parent8698dd63d7b38ec4b64f32756c991528315cc4ec (diff)
downloadbcm5719-llvm-b307400326c4f8bc11c99308f52fb0ed3b5bdfae.tar.gz
bcm5719-llvm-b307400326c4f8bc11c99308f52fb0ed3b5bdfae.zip
Improve r159256 following Chandler's comments:
Implement UniqueFileContainer::erase(), camelCase, add comment on future optimizations of the cache versus de-optimizations of invalidations. llvm-svn: 159997
Diffstat (limited to 'clang/lib/Basic')
-rw-r--r--clang/lib/Basic/FileManager.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 100f3ceaf04..9804105e671 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -112,7 +112,7 @@ public:
size_t size() const { return UniqueFiles.size(); }
- friend class FileManager;
+ void erase(const FileEntry *Entry) { UniqueFiles.erase(Entry->getName()); }
};
//===----------------------------------------------------------------------===//
@@ -155,7 +155,7 @@ public:
size_t size() const { return UniqueFiles.size(); }
- friend class FileManager;
+ void erase(const FileEntry *Entry) { UniqueFiles.erase(*Entry); }
};
#endif
@@ -563,16 +563,15 @@ bool FileManager::getNoncachedStatValue(StringRef Path,
return ::stat(FilePath.c_str(), &StatBuf) != 0;
}
-void FileManager::InvalidateCache(const FileEntry* Entry) {
- if (!Entry)
- return;
+void FileManager::invalidateCache(const FileEntry *Entry) {
+ assert(Entry && "Cannot invalidate a NULL FileEntry");
SeenFileEntries.erase(Entry->getName());
-#ifdef LLVM_ON_WIN32
- UniqueRealFiles.UniqueFiles.erase(Entry->getName());
-#else
- UniqueRealFiles.UniqueFiles.erase(*Entry);
-#endif
+
+ // FileEntry invalidation should not block future optimizations in the file
+ // caches. Possible alternatives are cache truncation (invalidate last N) or
+ // invalidation of the whole cache.
+ UniqueRealFiles.erase(Entry);
}
OpenPOWER on IntegriCloud