15#include "llvm/ADT/IntrusiveRefCntPtr.h"
16#include "llvm/ADT/ScopeExit.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 TracingFS = llvm::makeIntrusiveRefCnt<llvm::vfs::TracingFileSystem>(
40 DepFS = llvm::makeIntrusiveRefCnt<DependencyScanningWorkerFilesystem>(
41 Service, std::move(BaseFS));
49 std::shared_ptr<clang::PCHContainerOperations> &PCHContainerOps,
55 return Action.
runInvocation(CommandLine[0], std::move(Invocation),
56 std::move(FS), PCHContainerOps,
60IntrusiveRefCntPtr<llvm::vfs::FileSystem>
62 StringRef WorkingDirectory,
67 llvm::makeIntrusiveRefCnt<llvm::vfs::OverlayFileSystem>(std::move(FS));
68 NewFS->pushOverlay(std::move(OverlayFS));
69 FS = std::move(NewFS);
71 FS->setCurrentWorkingDirectory(WorkingDirectory);
85 const bool Success = llvm::all_of(CommandLines, [&](
const auto &Cmd) {
86 if (StringRef(Cmd[1]) !=
"-cc1") {
89 {Cmd.front(), {Cmd.begin() + 1, Cmd.end()}});
93 Service.getLogger().log().logArray(
"starting scanning command:",
" ", Cmd);
94 llvm::scope_exit ExitLogging([&] {
95 Service.getLogger().log().logArray(
"finished scanning command:",
" ",
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 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.