summaryrefslogtreecommitdiff
path: root/lib/Serialization/ModuleManager.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-05-30 17:54:59 +0000
committerBen Langmuir <blangmuir@apple.com>2014-05-30 17:54:59 +0000
commitacdc0afb1e492dc10cd8b5e6ad789c3a885ecef5 (patch)
treef3459218160cf8abc5e33cb4b6739ad0db0a57d1 /lib/Serialization/ModuleManager.cpp
parentd7d0010c54810582af3f234bd4fa7004ff028304 (diff)
downloadclang-acdc0afb1e492dc10cd8b5e6ad789c3a885ecef5.tar.gz
clang-acdc0afb1e492dc10cd8b5e6ad789c3a885ecef5.tar.bz2
clang-acdc0afb1e492dc10cd8b5e6ad789c3a885ecef5.tar.xz
Revert "Invalidate the file system cache entries for files that may rebuild"
This reverts commit r209910, which is breaking some of the bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ModuleManager.cpp')
-rw-r--r--lib/Serialization/ModuleManager.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp
index 7b68726143..5613d372d2 100644
--- a/lib/Serialization/ModuleManager.cpp
+++ b/lib/Serialization/ModuleManager.cpp
@@ -135,32 +135,19 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type,
return NewModule? NewlyLoaded : AlreadyLoaded;
}
-static void invalidateFileCacheForFileAndImporters(
- ModuleFile *F, FileManager &FileMgr,
- llvm::SmallPtrSetImpl<ModuleFile *> &VictimSet) {
- assert(VictimSet.count(F) && "removeModules() missing ancestor of module "
- "that failed to load");
- FileMgr.invalidateCache(F->File);
- F->File = nullptr;
- for (ModuleFile *Importer : F->ImportedBy)
- invalidateFileCacheForFileAndImporters(Importer, FileMgr, VictimSet);
-}
-
void ModuleManager::removeModules(ModuleIterator first, ModuleIterator last,
ModuleMap *modMap) {
if (first == last)
return;
+ // The first file entry is about to be rebuilt (or there was an error), so
+ // there should be no references to it. Remove it from the cache to close it,
+ // as Windows doesn't seem to allow renaming over an open file.
+ FileMgr.invalidateCache((*first)->File);
+
// Collect the set of module file pointers that we'll be removing.
llvm::SmallPtrSet<ModuleFile *, 4> victimSet(first, last);
- // The last module file caused the load failure, so it and its ancestors in
- // the module dependency tree will be rebuilt (or there was an error), so
- // there should be no references to them. Remove them from the cache,
- // since rebuilding them will create new files at the old locations.
- invalidateFileCacheForFileAndImporters(*(last-1), FileMgr, victimSet);
- assert((*first)->File == nullptr && "non-dependent module loaded");
-
// Remove any references to the now-destroyed modules.
for (unsigned i = 0, n = Chain.size(); i != n; ++i) {
Chain[i]->ImportedBy.remove_if([&](ModuleFile *MF) {