From 5988590363f4c438586785f4895812751adc60b6 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. llvm-svn: 209195 --- clang/lib/Serialization/ModuleManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index 0130994ebc4d..43c250b80abb 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/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);