aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-03-13 10:54:51 -0700
committerGitHub <noreply@github.com>2025-03-13 10:54:51 -0700
commitd8dfdafc1d75ab17f742d40ab93240a10c216507 (patch)
tree7e0f9e80fa6ae919540e7bbe4720a151f1869172 /clang/lib/Frontend/CompilerInstance.cpp
parentbd0d28ac257d4df68ea7148e7a7c03910c22c1f3 (diff)
downloadllvm-d8dfdafc1d75ab17f742d40ab93240a10c216507.zip
llvm-d8dfdafc1d75ab17f742d40ab93240a10c216507.tar.gz
llvm-d8dfdafc1d75ab17f742d40ab93240a10c216507.tar.bz2
[Support] Introduce new `AdvisoryLock` interface (#130989)
This PR abstracts the `LockFileManager` API into new `AdvisoryLock` interface. This is so that we can create an alternative implementation for Clang implicitly-built modules that is optimized for single-process environment.
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 44f4f48..fc350f2 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1502,19 +1502,19 @@ static bool compileModuleAndReadASTBehindLock(
// Someone else is responsible for building the module. Wait for them to
// finish.
- switch (Lock.waitForUnlock()) {
- case llvm::LockFileManager::Res_Success:
+ switch (Lock.waitForUnlockFor(std::chrono::seconds(90))) {
+ case llvm::WaitForUnlockResult::Success:
break; // The interesting case.
- case llvm::LockFileManager::Res_OwnerDied:
+ case llvm::WaitForUnlockResult::OwnerDied:
continue; // try again to get the lock.
- case llvm::LockFileManager::Res_Timeout:
+ case llvm::WaitForUnlockResult::Timeout:
// Since ModuleCache takes care of correctness, we try waiting for
// another process to complete the build so clang does not do it done
// twice. If case of timeout, build it ourselves.
Diags.Report(ModuleNameLoc, diag::remark_module_lock_timeout)
<< Module->Name;
// Clear the lock file so that future invocations can make progress.
- Lock.unsafeRemoveLockFile();
+ Lock.unsafeMaybeUnlock();
continue;
}