diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-11-04 21:51:33 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-11-04 21:51:33 +0000 |
commit | e9bcf5b7b1f3df4e303f4d17c8fef62882ae848f (patch) | |
tree | 9edf30dd0f68608aa481a78bfe487f8613a31e1e /clang/lib | |
parent | d1382b6c31bac564c784a5d6da0c2449bbf94d7e (diff) | |
download | bcm5719-llvm-e9bcf5b7b1f3df4e303f4d17c8fef62882ae848f.tar.gz bcm5719-llvm-e9bcf5b7b1f3df4e303f4d17c8fef62882ae848f.zip |
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.
llvm-svn: 194018
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/Module.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 11 |
2 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index 4818e8d173c..d08cef1a156 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -194,6 +194,16 @@ static void printModuleId(raw_ostream &OS, const ModuleId &Id) { } void Module::getExportedModules(SmallVectorImpl<Module *> &Exported) const { + // All non-explicit submodules are exported. + for (std::vector<Module *>::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<Module *, 4> WildcardRestrictions; diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 57278d5620a..4d1b4b90b66 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -2845,16 +2845,7 @@ void ASTReader::makeModuleVisible(Module *Mod, makeNamesVisible(Hidden->second, Hidden->first); HiddenNamesMap.erase(Hidden); } - - // Push any non-explicit submodules onto the stack to be marked as - // visible. - for (Module::submodule_iterator Sub = Mod->submodule_begin(), - SubEnd = Mod->submodule_end(); - Sub != SubEnd; ++Sub) { - if (!(*Sub)->IsExplicit && Visited.insert(*Sub)) - Stack.push_back(*Sub); - } - + // Push any exported modules onto the stack to be marked as visible. SmallVector<Module *, 16> Exports; Mod->getExportedModules(Exports); |