clang  14.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)
 Construct a dependency scanning tool. More...
 
llvm::Expected< std::stringgetDependencyFile (const std::vector< std::string > &CommandLine, StringRef CWD, llvm::Optional< StringRef > ModuleName=None)
 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. More...
 
llvm::Expected< FullDependenciesResultgetFullDependencies (const std::vector< std::string > &CommandLine, StringRef CWD, const llvm::StringSet<> &AlreadySeen, llvm::Optional< StringRef > ModuleName=None)
 Collect the full module dependency graph for the input, ignoring any modules which have already been seen. More...
 

Detailed Description

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

Definition at line 73 of file DependencyScanningTool.h.

Constructor & Destructor Documentation

◆ DependencyScanningTool()

clang::tooling::dependencies::DependencyScanningTool::DependencyScanningTool ( DependencyScanningService Service)

Construct a dependency scanning tool.

Definition at line 44 of file DependencyScanningTool.cpp.

Member Function Documentation

◆ getDependencyFile()

llvm::Expected< std::string > clang::tooling::dependencies::DependencyScanningTool::getDependencyFile ( const std::vector< std::string > &  CommandLine,
StringRef  CWD,
llvm::Optional< StringRef >  ModuleName = None 
)

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.

If ModuleName isn't empty, this function returns the dependency information of module ModuleName.

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

Prints out all of the gathered dependencies into a string.

Definition at line 48 of file DependencyScanningTool.cpp.

References clang::File, and string().

◆ getFullDependencies()

llvm::Expected< FullDependenciesResult > clang::tooling::dependencies::DependencyScanningTool::getFullDependencies ( const std::vector< std::string > &  CommandLine,
StringRef  CWD,
const llvm::StringSet<> &  AlreadySeen,
llvm::Optional< StringRef >  ModuleName = None 
)

Collect the full module dependency graph for the input, ignoring any modules which have already been seen.

If ModuleName isn't empty, this function returns the full dependency information of module ModuleName.

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.
Returns
a StringError with the diagnostic output if clang errors occurred, FullDependencies otherwise.

Definition at line 113 of file DependencyScanningTool.cpp.

References clang::tooling::dependencies::FullDependencies::ClangModuleDeps, clang::tooling::dependencies::DependencyScanningWorker::computeDependencies(), clang::tooling::dependencies::ModuleID::ContextHash, clang::tooling::dependencies::FullDependenciesResult::DiscoveredModules, clang::File, clang::tooling::dependencies::FullDependencies::FileDeps, clang::tooling::dependencies::FullDependenciesResult::FullDeps, clang::tooling::dependencies::FullDependencies::ID, clang::tooling::dependencies::ModuleDeps::ID, clang::tooling::dependencies::ModuleDeps::ImportedByMainFile, clang::tooling::dependencies::ModuleID::ModuleName, clang::tooling::dependencies::FullDependencies::PrebuiltModuleDeps, and string().


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