clang 24.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
14#include "llvm/ADT/StringMap.h"
15
16#include <atomic>
17#include <condition_variable>
18#include <memory>
19#include <mutex>
20
21namespace llvm {
22class MemoryBuffer;
23} // namespace llvm
24
25namespace clang {
26namespace dependencies {
27
29 std::mutex Mutex;
30 std::condition_variable CondVar;
31 bool Locked = false;
32 unsigned Generation = 0;
33
34 std::atomic<std::time_t> Timestamp = 0;
35
36 enum {
40 } State = S_Unknown;
41 /// The buffer we've read from disk, if any.
42 std::unique_ptr<llvm::MemoryBuffer> ReadBuffer;
43 /// The buffer we've written to module cache, if any.
44 std::unique_ptr<llvm::MemoryBuffer> WrittenBuffer;
45 /// The modification time of the entry.
46 time_t ModTime = 0;
47};
48
50 std::mutex Mutex;
51 llvm::StringMap<std::unique_ptr<ModuleCacheEntry>> Map;
52
53 /// Flushes all PCMs built in-process to disk.
54 void flush();
55};
56
57std::shared_ptr<ModuleCache>
59
60} // namespace dependencies
61} // namespace clang
62
63#endif // LLVM_CLANG_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H
Defines a logger where each line is written atomically to the file.
std::shared_ptr< ModuleCache > makeInProcessModuleCache(ModuleCacheEntries &Entries, AtomicLineLogger &Logger)
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.