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 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;
75 const std::vector<std::string> &CommandLine, StringRef CWD) {
76 MakeDependencyPrinterConsumer Consumer;
79 Worker.computeDependencies(CWD, CommandLine, Consumer, Controller);
83 Consumer.printDependencies(Output);
89 std::string &MakeformatOutputPath) {
90 class P1689ModuleDependencyPrinterConsumer
91 :
public MakeDependencyPrinterConsumer {
93 P1689ModuleDependencyPrinterConsumer(
P1689Rule &Rule,
95 : Filename(
Command.Filename), Rule(Rule) {
96 Rule.PrimaryOutput =
Command.Output;
99 void handleProvidedAndRequiredStdCXXModules(
100 std::optional<P1689ModuleInfo> Provided,
101 std::vector<P1689ModuleInfo> Requires)
override {
102 Rule.Provides = Provided;
104 Rule.Provides->SourcePath = Filename.str();
105 Rule.Requires = Requires;
108 StringRef getMakeFormatDependencyOutputPath() {
111 return Opts->OutputFile;
122 std::string lookupModuleOutput(
const ModuleDeps &,
129 P1689ModuleDependencyPrinterConsumer Consumer(Rule,
Command);
130 P1689ActionController Controller;
131 auto Result = Worker.computeDependencies(CWD,
Command.CommandLine, Consumer,
136 MakeformatOutputPath = Consumer.getMakeFormatDependencyOutputPath();
137 if (!MakeformatOutputPath.empty())
138 Consumer.printDependencies(MakeformatOutput);
144 const std::vector<std::string> &CommandLine, StringRef CWD,
145 const llvm::DenseSet<ModuleID> &AlreadySeen,
147 std::optional<llvm::MemoryBufferRef> TUBuffer) {
150 llvm::Error
Result = Worker.computeDependencies(CWD, CommandLine, Consumer,
151 Controller, TUBuffer);
160 StringRef ModuleName,
const std::vector<std::string> &CommandLine,
161 StringRef CWD,
const llvm::DenseSet<ModuleID> &AlreadySeen,
165 llvm::Error
Result = Worker.computeDependencies(CWD, CommandLine, Consumer,
166 Controller, ModuleName);
178 TU.
FileDeps = std::move(Dependencies);
183 for (
auto &&M : ClangModuleDeps) {
187 if (AlreadySeen.count(M.first))
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
@ 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.