clang 23.0.0git
InProcessModuleCache.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H
10#define LLVM_CLANG_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H
11
13#include "llvm/ADT/StringMap.h"
14
15#include <atomic>
16#include <condition_variable>
17#include <memory>
18#include <mutex>
19
20namespace llvm {
21class MemoryBuffer;
22} // namespace llvm
23
24namespace clang {
25namespace dependencies {
26
28 std::mutex Mutex;
29 std::condition_variable CondVar;
30 bool Locked = false;
31 unsigned Generation = 0;
32
33 std::atomic<std::time_t> Timestamp = 0;
34
35 enum {
39 } State = S_Unknown;
40 /// The buffer we've read from disk, if any.
41 std::unique_ptr<llvm::MemoryBuffer> ReadBuffer;
42 /// The buffer we've written to module cache, if any.
43 std::unique_ptr<llvm::MemoryBuffer> WrittenBuffer;
44 /// The modification time of the entry.
45 time_t ModTime = 0;
46};
47
49 std::mutex Mutex;
50 llvm::StringMap<std::unique_ptr<ModuleCacheEntry>> Map;
51
52 /// Flushes all PCMs built in-process to disk.
53 void flush();
54};
55
56std::shared_ptr<ModuleCache>
58
59} // namespace dependencies
60} // namespace clang
61
62#endif // LLVM_CLANG_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H
std::shared_ptr< ModuleCache > makeInProcessModuleCache(ModuleCacheEntries &Entries)
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
llvm::StringMap< std::unique_ptr< ModuleCacheEntry > > Map
void flush()
Flushes all PCMs built in-process to disk.
time_t ModTime
The modification time of the entry.
std::unique_ptr< llvm::MemoryBuffer > WrittenBuffer
The buffer we've written to module cache, if any.
std::unique_ptr< llvm::MemoryBuffer > ReadBuffer
The buffer we've read from disk, if any.