|
clang 24.0.0git
|
In-memory cache for modules. More...
#include "clang/Serialization/InMemoryModuleCache.h"
Public Types | |
| enum | State { Unknown , Tentative , ToBuild , Final } |
| There are four states for a PCM. More... | |
Public Member Functions | |
| InMemoryModuleCache (AtomicLineLogger &Logger) | |
| State | getPCMState (llvm::StringRef Filename) const |
| Get the state of the PCM. | |
| llvm::MemoryBuffer & | addPCM (llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer, off_t Size, time_t ModTime) |
| Store the PCM under the Filename. | |
| llvm::MemoryBuffer & | addBuiltPCM (llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer, off_t Size, time_t ModTime) |
| Store a just-built PCM under the Filename. | |
| bool | tryToDropPCM (llvm::StringRef Filename) |
| Try to remove a buffer from the cache. | |
| void | finalizePCM (llvm::StringRef Filename) |
| Mark a PCM as final. | |
| llvm::MemoryBuffer * | lookupPCM (llvm::StringRef Filename, off_t &Size, time_t &ModTime) const |
Get a pointer to the PCM if it exists and set Size and ModTime to its on-disk size and modification time. | |
| bool | isPCMFinal (llvm::StringRef Filename) const |
| Check whether the PCM is final and has been shown to work. | |
| bool | shouldBuildPCM (llvm::StringRef Filename) const |
| Check whether the PCM is waiting to be built. | |
In-memory cache for modules.
This is a cache for modules for use across a compilation, sharing state between the CompilerInstances in a modules build. It must be shared by each CompilerInstance, ASTReader, ASTWriter, and ModuleManager that are coordinating.
Critically, it ensures that a single process has a consistent view of each implicitly-built PCM. This is used by CompilerInstance when building PCMs to ensure that each ModuleManager sees the same files.
Definition at line 30 of file InMemoryModuleCache.h.
There are four states for a PCM.
It must monotonically increase.
| Enumerator | |
|---|---|
| Unknown | |
| Tentative | |
| ToBuild | |
| Final | |
Definition at line 69 of file InMemoryModuleCache.h.
|
inlineexplicit |
Definition at line 58 of file InMemoryModuleCache.h.
| llvm::MemoryBuffer & InMemoryModuleCache::addBuiltPCM | ( | llvm::StringRef | Filename, |
| std::unique_ptr< llvm::MemoryBuffer > | Buffer, | ||
| off_t | Size, | ||
| time_t | ModTime ) |
Store a just-built PCM under the Filename.
Definition at line 37 of file InMemoryModuleCache.cpp.
Referenced by compileModuleImpl(), and createASTReader().
| llvm::MemoryBuffer & InMemoryModuleCache::addPCM | ( | llvm::StringRef | Filename, |
| std::unique_ptr< llvm::MemoryBuffer > | Buffer, | ||
| off_t | Size, | ||
| time_t | ModTime ) |
Store the PCM under the Filename.
Definition at line 26 of file InMemoryModuleCache.cpp.
Referenced by clang::serialization::ModuleManager::addModule().
| void InMemoryModuleCache::finalizePCM | ( | llvm::StringRef | Filename | ) |
Mark a PCM as final.
Definition at line 88 of file InMemoryModuleCache.cpp.
| InMemoryModuleCache::State InMemoryModuleCache::getPCMState | ( | llvm::StringRef | Filename | ) | const |
Get the state of the PCM.
Definition at line 16 of file InMemoryModuleCache.cpp.
References Final, Tentative, ToBuild, and Unknown.
Referenced by isPCMFinal(), and shouldBuildPCM().
| bool InMemoryModuleCache::isPCMFinal | ( | llvm::StringRef | Filename | ) | const |
Check whether the PCM is final and has been shown to work.
Definition at line 63 of file InMemoryModuleCache.cpp.
References Final, and getPCMState().
| llvm::MemoryBuffer * InMemoryModuleCache::lookupPCM | ( | llvm::StringRef | Filename, |
| off_t & | Size, | ||
| time_t & | ModTime ) const |
Get a pointer to the PCM if it exists and set Size and ModTime to its on-disk size and modification time.
Otherwise, return nullptr and don't change Size and ModTime.
Definition at line 51 of file InMemoryModuleCache.cpp.
Referenced by clang::ASTReader::readASTFileControlBlock().
| bool InMemoryModuleCache::shouldBuildPCM | ( | llvm::StringRef | Filename | ) | const |
Check whether the PCM is waiting to be built.
Definition at line 67 of file InMemoryModuleCache.cpp.
References getPCMState(), and ToBuild.
| bool InMemoryModuleCache::tryToDropPCM | ( | llvm::StringRef | Filename | ) |
Try to remove a buffer from the cache.
No effect if state is Final.
Definition at line 71 of file InMemoryModuleCache.cpp.