aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2020-04-17 20:25:15 -0700
committerRichard Smith <richard@metafoo.co.uk>2020-04-17 22:49:58 -0700
commit6bc7502385cc2a06954082a7d0e6418e610d35f4 (patch)
treeec3bac247a76bf492aa39a3679b59cd0e6eb28b7 /clang/lib/Lex/ModuleMap.cpp
parentfc76b4ad3da3c1f5fdc34370a55d613b3ca7af73 (diff)
downloadllvm-6bc7502385cc2a06954082a7d0e6418e610d35f4.zip
llvm-6bc7502385cc2a06954082a7d0e6418e610d35f4.tar.gz
llvm-6bc7502385cc2a06954082a7d0e6418e610d35f4.tar.bz2
When making modules transitively visible, don't take into account
whether they have missing header files. Whether a module's headers happen to be present on the local file system should make no difference to whether we make its contents visible when importing another module that re-exports it. If we have an up-to-date AST file that we can load, that's all that matters. This fixes the ability to header syntax checking for modular headers in C++20 mode (or in prior modes where -fmodules-local-submodule-visibility is enabled but -fmodules is not).
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 2c79bb2..4f7d5ab 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -544,6 +544,9 @@ void ModuleMap::diagnoseHeaderInclusion(Module *RequestingModule,
static bool isBetterKnownHeader(const ModuleMap::KnownHeader &New,
const ModuleMap::KnownHeader &Old) {
// Prefer available modules.
+ // FIXME: Considering whether the module is available rather than merely
+ // importable is non-hermetic and can result in surprising behavior for
+ // prebuilt modules. Consider only checking for importability here.
if (New.getModule()->isAvailable() && !Old.getModule()->isAvailable())
return true;