Index: lib/Frontend/CompilerInstance.cpp =================================================================== --- lib/Frontend/CompilerInstance.cpp +++ lib/Frontend/CompilerInstance.cpp @@ -1096,6 +1096,7 @@ diagnoseBuildFailure(); return false; } + ModuleLoadCapabilities |= ASTReader::ARR_OutOfDate; break; case llvm::LockFileManager::LFS_Shared: @@ -1124,10 +1125,14 @@ ModuleLoadCapabilities); if (ReadResult == ASTReader::OutOfDate && - Locked == llvm::LockFileManager::LFS_Shared) { + (Locked == llvm::LockFileManager::LFS_Shared || + Locked == llvm::LockFileManager::LFS_Owned)) { // The module may be out of date in the presence of file system races, // or if one of its imports depends on header search paths that are not // consistent with this ImportingInstance. Try again... + + // The module may be out of date right after we rebuild it if a module + // it imports is overwritten by another process. Try again... continue; } else if (ReadResult == ASTReader::Missing) { diagnoseBuildFailure();