Properly deserialize ParamInfo of FunctionDecl.

When allocating an array for ParamInfo, the "decl->getNumParams()" call was used, but this will return 0 since it checks ParamInfo (which isn't yet defined and is null).
The result was that ParamInfo got an array of zero length to hold the ParmVarDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58850 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index f2aa3f3..34066a5 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -402,6 +402,7 @@
   
   if (ParamInfo != NULL) {
     S.EmitBool(true);
+    S.EmitInt(getNumParams());
     S.BatchEmitOwnedPtrs(getNumParams(),&ParamInfo[0], Body,
                          getNextDeclarator());
   }
@@ -425,14 +426,17 @@
 
   Decl* next_declarator;
   
+  int numParams;
   bool hasParamDecls = D.ReadBool();
+  if (hasParamDecls)
+    numParams = D.ReadInt();
     
   decl->ParamInfo = hasParamDecls
-                  ? new ParmVarDecl*[decl->getNumParams()] 
+                  ? new ParmVarDecl*[numParams] 
                   : NULL;  
   
   if (hasParamDecls)
-    D.BatchReadOwnedPtrs(decl->getNumParams(),
+    D.BatchReadOwnedPtrs(numParams,
                          reinterpret_cast<Decl**>(&decl->ParamInfo[0]),
                          decl->Body, next_declarator, C);
   else