r190833 - Fix potential race in module building code.

Eli Friedman eli.friedman at gmail.com
Mon Sep 16 17:51:29 PDT 2013


Author: efriedma
Date: Mon Sep 16 19:51:29 2013
New Revision: 190833

URL: http://llvm.org/viewvc/llvm-project?rev=190833&view=rev
Log:
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.

<rdar://problem/14403381>

Modified:
    cfe/trunk/lib/Frontend/CompilerInstance.cpp

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=190833&r1=190832&r2=190833&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Sep 16 19:51:29 2013
@@ -1186,15 +1186,9 @@ CompilerInstance::loadModule(SourceLocat
     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.





More information about the cfe-commits mailing list