14using namespace tooling;
15using namespace dependencies;
20 : Worker(Service,
std::move(FS)) {}
26 void handleBuildCommand(
Command)
override {}
30 this->Opts = std::make_unique<DependencyOutputOptions>(Opts);
33 void handleFileDependency(StringRef
File)
override {
34 Dependencies.push_back(std::string(
File));
41 void handleModuleDependency(
ModuleDeps MD)
override {}
42 void handleDirectModuleDependency(
ModuleID ID)
override {}
43 void handleContextHash(std::string Hash)
override {}
45 void printDependencies(std::string &S) {
46 assert(Opts &&
"Handled dependency output options.");
53 for (
const auto &Dep : Dependencies)
57 void printDependencies(std::string &S) {
58 llvm::raw_string_ostream OS(S);
59 outputDependencyFile(OS);
63 DependencyPrinter
Generator(*Opts, Dependencies);
68 std::unique_ptr<DependencyOutputOptions> Opts;
69 std::vector<std::string> Dependencies;
74 const std::vector<std::string> &CommandLine, StringRef CWD) {
75 MakeDependencyPrinterConsumer Consumer;
82 Consumer.printDependencies(Output);
88 std::string &MakeformatOutputPath) {
89 class P1689ModuleDependencyPrinterConsumer
90 :
public MakeDependencyPrinterConsumer {
92 P1689ModuleDependencyPrinterConsumer(
P1689Rule &Rule,
98 void handleProvidedAndRequiredStdCXXModules(
99 std::optional<P1689ModuleInfo> Provided,
100 std::vector<P1689ModuleInfo> Requires)
override {
107 StringRef getMakeFormatDependencyOutputPath() {
108 if (Opts->OutputFormat != DependencyOutputFormat::Make)
110 return Opts->OutputFile;
121 std::string lookupModuleOutput(
const ModuleID &,
128 P1689ModuleDependencyPrinterConsumer Consumer(Rule,
Command);
129 P1689ActionController Controller;
135 MakeformatOutputPath = Consumer.getMakeFormatDependencyOutputPath();
136 if (!MakeformatOutputPath.empty())
137 Consumer.printDependencies(MakeformatOutput);
143 const std::vector<std::string> &CommandLine, StringRef CWD,
156 StringRef ModuleName,
const std::vector<std::string> &CommandLine,
162 Controller, ModuleName);
172 TU.
FileDeps = std::move(Dependencies);
176 for (
auto &&M : ClangModuleDeps) {
180 if (AlreadySeen.count(M.first))
192 for (
auto &&M : ClangModuleDeps) {
196 if (AlreadySeen.count(M.first))
198 ModuleGraph.push_back(std::move(MD));
Builds a dependency file when attached to a Preprocessor (for includes) and ASTReader (for module imp...
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
@ Result
The result type of a method or function.