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>
64 std::optional<P1689Rule>
66 std::string &MakeformatOutput,
67 std::string &MakeformatOutputPath,
69 std::optional<P1689Rule>
72 std::string MakeformatOutput;
73 std::string MakeformatOutputPath;
76 MakeformatOutputPath, DiagConsumer);
96 std::optional<dependencies::TranslationUnitDeps>
100 const llvm::DenseSet<dependencies::ModuleID> &AlreadySeen,
102 std::optional<llvm::MemoryBufferRef> TUBuffer = std::nullopt);
112 const llvm::DenseSet<dependencies::ModuleID> &AlreadySeen,
117 return Worker.getTracingVFS();
145class CompilerInstanceWithContext {
149 std::vector<std::string> CommandLine;
153 std::unique_ptr<dependencies::DiagnosticsEngineWithDiagOpts>
154 DiagEngineWithCmdAndOpts;
155 std::unique_ptr<dependencies::TextDiagnosticsPrinterWithOutput>
159 std::unique_ptr<CompilerInvocation> OriginalInvocation;
162 std::unique_ptr<DependencyOutputOptions> OutputOpts;
169 std::unique_ptr<CompilerInstance> CIPtr;
172 int32_t SrcLocOffset = 0;
176 const std::vector<std::string> &CMD)
177 :
Worker(Worker), CWD(CWD), CommandLine(CMD) {};
180 std::unique_ptr<dependencies::DiagnosticsEngineWithDiagOpts>
181 DiagEngineWithDiagOpts,
233 StringRef ModuleName,
234 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 llvm::Expected< CompilerInstanceWithContext > initializeOrError(DependencyScanningTool &Tool, StringRef CWD, ArrayRef< std::string > CommandLine, dependencies::DependencyActionController &Controller)
Initializing the context and the compiler instance.
static const int32_t MaxNumOfQueries
bool computeDependencies(StringRef ModuleName, dependencies::DependencyConsumer &Consumer, dependencies::DependencyActionController &Controller)
llvm::Expected< dependencies::TranslationUnitDeps > computeDependenciesByNameOrError(StringRef ModuleName, const llvm::DenseSet< dependencies::ModuleID > &AlreadySeen, dependencies::DependencyActionController &Controller)
Computes the dependeny for the module named ModuleName.
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.