aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2022-03-07 10:22:06 +0100
committerJan Svoboda <jan_svoboda@apple.com>2022-03-07 10:47:46 +0100
commitb45888e959ad2d6562b8d321166e6387facdd412 (patch)
treed5f735ab22bc9df332e550f03588237a2248181e /clang/lib/Basic/Module.cpp
parent242b24c1849165bedb73fb14c8012d1d63ffd344 (diff)
downloadllvm-b45888e959ad2d6562b8d321166e6387facdd412.zip
llvm-b45888e959ad2d6562b8d321166e6387facdd412.tar.gz
llvm-b45888e959ad2d6562b8d321166e6387facdd412.tar.bz2
[clang][modules] Report module maps affecting `no_undeclared_includes` modules
Since D106876, PCM files don't report module maps as input files unless they contributed to the compilation. Reporting only module maps of (transitively) imported modules is not enough, though. For modules marked with `[no_undeclared_includes]`, other module maps affect the compilation by introducing anti-dependencies. This patch makes sure such module maps are being reported as input files. Depends on D120463. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D120464
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 09bd325..17b8318 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -267,7 +267,7 @@ ArrayRef<const FileEntry *> Module::getTopHeaders(FileManager &FileMgr) {
return llvm::makeArrayRef(TopHeaders.begin(), TopHeaders.end());
}
-bool Module::directlyUses(const Module *Requested) const {
+bool Module::directlyUses(const Module *Requested) {
auto *Top = getTopLevelModule();
// A top-level module implicitly uses itself.
@@ -282,6 +282,9 @@ bool Module::directlyUses(const Module *Requested) const {
if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t")
return true;
+ if (NoUndeclaredIncludes)
+ UndeclaredUses.insert(Requested);
+
return false;
}