class DependencyScanningTool

Declaration

class DependencyScanningTool { /* full declaration omitted */ };

Description

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

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h:68

Member Variables

private clang::tooling::dependencies:: DependencyScanningWorker Worker

Method Overview

  • public DependencyScanningTool(clang::tooling::dependencies::DependencyScanningService & Service, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = llvm::vfs::createPhysicalFileSystem())
  • public llvm::Expected<std::string> getDependencyFile(const std::vector<std::string> & CommandLine, llvm::StringRef CWD, llvm::Optional<StringRef> ModuleName = None)
  • public llvm::Expected<FullDependenciesResult> getFullDependencies(const std::vector<std::string> & CommandLine, llvm::StringRef CWD, const llvm::StringSet<> & AlreadySeen, llvm::Optional<StringRef> ModuleName = None)

Methods

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

Description

Construct a dependency scanning tool.

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h:71

Parameters

clang::tooling::dependencies:: DependencyScanningService& Service
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = llvm::vfs::createPhysicalFileSystem()

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

Description

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 \p ModuleName isn't empty, this function returns the dependency information of module \p ModuleName.

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h:83

Parameters

const std::vector<std::string>& CommandLine
llvm::StringRef CWD
llvm::Optional<StringRef> ModuleName = None

Returns

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

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

Description

Collect the full module dependency graph for the input, ignoring any modules which have already been seen. If \p ModuleName isn't empty, this function returns the full dependency information of module \p ModuleName.

Declared at: clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h:99

Parameters

const std::vector<std::string>& CommandLine
llvm::StringRef CWD
const llvm::StringSet<>& AlreadySeen
This stores modules which have previously been reported. Use the same instance for all calls to this function for a single \c DependencyScanningTool in a single build. Use a different one for different tools, and clear it between builds.
llvm::Optional<StringRef> ModuleName = None

Returns

a \c StringError with the diagnostic output if clang errors occurred, \c FullDependencies otherwise.