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));
40 void handlePrebuiltModuleDependency(PrebuiltModuleDep PMD)
override {}
41 void handleModuleDependency(ModuleDeps MD)
override {}
42 void handleDirectModuleDependency(ModuleID ID)
override {}
43 void handleVisibleModule(std::string ModuleName)
override {}
44 void handleContextHash(std::string Hash)
override {}
46 void printDependencies(std::string &S) {
47 assert(Opts &&
"Handled dependency output options.");
49 class DependencyPrinter :
public DependencyFileGenerator {
51 DependencyPrinter(DependencyOutputOptions &Opts,
52 ArrayRef<std::string> Dependencies)
53 : DependencyFileGenerator(Opts) {
54 for (
const auto &Dep : Dependencies)
58 void printDependencies(std::string &S) {
59 llvm::raw_string_ostream
OS(S);
60 outputDependencyFile(OS);
64 DependencyPrinter
Generator(*Opts, Dependencies);
69 std::unique_ptr<DependencyOutputOptions> Opts;
70 std::vector<std::string> Dependencies;
77 MakeDependencyPrinterConsumer Consumer;
80 Worker.computeDependencies(CWD, CommandLine, Consumer, Controller);
84 Consumer.printDependencies(Output);
90 std::string &MakeformatOutputPath) {
91 class P1689ModuleDependencyPrinterConsumer
92 :
public MakeDependencyPrinterConsumer {
94 P1689ModuleDependencyPrinterConsumer(
P1689Rule &Rule,
96 : Filename(
Command.Filename), Rule(Rule) {
97 Rule.PrimaryOutput =
Command.Output;
100 void handleProvidedAndRequiredStdCXXModules(
101 std::optional<P1689ModuleInfo> Provided,
102 std::vector<P1689ModuleInfo> Requires)
override {
103 Rule.Provides = Provided;
105 Rule.Provides->SourcePath = Filename.str();
106 Rule.Requires = Requires;
109 StringRef getMakeFormatDependencyOutputPath() {
112 return Opts->OutputFile;
123 std::string lookupModuleOutput(
const ModuleDeps &,
130 P1689ModuleDependencyPrinterConsumer Consumer(Rule,
Command);
131 P1689ActionController Controller;
132 auto Result = Worker.computeDependencies(CWD,
Command.CommandLine, Consumer,
137 MakeformatOutputPath = Consumer.getMakeFormatDependencyOutputPath();
138 if (!MakeformatOutputPath.empty())
139 Consumer.printDependencies(MakeformatOutput);
146 const llvm::DenseSet<ModuleID> &AlreadySeen,
148 std::optional<llvm::MemoryBufferRef> TUBuffer) {
151 llvm::Error
Result = Worker.computeDependencies(CWD, CommandLine, Consumer,
152 Controller, TUBuffer);
162 const llvm::DenseSet<ModuleID> &AlreadySeen,
167 Worker.initializeCompilerInstanceWithContextOrError(CWD, CommandLine))
168 return std::move(
Error);
170 auto Result = Worker.computeDependenciesByNameWithContextOrError(
171 ModuleName, Consumer, Controller);
173 if (
auto Error = Worker.finalizeCompilerInstanceWithContextOrError())
174 return std::move(
Error);
184 return Worker.initializeCompilerInstanceWithContextOrError(CWD, CommandLine);
189 StringRef ModuleName,
const llvm::DenseSet<ModuleID> &AlreadySeen,
193 llvm::Error
Result = Worker.computeDependenciesByNameWithContextOrError(
194 ModuleName, Consumer, Controller);
202 return Worker.finalizeCompilerInstanceWithContextOrError();
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
A simple dependency action controller that uses a callback.
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
The dependency scanning service contains shared configuration and state that is used by the individua...
TranslationUnitDeps takeTranslationUnitDeps()
llvm::function_ref< std::string(const ModuleDeps &, ModuleOutputKind)> LookupModuleOutputCallback
A callback to lookup module outputs for "-fmodule-file=", "-o" etc.
ModuleOutputKind
An output from a module compilation, such as the path of the module file.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
A command-line tool invocation that is part of building a TU.