|
clang 22.0.0git
|
An individual dependency scanning worker that is able to run on its own thread. More...
#include "clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
Public Member Functions | |
| DependencyScanningWorker (DependencyScanningService &Service, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS) | |
| Construct a dependency scanning worker. | |
| ~DependencyScanningWorker () | |
| bool | computeDependencies (StringRef WorkingDirectory, const std::vector< std::string > &CommandLine, DependencyConsumer &DepConsumer, DependencyActionController &Controller, DiagnosticConsumer &DiagConsumer, std::optional< llvm::MemoryBufferRef > TUBuffer=std::nullopt) |
| Run the dependency scanning tool for a given clang driver command-line, and report the discovered dependencies to the provided consumer. | |
| llvm::Error | computeDependencies (StringRef WorkingDirectory, const std::vector< std::string > &CommandLine, DependencyConsumer &Consumer, DependencyActionController &Controller, std::optional< llvm::MemoryBufferRef > TUBuffer=std::nullopt) |
| Run the dependency scanning tool for a given clang driver command-line for a specific translation unit via file system or memory buffer. | |
| llvm::Error | initializeCompilerInstanceWithContextOrError (StringRef CWD, const std::vector< std::string > &CommandLine) |
| The three method below implements a new interface for by name dependency scanning. | |
| llvm::Error | computeDependenciesByNameWithContextOrError (StringRef ModuleName, DependencyConsumer &Consumer, DependencyActionController &Controller) |
| Performaces dependency scanning for the module whose name is specified. | |
| llvm::Error | finalizeCompilerInstanceWithContextOrError () |
| Finalizes the diagnostics engine and deletes the compiler instance. | |
| bool | initializeCompilerInstanceWithContext (StringRef CWD, const std::vector< std::string > &CommandLine, DiagnosticConsumer *DC=nullptr) |
| The three methods below provides the same functionality as the three methods above. | |
| bool | computeDependenciesByNameWithContext (StringRef ModuleName, DependencyConsumer &Consumer, DependencyActionController &Controller) |
| bool | finalizeCompilerInstance () |
| llvm::vfs::FileSystem & | getVFS () const |
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 84 of file DependencyScanningWorker.h.
| DependencyScanningWorker::DependencyScanningWorker | ( | DependencyScanningService & | Service, |
| llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | FS ) |
Construct a dependency scanning worker.
| Service | The parent service. Must outlive the worker. |
| FS | The filesystem for the worker to use. |
Definition at line 19 of file DependencyScanningWorker.cpp.
References clang::tooling::dependencies::CanonicalPreprocessing, and clang::tooling::dependencies::DependencyDirectivesScan.
|
default |
| llvm::Error DependencyScanningWorker::computeDependencies | ( | StringRef | WorkingDirectory, |
| const std::vector< std::string > & | CommandLine, | ||
| DependencyConsumer & | Consumer, | ||
| DependencyActionController & | Controller, | ||
| std::optional< llvm::MemoryBufferRef > | TUBuffer = std::nullopt ) |
Run the dependency scanning tool for a given clang driver command-line for a specific translation unit via file system or memory buffer.
StringError with the diagnostic output if clang errors occurred, success otherwise. Definition at line 49 of file DependencyScanningWorker.cpp.
References computeDependencies(), clang::tooling::dependencies::TextDiagnosticsPrinterWithOutput::DiagnosticsOS, and clang::tooling::dependencies::TextDiagnosticsPrinterWithOutput::DiagPrinter.
| bool DependencyScanningWorker::computeDependencies | ( | StringRef | WorkingDirectory, |
| const std::vector< std::string > & | CommandLine, | ||
| DependencyConsumer & | DepConsumer, | ||
| DependencyActionController & | Controller, | ||
| DiagnosticConsumer & | DiagConsumer, | ||
| std::optional< llvm::MemoryBufferRef > | TUBuffer = std::nullopt ) |
Run the dependency scanning tool for a given clang driver command-line, and report the discovered dependencies to the provided consumer.
If TUBuffer is not nullopt, it is used as TU input for the dependency scanning. Otherwise, the input should be included as part of the command-line.
DiagConsumer), true otherwise. Definition at line 155 of file DependencyScanningWorker.cpp.
References clang::tooling::dependencies::initVFSForTUBufferScanning().
Referenced by computeDependencies().
| bool DependencyScanningWorker::computeDependenciesByNameWithContext | ( | StringRef | ModuleName, |
| DependencyConsumer & | Consumer, | ||
| DependencyActionController & | Controller ) |
Definition at line 201 of file DependencyScanningWorker.cpp.
Referenced by computeDependenciesByNameWithContextOrError().
| llvm::Error DependencyScanningWorker::computeDependenciesByNameWithContextOrError | ( | StringRef | ModuleName, |
| DependencyConsumer & | Consumer, | ||
| DependencyActionController & | Controller ) |
Performaces dependency scanning for the module whose name is specified.
| ModuleName | The name of the module whose dependency will be scanned. |
| Consumer | The dependency consumer that stores the results. |
| Controller | The controller for the dependency scanning action. |
Definition at line 179 of file DependencyScanningWorker.cpp.
References computeDependenciesByNameWithContext(), and clang::Success.
| bool DependencyScanningWorker::finalizeCompilerInstance | ( | ) |
Definition at line 208 of file DependencyScanningWorker.cpp.
Referenced by finalizeCompilerInstanceWithContextOrError().
| llvm::Error DependencyScanningWorker::finalizeCompilerInstanceWithContextOrError | ( | ) |
Finalizes the diagnostics engine and deletes the compiler instance.
Definition at line 188 of file DependencyScanningWorker.cpp.
References finalizeCompilerInstance(), and clang::Success.
|
inline |
Definition at line 160 of file DependencyScanningWorker.h.
| bool DependencyScanningWorker::initializeCompilerInstanceWithContext | ( | StringRef | CWD, |
| const std::vector< std::string > & | CommandLine, | ||
| DiagnosticConsumer * | DC = nullptr ) |
The three methods below provides the same functionality as the three methods above.
Instead of returning llvm::Errors, these three methods return a flag to indicate if the call is successful. The initialization function asks the client for a DiagnosticsConsumer that it direct the diagnostics to.
Definition at line 193 of file DependencyScanningWorker.cpp.
Referenced by initializeCompilerInstanceWithContextOrError().
| llvm::Error DependencyScanningWorker::initializeCompilerInstanceWithContextOrError | ( | StringRef | CWD, |
| const std::vector< std::string > & | CommandLine ) |
The three method below implements a new interface for by name dependency scanning.
They together enable the dependency scanning worker to more effectively perform scanning for a sequence of modules by name when the CWD and CommandLine do not change across the queries.
Initializing the context and the compiler instance.
| CWD | The current working directory used during the scan. |
| CommandLine | The commandline used for the scan. |
Definition at line 172 of file DependencyScanningWorker.cpp.
References initializeCompilerInstanceWithContext(), and clang::Success.