[PCH/Modules] De/Serialize MacroInfos separately than MacroDirectives.

-Serialize the macro directives history into its own section
-Get rid of the macro updates section
-When de/serializing an identifier from a module, associate only one macro per
 submodule that defined+exported it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177761 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 8e54f01..868820b 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -42,20 +42,28 @@
 }
 
 /// \brief Specify a macro for this identifier.
-MacroDirective *
-Preprocessor::setMacroDirective(IdentifierInfo *II, MacroInfo *MI,
-                                SourceLocation Loc, bool isImported) {
-  assert(MI && "MacroInfo should be non-zero!");
+void Preprocessor::setMacroDirective(IdentifierInfo *II, MacroDirective *MD) {
+  assert(MD && "MacroDirective should be non-zero!");
 
-  MacroDirective *MD = AllocateMacroDirective(MI, Loc, isImported);
   MacroDirective *&StoredMD = Macros[II];
   MD->setPrevious(StoredMD);
   StoredMD = MD;
   II->setHasMacroDefinition(true);
   if (II->isFromAST())
     II->setChangedSinceDeserialization();
+}
 
-  return MD;
+void Preprocessor::setLoadedMacroDirective(IdentifierInfo *II,
+                                           MacroDirective *MD) {
+  assert(II && MD);
+  MacroDirective *&StoredMD = Macros[II];
+  assert(!StoredMD &&
+         "the macro history was modified before initializing it from a pch");
+  StoredMD = MD;
+  // Setup the identifier as having associated macro history.
+  II->setHasMacroDefinition(true);
+  if (!MD->isDefined())
+    II->setHasMacroDefinition(false);
 }
 
 void Preprocessor::addLoadedMacroInfo(IdentifierInfo *II, MacroDirective *MD,