[clang] [clang][deps] Stop relying on name of inferred module maps (PR #114085)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 29 09:49:14 PDT 2024
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/114085
What the special case for `"__inferred_module.map"` was getting at is that in general we cannot report overridden files as dependencies: neither the build system nor Clang itself won't know what to do with such files that might not exist on the file system. Moreover, Clang always overrides files based on the command-line arguments, so whatever we drop this way in the scanner, the explicit build will be able to recreate.
>From c5e418e063f3d5dc640dcfa7f82e3d72473c7837 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <jan_svoboda at apple.com>
Date: Tue, 29 Oct 2024 09:38:23 -0700
Subject: [PATCH] [clang][deps] Stop relying on name of inferred module maps
---
.../DependencyScanning/ModuleDepCollector.cpp | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index 637416cd1fc621..7ee335ecb8510f 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -599,14 +599,8 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
MDC.ScanInstance.getASTReader()->visitInputFileInfos(
*MF, /*IncludeSystem=*/true,
[&](const serialization::InputFileInfo &IFI, bool IsSystem) {
- // The __inferred_module.map file is an insignificant implementation
- // detail of implicitly-built modules. The PCM will also report the
- // actual on-disk module map file that allowed inferring the module,
- // which is what we need for building the module explicitly
- // Let's ignore this file.
- if (StringRef(IFI.Filename).ends_with("__inferred_module.map"))
- return;
- MDC.addFileDep(MD, IFI.Filename);
+ if (!IFI.Overridden)
+ MDC.addFileDep(MD, IFI.Filename);
});
llvm::DenseSet<const Module *> SeenDeps;
@@ -617,12 +611,8 @@ ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
MDC.ScanInstance.getASTReader()->visitInputFileInfos(
*MF, /*IncludeSystem=*/true,
[&](const serialization::InputFileInfo &IFI, bool IsSystem) {
- if (!(IFI.TopLevel && IFI.ModuleMap))
- return;
- if (StringRef(IFI.FilenameAsRequested)
- .ends_with("__inferred_module.map"))
- return;
- MD.ModuleMapFileDeps.emplace_back(IFI.FilenameAsRequested);
+ if (IFI.TopLevel && IFI.ModuleMap && !IFI.Overridden)
+ MD.ModuleMapFileDeps.emplace_back(IFI.FilenameAsRequested);
});
CowCompilerInvocation CI =
More information about the cfe-commits
mailing list