clang 24.0.0git
ModuleCache.cpp File Reference
#include "clang/Serialization/ModuleCache.h"
#include "clang/Basic/AtomicLineLogger.h"
#include "clang/Serialization/InMemoryModuleCache.h"
#include "clang/Serialization/ModuleFile.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/IOSandbox.h"
#include "llvm/Support/LockFileManager.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include <chrono>

Go to the source code of this file.

Functions

static void writeTimestampFile (StringRef TimestampFile)
 Write a new timestamp file with the given path.
static constexpr std::chrono::seconds AccessTimeRefreshInterval (60)
 The access time of a module file is only refreshed explicitly when it is older than this interval so we avoid frequent yet unnecessary updates.
static void refreshAccessTime (llvm::sys::fs::file_t FD, const llvm::sys::fs::file_status &Status)
 Record that the module file open as FD has just been used by setting its access time to now, if it is older than AccessTimeRefreshInterval.

Function Documentation

◆ AccessTimeRefreshInterval()

constexpr std::chrono::seconds AccessTimeRefreshInterval ( 60 )
staticconstexpr

The access time of a module file is only refreshed explicitly when it is older than this interval so we avoid frequent yet unnecessary updates.

Referenced by refreshAccessTime().

◆ refreshAccessTime()

void refreshAccessTime ( llvm::sys::fs::file_t FD,
const llvm::sys::fs::file_status & Status )
static

Record that the module file open as FD has just been used by setting its access time to now, if it is older than AccessTimeRefreshInterval.

Module cache pruning goes by access time, and file systems don't reliably update it when a file is read (e.g., Linux relatime).

Definition at line 240 of file ModuleCache.cpp.

References AccessTimeRefreshInterval().

Referenced by clang::readImpl().

◆ writeTimestampFile()

void writeTimestampFile ( StringRef TimestampFile)
static

Write a new timestamp file with the given path.

Definition at line 57 of file ModuleCache.cpp.

Referenced by clang::maybePruneImpl().