9#ifndef LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNINGUTILS_H
10#define LLVM_CLANG_DEPENDENCYSCANNING_DEPENDENCYSCANNINGUTILS_H
15#include "llvm/ADT/DenseSet.h"
16#include "llvm/ADT/MapVector.h"
64 std::vector<clang::dependencies::Command>
Commands;
73 const llvm::DenseSet<clang::dependencies::ModuleID> &AlreadySeen)
74 : AlreadySeen(AlreadySeen) {}
77 Commands.push_back(std::move(Cmd));
83 Dependencies.push_back(std::string(
File));
88 PrebuiltModuleDeps.emplace_back(std::move(PMD));
92 ClangModuleDeps[MD.
ID] = std::move(MD);
96 DirectModuleDeps.push_back(ID);
100 VisibleModules.push_back(ModuleName);
104 ContextHash = std::move(Hash);
108 std::optional<clang::dependencies::P1689ModuleInfo> Provided,
109 std::vector<clang::dependencies::P1689ModuleInfo> Requires)
override {
110 ModuleName = Provided ? Provided->ModuleName :
"";
111 llvm::transform(Requires, std::back_inserter(NamedModuleDeps),
118 std::vector<std::string> Dependencies;
119 std::vector<clang::dependencies::PrebuiltModuleDep> PrebuiltModuleDeps;
123 std::string ModuleName;
124 std::vector<std::string> NamedModuleDeps;
125 std::vector<clang::dependencies::ModuleID> DirectModuleDeps;
126 std::vector<std::string> VisibleModules;
127 std::vector<clang::dependencies::Command> Commands;
128 std::string ContextHash;
129 const llvm::DenseSet<clang::dependencies::ModuleID> &AlreadySeen;
147 llvm::report_fatal_error(
"unexpected call to lookupModuleOutput");
151 : LookupModuleOutput(
std::move(LMO)) {
152 if (!LookupModuleOutput) {
160 return LookupModuleOutput(MD, Kind);
DependencyOutputOptions - Options for controlling the compiler dependency file generation.
Describes a module or submodule.
virtual ~CallbackActionController()
CallbackActionController(LookupModuleOutputCallback LMO)
std::string lookupModuleOutput(const clang::dependencies::ModuleDeps &MD, clang::dependencies::ModuleOutputKind Kind) override
static std::string lookupUnreachableModuleOutput(const clang::dependencies::ModuleDeps &MD, clang::dependencies::ModuleOutputKind Kind)
Dependency scanner callbacks that are used during scanning to influence the behaviour of the scan - f...
void handleModuleDependency(clang::dependencies::ModuleDeps MD) override
TranslationUnitDeps takeTranslationUnitDeps()
void handleDependencyOutputOpts(const DependencyOutputOptions &) override
void handleDirectModuleDependency(clang::dependencies::ModuleID ID) override
FullDependencyConsumer(const llvm::DenseSet< clang::dependencies::ModuleID > &AlreadySeen)
void handleProvidedAndRequiredStdCXXModules(std::optional< clang::dependencies::P1689ModuleInfo > Provided, std::vector< clang::dependencies::P1689ModuleInfo > Requires) override
void handlePrebuiltModuleDependency(clang::dependencies::PrebuiltModuleDep PMD) override
void handleContextHash(std::string Hash) override
void handleBuildCommand(clang::dependencies::Command Cmd) override
void handleFileDependency(StringRef File) override
void handleVisibleModule(std::string ModuleName) override
std::vector< clang::dependencies::ModuleDeps > ModuleDepsGraph
Graph of modular dependencies.
ModuleOutputKind
An output from a module compilation, such as the path of the module file.
llvm::function_ref< std::string(const clang::dependencies::ModuleDeps &, clang::dependencies::ModuleOutputKind)> LookupModuleOutputCallback
A callback to lookup module outputs for "-fmodule-file=", "-o" etc.
The JSON file list parser is used to communicate input to InstallAPI.
A command-line tool invocation that is part of building a TU.
ModuleID ID
The identifier of the module.
This is used to identify a specific module.
Modular dependency that has already been built prior to the dependency scan.
The full dependencies and module graph for a specific input.
clang::dependencies::ModuleID ID
The identifier of the C++20 module this translation unit exports.
std::vector< std::string > VisibleModules
A list of module names that are visible to this translation unit.
std::vector< std::string > FileDeps
A collection of absolute paths to files that this translation unit directly depends on,...
std::vector< std::string > DriverCommandLine
Deprecated driver command-line. This will be removed in a future version.
std::vector< clang::dependencies::ModuleID > ClangModuleDeps
A list of modules this translation unit directly depends on, not including transitive dependencies.
std::vector< std::string > NamedModuleDeps
A list of the C++20 named modules this translation unit depends on.
std::vector< clang::dependencies::PrebuiltModuleDep > PrebuiltModuleDeps
A collection of prebuilt modules this translation unit directly depends on, not including transitive ...
std::vector< clang::dependencies::Command > Commands
The sequence of commands required to build the translation unit.
ModuleDepsGraph ModuleGraph
The graph of direct and transitive modular dependencies.