class InMemoryModuleCache

Declaration

class InMemoryModuleCache : public RefCountedBase { /* full declaration omitted */ };

Description

In-memory cache for modules. This is a cache for modules for use across a compilation, sharing state between the CompilerInstances in an implicit 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 PCM. This is used by \a CompilerInstance when building PCMs to ensure that each \a ModuleManager sees the same files.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:30

Inherits from: RefCountedBase

Member Variables

private llvm::StringMap<PCM> PCMs
Cache of buffers.

Method Overview

  • public llvm::MemoryBuffer & addBuiltPCM(llvm::StringRef Filename, std::unique_ptr<llvm::MemoryBuffer> Buffer)
  • public llvm::MemoryBuffer & addPCM(llvm::StringRef Filename, std::unique_ptr<llvm::MemoryBuffer> Buffer)
  • public void finalizePCM(llvm::StringRef Filename)
  • public clang::InMemoryModuleCache::State getPCMState(llvm::StringRef Filename) const
  • public bool isPCMFinal(llvm::StringRef Filename) const
  • public llvm::MemoryBuffer * lookupPCM(llvm::StringRef Filename) const
  • public bool shouldBuildPCM(llvm::StringRef Filename) const
  • public bool tryToDropPCM(llvm::StringRef Filename)

Methods

llvm::MemoryBuffer& addBuiltPCM(
    llvm::StringRef Filename,
    std::unique_ptr<llvm::MemoryBuffer> Buffer)

Description

Store a just-built PCM under the Filename.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:75

Parameters

llvm::StringRef Filename
std::unique_ptr<llvm::MemoryBuffer> Buffer

Returns

a reference to the buffer as a convenience.

llvm::MemoryBuffer& addPCM(
    llvm::StringRef Filename,
    std::unique_ptr<llvm::MemoryBuffer> Buffer)

Description

Store the PCM under the Filename.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:67

Parameters

llvm::StringRef Filename
std::unique_ptr<llvm::MemoryBuffer> Buffer

Returns

a reference to the buffer as a convenience.

void finalizePCM(llvm::StringRef Filename)

Description

Mark a PCM as final.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:89

Parameters

llvm::StringRef Filename

clang::InMemoryModuleCache::State getPCMState(
    llvm::StringRef Filename) const

Description

Get the state of the PCM.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:60

Parameters

llvm::StringRef Filename

bool isPCMFinal(llvm::StringRef Filename) const

Description

Check whether the PCM is final and has been shown to work.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:97

Parameters

llvm::StringRef Filename

Returns

true iff state is Final.

llvm::MemoryBuffer* lookupPCM(
    llvm::StringRef Filename) const

Description

Get a pointer to the pCM if it exists; else nullptr.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:92

Parameters

llvm::StringRef Filename

bool shouldBuildPCM(
    llvm::StringRef Filename) const

Description

Check whether the PCM is waiting to be built.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:102

Parameters

llvm::StringRef Filename

Returns

true iff state is ToBuild.

bool tryToDropPCM(llvm::StringRef Filename)

Description

Try to remove a buffer from the cache. No effect if state is Final.

Declared at: clang/include/clang/Serialization/InMemoryModuleCache.h:83

Parameters

llvm::StringRef Filename

Returns

false on success, i.e. if Tentative => ToBuild.