]> granicus.if.org Git - clang/commitdiff
Fix potential race in module building code.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 17 Sep 2013 00:51:29 +0000 (00:51 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 17 Sep 2013 00:51:29 +0000 (00:51 +0000)
Let the module building code handle the case of overwriting an existing file
itself, so the existing locking infrastructure works correctly.

<rdar://problem/14403381>

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

lib/Frontend/CompilerInstance.cpp

index 455f71f15d9f07b3041c046f1b67f3c89205eba6..7c5ca01272623828a2449f050966cd9a90ca697e 100644 (file)
@@ -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.