]> granicus.if.org Git - clang/commitdiff
Speculative fix for Windows buildbot after r209138
authorBen Langmuir <blangmuir@apple.com>
Tue, 20 May 2014 05:55:04 +0000 (05:55 +0000)
committerBen Langmuir <blangmuir@apple.com>
Tue, 20 May 2014 05:55:04 +0000 (05:55 +0000)
It appears that Windows doesn't like renaming over open files, which we
do in clearOutputFiles. The file being compiled should be safe to
removed, but this isn't very satisfying - we don't want to manually
manage the lifetime of files we cannot prove have no references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209195 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ModuleManager.cpp

index 0130994ebc4dc1d953d1047a366556045a6d243d..43c250b80abbd30a468bbffaaf67d09dae22f847 100644 (file)
@@ -140,6 +140,11 @@ void ModuleManager::removeModules(ModuleIterator first, ModuleIterator last,
   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);