clang 23.0.0git
clang::tooling::CompilerInstanceWithContext Class Reference

#include "clang/Tooling/DependencyScanningTool.h"

Public Member Functions

bool computeDependencies (StringRef ModuleName, dependencies::DependencyConsumer &Consumer, dependencies::DependencyActionController &Controller)
llvm::Expected< dependencies::TranslationUnitDepscomputeDependenciesByNameOrError (StringRef ModuleName, const llvm::DenseSet< dependencies::ModuleID > &AlreadySeen, dependencies::LookupModuleOutputCallback LookupModuleOutput)
 Computes the dependeny for the module named ModuleName.

Static Public Member Functions

static std::optional< CompilerInstanceWithContextinitializeFromCommandline (DependencyScanningTool &Tool, StringRef CWD, ArrayRef< std::string > CommandLine, DiagnosticConsumer &DC)
 Initialize the tool's compiler instance from the commandline.
static llvm::Expected< CompilerInstanceWithContextinitializeOrError (DependencyScanningTool &Tool, StringRef CWD, ArrayRef< std::string > CommandLine)
 Initializing the context and the compiler instance.

Static Public Attributes

static const int32_t MaxNumOfQueries = 1 << 16

Detailed Description

Definition at line 141 of file DependencyScanningTool.h.

Member Function Documentation

◆ computeDependencies()

◆ computeDependenciesByNameOrError()

llvm::Expected< TranslationUnitDeps > CompilerInstanceWithContext::computeDependenciesByNameOrError ( StringRef ModuleName,
const llvm::DenseSet< dependencies::ModuleID > & AlreadySeen,
dependencies::LookupModuleOutputCallback LookupModuleOutput )

Computes the dependeny for the module named ModuleName.

Parameters
ModuleNameThe name of the module for which this method computes . dependencies.
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. Note that this parameter is not part of the context because it can be shared across different worker threads and each worker thread may update it.
LookupModuleOutputThis function is called to fill in "-fmodule-file=", "-o" and other output arguments for dependencies.
Returns
An instance of TranslationUnitDeps if the scan is successful. Otherwise it returns an error.

Definition at line 432 of file DependencyScanningTool.cpp.

References computeDependencies(), makeErrorFromDiagnosticsOS(), and clang::dependencies::FullDependencyConsumer::takeTranslationUnitDeps().

◆ initializeFromCommandline()

std::optional< CompilerInstanceWithContext > CompilerInstanceWithContext::initializeFromCommandline ( DependencyScanningTool & Tool,
StringRef CWD,
ArrayRef< std::string > CommandLine,
DiagnosticConsumer & DC )
static

Initialize the tool's compiler instance from the commandline.

The compiler instance only takes a -cc1 job, so this method builds the -cc1 job from the CommandLine input.

Parameters
ToolThe dependency scanning tool whose compiler instance with context is initialized.
CWDThe current working directory.
CommandLineThis command line may be a driver command or a cc1 command.
DCA diagnostics consumer to report error if the initialization fails.

Definition at line 379 of file DependencyScanningTool.cpp.

References getFirstCC1CommandLine(), clang::dependencies::DependencyScanningWorker::getVFS(), and initVFSForByNameScanning().

Referenced by initializeOrError().

◆ initializeOrError()

llvm::Expected< CompilerInstanceWithContext > CompilerInstanceWithContext::initializeOrError ( DependencyScanningTool & Tool,
StringRef CWD,
ArrayRef< std::string > CommandLine )
static

Initializing the context and the compiler instance.

This method must be called before calling computeDependenciesByNameWithContext.

Parameters
CWDThe current working directory used during the scan.
CommandLineThe commandline used for the scan.
Returns
Error if the initializaiton fails.

Definition at line 416 of file DependencyScanningTool.cpp.

References initializeFromCommandline(), makeErrorFromDiagnosticsOS(), and clang::Result.

Referenced by clang::tooling::DependencyScanningTool::getModuleDependencies().

Member Data Documentation

◆ MaxNumOfQueries

const int32_t clang::tooling::CompilerInstanceWithContext::MaxNumOfQueries = 1 << 16
static

Definition at line 238 of file DependencyScanningTool.h.

Referenced by computeDependencies(), and FakeInput().


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