aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2015-02-09 20:35:13 +0000
committerBen Langmuir <blangmuir@apple.com>2015-02-09 20:35:13 +0000
commit1daf4801469021590a814e0f8fbdade459d42b27 (patch)
tree53e8aae97f094579f03508d67574523df4b72bd6 /clang/lib/Frontend/CompilerInstance.cpp
parentd2d52de229393d5333290748f7a85ed9e727ed38 (diff)
downloadllvm-1daf4801469021590a814e0f8fbdade459d42b27.zip
llvm-1daf4801469021590a814e0f8fbdade459d42b27.tar.gz
llvm-1daf4801469021590a814e0f8fbdade459d42b27.tar.bz2
Diagnose timeouts in the LockFileManager and delete the dead lock file
If the lock file manager times out, we should give an error rather than silently trying to load the existing module. And delete the (presumably) dead lock file, since it will otherwise prevent progress in future invokations. This is unsound since we have no way to prove that the lock file we are deleting is the same one we timed out on, but since the lock is only to avoid excessive rebuilding anyway it should be okay. Depends on llvm r228603. llvm-svn: 228604
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 9cb26f8..187e2b7 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1022,9 +1022,19 @@ static bool compileAndLoadModule(CompilerInstance &ImportingInstance,
case llvm::LockFileManager::LFS_Shared:
// Someone else is responsible for building the module. Wait for them to
// finish.
- if (Locked.waitForUnlock() == llvm::LockFileManager::Res_OwnerDied)
+ switch (Locked.waitForUnlock()) {
+ case llvm::LockFileManager::Res_Success:
+ ModuleLoadCapabilities |= ASTReader::ARR_OutOfDate;
+ break;
+ case llvm::LockFileManager::Res_OwnerDied:
continue; // try again to get the lock.
- ModuleLoadCapabilities |= ASTReader::ARR_OutOfDate;
+ case llvm::LockFileManager::Res_Timeout:
+ Diags.Report(ModuleNameLoc, diag::err_module_lock_timeout)
+ << Module->Name;
+ // Clear the lock file so that future invokations can make progress.
+ Locked.unsafeRemoveLockFile();
+ return false;
+ }
break;
}