summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/ModuleMap.cpp2
-rw-r--r--clang/test/Modules/Inputs/explicit-build-prefer-self/map4
2 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index e6fe38927e2..6faae818bc1 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -347,7 +347,7 @@ ModuleMap::KnownHeader ModuleMap::findModuleForHeader(const FileEntry *File) {
// Iterate over all modules that 'File' is part of to find the best fit.
for (KnownHeader &H : Known->second) {
// Prefer a header from the current module over all others.
- if (H.getModule() == CompilingModule)
+ if (H.getModule()->getTopLevelModule() == CompilingModule)
return MakeResult(H);
// Cannot use a module if it is unavailable.
if (!H.getModule()->isAvailable())
diff --git a/clang/test/Modules/Inputs/explicit-build-prefer-self/map b/clang/test/Modules/Inputs/explicit-build-prefer-self/map
index 26be8e69073..042b2ae5b50 100644
--- a/clang/test/Modules/Inputs/explicit-build-prefer-self/map
+++ b/clang/test/Modules/Inputs/explicit-build-prefer-self/map
@@ -1,2 +1,2 @@
-module a { header "a.h" header "x.h" }
-module b { header "b.h" header "x.h" }
+module a { module h { header "a.h" } module x { header "x.h" } }
+module b { module h { header "b.h" } module x { header "x.h" } }
OpenPOWER on IntegriCloud