|
clang 24.0.0git
|
The high-level implementation of the dependency discovery tool that runs on an individual worker thread. More...
#include "clang/Tooling/DependencyScanningTool.h"
Public Member Functions | |
| DependencyScanningTool (dependencies::DependencyScanningService &Service) | |
| Construct a dependency scanning tool. | |
| std::optional< std::string > | getDependencyFile (ArrayRef< std::string > CommandLine, StringRef CWD, dependencies::LookupModuleOutputCallback LookupModuleOutput, DiagnosticConsumer &DiagConsumer) |
| Print out the dependency information into a string using the dependency file format that is specified in the options (-MD is the default) and return it. | |
| std::optional< P1689Rule > | getP1689ModuleDependencyFile (const CompileCommand &Command, StringRef CWD, std::string &MakeformatOutput, std::string &MakeformatOutputPath, DiagnosticConsumer &DiagConsumer) |
| Collect the module dependency in P1689 format for C++20 named modules. | |
| std::optional< P1689Rule > | getP1689ModuleDependencyFile (const CompileCommand &Command, StringRef CWD, DiagnosticConsumer &DiagConsumer) |
| std::optional< dependencies::TranslationUnitDeps > | getTranslationUnitDependencies (ArrayRef< std::string > CommandLine, StringRef CWD, DiagnosticConsumer &DiagConsumer, const llvm::DenseSet< dependencies::ModuleID > &AlreadySeen, dependencies::LookupModuleOutputCallback LookupModuleOutput, std::optional< llvm::MemoryBufferRef > TUBuffer=std::nullopt) |
| Given a Clang driver command-line for a translation unit, gather the modular dependencies and return the information needed for explicit build. | |
| bool | getByNameDependencies (StringRef CWD, ArrayRef< std::string > CommandLine, DiagnosticConsumer &DiagConsumer, dependencies::DependencyActionController &Controller, llvm::function_ref< std::optional< std::string >()> getNextName, dependencies::DependencyConsumer &DepConsumer) |
| By-name scanning given a Clang command-line. | |
| llvm::vfs::TracingFileSystem * | getWorkerTracingVFS () const |
| Returns the worker tracing VFS, if it was requested via the service. | |
The high-level implementation of the dependency discovery tool that runs on an individual worker thread.
Definition at line 33 of file DependencyScanningTool.h.
|
inline |
Construct a dependency scanning tool.
| Service | The parent service. Must outlive the tool. |
Definition at line 38 of file DependencyScanningTool.h.
| bool DependencyScanningTool::getByNameDependencies | ( | StringRef | CWD, |
| ArrayRef< std::string > | CommandLine, | ||
| DiagnosticConsumer & | DiagConsumer, | ||
| dependencies::DependencyActionController & | Controller, | ||
| llvm::function_ref< std::optional< std::string >()> | getNextName, | ||
| dependencies::DependencyConsumer & | DepConsumer ) |
By-name scanning given a Clang command-line.
The scanning context is initialized once and reused for each name pulled from getNextName until it returns std::nullopt. Results flow to DepConsumer (with per-name status via finishQuery); diagnostics flow to DiagConsumer.
Definition at line 349 of file DependencyScanningTool.cpp.
References clang::CompilerInstance::createDiagnostics(), clang::dependencies::createScanningDiagOptions(), getFirstCC1CommandLine(), and initVFSForByNameScanning().
| std::optional< std::string > DependencyScanningTool::getDependencyFile | ( | ArrayRef< std::string > | CommandLine, |
| StringRef | CWD, | ||
| dependencies::LookupModuleOutputCallback | LookupModuleOutput, | ||
| DiagnosticConsumer & | DiagConsumer ) |
Print out the dependency information into a string using the dependency file format that is specified in the options (-MD is the default) and return it.
Definition at line 188 of file DependencyScanningTool.cpp.
References clang::tooling::computeDependencies().
|
inline |
Definition at line 69 of file DependencyScanningTool.h.
References getP1689ModuleDependencyFile().
| std::optional< P1689Rule > DependencyScanningTool::getP1689ModuleDependencyFile | ( | const CompileCommand & | Command, |
| StringRef | CWD, | ||
| std::string & | MakeformatOutput, | ||
| std::string & | MakeformatOutputPath, | ||
| DiagnosticConsumer & | DiagConsumer ) |
Collect the module dependency in P1689 format for C++20 named modules.
| MakeformatOutput | The output parameter for dependency information in make format if the command line requires to generate make-format dependency information by -MD -MF <dep_file>. |
| MakeformatOutputPath | The output parameter for the path to |
| MakeformatOutput. |
Definition at line 202 of file DependencyScanningTool.cpp.
References clang::tooling::computeDependencies(), clang::Make, clang::DependencyOutputOptions::OutputFile, and clang::DependencyOutputOptions::OutputFormat.
Referenced by getP1689ModuleDependencyFile().
| std::optional< TranslationUnitDeps > DependencyScanningTool::getTranslationUnitDependencies | ( | ArrayRef< std::string > | CommandLine, |
| StringRef | CWD, | ||
| DiagnosticConsumer & | DiagConsumer, | ||
| const llvm::DenseSet< dependencies::ModuleID > & | AlreadySeen, | ||
| dependencies::LookupModuleOutputCallback | LookupModuleOutput, | ||
| std::optional< llvm::MemoryBufferRef > | TUBuffer = std::nullopt ) |
Given a Clang driver command-line for a translation unit, gather the modular dependencies and return the information needed for explicit build.
| AlreadySeen | This stores modules which have previously been reported. Use the same instance for all calls to this function for a single DependencyScanningTool in a single build. Use a different one for different tools, and clear it between builds. |
| LookupModuleOutput | This function is called to fill in "-fmodule-file=", "-o" and other output arguments for dependencies. |
| TUBuffer | Optional memory buffer for translation unit input. If TUBuffer is nullopt, the input should be included in the Commandline already. |
Definition at line 301 of file DependencyScanningTool.cpp.
References clang::tooling::computeDependencies(), initVFSForTUBufferScanning(), and clang::dependencies::FullDependencyConsumer::takeTranslationUnitDeps().
|
inline |
Returns the worker tracing VFS, if it was requested via the service.
Definition at line 120 of file DependencyScanningTool.h.