clang
23.0.0git
include
clang
DependencyScanning
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
12
#include "
clang/Serialization/ModuleCache.h
"
13
#include "llvm/ADT/StringMap.h"
14
15
#include <atomic>
16
#include <condition_variable>
17
#include <memory>
18
#include <mutex>
19
20
namespace
llvm
{
21
class
MemoryBuffer;
22
}
// namespace llvm
23
24
namespace
clang
{
25
namespace
dependencies
{
26
27
struct
ModuleCacheEntry
{
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
{
36
S_Unknown
,
37
S_Read
,
38
S_Written
,
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
46
struct
ModuleCacheEntries
{
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
54
std::shared_ptr<ModuleCache>
55
makeInProcessModuleCache
(
ModuleCacheEntries
&Entries);
56
57
}
// namespace dependencies
58
}
// namespace clang
59
60
#endif
// LLVM_CLANG_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H
ModuleCache.h
clang::dependencies
Definition
DependencyScannerImpl.h:22
clang::dependencies::makeInProcessModuleCache
std::shared_ptr< ModuleCache > makeInProcessModuleCache(ModuleCacheEntries &Entries)
Definition
InProcessModuleCache.cpp:187
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition
CalledOnceCheck.h:17
llvm
Diagnostic wrappers for TextAPI types for error reporting.
Definition
Dominators.h:30
clang::dependencies::ModuleCacheEntries
Definition
InProcessModuleCache.h:46
clang::dependencies::ModuleCacheEntries::Map
llvm::StringMap< std::unique_ptr< ModuleCacheEntry > > Map
Definition
InProcessModuleCache.h:48
clang::dependencies::ModuleCacheEntries::flush
void flush()
Flushes all PCMs built in-process to disk.
Definition
InProcessModuleCache.cpp:23
clang::dependencies::ModuleCacheEntries::Mutex
std::mutex Mutex
Definition
InProcessModuleCache.h:47
clang::dependencies::ModuleCacheEntry
Definition
InProcessModuleCache.h:27
clang::dependencies::ModuleCacheEntry::Timestamp
std::atomic< std::time_t > Timestamp
Definition
InProcessModuleCache.h:33
clang::dependencies::ModuleCacheEntry::S_Written
@ S_Written
Definition
InProcessModuleCache.h:38
clang::dependencies::ModuleCacheEntry::S_Read
@ S_Read
Definition
InProcessModuleCache.h:37
clang::dependencies::ModuleCacheEntry::S_Unknown
@ S_Unknown
Definition
InProcessModuleCache.h:36
clang::dependencies::ModuleCacheEntry::CondVar
std::condition_variable CondVar
Definition
InProcessModuleCache.h:29
clang::dependencies::ModuleCacheEntry::Buffer
std::unique_ptr< llvm::MemoryBuffer > Buffer
The buffer that we've either read from disk or written in-process.
Definition
InProcessModuleCache.h:41
clang::dependencies::ModuleCacheEntry::ModTime
time_t ModTime
The modification time of the entry.
Definition
InProcessModuleCache.h:43
clang::dependencies::ModuleCacheEntry::Locked
bool Locked
Definition
InProcessModuleCache.h:30
clang::dependencies::ModuleCacheEntry::Mutex
std::mutex Mutex
Definition
InProcessModuleCache.h:28
clang::dependencies::ModuleCacheEntry::Generation
unsigned Generation
Definition
InProcessModuleCache.h:31
Generated on
for clang by
1.14.0