clang 23.0.0git
ModulesDriver.cpp File Reference

This file defines functionality to support driver managed builds for compilations which use Clang modules or standard C++20 named modules. More...

#include "clang/Driver/ModulesDriver.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/LLVM.h"
#include "clang/DependencyScanning/DependencyScanningUtils.h"
#include "clang/Driver/Compilation.h"
#include "clang/Driver/Driver.h"
#include "clang/Driver/Job.h"
#include "clang/Driver/Tool.h"
#include "clang/Driver/ToolChain.h"
#include "clang/Frontend/StandaloneDiagnostic.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/DirectedGraph.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVectorExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/VirtualFileSystem.h"
#include <utility>

Go to the source code of this file.

Classes

struct  llvm::GraphTraits< CGNode * >
 Non-const versions of the GraphTraits specializations for CompilationGraph. More...
struct  llvm::GraphTraits< CompilationGraph * >
struct  llvm::GraphTraits< const CGNode * >
 Const versions of the GraphTraits specializations for CompilationGraph. More...
struct  llvm::GraphTraits< const CompilationGraph * >
struct  llvm::DOTGraphTraits< const CompilationGraph * >
class  llvm::GraphWriter< const CompilationGraph * >
 GraphWriter specialization for CompilationGraph that emits a more human-readable DOT graph. More...

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::driver
namespace  clang::driver::modules
namespace  llvm
 Diagnostic wrappers for TextAPI types for error reporting.

Typedefs

using ManifestEntryLookup
using ModuleNameAndTriple = std::pair<StringRef, StringRef>

Functions

static bool clang::driver::modules::fromJSON (const llvm::json::Value &Params, StdModuleManifest::Module::LocalArguments &LocalArgs, llvm::json::Path P)
static bool clang::driver::modules::fromJSON (const llvm::json::Value &Params, StdModuleManifest::Module &ModuleEntry, llvm::json::Path P)
static bool clang::driver::modules::fromJSON (const llvm::json::Value &Params, StdModuleManifest &Manifest, llvm::json::Path P)
static Expected< StdModuleManifestparseManifest (StringRef Buffer)
 Parses the Standard library module manifest from Buffer.
static void makeManifestPathsAbsolute (MutableArrayRef< StdModuleManifest::Module > ManifestEntries, StringRef ManifestPath)
 Converts each file path in manifest from relative to absolute.
static ManifestEntryLookup buildManifestLookupMap (ArrayRef< StdModuleManifest::Module > ManifestEntries)
 Builds a mapping from a module's source path to its entry in the manifest.
static const StdModuleManifest::ModulegetManifestEntryForCommand (const Command &Job, const ManifestEntryLookup &ManifestEntryBySource)
 Returns the manifest entry corresponding to Job, or nullptr if none exists.
static void addSystemIncludeDirsFromManifest (Compilation &C, Command &Job, ArgStringList &CC1Args, ArrayRef< std::string > SystemIncludeDirs)
 Adds all SystemIncludeDirs to the CC1Args of Job.
static bool isCC1Job (const Command &Job)
static void applyArgsForStdModuleManifestInputs (Compilation &C, const ManifestEntryLookup &ManifestEntryBySource, MutableArrayRef< std::unique_ptr< Command > > Jobs)
 Apply command-line modifications specific for inputs originating from the Standard library module manifest.
static std::optional< std::string > getModuleCachePath (llvm::opt::DerivedArgList &Args)
 Computes the -fmodule-cache-path for this compilation.
static bool isDependencyScannableJob (const Command &Job)
 Returns true if a dependency scan can be performed using Job.
static std::pair< std::unique_ptr< llvm::ThreadPoolInterface >, std::unique_ptr< ScanningWorkerPool > > createOptimalThreadAndWorkerPool (size_t NumScanInputs, bool HasStdlibModuleInputs, deps::DependencyScanningService &ScanningService)
static StringRef getTriple (const Command &Job)
static void reportAllScanDiagnostics (SmallVectorImpl< SmallVector< StandaloneDiagnostic, 0 > > &&AllScanDiags, DiagnosticsEngine &Diags)
 Report the diagnostics collected during each dependency scan.
static std::string constructPCMPath (const deps::ModuleID &ID, StringRef OutputDir)
 Construct a path for the explicitly built PCM.
static InputDependencies makeInputDeps (deps::TranslationUnitDeps &&TUDeps)
static SmallVector< std::string, 0 > buildCommandLine (const Command &Job)
 Constructs the full command line, including the executable, for Job.
static std::pair< std::optional< deps::TranslationUnitDeps >, SmallVector< StandaloneDiagnostic, 0 > > scanDependenciesForJob (const Command &Job, ScanningWorkerPool &WorkerPool, StringRef WorkingDirectory, ModuleLookupController &LookupController)
 Performs a dependency scan for a single job.
static std::optional< DependencyScanResult > scanDependencies (ArrayRef< std::unique_ptr< Command > > Jobs, llvm::DenseMap< StringRef, const StdModuleManifest::Module * > ManifestLookup, StringRef ModuleCachePath, StringRef WorkingDirectory, DiagnosticsEngine &Diags)
 Scans the compilations job list Jobs for module dependencies.
static StringRef getFirstInputFilename (const Command &Job)
static SmallVector< std::unique_ptr< Command > > takeJobsAtIndices (SmallVectorImpl< std::unique_ptr< Command > > &Jobs, ArrayRef< size_t > Indices)
static void createNodesForNonScannableJobs (CompilationGraph &Graph, SmallVectorImpl< std::unique_ptr< Command > > &&NonScannableJobs)
 Creates nodes for all jobs that could not be scanned (e.g. image jobs, ...).
static SmallVector< JobNode * > createNodesForUnusedStdlibModuleJobs (CompilationGraph &Graph, SmallVectorImpl< std::unique_ptr< Command > > &&UnusedStdlibModuleJobs)
 Creates nodes for the Standard library module jobs not discovered as dependencies.
static std::unique_ptr< CC1CommandcreateClangModulePrecompileJob (Compilation &C, const Command &ImportingJob, const deps::ModuleDeps &MD)
 Creates a job for the Clang module described by MD.
static void createClangModuleJobsAndNodes (CompilationGraph &Graph, Compilation &C, ArrayRef< std::unique_ptr< Command > > ImportingJobs, SmallVectorImpl< deps::ModuleDepsGraph > &&ModuleDepGraphsForScannedJobs)
 Creates a ClangModuleJobNode with associated job for each unique Clang module in ModuleDepGraphsForScannedJobs.
static void installScanCommandLines (Compilation &C, MutableArrayRef< std::unique_ptr< Command > > ScannedJobs, ArrayRef< InputDependencies > InputDepsForScannedJobs)
 Installs the command lines produced by the dependency scan into ScannedJobs.
static void createNodesForScannedJobs (CompilationGraph &Graph, SmallVectorImpl< std::unique_ptr< Command > > &&ScannedJobs, SmallVectorImpl< InputDependencies > &&InputDepsForScannedJobs)
 Creates nodes for all jobs which were scanned for dependencies.
template<typename LookupT, typename KeyRangeT>
static void connectEdgesViaLookup (CompilationGraph &Graph, CGNode &TgtNode, const LookupT &SrcNodeLookup, const KeyRangeT &SrcNodeLookupKeys, CGEdge::EdgeKind Kind)
static void createRegularEdges (CompilationGraph &Graph)
 Create edges for regular (non-module) dependencies in Graph.
static bool createModuleDependencyEdges (CompilationGraph &Graph, DiagnosticsEngine &Diags)
 Create edges for module dependencies in Graph.
static void pruneUnusedStdlibModuleJobs (CompilationGraph &Graph, ArrayRef< JobNode * > UnusedStdlibModuleJobNodes)
 Prunes the compilation graph of any jobs which build Standard library modules not required in this compilation.
static void createAndConnectRoot (CompilationGraph &Graph)
 Creates the root node and connects it to all nodes with no incoming edges ensuring that every node in the graph is reachable from the root.

Detailed Description

This file defines functionality to support driver managed builds for compilations which use Clang modules or standard C++20 named modules.

Definition in file ModulesDriver.cpp.

Typedef Documentation

◆ ManifestEntryLookup

Initial value:
llvm::DenseMap<StringRef, const StdModuleManifest::Module *>

Definition at line 144 of file ModulesDriver.cpp.

◆ ModuleNameAndTriple

using ModuleNameAndTriple = std::pair<StringRef, StringRef>

Definition at line 331 of file ModulesDriver.cpp.

Function Documentation

◆ addSystemIncludeDirsFromManifest()

void addSystemIncludeDirsFromManifest ( Compilation & C,
Command & Job,
ArgStringList & CC1Args,
ArrayRef< std::string > SystemIncludeDirs )
static

◆ applyArgsForStdModuleManifestInputs()

void applyArgsForStdModuleManifestInputs ( Compilation & C,
const ManifestEntryLookup & ManifestEntryBySource,
MutableArrayRef< std::unique_ptr< Command > > Jobs )
static

Apply command-line modifications specific for inputs originating from the Standard library module manifest.

Definition at line 193 of file ModulesDriver.cpp.

References addSystemIncludeDirsFromManifest(), clang::C, getManifestEntryForCommand(), and isCC1Job().

Referenced by clang::driver::modules::runModulesDriver().

◆ buildCommandLine()

SmallVector< std::string, 0 > buildCommandLine ( const Command & Job)
static

Constructs the full command line, including the executable, for Job.

Definition at line 534 of file ModulesDriver.cpp.

References clang::driver::Command::getArguments(), and clang::driver::Command::getExecutable().

Referenced by scanDependenciesForJob().

◆ buildManifestLookupMap()

ManifestEntryLookup buildManifestLookupMap ( ArrayRef< StdModuleManifest::Module > ManifestEntries)
static

Builds a mapping from a module's source path to its entry in the manifest.

Definition at line 149 of file ModulesDriver.cpp.

Referenced by clang::driver::modules::runModulesDriver().

◆ connectEdgesViaLookup()

template<typename LookupT, typename KeyRangeT>
void connectEdgesViaLookup ( CompilationGraph & Graph,
CGNode & TgtNode,
const LookupT & SrcNodeLookup,
const KeyRangeT & SrcNodeLookupKeys,
CGEdge::EdgeKind Kind )
static

Definition at line 1324 of file ModulesDriver.cpp.

Referenced by createModuleDependencyEdges(), and createRegularEdges().

◆ constructPCMPath()

std::string constructPCMPath ( const deps::ModuleID & ID,
StringRef OutputDir )
static

Construct a path for the explicitly built PCM.

Definition at line 456 of file ModulesDriver.cpp.

◆ createAndConnectRoot()

void createAndConnectRoot ( CompilationGraph & Graph)
static

Creates the root node and connects it to all nodes with no incoming edges ensuring that every node in the graph is reachable from the root.

Definition at line 1483 of file ModulesDriver.cpp.

Referenced by clang::driver::modules::runModulesDriver().

◆ createClangModuleJobsAndNodes()

void createClangModuleJobsAndNodes ( CompilationGraph & Graph,
Compilation & C,
ArrayRef< std::unique_ptr< Command > > ImportingJobs,
SmallVectorImpl< deps::ModuleDepsGraph > && ModuleDepGraphsForScannedJobs )
static

Creates a ClangModuleJobNode with associated job for each unique Clang module in ModuleDepGraphsForScannedJobs.

Parameters
ImportingJobsJobs whose module dependencies were scanned.
ModuleDepGraphsForScannedJobsFull Clang module dependency graphs corresponding to ImportingJobs, in order.

Definition at line 1259 of file ModulesDriver.cpp.

References clang::C, createClangModulePrecompileJob(), and clang::dependencies::ModuleDeps::ID.

Referenced by clang::driver::modules::runModulesDriver().

◆ createClangModulePrecompileJob()

◆ createModuleDependencyEdges()

bool createModuleDependencyEdges ( CompilationGraph & Graph,
DiagnosticsEngine & Diags )
static

Create edges for module dependencies in Graph.

Returns
false if there are multiple definitions for a named module, with diagnostics reported to Diags; otherwise returns true.

Definition at line 1364 of file ModulesDriver.cpp.

References clang::cast(), clang::dependencies::ModuleDeps::ClangModuleDeps, connectEdgesViaLookup(), getFirstInputFilename(), getTriple(), clang::dependencies::ModuleDeps::ID, and clang::DiagnosticsEngine::Report().

Referenced by clang::driver::modules::runModulesDriver().

◆ createNodesForNonScannableJobs()

void createNodesForNonScannableJobs ( CompilationGraph & Graph,
SmallVectorImpl< std::unique_ptr< Command > > && NonScannableJobs )
static

Creates nodes for all jobs that could not be scanned (e.g. image jobs, ...).

Definition at line 1198 of file ModulesDriver.cpp.

Referenced by clang::driver::modules::runModulesDriver().

◆ createNodesForScannedJobs()

void createNodesForScannedJobs ( CompilationGraph & Graph,
SmallVectorImpl< std::unique_ptr< Command > > && ScannedJobs,
SmallVectorImpl< InputDependencies > && InputDepsForScannedJobs )
static

Creates nodes for all jobs which were scanned for dependencies.

The updated command lines produced by the dependency scan are installed at a later point.

Definition at line 1308 of file ModulesDriver.cpp.

Referenced by clang::driver::modules::runModulesDriver().

◆ createNodesForUnusedStdlibModuleJobs()

SmallVector< JobNode * > createNodesForUnusedStdlibModuleJobs ( CompilationGraph & Graph,
SmallVectorImpl< std::unique_ptr< Command > > && UnusedStdlibModuleJobs )
static

Creates nodes for the Standard library module jobs not discovered as dependencies.

These and any dependent (non-image) job nodes should be pruned from the graph later.

Definition at line 1214 of file ModulesDriver.cpp.

Referenced by clang::driver::modules::runModulesDriver().

◆ createOptimalThreadAndWorkerPool()

std::pair< std::unique_ptr< llvm::ThreadPoolInterface >, std::unique_ptr< ScanningWorkerPool > > createOptimalThreadAndWorkerPool ( size_t NumScanInputs,
bool HasStdlibModuleInputs,
deps::DependencyScanningService & ScanningService )
static

Definition at line 293 of file ModulesDriver.cpp.

Referenced by scanDependencies().

◆ createRegularEdges()

void createRegularEdges ( CompilationGraph & Graph)
static

Create edges for regular (non-module) dependencies in Graph.

Definition at line 1339 of file ModulesDriver.cpp.

References clang::cast(), and connectEdgesViaLookup().

Referenced by clang::driver::modules::runModulesDriver().

◆ getFirstInputFilename()

◆ getManifestEntryForCommand()

const StdModuleManifest::Module * getManifestEntryForCommand ( const Command & Job,
const ManifestEntryLookup & ManifestEntryBySource )
static

Returns the manifest entry corresponding to Job, or nullptr if none exists.

Definition at line 163 of file ModulesDriver.cpp.

References clang::driver::Command::getInputInfos().

Referenced by applyArgsForStdModuleManifestInputs(), and scanDependencies().

◆ getModuleCachePath()

std::optional< std::string > getModuleCachePath ( llvm::opt::DerivedArgList & Args)
static

Computes the -fmodule-cache-path for this compilation.

Definition at line 216 of file ModulesDriver.cpp.

References clang::driver::Driver::getDefaultModuleCachePath().

Referenced by clang::driver::modules::runModulesDriver().

◆ getTriple()

StringRef getTriple ( const Command & Job)
static

Definition at line 327 of file ModulesDriver.cpp.

References clang::driver::Command::getCreator(), clang::driver::Tool::getToolChain(), and clang::driver::ToolChain::getTriple().

Referenced by clang::driver::toolchains::MinGW::AddClangSystemIncludeArgs(), clang::driver::toolchains::PS4PS5Base::addClangTargetOptions(), clang::driver::tools::ClangAs::AddLoongArchTargetArgs(), clang::driver::toolchains::HIPSPVToolChain::buildLinker(), clang::Sema::BuildPointerType(), clang::Sema::BuildReferenceType(), clang::ASTContext::canBuiltinBeRedeclared(), clang::driver::tools::amdgpu::Linker::ConstructJob(), clang::driver::tools::AVR::Linker::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::darwin::Linker::ConstructJob(), clang::driver::tools::gcc::Common::ConstructJob(), clang::driver::tools::gnutools::Assembler::ConstructJob(), clang::driver::tools::gnutools::Linker::ConstructJob(), clang::driver::tools::NVPTX::Linker::ConstructJob(), createModuleDependencyEdges(), clang::driver::toolchains::ROCMToolChain::diagnoseUnsupportedOption(), clang::CodeGen::CodeGenFunction::EmitAMDGPUBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAMDGPUDevicePrintfCallExpr(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CIRGen::CIRGenFunction::emitBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitCall(), clang::CodeGen::CodeGenFunction::EmitCallArgs(), clang::CodeGen::CodeGenFunction::EmitHLSLBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitMultiVersionResolver(), clang::CodeGen::CodeGenFunction::EmitNVPTXDevicePrintfCallExpr(), clang::CodeGen::CodeGenFunction::EmitPPCBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitRISCVMultiVersionResolver(), clang::CodeGen::CodeGenFunction::EmitTargetBuiltinExpr(), clang::CIRGen::CIRGenFunction::emitTargetBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitX86BuiltinExpr(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::targets::X86TargetInfo::getABI(), clang::driver::toolchains::HexagonToolChain::getBaseIncludeDir(), clang::targets::ARMTargetInfo::getBuiltinVaListKind(), clang::targets::HexagonTargetInfo::getBuiltinVaListKind(), clang::driver::toolchains::MSVCToolChain::getDefaultDebugFormat(), clang::driver::toolchains::HexagonToolChain::getDefaultLinker(), clang::driver::toolchains::HIPSPVToolChain::getDeviceLibs(), clang::driver::toolchains::HexagonToolChain::getEffectiveSysRoot(), clang::targets::DarwinTargetInfo< Target >::getExnObjectAlignment(), clang::driver::toolchains::HexagonToolChain::getLibraryDir(), clang::targets::AMDGPUTargetInfo::getMaxPointerWidth(), llvm::DOTGraphTraits< const CompilationGraph * >::getNodeIdentifier(), llvm::DOTGraphTraits< const CompilationGraph * >::getNodeLabel(), clang::ASTContext::getOpenMPDefaultSimdAlign(), clang::targets::AMDGPUTargetInfo::getPointerWidthV(), clang::targets::SystemZTargetInfo::getPointerWidthV(), clang::driver::toolchains::OpenBSD::getSupportedSanitizers(), clang::targets::AMDGPUTargetInfo::getTargetID(), clang::SemaX86::handleAnyInterruptAttr(), clang::targets::AMDGPUTargetInfo::handleTargetFeatures(), clang::targets::SystemZTargetInfo::handleTargetFeatures(), clang::targets::AMDGPUTargetInfo::hasBFloat16Type(), clang::TargetInfo::hasPS4DLLImportExport(), clang::driver::toolchains::Darwin::isMacosxVersionLT(), clang::driver::toolchains::MachO::IsObjCNonFragileABIDefault(), clang::TargetInfo::isSEHTrySupported(), clang::driver::toolchains::Generic_GCC::isTarget32Bit(), clang::driver::toolchains::Generic_GCC::isTarget64Bit(), clang::targets::AMDGPUTargetInfo::isValidCPUName(), clang::targets::X86TargetInfo::isValidCPUName(), clang::targets::PPC32TargetInfo::PPC32TargetInfo(), clang::CodeGen::CodeGenFunction::ProcessOrderScopeAMDGCN(), scanDependencies(), clang::targets::AMDGPUTargetInfo::setCPU(), clang::targets::X86TargetInfo::setCPU(), clang::targets::PPC64TargetInfo::setMaxAtomicWidth(), clang::targets::MipsTargetInfo::setN32N64ABITypes(), clang::targets::MipsTargetInfo::setN64ABITypes(), clang::targets::AMDGPUTargetInfo::setSupportedOpenCLOpts(), clang::TargetInfo::shouldDLLImportComdatSymbols(), clang::targets::SparcV8TargetInfo::SparcV8TargetInfo(), clang::targets::SparcV9TargetInfo::SparcV9TargetInfo(), clang::targets::SPIRTargetInfo::SPIRTargetInfo(), clang::targets::SPIRV32TargetInfo::SPIRV32TargetInfo(), clang::targets::SPIRV64AMDGCNTargetInfo::SPIRV64AMDGCNTargetInfo(), clang::targets::SPIRV64TargetInfo::SPIRV64TargetInfo(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::targets::PPCTargetInfo::supportsCpuIs(), clang::targets::PPCTargetInfo::supportsCpuSupports(), clang::targets::X86TargetInfo::supportsExtendIntArgs(), clang::TargetInfo::supportsIFunc(), clang::TargetInfo::supportsMultiVersioning(), TargetOMPContext::TargetOMPContext(), clang::targets::WindowsX86_32TargetInfo::WindowsX86_32TargetInfo(), clang::targets::X86_64TargetInfo::X86_64TargetInfo(), and clang::targets::X86TargetInfo::X86TargetInfo().

◆ installScanCommandLines()

void installScanCommandLines ( Compilation & C,
MutableArrayRef< std::unique_ptr< Command > > ScannedJobs,
ArrayRef< InputDependencies > InputDepsForScannedJobs )
static

Installs the command lines produced by the dependency scan into ScannedJobs.

Definition at line 1282 of file ModulesDriver.cpp.

References clang::C.

Referenced by clang::driver::modules::runModulesDriver().

◆ isCC1Job()

◆ isDependencyScannableJob()

bool isDependencyScannableJob ( const Command & Job)
static

Returns true if a dependency scan can be performed using Job.

Definition at line 227 of file ModulesDriver.cpp.

References clang::driver::Command::getInputInfos(), isCC1Job(), and clang::driver::types::isSrcFile().

Referenced by scanDependencies().

◆ makeInputDeps()

InputDependencies makeInputDeps ( deps::TranslationUnitDeps && TUDeps)
static

Definition at line 522 of file ModulesDriver.cpp.

Referenced by scanDependencies().

◆ makeManifestPathsAbsolute()

void makeManifestPathsAbsolute ( MutableArrayRef< StdModuleManifest::Module > ManifestEntries,
StringRef ManifestPath )
static

Converts each file path in manifest from relative to absolute.

Each file path in the manifest is expected to be relative the manifest's location ManifestPath itself.

Definition at line 94 of file ModulesDriver.cpp.

◆ parseManifest()

Expected< StdModuleManifest > parseManifest ( StringRef Buffer)
static

Parses the Standard library module manifest from Buffer.

Definition at line 77 of file ModulesDriver.cpp.

References clang::driver::modules::fromJSON().

◆ pruneUnusedStdlibModuleJobs()

void pruneUnusedStdlibModuleJobs ( CompilationGraph & Graph,
ArrayRef< JobNode * > UnusedStdlibModuleJobNodes )
static

Prunes the compilation graph of any jobs which build Standard library modules not required in this compilation.

Definition at line 1433 of file ModulesDriver.cpp.

References clang::cast().

Referenced by clang::driver::modules::runModulesDriver().

◆ reportAllScanDiagnostics()

void reportAllScanDiagnostics ( SmallVectorImpl< SmallVector< StandaloneDiagnostic, 0 > > && AllScanDiags,
DiagnosticsEngine & Diags )
static

Report the diagnostics collected during each dependency scan.

Definition at line 447 of file ModulesDriver.cpp.

Referenced by scanDependencies().

◆ scanDependencies()

std::optional< DependencyScanResult > scanDependencies ( ArrayRef< std::unique_ptr< Command > > Jobs,
llvm::DenseMap< StringRef, const StdModuleManifest::Module * > ManifestLookup,
StringRef ModuleCachePath,
StringRef WorkingDirectory,
DiagnosticsEngine & Diags )
static

Scans the compilations job list Jobs for module dependencies.

Standard library module jobs are scanned on demand if imported by any user-provided input.

Returns
DependencyScanResult on success, or std::nullopt on failure, with diagnostics reported via Diags in both cases.

Definition at line 597 of file ModulesDriver.cpp.

References createOptimalThreadAndWorkerPool(), std::function, getManifestEntryForCommand(), getTriple(), isDependencyScannableJob(), makeInputDeps(), reportAllScanDiagnostics(), and scanDependenciesForJob().

Referenced by clang::driver::modules::runModulesDriver().

◆ scanDependenciesForJob()

std::pair< std::optional< deps::TranslationUnitDeps >, SmallVector< StandaloneDiagnostic, 0 > > scanDependenciesForJob ( const Command & Job,
ScanningWorkerPool & WorkerPool,
StringRef WorkingDirectory,
ModuleLookupController & LookupController )
static

Performs a dependency scan for a single job.

Returns
a pair containing TranslationUnitDeps on success, or std::nullopt on failure, along with any diagnostics produced.

Definition at line 550 of file ModulesDriver.cpp.

References buildCommandLine(), and clang::dependencies::FullDependencyConsumer::takeTranslationUnitDeps().

Referenced by scanDependencies().

◆ takeJobsAtIndices()

SmallVector< std::unique_ptr< Command > > takeJobsAtIndices ( SmallVectorImpl< std::unique_ptr< Command > > & Jobs,
ArrayRef< size_t > Indices )
static

Definition at line 1187 of file ModulesDriver.cpp.

Referenced by clang::driver::modules::runModulesDriver().