clang 23.0.0git
clang::dependencies::DependencyScanningWorker Class Reference

An individual dependency scanning worker that is able to run on its own thread. More...

#include "clang/DependencyScanning/DependencyScanningWorker.h"

Public Member Functions

 DependencyScanningWorker (DependencyScanningService &Service)
 Construct a dependency scanning worker.
 ~DependencyScanningWorker ()
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 dependencies to the provided consumer.
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.
llvm::vfs::TracingFileSystem * getTracingVFS () const
 Returns the worker tracing VFS, if it was requested via the service.

Detailed Description

An individual dependency scanning worker that is able to run on its own thread.

The worker computes the dependencies for the input files by preprocessing sources either using a fast mode where the source files are minimized, or using the regular processing run.

Definition at line 45 of file DependencyScanningWorker.h.

Constructor & Destructor Documentation

◆ DependencyScanningWorker()

DependencyScanningWorker::DependencyScanningWorker ( DependencyScanningService & Service)

Construct a dependency scanning worker.

Parameters
ServiceThe parent service. Must outlive the worker.

Definition at line 21 of file DependencyScanningWorker.cpp.

◆ ~DependencyScanningWorker()

DependencyScanningWorker::~DependencyScanningWorker ( )
default

Member Function Documentation

◆ computeDependencies()

bool DependencyScanningWorker::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 dependencies to the provided consumer.

The OverlayFS will be used to call makeEffectiveVFS().

Returns
false if any errors occurred (with diagnostics reported to DiagConsumer), true otherwise.

Definition at line 74 of file DependencyScanningWorker.cpp.

References createAndRunToolInvocation(), clang::dependencies::DependencyConsumer::handleBuildCommand(), clang::dependencies::DependencyScanningAction::hasScanned(), makeEffectiveVFS(), and clang::Success.

◆ getTracingVFS()

llvm::vfs::TracingFileSystem * clang::dependencies::DependencyScanningWorker::getTracingVFS ( ) const
inline

Returns the worker tracing VFS, if it was requested via the service.

Definition at line 77 of file DependencyScanningWorker.h.

◆ makeEffectiveVFS()

IntrusiveRefCntPtr< llvm::vfs::FileSystem > DependencyScanningWorker::makeEffectiveVFS ( StringRef WorkingDirectory,
IntrusiveRefCntPtr< llvm::vfs::FileSystem > OverlayFS = nullptr ) const

Creates the effective VFS that will be used for the scan.

If provided, OverlayFS will be overlaid on top of the Worker's dependency scanning file-system and can be used to provide any input specified on the command-line as in-memory file. If no overlay file-system is provided, the Worker's dependency scanning file-system is used directly.

Definition at line 60 of file DependencyScanningWorker.cpp.

Referenced by computeDependencies(), and clang::tooling::CompilerInstanceWithContext::initializeFromCommandline().


The documentation for this class was generated from the following files: