[clang] [clang][modules-driver] Add dependency scan and dependency graph (PR #152770)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 28 19:11:32 PDT 2025
================
@@ -1829,6 +1831,53 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
// Populate the tool chains for the offloading devices, if any.
CreateOffloadingDeviceToolChains(*C, Inputs);
+ modules::StdModuleManifest Manifest;
+ if (C->getArgs().hasFlag(options::OPT_fmodules_driver,
+ options::OPT_fno_modules_driver, false)) {
+ Diags.Report(diag::remark_performing_driver_managed_module_build);
+ // TODO: Once -fmodules-driver is no longer experimental, move
+ // TODO: The detection logic to implicitly enable -fmodules-driver is kept
+ // here only for diagnostics until the feature is no longer experimental.
+ auto EnableOrErr = modules::shouldUseModulesDriver(Inputs, getVFS(), Diags);
+ if (!EnableOrErr) {
+ llvm::handleAllErrors(
+ EnableOrErr.takeError(), [&](const llvm::FileError &Err) {
+ Diags.Report(diag::err_cannot_open_file)
+ << Err.getFileName() << Err.messageWithoutFileInfo();
+ });
+ return C;
+ }
+
+ // Read the standard modules manifest, and if available, add all discovered
+ // modules to the compilation. Compilation jobs for modules discovered from
+ // the manifest, which are not imported by any other source input, are
+ // pruned later.
+ const auto StdModuleManifestPath =
+ GetStdModuleManifestPath(*C, C->getDefaultToolChain());
+ if (StdModuleManifestPath == "<NOT PRESENT>") {
----------------
ChuanqiXu9 wrote:
nit: maybe we can avoid hardcoding by judging this by if it is a path.
https://github.com/llvm/llvm-project/pull/152770
More information about the cfe-commits
mailing list