clang 20.0.0git
DependencyScanningService.h
Go to the documentation of this file.
1//===- DependencyScanningService.h - clang-scan-deps service ===-*- C++ -*-===//
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_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
10#define LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
11
13#include "llvm/ADT/BitmaskEnum.h"
14
15namespace clang {
16namespace tooling {
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.
37 Make,
38
39 /// This outputs the full clang module dependency graph suitable for use for
40 /// explicitly building modules.
41 Full,
42
43 /// This outputs the dependency graph for standard c++ modules in P1689R5
44 /// format.
45 P1689,
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.
55 HeaderSearch = 1,
56
57 /// Remove warnings from system modules.
59
60 /// Remove unused -ivfsoverlay arguments.
61 VFS = 4,
62
63 /// Canonicalize -D and -U options.
64 Macros = 8,
65
67 Default = All
68};
69
70#undef DSS_LAST_BITMASK_ENUM
71
72/// The dependency scanning service contains shared configuration and state that
73/// is used by the individual dependency scanning workers.
75public:
79 bool EagerLoadModules = false);
80
81 ScanningMode getMode() const { return Mode; }
82
83 ScanningOutputFormat getFormat() const { return Format; }
84
85 ScanningOptimizations getOptimizeArgs() const { return OptimizeArgs; }
86
87 bool shouldEagerLoadModules() const { return EagerLoadModules; }
88
90 return SharedCache;
91 }
92
93private:
94 const ScanningMode Mode;
95 const ScanningOutputFormat Format;
96 /// Whether to optimize the modules' command-line arguments.
97 const ScanningOptimizations OptimizeArgs;
98 /// Whether to set up command-lines to load PCM files eagerly.
99 const bool EagerLoadModules;
100 /// The global file system cache.
102};
103
104} // end namespace dependencies
105} // end namespace tooling
106} // end namespace clang
107
108#endif // LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H
Encapsulates the information needed to find the file referenced by a #include or #include_next,...
Definition: HeaderSearch.h:249
This class is a shared cache, that caches the 'stat' and 'open' calls to the underlying real file sys...
The dependency scanning service contains shared configuration and state that is used by the individua...
DependencyScanningFilesystemSharedCache & getSharedCache()
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.
@ VFS
Remove unused -ivfsoverlay arguments.
@ SystemWarnings
Remove warnings from system modules.
The JSON file list parser is used to communicate input to InstallAPI.