aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2025-02-21 10:04:42 -0800
committerGitHub <noreply@github.com>2025-02-21 10:04:42 -0800
commit4bb04d417669be7a3d0359dfd313f0bf4f7ca531 (patch)
tree7b2d877217869fac67c7d1b5eb3c17ab4ee43125 /clang/lib/Lex/Preprocessor.cpp
parent9738f20bb03c1a53f64dce5626972f4f6c1b815e (diff)
downloadllvm-4bb04d417669be7a3d0359dfd313f0bf4f7ca531.zip
llvm-4bb04d417669be7a3d0359dfd313f0bf4f7ca531.tar.gz
llvm-4bb04d417669be7a3d0359dfd313f0bf4f7ca531.tar.bz2
[clang][modules] Fix local submodule visibility of macros from transitive import (#122955)
When we mark a module visible, we normally mark all of its non-explicit submodules and other exports as visible. However, when we first enter a submodule we should not make them visible to the submodule itself until they are actually imported. Marking exports visible before import would cause bizarre behaviour with local submodule visibility, because it happened before we discovered the submodule's transitive imports and could fail to make them visible in the parent module depending on whether the submodules involved were explicitly defined (module X) or implicitly defined from an umbrella (module *). rdar://136524433
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 5ac5e6f..7256473 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -1331,9 +1331,10 @@ bool Preprocessor::LexAfterModuleImport(Token &Result) {
return true;
}
-void Preprocessor::makeModuleVisible(Module *M, SourceLocation Loc) {
+void Preprocessor::makeModuleVisible(Module *M, SourceLocation Loc,
+ bool IncludeExports) {
CurSubmoduleState->VisibleModules.setVisible(
- M, Loc, [](Module *) {},
+ M, Loc, IncludeExports, [](Module *) {},
[&](ArrayRef<Module *> Path, Module *Conflict, StringRef Message) {
// FIXME: Include the path in the diagnostic.
// FIXME: Include the import location for the conflicting module.