16#include "llvm/ADT/IntrusiveRefCntPtr.h"
17#include "llvm/Support/VirtualFileSystem.h"
25 PCHContainerOps = std::make_shared<PCHContainerOperations>();
27 PCHContainerOps->registerReader(
28 std::make_unique<ObjectFilePCHContainerReader>());
30 PCHContainerOps->registerWriter(std::make_unique<RawPCHContainerWriter>());
32 auto BaseFS = Service.getOpts().MakeVFS();
34 if (Service.getOpts().TraceVFS)
35 BaseFS = llvm::makeIntrusiveRefCnt<llvm::vfs::TracingFileSystem>(
38 DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
39 Service.getSharedCache(), std::move(BaseFS));
48 std::shared_ptr<clang::PCHContainerOperations> &PCHContainerOps,
54 return Action.
runInvocation(CommandLine[0], std::move(Invocation),
55 std::move(FS), PCHContainerOps,
66 DepConsumer, Controller, DiagConsumer, OverlayFS);
77 bool SawDepFS =
false;
79 [&](llvm::vfs::FileSystem &
VFS) { SawDepFS |= &
VFS == DepFS.get(); });
80 assert(SawDepFS &&
"OverlayFS not based on DepFS");
82 FS = std::move(OverlayFS);
85 FS->setCurrentWorkingDirectory(WorkingDirectory);
91 const bool Success = llvm::all_of(CommandLines, [&](
const auto &Cmd) {
92 if (StringRef(Cmd[1]) !=
"-cc1") {
95 {Cmd.front(), {Cmd.begin() + 1, Cmd.end()}});
99 auto DiagEngineWithDiagOpts =
101 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 ~DependencyActionController()
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.
~DependencyScanningWorker()
bool computeDependencies(StringRef WorkingDirectory, ArrayRef< std::string > CommandLine, DependencyConsumer &DepConsumer, DependencyActionController &Controller, DiagnosticConsumer &DiagConsumer, llvm::IntrusiveRefCntPtr< llvm::vfs::OverlayFileSystem > OverlayFS=nullptr)
Run the dependency scanning worker for the given frontend command-line, and report the discovered dep...
@ VFS
Remove unused -ivfsoverlay arguments.
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.