Implement (de-)serialization of the set of exported modules in a
module map. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145695 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp
index 04f9bef..6bca55c 100644
--- a/lib/Basic/Module.cpp
+++ b/lib/Basic/Module.cpp
@@ -53,6 +53,14 @@
   return Top->Name;
 }
 
+static void printModuleId(llvm::raw_ostream &OS, const ModuleId &Id) {
+  for (unsigned I = 0, N = Id.size(); I != N; ++I) {
+    if (I)
+      OS << ".";
+    OS << Id[I].first;
+  }
+}
+
 void Module::print(llvm::raw_ostream &OS, unsigned Indent) const {
   OS.indent(Indent);
   if (IsFramework)
@@ -80,6 +88,23 @@
        MI != MIEnd; ++MI)
     MI->getValue()->print(OS, Indent + 2);
   
+  for (unsigned I = 0, N = Exports.size(); I != N; ++I) {
+    OS.indent(Indent + 2);
+    OS << "export " << Exports[I].getPointer()->getFullModuleName();
+    if (Exports[I].getInt())
+      OS << ".*";
+    OS << "\n";
+  }
+
+  for (unsigned I = 0, N = UnresolvedExports.size(); I != N; ++I) {
+    OS.indent(Indent + 2);
+    OS << "export ";
+    printModuleId(OS, UnresolvedExports[I].Id);
+    if (UnresolvedExports[I].Wildcard)
+      OS << ".*";
+    OS << "\n";
+  }
+
   OS.indent(Indent);
   OS << "}\n";
 }