clang 19.0.0git
Public Member Functions | List of all members
clang::tooling::dependencies::DependencyScanningTool Class Reference

The high-level implementation of the dependency discovery tool that runs on an individual worker thread. More...

#include "clang/Tooling/DependencyScanning/DependencyScanningTool.h"

Public Member Functions

 DependencyScanningTool (DependencyScanningService &Service, llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS=llvm::vfs::createPhysicalFileSystem())
 Construct a dependency scanning tool.
 
llvm::Expected< std::string > getDependencyFile (const std::vector< std::string > &CommandLine, StringRef CWD)
 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.
 
llvm::Expected< P1689RulegetP1689ModuleDependencyFile (const clang::tooling::CompileCommand &Command, StringRef CWD, std::string &MakeformatOutput, std::string &MakeformatOutputPath)
 Collect the module dependency in P1689 format for C++20 named modules.
 
llvm::Expected< P1689RulegetP1689ModuleDependencyFile (const clang::tooling::CompileCommand &Command, StringRef CWD)
 
llvm::Expected< TranslationUnitDepsgetTranslationUnitDependencies (const std::vector< std::string > &CommandLine, StringRef CWD, const llvm::DenseSet< ModuleID > &AlreadySeen, LookupModuleOutputCallback LookupModuleOutput)
 Given a Clang driver command-line for a translation unit, gather the modular dependencies and return the information needed for explicit build.
 
llvm::Expected< ModuleDepsGraphgetModuleDependencies (StringRef ModuleName, const std::vector< std::string > &CommandLine, StringRef CWD, const llvm::DenseSet< ModuleID > &AlreadySeen, LookupModuleOutputCallback LookupModuleOutput)
 Given a compilation context specified via the Clang driver command-line, gather modular dependencies of module with the given name, and return the information needed for explicit build.
 

Detailed Description

The high-level implementation of the dependency discovery tool that runs on an individual worker thread.

Definition at line 78 of file DependencyScanningTool.h.

Constructor & Destructor Documentation

◆ DependencyScanningTool()

DependencyScanningTool::DependencyScanningTool ( DependencyScanningService Service,
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem >  FS = llvm::vfs::createPhysicalFileSystem() 
)

Construct a dependency scanning tool.

Definition at line 17 of file DependencyScanningTool.cpp.

Member Function Documentation

◆ getDependencyFile()

llvm::Expected< std::string > DependencyScanningTool::getDependencyFile ( const std::vector< std::string > &  CommandLine,
StringRef  CWD 
)

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.

Returns
A StringError with the diagnostic output if clang errors occurred, dependency file contents otherwise.

Definition at line 73 of file DependencyScanningTool.cpp.

References clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(), and clang::Result.

◆ getModuleDependencies()

llvm::Expected< ModuleDepsGraph > DependencyScanningTool::getModuleDependencies ( StringRef  ModuleName,
const std::vector< std::string > &  CommandLine,
StringRef  CWD,
const llvm::DenseSet< ModuleID > &  AlreadySeen,
LookupModuleOutputCallback  LookupModuleOutput 
)

Given a compilation context specified via the Clang driver command-line, gather modular dependencies of module with the given name, and return the information needed for explicit build.

Definition at line 155 of file DependencyScanningTool.cpp.

References clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(), clang::Result, and clang::tooling::dependencies::FullDependencyConsumer::takeModuleGraphDeps().

◆ getP1689ModuleDependencyFile() [1/2]

llvm::Expected< P1689Rule > clang::tooling::dependencies::DependencyScanningTool::getP1689ModuleDependencyFile ( const clang::tooling::CompileCommand Command,
StringRef  CWD 
)
inline

Definition at line 110 of file DependencyScanningTool.h.

References getP1689ModuleDependencyFile().

◆ getP1689ModuleDependencyFile() [2/2]

llvm::Expected< P1689Rule > DependencyScanningTool::getP1689ModuleDependencyFile ( const clang::tooling::CompileCommand Command,
StringRef  CWD,
std::string &  MakeformatOutput,
std::string &  MakeformatOutputPath 
)

Collect the module dependency in P1689 format for C++20 named modules.

Parameters
MakeformatOutputThe output parameter for dependency information in make format if the command line requires to generate make-format dependency information by -MD -MF <dep_file>.
MakeformatOutputPathThe output parameter for the path to
MakeformatOutput.
Returns
A StringError with the diagnostic output if clang errors occurred, P1689 dependency format rules otherwise.

Definition at line 86 of file DependencyScanningTool.cpp.

References clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(), Filename, clang::tooling::dependencies::P1689Rule::PrimaryOutput, clang::tooling::dependencies::P1689Rule::Provides, clang::tooling::dependencies::P1689Rule::Requires, and clang::Result.

Referenced by getP1689ModuleDependencyFile().

◆ getTranslationUnitDependencies()

llvm::Expected< TranslationUnitDeps > DependencyScanningTool::getTranslationUnitDependencies ( const std::vector< std::string > &  CommandLine,
StringRef  CWD,
const llvm::DenseSet< ModuleID > &  AlreadySeen,
LookupModuleOutputCallback  LookupModuleOutput 
)

Given a Clang driver command-line for a translation unit, gather the modular dependencies and return the information needed for explicit build.

Parameters
AlreadySeenThis 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.
LookupModuleOutputThis function is called to fill in "-fmodule-file=", "-o" and other output arguments for dependencies.
Returns
a StringError with the diagnostic output if clang errors occurred, TranslationUnitDeps otherwise.

Definition at line 142 of file DependencyScanningTool.cpp.

References clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(), clang::Result, and clang::tooling::dependencies::FullDependencyConsumer::takeTranslationUnitDeps().


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