From e3870d8c83cb446bf5dd4adb2e6943da6a87d72c Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Tue, 20 May 2014 05:55:04 +0000 Subject: [PATCH] Speculative fix for Windows buildbot after r209138 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp index 0130994ebc..43c250b80a 100644 --- a/lib/Serialization/ModuleManager.cpp +++ b/lib/Serialization/ModuleManager.cpp @@ -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 victimSet(first, last); -- 2.40.0