diff options
author | Axel Naumann <Axel.Naumann@cern.ch> | 2012-06-27 09:17:42 +0000 |
---|---|---|
committer | Axel Naumann <Axel.Naumann@cern.ch> | 2012-06-27 09:17:42 +0000 |
commit | 38179d96930691fbc8ef95e68f525bbeeeb9cf62 (patch) | |
tree | 5f5c6da2f8beecafe06fd665af36c67c47141456 /clang | |
parent | 9aaf156f303bbaec58040ff42c71dd168520862a (diff) | |
download | bcm5719-llvm-38179d96930691fbc8ef95e68f525bbeeeb9cf62.tar.gz bcm5719-llvm-38179d96930691fbc8ef95e68f525bbeeeb9cf62.zip |
From Vassil Vassilev:
add interface for removing a FileEntry from the cache.
Forces a re-read the contents from disk, e.g. because a tool (like cling) wants to pick up a modified file.
llvm-svn: 159256
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Basic/FileManager.h | 3 | ||||
-rw-r--r-- | clang/lib/Basic/FileManager.cpp | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/FileManager.h b/clang/include/clang/Basic/FileManager.h index 909213d748f..b14ad83df25 100644 --- a/clang/include/clang/Basic/FileManager.h +++ b/clang/include/clang/Basic/FileManager.h @@ -222,6 +222,9 @@ public: /// FileManager's FileSystemOptions. bool getNoncachedStatValue(StringRef Path, struct stat &StatBuf); + /// \brief Remove the real file Entry from the cache. + void InvalidateCache(const FileEntry* Entry); + /// \brief If path is not absolute and FileSystemOptions set the working /// directory, the path is modified to be relative to the given /// working directory. diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp index 75333f8fb55..16906de55ab 100644 --- a/clang/lib/Basic/FileManager.cpp +++ b/clang/lib/Basic/FileManager.cpp @@ -111,6 +111,8 @@ public: } size_t size() const { return UniqueFiles.size(); } + + friend class FileManager; }; //===----------------------------------------------------------------------===// @@ -152,6 +154,8 @@ public: } size_t size() const { return UniqueFiles.size(); } + + friend class FileManager; }; #endif @@ -559,6 +563,15 @@ bool FileManager::getNoncachedStatValue(StringRef Path, return ::stat(FilePath.c_str(), &StatBuf) != 0; } +void FileManager::InvalidateCache(const FileEntry* Entry) { + if (!Entry) + return; + + SeenFileEntries.erase(Entry->getName()); + UniqueRealFiles.UniqueFiles.erase(*Entry); +} + + void FileManager::GetUniqueIDMapping( SmallVectorImpl<const FileEntry *> &UIDToFiles) const { UIDToFiles.clear(); |