13#include "llvm/Support/FileSystem.h"
14#include "llvm/Support/LockFileManager.h"
15#include "llvm/Support/Path.h"
27 StringRef Dir = llvm::sys::path::parent_path(ModuleFilename);
28 llvm::sys::fs::create_directories(Dir);
31 std::unique_ptr<llvm::AdvisoryLock>
32 getLock(StringRef ModuleFilename)
override {
33 return std::make_unique<llvm::LockFileManager>(ModuleFilename);
37 llvm::sys::fs::file_status Status;
38 if (llvm::sys::fs::status(ModuleFilename, Status) != std::error_code{})
40 return llvm::sys::toTimeT(Status.getLastModificationTime());
46 llvm::raw_fd_ostream OS(
48 llvm::sys::fs::OF_TextWithCRLF);
51 OS <<
"Timestamp file\n";
64 return llvm::makeIntrusiveRefCnt<CrossProcessModuleCache>();
In-memory cache for modules.
The module cache used for compiling modules implicitly.
virtual void prepareForGetLock(StringRef ModuleFilename)=0
May perform any work that only needs to be performed once for multiple calls getLock() with the same ...
virtual std::time_t getModuleTimestamp(StringRef ModuleFilename)=0
Returns the timestamp denoting the last time inputs of the module file were validated.
virtual InMemoryModuleCache & getInMemoryModuleCache()=0
Returns this process's view of the module cache.
virtual void updateModuleTimestamp(StringRef ModuleFilename)=0
Updates the timestamp denoting the last time inputs of the module file were validated.
virtual std::unique_ptr< llvm::AdvisoryLock > getLock(StringRef ModuleFilename)=0
Returns lock for the given module file. The lock is initially unlocked.
static std::string getTimestampFilename(StringRef FileName)
The JSON file list parser is used to communicate input to InstallAPI.
IntrusiveRefCntPtr< ModuleCache > createCrossProcessModuleCache()
Creates new ModuleCache backed by a file system directory that may be operated on by multiple process...