aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2022-08-15 17:27:43 -0700
committerJan Svoboda <jan_svoboda@apple.com>2022-08-24 14:36:06 -0700
commit94e64df5763b49d750a9a87ecdd4a6583ad6154f (patch)
tree0f91e408e4f247f4b05a448d7ad4eed0fffba22f /clang/lib/Frontend/CompilerInstance.cpp
parent42af1a776abceee250a4047c4497338c37bdea94 (diff)
downloadllvm-94e64df5763b49d750a9a87ecdd4a6583ad6154f.zip
llvm-94e64df5763b49d750a9a87ecdd4a6583ad6154f.tar.gz
llvm-94e64df5763b49d750a9a87ecdd4a6583ad6154f.tar.bz2
[clang][modules] Consider M affecting after mapping M.Private to M_Private
When Clang encounters `@import M.Private` during implicit build, it precompiles module `M` and looks through its submodules. If the `Private` submodule is not found, Clang assumes `@import M_Private`. In the dependency scanner, we don't capture the dependency on `M`, since it's not imported. It's an affecting module, though: compilation of the import statement will fail when implicit modules are disabled and `M` is not precompiled and explicitly provided. This patch fixes that. Depends on D132430. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D132502
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 6d1e378..c44ee00 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -2013,8 +2013,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
// match Foo_Private and emit a warning asking for the user to write
// @import Foo_Private instead. FIXME: remove this when existing clients
// migrate off of Foo.Private syntax.
- if (!Sub && PP->getLangOpts().ImplicitModules && Name == "Private" &&
- Module == Module->getTopLevelModule()) {
+ if (!Sub && Name == "Private" && Module == Module->getTopLevelModule()) {
SmallString<128> PrivateModule(Module->Name);
PrivateModule.append("_Private");
@@ -2028,6 +2027,7 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
Sub = loadModule(ImportLoc, PrivPath, Visibility, IsInclusionDirective);
if (Sub) {
MapPrivateSubModToTopLevel = true;
+ PP->markModuleAsAffecting(Module);
if (!getDiagnostics().isIgnored(
diag::warn_no_priv_submodule_use_toplevel, ImportLoc)) {
getDiagnostics().Report(Path[I].second,