================ @@ -0,0 +1,31 @@ +#ifndef LLVM_CLANG_SERIALIZATION_MODULECACHELOCK_H +#define LLVM_CLANG_SERIALIZATION_MODULECACHELOCK_H + +#include "clang/Basic/LLVM.h" +#include "llvm/Support/LockFileManager.h" + +namespace clang { +enum class LockResult { Owned, Shared, Error }; +enum class WaitForUnlockResult { Success, OwnerDied, Timeout }; + +class ModuleCacheLockManager { +public: + virtual operator LockResult() const = 0; + virtual WaitForUnlockResult waitForUnlock() = 0; + virtual void unsafeRemoveLock() = 0; + virtual std::string getErrorMessage() const = 0; + virtual ~ModuleCacheLockManager() = default; +}; + +class ModuleCacheLock { +public: + virtual void prepareLock(StringRef ModuleFilename) = 0; + virtual std::unique_ptr<ModuleCacheLockManager> + tryLock(StringRef ModuleFilename) = 0; + virtual ~ModuleCacheLock() = default; +}; ---------------- Bigcheese wrote:
Hmm, `ModuleCacheLockManager` is basically the same interface, and the enums are the same. I do think it makes sense to have that part in llvm/Support. I think the `ModuleCacheLock` should stay in Clang though. It would also be nice to modernize the interface (particularly `std::string getErrorMessage()`), but I think that can happen separately. https://github.com/llvm/llvm-project/pull/129751 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits