From 86250895597e288c86ef08c2e824956ea9835fed Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Mon, 4 Nov 2013 21:51:33 +0000 Subject: Include non-explicit submodules in exported module list This change fixes Richard's testcase for r193815. Now we include non-explicit submodules into the list of exports. The test failed previously because: - recursive_visibility_a1.inner is not imported (only recursive_visibility_a1 is), - thus the 'inner' submodule is not showing up in any of the import lists, - and because of this getExportedModules() is not returning the correct module set -- it only considers modules that are imported. The fix is to make Module::getExportedModules() include non-explicit submodules into the list of exports. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194018 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Basic/Module.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/Basic/Module.cpp') diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp index 4818e8d173..d08cef1a15 100644 --- a/lib/Basic/Module.cpp +++ b/lib/Basic/Module.cpp @@ -194,6 +194,16 @@ static void printModuleId(raw_ostream &OS, const ModuleId &Id) { } void Module::getExportedModules(SmallVectorImpl &Exported) const { + // All non-explicit submodules are exported. + for (std::vector::const_iterator I = SubModules.begin(), + E = SubModules.end(); + I != E; ++I) { + Module *Mod = *I; + if (!Mod->IsExplicit) + Exported.push_back(Mod); + } + + // Find re-exported modules by filtering the list of imported modules. bool AnyWildcard = false; bool UnrestrictedWildcard = false; SmallVector WildcardRestrictions; -- cgit v1.2.3