r241936 - [modules] Fix "prefer own module over others" rule when selecting a module for a header to work in the presence of module hierarchy.
Richard Smith
richard-llvm at metafoo.co.uk
Fri Jul 10 13:09:49 PDT 2015
Author: rsmith
Date: Fri Jul 10 15:09:49 2015
New Revision: 241936
URL: http://llvm.org/viewvc/llvm-project?rev=241936&view=rev
Log:
[modules] Fix "prefer own module over others" rule when selecting a module for a header to work in the presence of module hierarchy.
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp
cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map
Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=241936&r1=241935&r2=241936&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Jul 10 15:09:49 2015
@@ -347,7 +347,7 @@ ModuleMap::KnownHeader ModuleMap::findMo
// 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())
Modified: cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map?rev=241936&r1=241935&r2=241936&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map (original)
+++ cfe/trunk/test/Modules/Inputs/explicit-build-prefer-self/map Fri Jul 10 15:09:49 2015
@@ -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" } }
More information about the cfe-commits
mailing list