From 0295c238f7b4329f86498055337f91f25465f836 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 17 Sep 2013 00:51:29 +0000 Subject: [PATCH] Fix potential race in module building code. Let the module building code handle the case of overwriting an existing file itself, so the existing locking infrastructure works correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190833 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInstance.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 455f71f15d..7c5ca01272 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -1186,15 +1186,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, case ASTReader::Success: break; - case ASTReader::OutOfDate: { - // The module file is out-of-date. Remove it, then rebuild it. - bool Existed; - llvm::sys::fs::remove(ModuleFileName, Existed); - } - // Fall through to build the module again. - + case ASTReader::OutOfDate: case ASTReader::Missing: { - // The module file is (now) missing. Build it. + // The module file is missing or out-of-date. Build it. // If we don't have a module, we don't know how to build the module file. // Complain and return. -- 2.40.0