Notify the AST writer (via ASTDeserializationListener) when a
(sub)module is read from an AST file. This makes sure that the AST
writer knows how to map all modules to their global IDs.

llvm-svn: 145685
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 4594a39..d8fb311 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -2973,6 +2973,12 @@
         Error("too many submodules");
         return Failure;
       }
+      
+      if (DeserializationListener)
+        DeserializationListener->ModuleRead(
+          CurrentModuleGlobalIndex + NUM_PREDEF_SUBMODULE_IDS, 
+          CurrentModule);
+      
       SubmodulesLoaded[CurrentModuleGlobalIndex++] = CurrentModule;
       break;
     }