Store the submodules of a module in source order, as they are stored
in the module map. This provides a bit more predictability for the
user, as well as eliminating the need to sort the submodules when
serializing them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147564 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 9c9e8b3..c29033e 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -2541,11 +2541,11 @@
// Push any non-explicit submodules onto the stack to be marked as
// visible.
- for (llvm::StringMap<Module *>::iterator Sub = Mod->SubModules.begin(),
- SubEnd = Mod->SubModules.end();
+ for (Module::submodule_iterator Sub = Mod->submodule_begin(),
+ SubEnd = Mod->submodule_end();
Sub != SubEnd; ++Sub) {
- if (!Sub->getValue()->IsExplicit && Visited.insert(Sub->getValue()))
- Stack.push_back(Sub->getValue());
+ if (!(*Sub)->IsExplicit && Visited.insert(*Sub))
+ Stack.push_back(*Sub);
}
// Push any exported modules onto the stack to be marked as visible.