From 3ce42c37b0ef6b10538f5040a33d19a6e6988d05 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Wed, 27 Jun 2012 09:17:42 +0000 Subject: 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159256 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/FileManager.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Basic/FileManager.cpp') diff --git a/lib/Basic/FileManager.cpp b/lib/Basic/FileManager.cpp index 75333f8fb5..16906de55a 100644 --- a/lib/Basic/FileManager.cpp +++ b/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 &UIDToFiles) const { UIDToFiles.clear(); -- cgit v1.2.3-18-g5258