clang 23.0.0git
DependencyScanningService.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_DEPENDENCYSCANNINGSERVICE_H
10#define LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
11
14#include "llvm/ADT/BitmaskEnum.h"
15
16namespace clang {
17namespace dependencies {
18
19/// The mode in which the dependency scanner will operate to find the
20/// dependencies.
21enum class ScanningMode {
22 /// This mode is used to compute the dependencies by running the preprocessor
23 /// over the source files.
25
26 /// This mode is used to compute the dependencies by running the preprocessor
27 /// with special kind of lexing after scanning header and source files to get
28 /// the minimum necessary preprocessor directives for evaluating includes.
30};
31
32/// The format that is output by the dependency scanner.
34 /// This is the Makefile compatible dep format. This will include all of the
35 /// deps necessary for an implicit modules build, but won't include any
36 /// intermodule dependency information.
38
39 /// This outputs the full clang module dependency graph suitable for use for
40 /// explicitly building modules.
42
43 /// This outputs the dependency graph for standard c++ modules in P1689R5
44 /// format.
46};
47
48#define DSS_LAST_BITMASK_ENUM(Id) \
49 LLVM_MARK_AS_BITMASK_ENUM(Id), All = llvm::NextPowerOf2(Id) - 1
50
52 None = 0,
53
54 /// Remove unused header search paths including header maps.
56
57 /// Remove warnings from system modules.
58 SystemWarnings = (1 << 1),
59
60 /// Remove unused -ivfsoverlay arguments.
61 VFS = (1 << 2),
62
63 /// Canonicalize -D and -U options.
64 Macros = (1 << 3),
65
66 /// Ignore the compiler's working directory if it is safe.
67 IgnoreCWD = (1 << 4),
68
70
71 // The build system needs to be aware that the current working
72 // directory is ignored. Without a good way of notifying the build
73 // system, it is less risky to default to off.
75};
76
77#undef DSS_LAST_BITMASK_ENUM
78
79/// The configuration knobs for the dependency scanning service.
82
83 /// The function invoked to create each worker's VFS. This function and the
84 /// VFS itself must be thread-safe whenever using multiple workers
85 /// concurrently or whenever \c AsyncScanModules is true.
87 MakeVFS; // = [] { return llvm::vfs::createPhysicalFileSystem(); }
88 /// Whether to use optimized dependency directive scan or full preprocessing.
90 /// What output format are we expected to produce.
92 /// How to optimize resulting explicit module command lines.
94 /// Whether to make reported file paths absolute.
96 /// Whether the resulting command lines should load explicit PCMs eagerly.
97 bool EagerLoadModules = false;
98 /// Whether to trace VFS accesses during the scan.
99 bool TraceVFS = false;
100 /// Whether to scan modules asynchronously.
101 bool AsyncScanModules = false;
102 /// The build session timestamp for validate-once-per-build-session logic.
103 std::time_t BuildSessionTimestamp; // = std::chrono::system_clock::now();
104};
105
106/// The dependency scanning service contains shared configuration and state that
107/// is used by the individual dependency scanning workers.
109public:
111 : Opts(std::move(Opts)) {}
112
113 const DependencyScanningServiceOptions &getOpts() const { return Opts; }
114
116 return SharedCache;
117 }
118
119 ModuleCacheEntries &getModuleCacheEntries() { return ModCacheEntries; }
120
121private:
122 /// The options customizing dependency scanning behavior.
124 /// The global file system cache.
126 /// The global module cache entries.
127 ModuleCacheEntries ModCacheEntries;
128};
129
130} // end namespace dependencies
131} // end namespace clang
132
133#endif // LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
This class is a shared cache, that caches the 'stat' and 'open' calls to the underlying real file sys...
const DependencyScanningServiceOptions & getOpts() const
DependencyScanningService(DependencyScanningServiceOptions Opts)
DependencyScanningFilesystemSharedCache & getSharedCache()
@ VFS
Remove unused -ivfsoverlay arguments.
@ IgnoreCWD
Ignore the compiler's working directory if it is safe.
@ SystemWarnings
Remove warnings from system modules.
@ HeaderSearch
Remove unused header search paths including header maps.
ScanningOutputFormat
The format that is output by the dependency scanner.
@ Make
This is the Makefile compatible dep format.
@ Full
This outputs the full clang module dependency graph suitable for use for explicitly building modules.
@ P1689
This outputs the dependency graph for standard c++ modules in P1689R5 format.
ScanningMode
The mode in which the dependency scanner will operate to find the dependencies.
@ DependencyDirectivesScan
This mode is used to compute the dependencies by running the preprocessor with special kind of lexing...
@ CanonicalPreprocessing
This mode is used to compute the dependencies by running the preprocessor over the source files.
The JSON file list parser is used to communicate input to InstallAPI.
int const char * function
Definition c++config.h:31
The configuration knobs for the dependency scanning service.
std::function< IntrusiveRefCntPtr< llvm::vfs::FileSystem >()> MakeVFS
The function invoked to create each worker's VFS.
bool AsyncScanModules
Whether to scan modules asynchronously.
ScanningMode Mode
Whether to use optimized dependency directive scan or full preprocessing.
bool TraceVFS
Whether to trace VFS accesses during the scan.
bool EagerLoadModules
Whether the resulting command lines should load explicit PCMs eagerly.
bool ReportAbsolutePaths
Whether to make reported file paths absolute.
std::time_t BuildSessionTimestamp
The build session timestamp for validate-once-per-build-session logic.
ScanningOptimizations OptimizeArgs
How to optimize resulting explicit module command lines.
ScanningOutputFormat Format
What output format are we expected to produce.