From 6bc7502385cc2a06954082a7d0e6418e610d35f4 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 17 Apr 2020 20:25:15 -0700 Subject: 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). --- clang/lib/Lex/ModuleMap.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Lex/ModuleMap.cpp') 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; -- cgit v1.1