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 that we've either read from disk or written in-process.
41 std::unique_ptr<llvm::MemoryBuffer> Buffer;
42 /// The modification time of the entry.
43 time_t ModTime = 0;
44};
45
47 std::mutex Mutex;
48 llvm::StringMap<std::unique_ptr<ModuleCacheEntry>> Map;
49
50 /// Flushes all PCMs built in-process to disk.
51 void flush();
52};
53
54std::shared_ptr<ModuleCache>
56
57} // namespace dependencies
58} // namespace clang
59
60#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.
std::unique_ptr< llvm::MemoryBuffer > Buffer
The buffer that we've either read from disk or written in-process.
time_t ModTime
The modification time of the entry.