[modules] Fix "prefer own module over others" rule when selecting a module for a header to work in the presence of module hierarchy.
llvm-svn: 241936
This commit is contained in:
parent
45be9e0d24
commit
8692a4d199
|
@ -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())
|
||||
|
|
|
@ -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" } }
|
||||
|
|
Loading…
Reference in New Issue