clang: include/clang/DependencyScanning/DependencyScanningUtils.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNINGUTILS_H
10#define LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNINGUTILS_H
11
15#include "llvm/ADT/DenseSet.h"
16#include "llvm/ADT/MapVector.h"
17#include
18#include
19
22
23
25
26
28
30
31
32
33
35
36
37
39
40
41
43
44
45
46
47
48
50
51
52
54
55
57
58
59
60
61
62
63
65
66
68};
69
71public:
73 : AlreadySeen(AlreadySeen) {}
74
76 Commands.push_back(std::move(Cmd));
77 }
78
80
82 Dependencies.push_back(std::string(File));
83 }
84
86 PrebuiltModuleDeps.emplace_back(std::move(PMD));
87 }
88
90 ClangModuleDeps[MD.ID] = std::move(MD);
91 }
92
94 DirectModuleDeps.push_back(ID);
95 }
96
98 VisibleModules.push_back(ModuleName);
99 }
100
102 ContextHash = std::move(Hash);
103 }
104
106 std::optional Provided,
107 std::vector Requires) override {
108 ModuleName = Provided ? Provided->ModuleName : "";
109 llvm::transform(Requires, std::back_inserter(NamedModuleDeps),
110 [](const auto &Module) { return Module.ModuleName; });
111 }
112
114
115private:
116 std::vectorstd::string Dependencies;
117 std::vector PrebuiltModuleDeps;
118 llvm::MapVector<ModuleID, ModuleDeps> ClangModuleDeps;
119 std::string ModuleName;
120 std::vectorstd::string NamedModuleDeps;
121 std::vector DirectModuleDeps;
122 std::vectorstd::string VisibleModules;
123 std::vector Commands;
124 std::string ContextHash;
125 const llvm::DenseSet &AlreadySeen;
126};
127
128
131
132
133
135public:
137
140 llvm::report_fatal_error("unexpected call to lookupModuleOutput");
141 };
142
144 : LookupModuleOutput(std::move(LMO)) {
145 if (!LookupModuleOutput) {
147 }
148 }
149
152 return LookupModuleOutput(MD, Kind);
153 }
154
155private:
157};
158
159}
160}
161
162#endif
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
Describes a module or submodule.
static std::string lookupUnreachableModuleOutput(const ModuleDeps &MD, ModuleOutputKind Kind)
Definition DependencyScanningUtils.h:138
virtual ~CallbackActionController()
CallbackActionController(LookupModuleOutputCallback LMO)
Definition DependencyScanningUtils.h:143
std::string lookupModuleOutput(const ModuleDeps &MD, ModuleOutputKind Kind) override
Definition DependencyScanningUtils.h:150
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
void handleModuleDependency(ModuleDeps MD) override
Definition DependencyScanningUtils.h:89
TranslationUnitDeps takeTranslationUnitDeps()
void handleDependencyOutputOpts(const DependencyOutputOptions &) override
Definition DependencyScanningUtils.h:79
void handlePrebuiltModuleDependency(PrebuiltModuleDep PMD) override
Definition DependencyScanningUtils.h:85
void handleContextHash(std::string Hash) override
Definition DependencyScanningUtils.h:101
FullDependencyConsumer(const llvm::DenseSet< ModuleID > &AlreadySeen)
Definition DependencyScanningUtils.h:72
void handleProvidedAndRequiredStdCXXModules(std::optional< P1689ModuleInfo > Provided, std::vector< P1689ModuleInfo > Requires) override
Definition DependencyScanningUtils.h:105
void handleBuildCommand(Command Cmd) override
Definition DependencyScanningUtils.h:75
void handleDirectModuleDependency(ModuleID ID) override
Definition DependencyScanningUtils.h:93
void handleFileDependency(StringRef File) override
Definition DependencyScanningUtils.h:81
void handleVisibleModule(std::string ModuleName) override
Definition DependencyScanningUtils.h:97
llvm::function_ref< std::string(const ModuleDeps &, ModuleOutputKind)> LookupModuleOutputCallback
A callback to lookup module outputs for "-fmodule-file=", "-o" etc.
Definition DependencyScanningUtils.h:129
ModuleOutputKind
An output from a module compilation, such as the path of the module file.
std::vector< ModuleDeps > ModuleDepsGraph
Graph of modular dependencies.
Definition DependencyScanningUtils.h:24
The JSON file list parser is used to communicate input to InstallAPI.
A command-line tool invocation that is part of building a TU.
ModuleID ID
The identifier of the module.
This is used to identify a specific module.
Modular dependency that has already been built prior to the dependency scan.
The full dependencies and module graph for a specific input.
Definition DependencyScanningUtils.h:27
std::vector< std::string > VisibleModules
A list of module names that are visible to this translation unit.
Definition DependencyScanningUtils.h:53
std::vector< std::string > FileDeps
A collection of absolute paths to files that this translation unit directly depends on,...
Definition DependencyScanningUtils.h:38
std::vector< PrebuiltModuleDep > PrebuiltModuleDeps
A collection of prebuilt modules this translation unit directly depends on, not including transitive ...
Definition DependencyScanningUtils.h:42
ModuleID ID
The identifier of the C++20 module this translation unit exports.
Definition DependencyScanningUtils.h:34
std::vector< std::string > DriverCommandLine
Deprecated driver command-line. This will be removed in a future version.
Definition DependencyScanningUtils.h:67
std::vector< std::string > NamedModuleDeps
A list of the C++20 named modules this translation unit depends on.
Definition DependencyScanningUtils.h:56
ModuleDepsGraph ModuleGraph
The graph of direct and transitive modular dependencies.
Definition DependencyScanningUtils.h:29
std::vector< Command > Commands
The sequence of commands required to build the translation unit.
Definition DependencyScanningUtils.h:64
std::vector< ModuleID > ClangModuleDeps
A list of modules this translation unit directly depends on, not including transitive dependencies.
Definition DependencyScanningUtils.h:49