15#include "llvm/ADT/IntrusiveRefCntPtr.h"
16#include "llvm/Support/VirtualFileSystem.h"
24 PCHContainerOps = std::make_shared<PCHContainerOperations>();
26 PCHContainerOps->registerReader(
27 std::make_unique<ObjectFilePCHContainerReader>());
29 PCHContainerOps->registerWriter(std::make_unique<RawPCHContainerWriter>());
31 auto BaseFS = Service.getOpts().MakeVFS();
33 if (Service.getOpts().TraceVFS) {
34 TracingFS = llvm::makeIntrusiveRefCnt<llvm::vfs::TracingFileSystem>(
39 DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
40 Service, std::move(BaseFS));
48 std::shared_ptr<clang::PCHContainerOperations> &PCHContainerOps,
54 return Action.
runInvocation(CommandLine[0], std::move(Invocation),
55 std::move(FS), PCHContainerOps,
59IntrusiveRefCntPtr<llvm::vfs::FileSystem>
61 StringRef WorkingDirectory,
66 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(std::move(FS));
67 NewFS->pushOverlay(std::move(OverlayFS));
68 FS = std::move(NewFS);
70 FS->setCurrentWorkingDirectory(WorkingDirectory);
84 const bool Success = llvm::all_of(CommandLines, [&](
const auto &Cmd) {
85 if (StringRef(Cmd[1]) !=
"-cc1") {
88 {Cmd.front(), {Cmd.begin() + 1, Cmd.end()}});
92 auto DiagEngineWithDiagOpts =
94 auto &Diags = *DiagEngineWithDiagOpts.DiagEngine;
Defines the Diagnostic-related interfaces.
static bool createAndRunToolInvocation(ArrayRef< std::string > CommandLine, DependencyScanningAction &Action, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS, std::shared_ptr< clang::PCHContainerOperations > &PCHContainerOps, DiagnosticsEngine &Diags)
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.
DiagnosticConsumer * getClient()
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
virtual void handleBuildCommand(Command Cmd)
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...
DependencyScanningWorker(DependencyScanningService &Service)
Construct a dependency scanning worker.
bool computeDependencies(StringRef WorkingDirectory, ArrayRef< ArrayRef< std::string > > CommandLines, DependencyConsumer &DepConsumer, DependencyActionController &Controller, DiagnosticConsumer &DiagConsumer, IntrusiveRefCntPtr< llvm::vfs::FileSystem > OverlayFS=nullptr)
Run the dependency scanning tool for all given frontend command-lines, and report the discovered depe...
~DependencyScanningWorker()
IntrusiveRefCntPtr< llvm::vfs::FileSystem > makeEffectiveVFS(StringRef WorkingDirectory, IntrusiveRefCntPtr< llvm::vfs::FileSystem > OverlayFS=nullptr) const
Creates the effective VFS that will be used for the scan.
std::unique_ptr< CompilerInvocation > createCompilerInvocation(ArrayRef< std::string > CommandLine, DiagnosticsEngine &Diags)
The JSON file list parser is used to communicate input to InstallAPI.
@ Success
Annotation was successful.