9#ifndef LLVM_CLANG_TOOLING_DEPENDENCYSCANNINGTOOL_H
10#define LLVM_CLANG_TOOLING_DEPENDENCYSCANNINGTOOL_H
18#include "llvm/ADT/DenseSet.h"
28 std::optional<dependencies::P1689ModuleInfo>
Provides;
29 std::vector<dependencies::P1689ModuleInfo>
Requires;
48 std::optional<std::string>
63 std::optional<P1689Rule>
65 std::string &MakeformatOutput,
66 std::string &MakeformatOutputPath,
68 std::optional<P1689Rule>
71 std::string MakeformatOutput;
72 std::string MakeformatOutputPath;
75 MakeformatOutputPath, DiagConsumer);
95 std::optional<dependencies::TranslationUnitDeps>
99 const llvm::DenseSet<dependencies::ModuleID> &AlreadySeen,
101 std::optional<llvm::MemoryBufferRef> TUBuffer = std::nullopt);
111 const llvm::DenseSet<dependencies::ModuleID> &AlreadySeen,
114 llvm::vfs::FileSystem &
getWorkerVFS()
const {
return Worker.getVFS(); }
141class CompilerInstanceWithContext {
145 std::vector<std::string> CommandLine;
149 std::unique_ptr<dependencies::DiagnosticsEngineWithDiagOpts>
150 DiagEngineWithCmdAndOpts;
151 std::unique_ptr<dependencies::TextDiagnosticsPrinterWithOutput>
155 std::unique_ptr<CompilerInvocation> OriginalInvocation;
158 std::unique_ptr<DependencyOutputOptions> OutputOpts;
165 std::unique_ptr<CompilerInstance> CIPtr;
168 int32_t SrcLocOffset = 0;
172 const std::vector<std::string> &CMD)
173 :
Worker(Worker), CWD(CWD), CommandLine(CMD) {};
176 std::unique_ptr<dependencies::DiagnosticsEngineWithDiagOpts>
177 DiagEngineWithDiagOpts,
229 StringRef ModuleName,
230 const llvm::DenseSet<dependencies::ModuleID> &AlreadySeen,
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
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...
An individual dependency scanning worker that is able to run on its own thread.
static std::optional< CompilerInstanceWithContext > initializeFromCommandline(DependencyScanningTool &Tool, StringRef CWD, ArrayRef< std::string > CommandLine, dependencies::DependencyActionController &Controller, DiagnosticConsumer &DC)
Initialize the tool's compiler instance from the commandline.
static const int32_t MaxNumOfQueries
static llvm::Expected< CompilerInstanceWithContext > initializeOrError(DependencyScanningTool &Tool, StringRef CWD, ArrayRef< std::string > CommandLine, dependencies::LookupModuleOutputCallback LookupModuleOutput)
Initializing the context and the compiler instance.
llvm::Expected< dependencies::TranslationUnitDeps > computeDependenciesByNameOrError(StringRef ModuleName, const llvm::DenseSet< dependencies::ModuleID > &AlreadySeen, dependencies::LookupModuleOutputCallback LookupModuleOutput)
Computes the dependeny for the module named ModuleName.
bool computeDependencies(StringRef ModuleName, dependencies::DependencyConsumer &Consumer, dependencies::DependencyActionController &Controller)
llvm::function_ref< std::string(const ModuleDeps &, ModuleOutputKind)> LookupModuleOutputCallback
A callback to lookup module outputs for "-fmodule-file=", "-o" etc.
llvm::StringMap< PrebuiltModuleASTAttrs > PrebuiltModulesAttrsMap
Attributes loaded from AST files of prebuilt modules collected prior to ModuleDepCollector creation.
The JSON file list parser is used to communicate input to InstallAPI.
@ Worker
'worker' clause, allowed on 'loop', Combined, and 'routine' directives.