Preliminary support for function overloading

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclSerialization.cpp b/lib/AST/DeclSerialization.cpp
index a0befbd..f2aa3f3 100644
--- a/lib/AST/DeclSerialization.cpp
+++ b/lib/AST/DeclSerialization.cpp
@@ -13,6 +13,7 @@
 
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
 #include "llvm/Bitcode/Serialize.h"
 #include "llvm/Bitcode/Deserialize.h"
@@ -74,7 +75,11 @@
     case Function:
       Dcl = FunctionDecl::CreateImpl(D, C);
       break;
-    
+
+    case OverloadedFunction:
+      Dcl = OverloadedFunctionDecl::CreateImpl(D, C);
+      break;
+
     case Record:
       Dcl = RecordDecl::CreateImpl(D, C);
       break;
@@ -455,6 +460,34 @@
 }
 
 //===----------------------------------------------------------------------===//
+//      OverloadedFunctionDecl Serialization.
+//===----------------------------------------------------------------------===//
+
+void OverloadedFunctionDecl::EmitImpl(Serializer& S) const {
+  NamedDecl::EmitInRec(S);
+
+  S.EmitInt(getNumFunctions());
+  for (unsigned func = 0; func < getNumFunctions(); ++func)
+    S.EmitPtr(Functions[func]);
+}
+
+OverloadedFunctionDecl * 
+OverloadedFunctionDecl::CreateImpl(Deserializer& D, ASTContext& C) {
+  void *Mem = C.getAllocator().Allocate<OverloadedFunctionDecl>();
+  OverloadedFunctionDecl* decl = new (Mem)
+    OverloadedFunctionDecl(0, NULL);
+  
+  decl->NamedDecl::ReadInRec(D, C);
+
+  unsigned numFunctions = D.ReadInt();
+  decl->Functions.reserve(numFunctions);
+  for (unsigned func = 0; func < numFunctions; ++func)
+    D.ReadPtr(decl->Functions[func]);
+  
+  return decl;
+}
+
+//===----------------------------------------------------------------------===//
 //      RecordDecl Serialization.
 //===----------------------------------------------------------------------===//