9#ifndef LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNERIMPL_H
10#define LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNERIMPL_H
20#include "llvm/Support/VirtualFileSystem.h"
39 std::optional<StringRef> ModuleName = std::nullopt)
40 : Service(Service), WorkingDirectory(WorkingDirectory),
41 Consumer(Consumer), Controller(Controller), DepFS(
std::move(DepFS)) {}
43 std::unique_ptr<CompilerInvocation> Invocation,
45 std::shared_ptr<PCHContainerOperations> PCHContainerOps,
53 StringRef WorkingDirectory;
57 std::optional<CompilerInstance> ScanInstanceStorage;
58 std::shared_ptr<ModuleDepCollector> MDC;
60 bool DiagConsumerFinished =
false;
64std::unique_ptr<DiagnosticOptions>
92std::pair<std::unique_ptr<driver::Driver>, std::unique_ptr<driver::Compilation>>
95 llvm::BumpPtrAllocator &Alloc);
97std::unique_ptr<CompilerInvocation>
101std::pair<IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>,
102 std::vector<std::string>>
105 StringRef WorkingDirectory,
106 llvm::MemoryBufferRef TUBuffer);
108std::pair<IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>,
109 std::vector<std::string>>
112 StringRef WorkingDirectory, StringRef ModuleName);
123std::optional<PrebuiltModulesAttrsMap>
132 std::unique_ptr<DependencyOutputOptions> DepOutputOpts,
133 StringRef WorkingDirectory, DependencyConsumer &Consumer,
135 DependencyActionController &Controller,
143 std::vector<std::string> CommandLine;
147 std::unique_ptr<DiagnosticsEngineWithDiagOpts> DiagEngineWithCmdAndOpts;
150 std::unique_ptr<CompilerInvocation> OriginalInvocation;
153 std::unique_ptr<DependencyOutputOptions> OutputOpts;
160 std::unique_ptr<CompilerInstance> CIPtr;
163 int32_t SrcLocOffset = 0;
167 const std::vector<std::string> &CMD)
168 : Worker(Worker), CWD(CWD), CommandLine(CMD) {};
173 std::unique_ptr<DiagnosticsEngineWithDiagOpts> DiagEngineWithDiagOpts,
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Helper class for holding the data necessary to invoke the compiler.
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
Concrete class used by the front-end to report problems and issues.
bool initialize(std::unique_ptr< DiagnosticsEngineWithDiagOpts > DiagEngineWithDiagOpts, IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > OverlayFS)
bool computeDependencies(StringRef ModuleName, DependencyConsumer &Consumer, DependencyActionController &Controller)
CompilerInstanceWithContext(DependencyScanningWorker &Worker, StringRef CWD, const std::vector< std::string > &CMD)
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
DependencyScanningAction(DependencyScanningService &Service, StringRef WorkingDirectory, DependencyConsumer &Consumer, DependencyActionController &Controller, IntrusiveRefCntPtr< DependencyScanningWorkerFilesystem > DepFS, std::optional< StringRef > ModuleName=std::nullopt)
bool hasDiagConsumerFinished() const
bool runInvocation(std::string Executable, std::unique_ptr< CompilerInvocation > Invocation, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, std::shared_ptr< PCHContainerOperations > PCHContainerOps, DiagnosticConsumer *DiagConsumer)
The dependency scanning service contains shared configuration and state that is used by the individua...
A virtual file system optimized for the dependency discovery.
An individual dependency scanning worker that is able to run on its own thread.
SmallVector< StringRef > getInitialStableDirs(const CompilerInstance &ScanInstance)
std::pair< IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem >, std::vector< std::string > > initVFSForTUBufferScanning(IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS, ArrayRef< std::string > CommandLine, StringRef WorkingDirectory, llvm::MemoryBufferRef TUBuffer)
void initializeScanCompilerInstance(CompilerInstance &ScanInstance, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, DiagnosticConsumer *DiagConsumer, DependencyScanningService &Service, IntrusiveRefCntPtr< DependencyScanningWorkerFilesystem > DepFS)
llvm::StringMap< PrebuiltModuleASTAttrs > PrebuiltModulesAttrsMap
Attributes loaded from AST files of prebuilt modules collected prior to ModuleDepCollector creation.
std::unique_ptr< CompilerInvocation > createCompilerInvocation(ArrayRef< std::string > CommandLine, DiagnosticsEngine &Diags)
std::optional< PrebuiltModulesAttrsMap > computePrebuiltModulesASTMap(CompilerInstance &ScanInstance, SmallVector< StringRef > &StableDirs)
std::pair< IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem >, std::vector< std::string > > initVFSForByNameScanning(IntrusiveRefCntPtr< llvm::vfs::FileSystem > BaseFS, ArrayRef< std::string > CommandLine, StringRef WorkingDirectory, StringRef ModuleName)
std::pair< std::unique_ptr< driver::Driver >, std::unique_ptr< driver::Compilation > > buildCompilation(ArrayRef< std::string > ArgStrs, DiagnosticsEngine &Diags, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, llvm::BumpPtrAllocator &Alloc)
std::shared_ptr< ModuleDepCollector > initializeScanInstanceDependencyCollector(CompilerInstance &ScanInstance, std::unique_ptr< DependencyOutputOptions > DepOutputOpts, StringRef WorkingDirectory, DependencyConsumer &Consumer, DependencyScanningService &Service, CompilerInvocation &Inv, DependencyActionController &Controller, PrebuiltModulesAttrsMap PrebuiltModulesASTMap, llvm::SmallVector< StringRef > &StableDirs)
Create the dependency collector that will collect the produced dependencies.
std::unique_ptr< DiagnosticOptions > createDiagOptions(ArrayRef< std::string > CommandLine)
The JSON file list parser is used to communicate input to InstallAPI.
IntrusiveRefCntPtr< DiagnosticsEngine > DiagEngine
DiagnosticsEngineWithDiagOpts(ArrayRef< std::string > CommandLine, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, DiagnosticConsumer &DC)
std::unique_ptr< DiagnosticOptions > DiagOpts
TextDiagnosticPrinter DiagPrinter
std::unique_ptr< DiagnosticOptions > DiagOpts
std::string DiagnosticOutput
TextDiagnosticsPrinterWithOutput(ArrayRef< std::string > CommandLine)
llvm::raw_string_ostream DiagnosticsOS